
The senior engineer's guide to AI coding: Context loading, custom hooks, and automation
Claire Vo (host), John Lindquist (guest)
In this episode of How I AI, featuring Claire Vo and John Lindquist, The senior engineer's guide to AI coding: Context loading, custom hooks, and automation explores advanced AI coding workflows: diagrams, context loading, hooks, and automation 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.
Advanced AI coding workflows: diagrams, context loading, hooks, and automation
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.
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.
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.
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.
Key Takeaways
Preload “how the system works,” not just rules.
Teams often provide AI tools with guidelines but omit architecture and flow. ...
Get the full analysis with uListen AI
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. ...
Get the full analysis with uListen AI
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.
Get the full analysis with uListen AI
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. ...
Get the full analysis with uListen AI
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). ...
Get the full analysis with uListen AI
Build tiny personal CLIs to productize your best prompts.
Instead of remembering “the perfect prompt,” wrap models (e. ...
Get the full analysis with uListen AI
Stop hooks turn “AI wrote code” into “AI shipped checked code.”
Claude Code hooks can run automatically when the agent stops: detect file changes, run typechecks/lints, feed error output back to Claude to fix, and optionally commit when clean—removing the mental overhead of repetitive quality steps.
Get the full analysis with uListen AI
Use hooks beyond TypeScript: enforce team-level guardrails.
The same pattern can run formatting, linting, complexity checks, circular dependency detection, duplicate-code analysis, or other pre-commit/pre-push tasks—moving quality left and reducing CI churn.
Get the full analysis with uListen AI
When the model drifts, restart beats endless steering.
If a single corrective prompt doesn’t fix the direction, revert to a prior commit and restart with a revised prompt. ...
Get the full analysis with uListen AI
Planning modes reduce derailment on non-trivial changes.
Both hosts note that “plan mode” features in modern tools help prevent conversational drift by forcing explicit steps and constraints before edits, especially for anything larger than a small file change.
Get the full analysis with uListen AI
Notable 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
Questions Answered in This Episode
What prompt/template do you use to generate Mermaid diagrams from an existing codebase, and what inputs (user actions, events, modules) make the diagrams most useful for AI?
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.
Get the full analysis with uListen AI
How do you decide which diagrams to preload for a given task, so you don’t blow the context window unnecessarily (e.g., auth-only vs. whole-system load)?
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.
Get the full analysis with uListen AI
What’s your recommended folder structure for a repo “memory” directory (diagrams, domain glossary, security notes, runbooks), and what belongs in system prompt vs. user prompt?
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.
Get the full analysis with uListen AI
In your stop-hook workflow, how do you prevent accidental commits of sensitive files or partial changes—do you use allowlists/denylists, diff checks, or staged-only rules?
Finally, he walks through Claude Code “stop hooks” that automatically run checks (e. ...
Get the full analysis with uListen AI
Which quality checks provide the biggest ROI in hooks (typecheck, lint, format, tests), and where do you draw the line because runtime cost becomes too high?
Get the full analysis with uListen AI
Transcript Preview
There are people out there definitely like me, that really want to know the advanced techniques that can leverage the most powerful parts of these AI-powered coding tools. Where do you want us to get started that you think many people don't think about in terms of how they can use these tools?
Context and diagrams is a great place to start. They're definitely the best way to get AI to do what you want. So they have what are called Mermaid diagrams. This is a way of visualizing database operations, and it's a way of essentially compressing your application down into very small lines of text that show how your application works. Now, for a human to read this, this is a big challenge, but an AI can consume this easily. I could even just say, "Please explain the authentication flow," and because it already has it in the context, it's not gonna have to do a bunch of file reads and code-based exploration to figure this out. It's gonna come up with the results much quicker.
If I gave you infinite junior-to-mid-career talent, who is always available, who would do the work you would do if you had unlimited amount of time and no meetings, what would you do when a ticket came in? Like, what would you do? [upbeat music] Welcome back to How I AI. I'm Claire Vo, product leader and AI obsessive, here on a mission to help you build better with these new tools. Today, we have John Lindquist at egghead.io, who is a superuser of AI-powered engineering tools like Cursor and Claude Code. Now, I love all you non-technical folks out there, but this is an episode for the senior software engineers who really want to understand how they can use the power features of some of these AI engineering tools to really both optimize the quality of code that they're generating, but also become more efficient as they use their IDE, terminal, and AI assistants to write, check, and deploy code. This is a great episode for any of our advanced users out there, VPs of engineering, CTO, pay attention, send this to your staff engineers. Let's get to it. This episode is brought to you by WorkOS. AI has already changed how we work. Tools are helping teams write better code, analyze customer data, and even handle support tickets automatically. But there's a catch: these tools only work well when they have deep access to company systems. Your copilot needs to see your entire codebase. Your chatbot needs to search across internal docs, and for enterprise buyers, that raises serious security concerns. That's why these apps face intense IT scrutiny from day one. To pass, they need secure authentication, access controls, audit logs, the whole suite of enterprise features. Building all that from scratch, it's a massive lift. That's where WorkOS comes in. WorkOS gives you drop-in APIs for enterprise features, so your app can become enterprise-ready and scale upmarket faster. Think of it like Stripe for enterprise features. OpenAI, Perplexity, and Cursor are already using WorkOS to move faster and meet enterprise demands. Join them and hundreds of other industry leaders at workos.com. Start building today. John, welcome to How I AI. I have to put some context here, which is we have done quite a bit of coding with Cursor, vibe coding episodes, but a lot of what our audience has asked for is early maturity, less technical introductions to these tools. But there are people out there definitely like me, um, and definitely like folks that follow you, that really do know how to write great software and want to, you know, as people say, "Of course, I'm a 9X engineer, but how do I become a 10X engineer?" [chuckles] With some of these tools, want to know really the advanced techniques that can leverage the most powerful parts of these AI-powered coding tools and get you really high-quality software. So I'm really excited about what you're going to show us today. And so, where do you want us to get started that you think many people don't think about in terms of how they can use these tools?
Install uListen to search the full transcript and get AI-powered insights
Get Full TranscriptGet more from every podcast
AI summaries, searchable transcripts, and fact-checking. Free forever.
Add to Chrome