Back/How I AI
How I AI

Beyond Vibe Coding: Advanced AI Engineering with John Lindquist

Egghead.io's John Lindquist joins me to demonstrate pro-level AI engineering workflows, from using Mermaid diagrams for context loading to building automated code quality checks with Claude Code's stop hooks.

Claire Vo's profile picture

Claire Vo

January 26, 2026·7 min read
Episode outline

Experienced engineers are not asking how to generate a toy app. They are asking where AI can remove repeated discovery, shorten common commands, and enforce project checks.

How can these tools make an experienced developer faster and more consistent?

In this episode of How I AI, John Lindquist, co-founder of egghead.io and AI DX at Vercel, demonstrates three systems: preloading architectural diagrams, wrapping repeated work in aliases and CLIs, and using stop hooks to run checks and fixes.

These workflows assume you already understand the code and want to improve the surrounding system.

John demonstrated three workflows.

Preload architectural context with Mermaid diagrams

Improve AI Code Awareness with Mermaid Diagram Context: Compress a codebase's architecture into source-grounded Mermaid diagrams, store them beside the repository, and load only the relevant diagrams into an AI coding session.

A new coding session does not begin with a complete map of the application. John preloads Mermaid diagrams that describe important architecture and flows.

The diagrams capture application flows, database schemas, and user interactions in text that the model can parse efficiently.

Generate and organize the diagrams

John generates diagrams from the codebase and stores them in a dedicated repository directory. Teams can also update diagrams during normal development, such as after a feature is merged.

Add the diagrams to session context

At the beginning of a Claude Code session, John appends the diagram files to the system prompt instead of attaching each file manually.

In your terminal, run this command:

claude append-system-prompt "$(cat memory/ai/diagrams/**/*.md)"

The command concatenates the Markdown files in the diagram directory and adds them to the session context.

The tradeoff: more initial tokens, less repeated discovery

Preloading consumes more tokens at the start. In return, Claude can answer architecture questions from the supplied map before deciding whether it needs to inspect implementation files.

Package repeated work in aliases and CLIs

Automate Repetitive AI Commands with Custom Shell Aliases and CLIs: Turn repeated AI commands into safe shell aliases, then promote a stable multi-step prompt into a small CLI with explicit inputs, visible configuration, and reproducible output.

John turns commands and prompts he repeats into shell aliases or small command-line tools.

Part A: Shorten common commands with aliases

In Zsh, John maps frequently used Claude Code commands to shorter aliases.

# Set the model to the fast but less powerful Haiku
alias h='claude set-model claude-3-haiku-20240307'
# Enable the 'dangerously' mode to bypass permissions
alias x='claude set-permission-mode bypass-permissions'
# Load all my diagrams into context (from Workflow #1)
alias cdi='claude append-system-prompt "$(cat memory/ai/diagrams/**/*.md)"'

The savings are small per command but repeat across many sessions.

Part B: Build focused command-line tools

John also builds small CLIs around ideas he wants to repeat. His sketch tool wraps the Gemini CLI to generate website design concepts.

The tool asks three questions:

  1. What type of website do you want to build?
  2. Which page do you want to design?
  3. What style should it use?

The CLI combines those answers with a predefined prompt and calls Gemini. The constrained interface keeps the inputs repeatable without requiring a separate graphical application.

Run quality checks with a Claude Code stop hook

Automate Code Quality and Fixes with AI Stop Hooks: Use an agent stop hook to run project-specific checks when files change, feed actionable failures back into the same session, and finish only when the bounded validation loop passes.

John uses a Claude Code stop hook to run project checks after the agent finishes and return failures to Claude for another attempt.

Define the hook logic

The TypeScript hook uses the Claude Agent SDK and follows this sequence:

  1. If no files changed, exit without running checks.
  2. If files changed, run bun typecheck.
  3. If type checking fails, print the report with an instruction for Claude to fix the errors.
  4. If the checks pass, ask a background agent to prepare a commit message and commit the work.

Register the hook in Claude Code

John points the project's settings.local.json configuration to the hook script.

{
  "claude.hooks.stop": [
    {
      "command": "bun run claude-hooks/index.ts"
    }
  ]
}

The result: check, fix, check again, then commit

In the demo, Claude created a syntax error. The hook ran type checking, returned the error, let Claude fix it, reran the check, and committed after the check passed.

A shared hook can apply the same project checks across sessions and developers.

The operating pattern

John treats AI tooling as infrastructure: preload useful context, package repeated commands, and put checks inside the workflow.

For an experienced engineer, the improvement comes from the system around the model as much as the prompt itself.

Use an agent stop hook to run project-specific checks when files change, feed actionable failures back into the same session, and finish only when the bounded validation loop passes.

Create a project-local hook script and read Claude's stop-hook input from standard input. Track the session, current directory, changed files, and retry count without writing secrets to logs.

If no relevant files changed, exit cleanly. Otherwise map the changed paths to focused commands such as typecheck, lint, tests, formatting, dependency checks, or document validation.

When a check fails, emit one valid JSON response that names the command, exit status, affected files, and concise diagnostic output. Reserve standard output for that response.

When checks pass, inspect the exact task diff and sensitive-file rules. If automatic commits are allowed, stage only the task-owned files and generate a conventional commit message; otherwise leave the validated diff uncommitted with a summary.

Register the script as a project stop hook in Claude settings, test no-change, failing, repaired, retry-limit, and success paths, and keep the full CI suite as an independent gate.

List commands you use repeatedly and choose only stable, low-risk sequences for aliases. Put complex quoting or project logic in a script rather than a one-line alias.

Choose a repeated AI task with consistent inputs and output, such as producing several design concepts from a website type, page, style, theme, and reference.

Build a small CLI around the installed AI tool or API. Keep model and prompt templates in versioned configuration, read credentials from the environment, and support help and dry-run output.

Prompt for only the variables that change the result. Validate required values, constrain enumerated choices, show defaults, and print the output destination before the API call.

Run the CLI against representative inputs, save outputs with stable filenames and metadata, and return useful errors for authentication, rate limits, invalid inputs, and partial generation.

Choose one bounded application flow, such as authentication or a database write. Ask the agent to inspect the relevant code and cite the files and symbols behind every diagram element.

Save the reviewed diagram in a domain-specific Markdown file under memory/ai/diagrams. Keep explanatory notes and source paths beside the Mermaid block.

Load only the diagram files relevant to the current task through Claude Code's append-system-prompt option or an equivalent context mechanism.

Handle Check Failures Automatically Fix the reported validation failures without changing unrelated files. Rerun the failing command, explain any remaining error, and stop after [maximum attempts] rather than repeating the same edit.

Handle Check Successes Role: You are an expert programmer who writes git commit messages in the conventional commit format. Task: Generate a git commit message for the following code changes. Diff: [paste git diff] Output only the commit message.

Turn repeated AI commands into safe shell aliases, then promote a stable multi-step prompt into a small CLI with explicit inputs, visible configuration, and reproducible output.

Compress a codebase's architecture into source-grounded Mermaid diagrams, store them beside the repository, and load only the relevant diagrams into an AI coding session.

Sponsors

Thanks for supporting How I AI

Tines

Start building intelligent workflows today

WorkOS

Make your app enterprise-ready today

Build your next product with ChatPRD

Turn an idea into a PRD, user stories, and a plan.

Try ChatPRD free

Start shipping
better products.

Join 100,000+ product managers who use ChatPRD to write better docs, align teams faster, and build products users love.

Free to start
No credit card
SOC 2 certified
Enterprise ready