Technical guide

Built with Claude Code

How I work with Claude Code

The setup that lets each new Claude session pick up where the last one left off: one front door, written decisions, a guide that can’t drift, one gate, hooks, memory, and sessions sized to one laptop.

Checked against the code on 2026-11-14.

On this page
  1. The loop
  2. One front door
  3. Written decisions
  4. A guide that can’t drift
  5. One gate
  6. Hooks: rules nobody has to remember
  7. Memory
  8. Skills
  9. Who decides what
  10. Several sessions at once
  11. Sized to one laptop

Claude forgets everything between sessions, so the project has to remember for it. This repository holds what the site is, every call I’ve made and why, how to check that it works, and the lessons we’ve learned. Each new session reads that and starts out knowing more than the last one did.

The other half is that every mistake gets fixed twice: once in the code, and once in whatever let it through. A test, a check, a rule, a better default. That’s what keeps the same bug from coming back.

The loop#

Most days go round the same loop:

  1. I ask in plain words. A game to build, a bug, or something that felt off at the table. I give it as a player would, and Claude works out what to build.
  2. Claude reads the front door, plans, and asks me only the calls that are mine, in one round, with its recommendation first. For anything visual and new, I see a mockup before anything is built.
  3. It builds in small pull requests, one idea each, and writes my calls down the day I make them.
  4. The gate runs everything, and hooks hold back a commit or a pull request that skipped it.
  5. Something still slips through. I notice it on my phone, or my family does on a game night. Since November 5 anyone can say so from the Feedback button on every screen (ADR 0068).
  6. Claude fixes it, then asks why the checks missed it, and adds what would have caught it. Then round again, with a project that knows a little more.

One front door#

On the first night I asked for it: “I think it’s probably good if we document some of this for future agents/contributors” (October 6). Every session starts by reading AGENTS.md: what the site is, a map of where everything lives, numbered rules with the decision record behind each one, and the exact commands. CLAUDE.md is the file Claude Code reads by itself, so it points there and repeats the one rule that touches every change:

CLAUDE.mdlines 1–5
# CLAUDE.md

See [AGENTS.md](AGENTS.md): it is the guide for every agent and contributor working in this repo.

One of its rules touches every change: every change that alters behavior updates the technical guide (`docs/guide/`) in the same PR; `npm run check:guide` names the chapters to review, then `npm run guide:stamp <chapter>` (AGENTS.md rule 2).

The file grows a line each time we learn something, and gets trimmed when it grows long. Every stale line costs every future session a little attention.

Written decisions#

A call made in chat and written nowhere gets asked again next week. So each one goes into docs/adr/ as a short decision record: the context, the decision (in my words when it was my call), what follows from it, and the date. When a later record changes an earlier one, both say so in their Status lines, and npm run check:adr fails if they don’t agree or if two sessions took the same number.

Smaller calls go where they apply: a game’s rules in docs/<game>.md, a design call in the design system, a release’s in its plan.

A guide that can’t drift#

This guide is how every system works, explained from the code, and it’s how a new session learns a part of the site before changing it. It’s for me too: the better I understand a game, the better my feedback on it. A chapter names the code it covers and carries a stamp, a hash of that code. When the code changes, npm run check:guide names the chapter to read again (ADR 0035). How this guide stays true is the whole of it. These chapters are held to the same rule: when a skill, a hook or AGENTS.md changes, the chapter that explains it asks to be read again.

One gate#

One command runs every check that doesn’t need a browser before any pull request: npm run check:pr, about three minutes, its checks side by side. It ran them one after another until I asked why it took so long. When it passes it keeps a receipt tied to the exact code it ran on (ADR 0061). There’s no hosted CI. When Claude proposed one, I said “I’m actually a bit concerned about creating a CI gate” (October 19): my free GitHub account’s minutes were already spoken for. So the gate runs on my laptop, which is cheaper and fast enough. Testing and checks has what it runs and when.

Hooks: rules nobody has to remember#

An instruction can be forgotten under pressure; a hook can’t. Claude Code runs these before its own commands, from .claude/settings.json:

.claude/settings.jsonlines 1–36
{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Bash",
        "hooks": [
          {
            "type": "command",
            "if": "Bash(git commit*)",
            "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/check-guide.sh commit",
            "timeout": 120,
            "statusMessage": "Checking the technical guide is up to date…"
          },
          {
            "type": "command",
            "if": "Bash(gh pr create*)",
            "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/gate-receipt.sh",
            "timeout": 30,
            "statusMessage": "Checking the gate passed on this code…"
          }
        ]
      }
    ],
    "Stop": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/check-guide.sh stop",
            "timeout": 120
          }
        ]
      }
    ]
  }
}
  • Before git commit, the guide’s check runs, and a stale chapter blocks the commit.
  • Before gh pr create, the gate’s receipt must match the committed code, or the pull request is held. A draft goes through.
  • When Claude finishes a turn, a stale guide gets a reminder, never a block.

Here’s the first of them. It reads which folder the command runs in, so a session working in its own worktree is checked against its own guide:

.claude/hooks/check-guide.shlines 1–29
#!/usr/bin/env bash
# The technical guide must stay true to the code (AGENTS.md rule 2, ADR 0035).
# commit: run before `git commit` and block it (exit 2) if the guide is stale.
# stop:   run when Claude finishes a turn; a reminder only, never blocks.
mode="${1:-commit}"
# The folder the command runs in, or the session's (hook-input.mjs): a session
# in a worktree is checked against its own guide.
# Only a `git commit` the command really runs (hook-input.mjs), not one in a
# heredoc or quotes: the settings' `if` lets some other commands by.
{ IFS= read -r dir; IFS= read -r run; IFS= read -r cmd; } < <(node "$(dirname "$0")/hook-input.mjs" git commit)
if [ "$mode" = "commit" ] && [ -z "$run" ]; then
  exit 0
