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 25, 202656mWatch on YouTube ↗

At a glance

WHAT IT’S REALLY ABOUT

Advanced AI coding workflows: diagrams, context loading, hooks, and automation

  1. The episode focuses on how experienced engineers can get higher-quality, more predictable results from AI coding assistants by intentionally managing context and automation around the model.
  2. Lindquist shows how Mermaid diagrams and markdown “memory” folders compress an application’s behavior into AI-friendly artifacts that can be preloaded via Claude Code’s system prompt, reducing exploratory file reads and speeding up answers and edits.
  3. He then demonstrates productivity patterns in the terminal—short aliases for common Claude configurations and custom CLIs that wrap models like Gemini with pre-baked prompts—to make repeatable workflows effortless.
  4. Finally, he walks through Claude Code “stop hooks” that automatically run checks (e.g., TypeScript typecheck), feed errors back to the agent for self-correction, and optionally commit changes—turning quality enforcement into an automated loop.

IDEAS WORTH REMEMBERING

5 ideas

Preload “how the system works,” not just rules.

Teams often provide AI tools with guidelines but omit architecture and flow. Mermaid diagrams and curated markdown let the model understand dependencies and impact, reducing risky edits that come from shallow context.

Mermaid diagrams are an AI-efficient compression format.

They can encode complex flows (auth, DB operations, event chains) in small text representations that models ingest quickly. Humans may find the diagrams hard to parse, but the AI can use them to answer questions without codebase exploration.

Use Claude Code’s system prompt to front-load project context.

By appending a system prompt that concatenates diagram markdown files (via glob + cat), you trade upfront tokens for faster, more reliable outputs and fewer file reads during the session.

Generate diagrams after the feature works (often at PR close).

Lindquist suggests spiking first, then diagramming once behavior is correct—especially valuable for legacy codebases that lack documentation. Claire adds a practical pattern: automate doc/diagram generation via GitHub Actions when PRs merge.

Make repeatable AI workflows one-keystroke operations.

Shell aliases can instantly launch Claude in specific modes (fast model, “dangerously” permissive mode, or “load all diagrams” mode). This eliminates retyping prompts and ensures consistent setup for recurring tasks.

WORDS WORTH SAVING

5 quotes

Context and diagrams… are definitely the best way to get AI to do what you want.

John Lindquist

It’s a way of essentially compressing your application down into very small lines of text that show how your application works.

John Lindquist

This does come at the cost of a lot more context… and tokens being used up front, but the work that you do… is more valuable than that to me.

John Lindquist

If you have nothing, you can’t iterate on nothing.

John Lindquist

If I gave you infinite junior-to-mid-career talent… what would you do when a ticket came in?… All of that could just become a prompt.

Claire Vo

Mermaid diagrams as compressed app contextRepo “memory” directories and structured AI contextClaude Code append system prompt / preloading contextToken cost vs. output speed and reliability trade-offsShell aliases for model modes and workflowsCustom CLI wrappers for repeatable AI promptsClaude Code hooks (stop hooks) for automated checks and commitsIDE vs terminal UI roles and UX moatsSelling AI to skeptical engineering teamsReset strategies: export, second model, revert, plan mode

High quality AI-generated summary created from speaker-labeled transcript.

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