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. Why senior engineers need “power-user” AI workflows (feat. John Lindquist)

    Claire sets expectations: this episode is for experienced engineers who want production-grade results, not just “vibe coding.” John Lindquist is introduced as a heavy user of Claude Code/Cursor, focused on speed and quality through repeatable workflows.

  2. Compressing codebase understanding with context + diagrams

    John argues the biggest lever is context: AI performs best when it understands how the application works, not just style rules. Diagrams—especially Mermaid—act like a compressed representation of system behavior that models can ingest quickly.

  3. Demo: Mermaid diagrams as machine-friendly architecture maps

    They walk through Mermaid diagrams embedded in Markdown and why they’re hard for humans but efficient for LLMs. John shows how a diagram can answer questions like “explain the authentication flow” without prompting the model to explore the repo.

  4. Preloading diagrams into Claude Code using Append System Prompt

    John demonstrates a repeatable technique: append a system prompt that concatenates all diagram files (via glob + cat) into Claude’s startup context. This front-loads tokens but removes repeated repo scanning and accelerates subsequent tasks.

  5. Organizing a “memory” directory and exploring Claude Code’s command surface area

    Claire highlights two meta-lessons: structure repo context deliberately (not just one generic markdown file), and learn the tool’s built-in commands. John emphasizes he uses append-system-prompt constantly because it changes the interaction model.

  6. The rise of specialized file formats for LLMs (beyond Markdown)

    They zoom out: Mermaid is one example of emerging “LLM-oriented” formats that machines parse better than humans. John and Claire discuss compression, metadata, images/video, and using models (like Gemini) to process long media into usable notes.

  7. When to generate diagrams: PR-time documentation and legacy code acceleration

    Claire shares generating diagrams/docs on PR close via automation; John agrees PR is a strong milestone. For legacy repos, John’s common use case is generating diagrams to quickly bootstrap AI-assisted development without months of onboarding.

  8. Mermaid diagram use cases: compliance, security reviews, and customer data-flow requests

    Claire notes diagram generation isn’t just for AI speed—it’s valuable for external demands like SOC2, security questionnaires, and customer-specific data-flow diagrams. These artifacts used to be tedious, but can now be generated on demand from code.

  9. Aliasing common AI commands for speed (models, permissions, project modes)

    John shows how he creates shell aliases to launch Claude in specific modes quickly—choosing models, enabling dangerous permissions, or loading diagram context. The goal is minimal friction: one or two letters to start the right workflow.

  10. Beyond aliases: building custom CLIs to wrap AI workflows (Gemini ‘Sketch’)

    John demos a personal CLI tool that wraps Gemini to generate website concept images via a short terminal questionnaire. Claire highlights why terminal UIs are powerful: constrained surfaces reduce UI distraction and speed up prototyping.

  11. Automating code quality with Claude hooks: stop hooks + typecheck + auto-fix

    They introduce hooks as a way to run commands automatically when Claude stops (finishes a response). John builds a stop hook that checks for file changes, runs TypeScript typecheck, feeds errors back to Claude, and can proceed to commit if clean.

  12. Hook implementation details and gotchas (JSON output, logging, local vs shared settings)

    John explains that hooks communicate back to Claude via a JSON object printed to stdout—so stray logs can break the protocol. They also clarify how to store hooks locally vs sharing across the team via repo settings, enabling organization-wide leverage.

  13. What else to automate: formatting, linting, complexity, duplicates, dependency checks

    Beyond TypeScript errors, John lists other guardrails that fit naturally into hooks—similar to pre-commit/pre-push checks but shifted earlier into the AI loop. Claire notes hooks can also apply to non-code deliverables (docs/workflows) as post-completion checks.

  14. Terminal UI vs IDE, selling AI to skeptics, and reset strategies when models drift

    John argues both terminal and IDE are necessary: CLIs excel at configurable launches, while IDEs provide diagnostics and extension ecosystems. For skeptical teams, he emphasizes AI’s value in issue orientation and investigation; when things drift, export and get a second model’s critique or reset via revert, with planning modes reducing drift overall.

Get more out of YouTube videos.

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

Add to Chrome