fi
cd "$dir" || exit 0
# Branches from before the guide have no check: nothing to enforce there.
node -e "process.exit(require('./package.json').scripts?.['check:guide'] ? 0 : 1)" 2>/dev/null || exit 0
out="$(npm run -s check:guide 2>&1)" && exit 0
if [ "$mode" = "commit" ]; then
  printf 'The technical guide is out of date with the code, so this commit is blocked.\n%s\nReview and update the chapters named above, then run `npm run guide:stamp <chapter>` and commit again.\n' "$out" >&2
  # This hook runs before the whole command, so a stamp chained before the
  # commit hasn't run yet when the guide is checked.
  case "$cmd" in *guide:stamp*|*"guide stamp"*)
    printf 'This command stamps the guide and then commits, but the check runs before any of it, so it sees the guide unstamped. Stamp first, then commit in a separate command.\n' >&2 ;;
  esac
  exit 2
fi
msg="Reminder: npm run check:guide fails — update the technical guide chapters it names before committing."
node -e 'console.log(JSON.stringify({systemMessage: process.argv[1]}))' "$msg"
exit 0

The rule that every change updates the guide was only advice until this hook blocked the commit. Then it held.

Memory#

Claude Code keeps notes of its own about me between sessions: my preferences, my corrections, and the reason for each. That I like a plan first and then no check-ins on every step. That my calls come in one round, with its pick first. That a pull request may merge once it passes the gate and does what I asked. Those notes are Claude’s and stay private. When a note turns out to be a rule for the project rather than a preference of mine, it moves into AGENTS.md, a skill or a decision record, where everyone can read it.

Skills#

A workflow I’ve walked Claude through twice gets written down once, as a skill, so the third time is one command: /release, /new-game, /playtest-round, /release-video, /design-audit and /plan-release. The skills, one by one has each of them.

Who decides what#

I make the calls only I can make, and Claude makes the rest.

  • Mine: which games, my family’s rules, how things look and feel, and when something ships. Claude brings each call with its options and a recommendation: “Please explain to me each option and I’ll choose just one for us to make the default.” (October 15). When there are several, they come together in one place.
  • Seen before it’s built: anything visual and new comes as a mockup first, with real content in it. A mockup of the rulebooks with no rules in it got sent back: I wanted to read the real words before approving their voice.
  • Claude’s: bugs, how the code is built, and the details of a direction I’ve set. For the 1.0.0 video I gave a theme and said, “This is a broad direction, not a verbatim script to follow.” (November 5).
  • Merging: “If it meets the needs I initially stated, let’s merge it.” (October 29). Claude asks first only for a call I haven’t made, and otherwise keeps moving rather than waiting on me.
  • Ship often: our playtest group is small and expects the site to change fast, so changes go out often. Since November 5 that rhythm is a numbered release once or twice a week.

Several sessions at once#

Bigger work runs as several Claude sessions side by side, each on its own piece:

  • Each session gets its own worktree, a separate checkout of the repository on its own branch, with its own database and its own port. Two sessions never edit the same files. The port started as my ask, so I could play each game in its own window as soon as it was ready.
  • Decision record numbers are handed out up front. Early on, three sessions each took the same next number on the same day. check:adr now catches it, but handing them out first is simpler.
  • Work lands on a release branch, never on main. Only a release, after my playtest and sign-off, reaches the live site (Releases and playtests).

For version 2.0.0 one more layer appeared. A major release is now built over weeks on its own branch, while smaller releases keep shipping from main and are merged into it as they ship (ADR 0084). One lead session owns it. It keeps the release’s plan in docs/releases/plans/: the items, my calls on each, the order, and who’s working on what. For each piece of work it writes a brief in briefs/: what and why, my calls that bind it, what done looks like, its branch, port and decision record number, and when to stop and ask. Then it starts a session with that brief, at most two at a time, and merges the result once the gate passes. npm run release:status shows every open release and its plan’s items. It also gathers every session’s questions for me, because with several sessions running I’d lost track: “Can you please ask me one question at a time with enough context for me to weigh in on each open item across the open sessions?” (November 8). This chapter was written from one of those briefs.

Sized to one laptop#

All of this runs on one 8 GB laptop. On October 29 I ran too many sessions, servers and headless browsers at once, and it ground to a halt. The next day: “let’s not max out my compute and memory like we did yesterday. Some sensible limits, please.” Since then the limits are written into every plan, brief and skill:

  • At most two helper agents at a time, and one dev server each.
  • Browser checks on only the game being worked on, one window at a time. Full-site checks, Safari’s engine and videos belong to the lead, once, on the combined work.
  • A time box for every session, with a rule for when to stop. A big run has to be worth what it costs the machine and my plan’s limits.
  • Work planned in waves of a few sessions at a time.

The browser checks also hold back by themselves: before opening Chrome they wait while the machine’s load is over 0.75 per core, or less than 20% of memory is free, for up to ten minutes, then go ahead and say so:

tools/house/chrome.mjsroomToRun · lines 50–62
/** Waits (up to ten minutes) until the machine isn't busy. */
export async function roomToRun({ quiet = false } = {}) {
  if (process.env.UO_WAIT === '0') return;
  const end = Date.now() + WAIT_MAX;
  let said = false;
  for (;;) {
    const why = busy(machine());
    if (!why) return;
    if (Date.now() > end) { console.error(`(still busy: ${why}; going ahead)`); return; }
    if (!said && !quiet) { console.error(`Waiting for the machine before starting Chrome: ${why}. (UO_WAIT=0 to skip)`); said = true; }
    await new Promise(r => setTimeout(r, 15_000));
  }
}