How I AIThe senior engineer's guide to AI coding: Context loading, custom hooks, and automation
CHAPTERS
- 0:00 – 4:09
Advanced AI coding for senior engineers: what “10x with tools” really means
Claire frames the episode as an advanced, senior-engineer-focused look at power features in AI coding tools (Claude Code, Cursor). The goal is higher-quality production code and faster workflows—not beginner “vibe coding.”
- •Episode focus: advanced techniques vs introductory AI tooling
- •Target audience: senior/staff engineers, engineering leaders
- •Core promise: improve both speed and quality through workflow design
- •Tools in scope: Claude Code and Cursor
- 4:09 – 5:38
Why diagrams beat rules: preloading how the system works
John argues that the biggest unlock for AI coding is giving models a compressed representation of the system’s flow. Diagrams help the AI understand dependencies and impact, reducing bad edits caused by missing architectural context.
- •AI sessions start with no memory; missing context causes unreliable edits
- •Diagrams encode flows and dependencies better than scattered rules
- •Goal: reduce exploration/file-reading and increase reliability
- •Concept parallels tools like “Code Maps”
- 5:38 – 6:39
Mermaid diagrams as “compressed architecture” the AI can parse instantly
They introduce Mermaid diagrams embedded in Markdown as a machine-friendly way to express complex workflows (e.g., auth and database flows). Humans may struggle to read large diagrams, but LLMs can ingest them as dense context.
- •Mermaid = diagram syntax inside Markdown
- •Acts as a compact representation of app flows (yes/no branches, states, operations)
- •Humans need visuals; AI can consume raw Mermaid text efficiently
- •Useful for questions like “explain the authentication flow”
- 6:39 – 8:51
Demo workflow: appending a system prompt to load all diagrams at startup
John demonstrates using Claude Code’s “Append System Prompt” to automatically concatenate and inject all diagram Markdown files into the agent’s context. This removes repeated manual referencing and speeds up downstream Q&A and planning.
- •Use Claude Code command surface area (help/options) to find power features
- •Glob + cat concatenates AI/diagrams/*.md into a single prompt stream
- •Preloaded context avoids repeated @file referencing and repo searching
- •Trade-off: higher upfront token cost for faster, better responses
- 8:51 – 10:31
Token cost vs. engineering time: optimizing for throughput and reliability
John explains the economic trade: spend tokens upfront to save developer time and reduce iterative back-and-forth. With context preloaded, outputs arrive faster and are more dependable because the model understands the system shape.
- •Preloading costs tokens but eliminates repeated exploration steps
- •Fewer file reads/searches means faster turnaround per task
- •Better system understanding reduces brittle or harmful edits
- •Plan mode becomes more effective once context is loaded
- 10:31 – 13:07
The rise of AI-oriented file formats (Markdown, JSON, Mermaid, multimedia)
Claire broadens the discussion to “the era of the file type,” where specialized formats become interfaces for LLMs. Mermaid is highlighted as a machine-friendly format; they also discuss images/video plus metadata as emerging inputs.
- •Markdown and JSON are becoming default AI context carriers
- •Mermaid is hard for humans but excellent for machines
- •Research trend: compressing large context into alternate representations (even images)
- •Video understanding (e.g., Gemini) enables new summarization and iteration workflows
- 13:07 – 15:10
When to generate diagrams: PR-time documentation and legacy acceleration
They discuss integrating diagram generation into development cadence—often after features stabilize (e.g., when a PR closes). For legacy codebases, diagramming is especially valuable to bootstrap AI-assisted development quickly.
- •Generate diagrams after the feature works; don’t diagram too early
- •PR close is a natural trigger for doc/diagram regeneration
- •Legacy codebases benefit most from retroactive diagramming
- •Diagrams also help humans answer “what did we just build?”
- 15:10 – 15:55
Mermaid beyond AI: compliance, security reviews, and customer data-flow diagrams
Claire shares pragmatic uses of generated diagrams for security questionnaires, SOC2/compliance, and customer-specific data-flow documentation. Diagram automation replaces historically tedious manual artifact creation.
- •Generate customer-specific data flow diagrams on demand
- •Support SOC2/compliance documentation workflows
- •Reduce expensive engineer time on manual diagram creation
- •Bridge internal engineering docs to customer-facing support content
- 15:55 – 19:28
Documentation that works for both humans and AI (and why metadata matters)
John suggests documentation can largely stay consistent for human and AI audiences, with Markdown acting as a durable medium. They note the growing importance of front matter/metadata conventions used by tooling ecosystems.
- •Markdown can serve as a shared interface for humans + models
- •AI can generate docs from code (and even generate code + docs together)
- •Front matter/metadata is increasingly useful for structured behaviors
- •Tool vendors (e.g., Anthropic) are shaping these conventions
- 19:28 – 21:05
Demo: shell aliases for repeatable Claude Code setups (models, permissions, context)
John shows how to encode frequent AI invocations into tiny terminal shortcuts using shell aliases. This makes switching models, permissions, and context-loading modes a one-keystroke operation.
- •Zsh/PowerShell aliases reduce friction in common AI workflows
- •Alias examples: fast/smaller model, bypass permissions, preload diagrams
- •Enables project- or initiative-specific context presets
- •Turns “setup overhead” into muscle memory
- 21:05 – 25:18
From aliases to personal tooling: building small CLIs that wrap AI prompts
They move beyond aliases into building custom command-line tools that wrap AI models (e.g., Gemini) with structured prompts. John’s “Sketch” CLI collects a few inputs and outputs multiple design images for rapid ideation.
- •AI tools can be scripted and wrapped into dedicated CLIs
- •CLI UX keeps scope tight and avoids UI rabbit holes
- •Structured questions + preloaded prompts eliminate prompt re-remembering
- •Output can seed downstream build steps (turn image into site sections/components)
- 25:18 – 26:58
Make something (even wrong) and iterate: dictation + rapid prototyping mindset
John and Claire emphasize speed-to-first-artifact: dictation and quick scaffolds beat staring at a blank slate. Even incorrect output provides something concrete to critique, revise, and steer.
- •Dictation accelerates “brain dump” prompting and exploration
- •Iteration requires an artifact; you can’t iterate on nothing
- •AI is especially valuable as a first draft generator
- •Principle: editing is easier than authoring from scratch
- 26:58 – 32:11
Stop hooks for automated code quality: typecheck, fix, then commit
John introduces Claude Code hooks—especially stop hooks—to automatically run checks after the agent finishes a task. The hook can run typechecks/linters and feed results back to Claude to fix errors, then proceed to a commit step.
- •Problem: AI declares “done” while errors remain
- •Stop hook runs when Claude is waiting for user input
- •Workflow: detect changed files → run typecheck → send errors back → auto-fix → commit
- •Hooks can be local-only or shared via team settings
- 32:11 – 35:16
Hook implementation gotchas + live demo: returning JSON via console.log
They cover practical hook engineering details: Claude reads the first console.log JSON payload, so other output must be suppressed or redirected. John demos creating a file with a TypeScript error, triggering the hook to fix and commit automatically.
- •Hook-to-Claude communication happens via JSON returned in console.log
- •Use quiet modes or console.error for debugging to avoid corrupting hook output
- •Demo shows hook running twice: first to detect/fix, second to commit
- •Net effect: fewer manual “run checks / fix / rerun” loops
- 35:16 – 41:14
Scaling quality across teams + broader hook use cases (formatting, linting, complexity)
Claire highlights that skepticism about AI tools often stems from missing workflow investment; hooks are a way to operationalize quality. John lists additional automated checks that can run at stop time, and Claire notes hooks also apply to non-code deliverables.
- •Org leverage: shared repo settings can standardize AI-assisted quality
- •Hook ideas: formatting, linting, circular dependency checks, duplicate code detection, complexity analysis
- •Choose checks by cost/benefit (some are expensive to run frequently)
- •Hooks can automate post-processing for documents and other non-code tasks
- 41:14 – 46:31
Terminal UI vs IDE: why both win—and where IDEs can differentiate
John argues terminals excel at fast, configurable launches (aliases, presets, background runs), while IDEs shine for focused edits, selections, diagnostics, and extension ecosystems. IDE competition will hinge on differentiated UX and low-friction agent experiences.
- •CLI strengths: instant presets, fast switching, background automation
- •IDE strengths: precise editing, selections, diagnostics, extensions feeding data back to agents
- •Opportunity: more custom IDE extensions that encode company rules/workflows
- •Market reality: any friction leads to quick dismissal; UX is the moat
- 46:31 – 51:57
Selling AI to skeptical teams: automate ticket orientation and reduce drudgery
John suggests the strongest pitch isn’t “AI writes code,” but “AI eliminates the slowest parts of software work”—issue triage, repo archaeology, risk surfacing, history analysis, and documentation. Claire reframes workflow design as delegating to infinite junior/mid-level helpers to produce better specs and reviews upfront.
- •Automate early-stage ticket work: find owners, history, risks, impact zones
- •Use diagrams and prompts to surface “unknown unknowns” before coding
- •Design an optimal workflow first, then automate 80% of it with AI
- •Side benefit: better commit messages and better institutional memory
- 51:57 – 56:37
Reset strategies when the agent drifts: second opinions, revert, and planning mode
When a conversation goes off the rails, John recommends exporting the thread to another model for critique or reverting to a previous commit and restarting with a revised prompt. He notes that modern planning modes reduce drift significantly for anything larger than a small change.
- •If you can’t correct drift in ~one prompt, restart instead of steering forever
- •Export conversation + files to another model for objective critique
- •Revert to prior commit to reset state cleanly
- •Use planning mode for most non-trivial changes to prevent drift