Reference · 16 Patterns · 6 Chapters
Agent Patterns
Repeatable techniques for engineering with AI coding agents. A structured reference — not tips, not tricks, not a beginner's guide.
Difficulty levels
No prior agent experience needed. Start here.
Assumes you've used coding agents on real projects.
Requires deep agent workflows and multi-session experience.
Foundation
Setting up your environment, codebase, and tools for agent success.
4 patterns
Convention File
Make implicit project rules explicit in a file the agent always reads, so it follows your standards without being told each time.
Safety Net
Establish automated checks (tests, types, linting) as guardrails so agent mistakes get caught immediately, not in production.
Memory Layer
Use persistent context files to maintain project knowledge across sessions, eliminating repetitive re-explanation.
Agent-Friendly Architecture
Organize code with clear boundaries, named modules, and explicit interfaces so agents can navigate and modify it confidently.
Context
Managing what the agent knows — and doesn't know.
4 patterns
Context Priming
Front-load the most relevant files and decisions before making a request, so the agent starts from understanding rather than guessing.
Scope Fence
Explicitly constrain the agent's working area to prevent drift into unrelated code, keeping changes focused and reviewable.
Progressive Disclosure
Reveal project complexity incrementally instead of dumping everything at once, avoiding context overload.
Anchor Point
Reference specific files, functions, and line numbers to ground the agent in concrete code rather than abstract descriptions.
Task
Breaking work into units that agents handle well.
4 patterns
Vertical Slice
Break features into thin end-to-end slices rather than horizontal layers, giving the agent complete context for each piece.
Checkpoint Loop
Work in small cycles of do-then-verify instead of one big request, catching drift early before it compounds.
Scaffold First
Have the agent build types, interfaces, and structure before filling in implementation, establishing constraints that guide the rest.
Parallel Fan-Out
Split independent subtasks across concurrent agent sessions to multiply throughput without multiplying errors.
Steering
Guiding agent behavior toward the output you actually want.
4 patterns
Test-First Steering
Write failing tests first so the agent has a concrete, verifiable target instead of an ambiguous description.
Example-Driven Spec
Show the desired output shape rather than describing it abstractly, reducing interpretation error.
Negative Space
Define what the agent should NOT do, because constraints eliminate more bad output than instructions produce good output.
Constraint Over Instruction
Specify boundaries and invariants rather than step-by-step procedures, giving the agent room to find good solutions within your guardrails.
Verification
Ensuring the agent's output is correct, complete, and safe.
Patterns coming soon
Recovery
What to do when things go wrong.
Patterns coming soon
Find by Problem
Start from the symptom you're experiencing.
“The agent keeps making changes I didn't ask for”
“I keep re-explaining the same things”
“Output is correct but doesn't match codebase style”
“Huge diff and I'm not sure it's right”
“Not getting enough value from agents on complex tasks”
“The agent broke something unrelated”
“Spending more time fixing agent output than writing it myself”