Back to database

John Lindquist, Egghead's AI use case

Founder and developer educator at Egghead

Uses Mermaid diagrams and Claude Code automation to make codebases easier for AI to understand, review, and improve, turning architecture context and quality checks into reusable development artifacts.

The problem

What was broken before AI

AI coding tools often struggle when the codebase context is hidden in folder structure, naming conventions, undocumented flows, or a developer’s head. A model can inspect files, but it may not understand the architecture, the sequence of events, or why one module depends on another. Without that context, it may make locally plausible changes that miss the larger system shape.

What changed

What the use case made possible

John’s workflow makes context more explicit. Mermaid diagrams give Claude Code a visual and textual map of the system. Markdown notes and project files can explain task flows, dependencies, and constraints. Stop hooks or automated checks can run after changes so the assistant does not stop at code that only looks correct. Together, these artifacts turn context into something the AI can repeatedly use.

Why this matters

Why this use case is worth studying

This use case is valuable because it focuses on preparing the environment, not just improving the prompt. A better prompt helps once. A diagram, context file, or stop hook can help every future task. John’s approach shows how developers can make their codebases more AI-friendly by externalizing the knowledge that usually lives in their head.

Use this when

When this pattern applies

Use this pattern when AI coding tools keep missing the bigger shape of your codebase. It works especially well for event flows, state machines, data pipelines, architecture boundaries, or any system where a visual map makes the code easier to understand.

Exponential Builder analysis

01

Make context durable.

The real leverage comes from moving architectural knowledge out of a developer’s head and into repo-readable artifacts the AI can revisit on every task.

02

Teach the codebase to explain itself.

Mermaid diagrams and Markdown notes give the assistant a shared map of flows, dependencies, and constraints, which reduces the odds of locally reasonable changes that break the broader system.

03

Pair generation with guardrails.

Stop hooks and automated checks turn “done” into something closer to verified work, while repeated misunderstandings become signals to improve the diagram, note, or rule.

Who this is for

Best fit

Developers using AI coding tools

Developer educators

Teams with complex code flows

Engineers onboarding AI to an existing repo

People using Claude Code or similar tools

Teams that want reusable context instead of long repeated prompts

What to avoid

Mistakes and warnings

Where this pattern can go wrong if you copy it too literally.

Do not create diagrams so complex that no one reads them.

Avoid treating diagrams as permanent if the code changes often.

Do not rely on AI to infer architecture from file names alone.

Keep checks lightweight enough that they actually run.

Update the context when AI makes the same mistake twice.

Public workflow preview

The shape of the workflow

A high-level look at how the use case works, with the reusable pattern made clear.

01

Map the system before changing it

John uses Mermaid diagrams to show how components, data, or events connect.

02

Store context where AI can read it

Architecture notes and diagrams become project artifacts rather than one-off explanations.

03

Ask AI to work from the map

Claude Code can reference the diagram while planning or making changes.

04

Add automated checks after edits

Stop hooks or quality checks help catch issues before the assistant hands work back.

05

Keep improving the context

When the AI misunderstands the system, the fix is not only a better prompt; it is a clearer diagram, note, or rule for next time.

Copy the pattern

The reusable idea

Pattern in one sentence

Make your codebase more legible to AI by turning architecture knowledge into diagrams, context files, and checks the assistant can reuse.

Reusable idea

John’s workflow is a reminder that AI coding improves when the codebase explains itself. If you keep repeating architectural context in prompts, turn that explanation into a file, diagram, or rule the assistant can reuse. The goal is to make the important parts of the system visible before the model starts editing.

Steal this workflow

Use this when an AI coding assistant keeps misunderstanding one part of your codebase:

1

Pick one confusing feature, flow, or module boundary.

2

Create a Mermaid diagram showing the main components, events, inputs, outputs, dependencies, and state changes.

3

Save the diagram in the repo or project context where the assistant can read it.

4

Add a short Markdown note explaining what the diagram means, which files matter, and what rules should not be violated.

5

Before any edit, require the assistant to read the diagram and summarize how the requested change fits the flow.

6

Ask for a small implementation plan that references the diagram.

7

Let the assistant make a limited change.

8

Run the relevant project command, test, or stop-hook check after the edit.

9

If the assistant gets confused, update the reusable context artifact instead of only rewriting the next prompt.

10

Reuse the same map whenever future work touches that system area.

Suggested prompt

“Before editing code, read the Mermaid architecture diagram and related Markdown notes for this feature. Summarize the current flow, name the components and files you expect to touch, and explain how the requested change fits into the existing system. Then propose a small plan. After making the change, run the relevant checks. If a check fails, inspect the failure and fix the smallest issue before stopping. When you are done, tell me where you lacked context and suggest one diagram, note, or rule we should add for future tasks.”

Field notes

Get new AI use cases in your inbox

A short weekly note on how real people are using AI to save time, make money, build tools, and run their lives.

No spam. Just useful AI use cases.

Related use cases

Keep exploring nearby systems.

Browse all