Skip to content
How I AIHow I AI

The senior engineer's guide to AI coding: Context loading, custom hooks, and automation

John Lindquist is the co-founder of egghead.io and an expert in leveraging AI tools for professional software development. In this episode, John shares advanced techniques for using AI coding tools like Claude Code and Cursor that go far beyond basic prompting. He demonstrates how senior engineers can use mermaid diagrams for context loading, create custom hooks for automated code quality checks, and build efficient command-line tools that streamline AI workflows. *What you’ll learn:* 1. How to use mermaid diagrams to preload context into Claude Code for faster, more accurate coding assistance 2. Creating custom hooks in Claude Code to automatically check for TypeScript errors and commit working code 3. Building efficient command-line aliases and tools to streamline your AI workflows 4. Techniques for using AI to generate documentation that works for both humans and machines 5. How to leverage AI for code investigation and orientation when tackling unfamiliar codebases 6. Strategies for resetting AI conversations when they go off track *Brought to you by:* WorkOS—Make your app enterprise-ready today: https://workos.com?utm_source=lennys_howiai&utm_medium=podcast&utm_campaign=q22025 Tines—Start building intelligent workflows today: https://tines.com/howiai *Detailed workflow walkthroughs from this episode:* • Beyond Vibe Coding: Advanced AI Engineering with John Lindquist: https://www.chatprd.ai/how-i-ai/advanced-ai-engineering-claude-code-john-lindquist • Automate Code Quality and Fixes with AI Stop Hooks: https://www.chatprd.ai/how-i-ai/workflows/automate-code-quality-and-fixes-with-ai-stop-hooks • Automate Repetitive AI Commands with Custom Shell Aliases and CLIs: https://www.chatprd.ai/how-i-ai/workflows/automate-repetitive-ai-commands-with-custom-shell-aliases-and-clis • Improve AI Code Awareness with Mermaid Diagram Context: https://www.chatprd.ai/how-i-ai/workflows/improve-ai-code-awareness-with-mermaid-diagram-context *In this episode, we cover:* (00:00) Introduction to John Lindquist (03:15) Using context and diagrams to provide context to AI tools (05:38) Demo: Mermaid diagrams (06:48) Preloading context with system prompts in Claude Code (10:30) The rise of specialized file formats for AI consumption (13:23) Mermaid diagram use cases (19:01) Demo: Creating aliases for common AI commands (21:05) Building custom command-line tools for AI workflows (26:39) Demo: Setting up stop hooks for automated code quality checks (35:16) Investing in quality outputs (36:40) Additional use cases for hooks beyond code quality (39:19) Quick review (41:14) Terminal UI vs. IDE (45:35) Selling AI to skeptical teams (51:57) Prompting reset tricks *Tools referenced:* • Claude Code: https://claude.ai/ • Cursor: https://cursor.sh/ • Gemini: https://gemini.google.com/ *Other references:* • Zsh: https://www.zsh.org/ • GitHub: https://github.com/ • TypeScript: https://www.typescriptlang.org/ • Bun: https://bun.sh/ • Claude hooks: https://code.claude.com/docs/en/hooks *Where to find John Lindquist:* Website: https://egghead.io Newsletter: https://egghead.io/newsletters/ai-dev-essentials LinkedIn: linkedin.com/in/john-lindquist-84230766 X: https://x.com/johnlindquist *Where to find Claire Vo:* ChatPRD: https://www.chatprd.ai/ Website: https://clairevo.com/ LinkedIn: https://www.linkedin.com/in/clairevo/ X: https://x.com/clairevo _Production and marketing by https://penname.co/._ _For inquiries about sponsoring the podcast, email jordan@penname.co._

Claire VohostJohn Lindquistguest
Jan 26, 202656mWatch on YouTube ↗

CHAPTERS

  1. 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
  2. 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”
  3. 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”
  4. 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
  5. 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
  6. 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
  7. 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?”
  8. 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
  9. 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
  10. 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
  11. 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)
  12. 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
  13. 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
  14. 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
  15. 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
  16. 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
  17. 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
  18. 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

Get more out of YouTube videos.

High quality summaries for YouTube videos. Accurate transcripts to search & find moments. Powered by ChatGPT & Claude AI.