Vol. 20 · Published Nov 18, 2026 · Book + Claude skill + MCP
The AI Codebase Playbook
Keep AI-Written Code Clean, Safe and Maintainable
About this playbook
Keep AI-written code clean, safe and maintainable
Coding agents make writing code nearly free. Reading, reviewing and maintaining it are not, so a codebase can grow faster than anyone understands it: parallel helpers, hardcoded values, large mixed diffs, tests that test nothing and docs that drift. This playbook is tool-neutral and works with Claude Code, AGENTS.md, Cursor, Copilot or any agent that reads project files.
A ten-step method covers a project rules file, an architecture guide with decision records, mechanical guardrails, small reviewable changes, tests, skeptical review, config and dependency hygiene, cleanup passes, safe refactoring and a weekly routine. Every step ends with a Done when gate you can check. It quotes no productivity statistics; it is a method, not a forecast.
Who it's for
- Experienced professionals and indie builders who ship software with AI coding agents
- Developers who want their codebase to stay understandable six months from now
- Solo builders who review every agent change themselves and need a checklist
- Teams using several agents that need one source of truth for project rules
- Anyone who has found three date helpers and a secret in the repo
What you'll be able to do
- Write a short rules file with exact commands and a never-list that agents follow
- Document architecture, dependency direction and key decisions as ADRs
- Run format, lint, type check, tests, build and secret scanning with one command and in CI
- Work in an explore, plan, implement, verify loop with one concern per change
- Fix bugs with a failing test first and spot fake tests in review
- Centralize and validate config, rotate exposed secrets and approve every new dependency
- Remove dead code and duplicates, and refactor behind characterization tests
- Keep the codebase healthy with a 30 to 60 minute weekly routine and a maintenance log
What's inside
Inside this volume
- 01
The problem
What usually goes wrong when agents write code, from parallel inventions and dead code to slopsquatting, and what good looks like.
- 02
Before you start
The inputs you need, including critical paths and where secrets live today, plus an intake checklist.
- 03
The project rules file
Which files Claude Code, AGENTS.md, Cursor and Copilot read, what to put in them, a starting template and scoped rules.
- 04
The architecture guide
Modules, boundaries, dependency direction, cross-cutting patterns, common gaps a critique reveals and a sample ADR.
- 05
Mechanical guardrails
Formatter, linter, type checker, secret scanner, dependency audit, pre-commit, CI, agent hooks and proving it all works.
- 06
Small, reviewable changes
The explore, plan, implement, verify, commit loop, separating refactors from features, size limits and commit conventions.
- 07
Tests as guardrails
Tests at the seam, test-first with agents, bug fixes with proof, coverage as a floor and how to spot fake tests.
- 08
Skeptical review
A review checklist for scope, correctness, duplication, config, security, dependencies, tests and docs.
- 09
Config, secrets and dependencies
One validated config module, secret handling and rotation, a dependency approval rule and supply chain checks.
- 10
Cleanup and safe refactoring
A dead code routine, consolidating duplicates, flags with expiry, characterization tests, codemods and migrations.
- 11
Docs and the weekly routine
Docs that stay true, a nine-step weekly routine, monthly additions and how to measure trends in your own repo.
- 12
Prompts, checklist and sources
A main audit prompt, 17 focused prompts, a full checklist, 14 common mistakes and links to official documentation.
Use it with your AI agent
Ask for the work. Your agent follows the playbook.
Install the Claude skill or connect the MCP with your license key. Then ask in plain language:
- “Audit this repository against the AI Codebase Playbook, read-only, and give me a prioritized plan of small changes, each with a Done when line.”
- “Draft a project rules file under 150 lines from what you actually see in the code, and mark anything you inferred rather than saw.”
- “Run the weekly maintenance routine on main, report findings in a short table and draft today's entry for docs/maintenance-log.md without merging anything.”
Questions
FAQ
Does it only work with Claude Code?
No. The method is tool-neutral. It covers CLAUDE.md, AGENTS.md, Cursor rules and Copilot instructions, and works with any agent that reads project files and edits code.
Will it make my agent faster or cut bugs by some percentage?
The book quotes no productivity or defect statistics, because studies disagree. It gives you a method with checkable Done when gates and tells you to measure trends in your own repository.
Is this for a large team or a solo builder?
Both. The rules file, guardrails and weekly routine work for one developer, and the advice on one source of truth and pull request descriptions helps teams with several agents.
What do I get with Playbook MCP?
Each volume includes the book, a Claude skill and MCP access, so your agent can apply the playbook one chapter at a time to your project.
Does the agent get to change things on its own?
The prompts keep the agent read-only until you approve a plan. It must ask before adding dependencies, show check output, and you review every diff.
Better together
The Builder's Codex
Design, build, polish and ship apps with AI agents.
$551 $15.80 Save 97%