Companion
The Kit
The templates the book describes, ready to copy into your own projects. Each one is taken from its chapter; the chapter explains why it is shaped the way it is.
Starter rulebook
The five sections of a CLAUDE.md, with the book’s core constraints filled in. Chapter 4
Preview
# CLAUDE.md — the rulebook for this project <!-- From "Inside the Mind of a Hacker", chapter 4. Keep it to a few screens: instructions, not documentation. --> ## Stack <!-- Named precisely: framework, database, hosting, styling. An agent that knows the stack reuses what is there. --> - Framework: - Database: - Hosting: - Styling: ## Commands that prove a change works <!-- The exact commands. An agent cannot verify its work if it does not know what verification means here. --> - Type check: `npm run typecheck` - Tests: - Lint: - Build: ## Structure <!-- Where things live and why. Which files may talk to the database. Which routes are public, which are behind a login. --> - ## Decisions already made <!-- Numbered, one line each, with the reason. Longer entries live in DECISIONS.md. --> 1. ## Constraints <!-- Not up for discussion. If a requirement conflicts with one of these, stop and ask. --> - Do not just implement a request literally: first work out the problem behind it. - Any request with more than one reasonable answer gets three options, their tradeoffs and a recommendation before work begins. - "Done" means verified. Every claim of done names the check that proved it and shows the evidence. - Gates (stop and ask, every time): reading or moving credentials; deploying to production; anything that cannot be undone; spending money or sending anything in my name. - Before deleting or overwriting anything, look at it first.Handoff
Where things stand, blocked and on whom, decisions, surprises, next session. Chapter 5
Preview
# Handoff: <project> <!-- From chapter 5. Short and ruthlessly current: rewrite, don't append. History lives in version control. --> _Last updated: YYYY-MM-DD._ ## Where things stand <!-- What is built, what is verified, and how. Not "auth is done" but which checks passed, where, at which commit. --> - ## Blocked, and on whom <!-- Things that cannot move until someone acts: a credential, an approval, a decision. --> - ## Decisions <!-- Pointer to DECISIONS.md, plus the few entries that matter right now, one line each. --> - ## Surprises <!-- Anything that went differently from what anyone expected. One line each, written the moment it is found. A surprise that is true for every project gets promoted into the rulebook. --> - ## Next session <!-- The single next thing to do. Not a roadmap. --> -End-of-day skill
The unattended close-out that keeps the handoff current. Chapter 5
Preview
# Skill: end of day <!-- From chapter 5, "The end-of-day ritual". Run it on a schedule (e.g. midnight) and by hand with "close out". --> Runs unattended. Never asks questions, never takes a risky action, never deploys anything. For each project that saw work today: 1. Read what changed (commits, uncommitted work, the session's notes). 2. Bring HANDOFF.md up to date: where things stand (with evidence), blocked and on whom, decisions, surprises, the single next step. 3. Record any new decisions in DECISIONS.md and any new surprises in the handoff, one line each. 4. Commit the result, so it is part of the version history. Its only job: nothing that mattered today lives only in today.Staffing Sheet
One sheet per agent: role, briefing, tools, checker, signatures, tests. A blank row is where it will fail. Chapter 1
Preview
# Staffing Sheet <!-- From chapter 1. Fill in one sheet per agent. --> If a row is blank, that is where the agent will fail. | Question a manager would ask | Your answer for this agent | | --- | --- | | **Role.** What is this agent for, in one sentence? | | | **Briefing.** What does it know when it starts? What does it fetch only when needed? | | | **Outside material.** What does it read that you didn't write, and is that labelled? | | | **Tools.** What can it do? For each: when to use it, when not to | | | **Handbook.** Which procedures are written down? Which still live in your head? | | | **Checker.** Who or what checks the work, and does it see only the result? | | | **Second opinion.** Who does it ask when stuck? | | | **No permission needed.** Which steps can it take alone? | | | **Your signature.** Which steps need you, because they can't be undone? | | | **Notes.** Where does it record progress on long jobs? When were they last read? | | | **Tests.** How many test cases does it have? When did they last all pass? | | | **Model and dial.** Which model, at what thinking setting, last reviewed when? | | ## At every model upgrade - [ ] Old tests run on the new model, unchanged - [ ] Workarounds removed and tests run again - [ ] Only proven rules put back, each with its reason - [ ] Thinking setting tried one step lower and one step higher - [ ] Agent's own notes read and pruned - [ ] Tried on a few real customers firstPrompt Debug Sheet
Read a hundred conversations, turn the failure piles into tests, clean the prompt, then change one thing at a time. Chapter 2
Download
prompt-debug-sheet.mdPreview
# Prompt Debug Sheet <!-- From chapter 2. Use it on one agent before you edit its instructions. --> It takes an afternoon to start and ten minutes per change after that. ## 1. Read (once, about three hours) - [ ] Pull 100 real conversations - [ ] Write a one-line note on each failure, in plain words - [ ] Sort the notes into piles and count each pile - [ ] Rank the piles by count times cost ## 2. Test (once, then add to it forever) | Test | Situation | Passes if | Kind | | --- | --- | --- | --- | | 1 | | | Easy / Scar / Edge | | 2 | | | | | 3 | | | | ## 3. Clean (before any fix) - [ ] Capitals and shouting removed - [ ] Pasted junk and untrue statements removed - [ ] "Think carefully" and "check your work" removed - [ ] Each remaining rule tested by taking it out - [ ] Each surviving rule rewritten as what, when and why ## 4. Fix (one row per change) | Failure pile | Owner | The one change made | Passed every run, before | Passed every run, after | Cost change | | --- | --- | --- | --- | --- | --- | | | Tool / Old rule / Context / Procedure / Checker / Format / Dial / Model | | of 5 | of 5 | | No change goes live without a row in part 4. If you can't fill in the row, you don't yet know whether the change helped.The diagnostic prompt
Problem, rivals, tradeoffs, verification: four lines. Chapter 2
Preview
# The diagnostic prompt <!-- From chapter 2, "How to write a diagnostic prompt". Four parts. --> ``` [The problem, in one sentence, in terms of a person trying to do something.] Recommend the best approach from: [three to five rival options, by name]. Explain the tradeoffs, then implement the best option. Verify with: [the checks that prove it worked]. ``` - Keep a person in the first line. "This page is bad" fails. "Someone setting up their account for the first time can't tell which fields are required" passes. - If you don't know the names of the options, say so: "I don't know what this kind of layout is called; name the options for me." - If you cannot say how you will know the change worked, you have not finished diagnosing.Ask for three
Three distinct directions, a recommendation, and no code until you pick. Chapter 3
Download
three-options-prompt.mdPreview
# Ask for three <!-- From chapter 3, "How to ask for three". Put it in your rulebook and the workforce follows it unprompted. --> ``` [The problem, from the diagnosis.] Give me three distinct directions that differ in [audience / approach / effort]. For each: what changes, why it helps, what it uses, difficulty, and what it gives up. Recommend one, and say which tradeoff decided it. Do not write code until I pick. ``` The last line is a gate: once a direction exists in code it becomes the default, and defaults are sticky. Keep the choice open until you have made it.Gate checklist
The four gates where an agent stops and asks. Chapter 8
Preview
# Gate checklist <!-- From chapter 8. A gate is a point where an agent must stop and get a human's approval before continuing. --> The agent stops and asks, every time, before it: ## 1. Credentials - [ ] reads, creates, links or moves a password, key or token - [ ] sends private details about me or my projects to an outside service ## 2. Deploys - [ ] promotes a change to production - [ ] pushes to the main branch of a shared repository - [ ] publishes a package ## 3. Destructive actions - [ ] deletes a database, a database branch or a table - [ ] removes files that are not under version control - [ ] rewrites a repository's history - [ ] cancels a subscription, or overwrites anything without a backup - Before any of these: look at the thing first. ## 4. Money and outward communication - [ ] buys a service, upgrades a plan or increases compute size - [ ] sends an email, posts a message, opens a public issue or comments on someone else's work ## Approval does not travel A yes covers the action it was given for, in the context it was given in. It does not open the next gate.Deploy preflight
Before, during and after, with retry-then-rollback. Chapter 9
Preview
# Deploy preflight <!-- From chapter 9. The deploy is a procedure, not an event: before, during, after. --> ## Before - [ ] Type-check first. - [ ] After renaming routes, clear the framework's build cache and check again. - [ ] The rulebook's automated checks pass as part of the build (cost rules included). - [ ] The change is verified on a preview deployment built from the same code. - [ ] Environment variables are set in a way that cannot add a trailing newline (e.g. `printf '%s'`). ## During - [ ] Deploy from a known commit, on the branch production is configured to serve. - [ ] Ship small: one change, verified, shipped, recorded. Then the next one. ## After - [ ] Read the sitemap and request every public page from the live domain. Every route must return 200, not just the home page. - [ ] Private pages answer the way they should: a redirect to sign-in, not an error and not the page itself. - [ ] Walk the main user path in a real browser (sign in, do the thing the change was for). - [ ] Update the changelog and the handoff before calling the deploy done. - [ ] If a route fails: wait briefly and retry a small, fixed number of times. - [ ] Still failing: roll back to the last working version, then investigate. - [ ] Write the failure report: which deployment failed, which is now live, which routes failed, what they returned, how many attempts. - [ ] Rollback restores code, not data. Changes that touch the database get their recovery planned before the deploy, not improvised after it.