The agent-facing files in a project (
AGENTS.md, CLAUDE.md, the agents and skills in .claude/) are currently written in Polish. Agents read them fine; English translations are planned.What ships in your project
Hooks and subagents work only in Claude Code. Other tools get the instructions in
AGENTS.md, and the rules are enforced there by CI and code review.
Why tests are written by someone else
A test written by the code’s author, after the code, usually restates the code’s assumptions and passes. Research on LLM-generated tests points the same way: assertions derived from code describe what the code does, not what it should do; tests generated after buggy code inherit the bug; and agents that are allowed to edit tests sometimes change or delete them instead of fixing the code. So “write good tests” isn’t enough as an instruction. The kit separates who writes tests and from what, blocks the implementer from changing them, and measures test strength with a tool that can’t be argued with: a mutant is either killed or it survives. An audit of the kit’s own core tests bore this out. Tests were strong for pure functions and weak in two places only Stryker found: a mocked file hid the fact that the admin-role check ingetAdminUserOrNull had no test at all (any signed-in user could have invited others and every test would pass), and 13 of 15 blocked better-auth paths could be removed without a red test.
The roles
The task flow
1
Plan
Each task lists behaviors (input → expected result as a literal) and mutations to kill (code changes a test must catch, such as “membership check removed”). The feature tutorial shows a full example.
2
Tests first
test-writer writes the tests, runs them and returns each test with the mutation it kills. Tests must be red for the right reason: a missing export or a wrong value, not a syntax or import error. Create empty stub files (export {};) for the code under test so imports resolve. For integration tests, tell the writer to use npm run test:integration -- <files>, because its default npx vitest run skips them.3
Implementation phase
The orchestrator writes
implement to .superpowers/phase and starts the implementer. The protect-tests hook now rejects any edit to a test file.4
End of phase
When the tests are green, the orchestrator deletes the phase file.
5
Test review
test-reviewer finds the task’s production files (git diff --name-only <base>...HEAD, minus tests and generated files), runs npm run test:mutation:task on them and classifies every Survived or NoCoverage mutant in the changed lines as a gap (observable behavior change: needs a test), equivalent (indistinguishable from the original, with a reason) or message/log (text with no contract). Security logic (auth, organizations, roles, guards, sign-up) may have no gaps. It then runs npm run test:mutation:gate and a checklist, and returns OK or back to the test writer with the list of gaps.6
Fix and repeat
On “back to tester”,
test-writer adds tests that kill the reported mutants and the review repeats. The phase file must be gone, because the hook blocks every agent, the tester included.7
Code review and pull request
Test review comes before code review. Proposed gate exceptions go into the pull request for a human to approve.
critical list, run npm run test:mutation:task -- <files> and npm run test:mutation:gate yourself; CI does not run mutations automatically.
Testing rules
For example, an invitation’s expiry is checked against a literal date, not
now + 48 * 60 * 60 * 1000:
src/features/users/services/commands/__tests__/invite-user-command.test.ts
The implementation phase and the protect-tests hook
.claude/settings.json registers both hooks as PreToolUse for the Edit|Write tools:
.claude/settings.json
npm run verify (npm run test:hooks).
protect-tests.mjs blocks an edit when .superpowers/phase contains exactly implement (after trimming whitespace) and the path matches:
.claude/hooks/protect-tests.mjs
__tests__/ or e2e/ directory at any depth and every *.test.* or *.spec.* JavaScript or TypeScript file. The agent sees:
.git entry, so a git worktree has its own phase) and the session’s project directory ($CLAUDE_PROJECT_DIR). Write the phase file in the implementer’s worktree, not the main checkout: a file in the main checkout blocks test edits in every Claude Code session for that repository. .superpowers/ is in .gitignore.
What the hook does not block:
Committing the tests before the implementation makes the review easy:
The block-comments hook
Project code has no comments: names should explain the code.block-comments.mjs rejects an edit that adds a comment line to a .ts, .tsx, .js, .jsx, .mjs, .cjs, .mts or .cts file, with Blocked: this edit adds code comments. The code must explain itself. It allows // WHY: … (at most 3 lines) for a non-obvious reason the code can’t show, and tool directives (@ts-expect-error, eslint-disable…, @vitest-environment, prettier-ignore, shebangs). Comments that only moved are not flagged, and paths under node_modules, generated and components/ui are exempt. ESLint has no such rule, so comments written through the shell or another editor are caught only in review.
Mutation testing
Stryker makes mutants of your code and, for each one, runs the tests that cover the changed line. It works on a copy in.stryker-tmp/, so your files don’t change. Typical mutators: ConditionalExpression (condition replaced by a constant), EqualityOperator (> → >=), StringLiteral (string emptied), ObjectLiteral (object replaced by {}), BooleanLiteral (true ↔ false).
Mutation score = (
Killed + Timeout) / (Killed + Timeout + Survived + NoCoverage).
Two configurations
Components and pages are not mutated: business logic belongs in
services/. A score below break sets exit code 1. AGENTS.md forbids lowering the threshold to let a change through.
Running it on a task
1
Make sure no other Stryker is running
pgrep -fl stryker should print nothing. Two runs at once overwrite each other’s reports, share the test database (which inflates scores) and compete for CPU (timeouts count as detected).2
Run it on the task's files
--force retests every mutant even when incremental results exist.3
Read your files' rows
With an incremental file (
reports/stryker-incremental.json), the final score covers the whole project; look at your files’ rows in the terminal table or in reports/mutation/mutation.html, which also shows each mutant’s code. Without it, the report covers only your files and break applies to them alone.4
Run the integration config if needed
Files also mutated by the integration config show mutants only integration tests can kill as undetected. Run
npm run test:mutation:integration (with INTEGRATION_DATABASE_URL if needed) so the gate can merge both reports.5
Run the gate
npm run test:mutation:gate.test.prop) use a fixed seed under Stryker (set in vitest.setup.ts when STRYKER_MUTATOR_WORKER is present), because Stryker selects tests by name and fast-check puts the seed in the name. Normal npm test runs draw a new seed every time.
To exclude a file from mutation, add a ! pattern to mutate. A // Stryker disable comment would be blocked by the comments hook.
The mutation gate
Thebreak threshold applies to the whole score, so it lets individual gaps through. In auth, organization, user and kit module services, any gap is a potential security bug. The gate (npm run test:mutation:gate) therefore checks critical files one by one: every undetected mutant must be killed by a test or have an approved exception.
mutation-gate.json has two lists. critical holds path prefixes:
mutation-gate.json
allowed holds exceptions with five fields: file, mutator, original (the exact code the mutant changes, with indentation and newlines), replacement and a non-empty reason. Three kinds of reason are accepted: an equivalent mutant, message or log text only, or a deliberate configuration constant. Your own critical code can be added to the critical list.
How the gate decides:
- It reads
reports/mutation/mutation.jsonandreports/mutation-integration/mutation.json(or the paths you pass). With no report, it fails. - It merges the reports: a mutant detected in either one counts as detected.
- An exception with an empty
reasonis a violation. - Every
SurvivedorNoCoveragemutant in a critical file without a matching exception is a violation. Matching is by file, mutator, original and replacement, not by line number, so exceptions survive code moving around (but one exception also covers identical mutants added later). - An exception for a file in the report that matches no mutant is stale and also fails the gate.
original and replacement exactly from the gate’s message. A stale exception means the mutant is now killed or the code changed: delete or update it.
Agent instructions
AGENTS.md holds the full rules; CLAUDE.md repeats the ones that cost the most when broken (the organizationId filter and guards, the service-mode confirmation, no comments, generated files, tests before code, the verify gate) and imports AGENTS.md with @AGENTS.md. Claude Code reads only CLAUDE.md when both exist, so the import gives it the full rules while other tools read AGENTS.md directly. One source of truth means a rule change lands in one place.
AGENTS.md opens with a task router: a table from “task” to “where to look”, so an agent starts from its row instead of searching the whole file. Paths to docs/… in it refer to the GatoJS repository, because docs/ is not copied into projects. Size matters: Codex silently truncates instructions above 32 KiB.
Permissions
permissions.allow in .claude/settings.json lists commands Claude Code runs without asking: npm run verify, npm run lint, npm run typecheck, npx tsc --noEmit, npm test, npm run test, npm run test:hooks, npm run test:mutation:gate, npm run wa -- generate and read-only git status, git diff, git log and git show.
Test commands are allowed only as exact strings. A wildcard like Bash(npm test *) would also allow npm test -- -c vitest.integration.config.ts, which truncates the _test database. For the same reason integration, e2e and mutation commands are not on the list, nor are migrations, installs, rm, git push or Docker. Put your own rules in .claude/settings.local.json, not in the kit’s settings.json.
Project skills
A skill is a folder.claude/skills/<name>/ with a SKILL.md. Claude Code loads it when a task matches its description, or on /<name>. Other tools reach the same files through links in the task router.
Code review does not depend on any external bot:
wa-code-review is the checklist.
Architecture tests keep the instructions honest
Instructions rot when the code moves on. The tests insrc/__tests__/architecture/ check what neither TypeScript nor ESLint can, and they run in npm test, so in every npm run verify:
Separately,
src/__tests__/server-entrypoints-guard.test.ts checks that every server entry point (server actions, queries, route handlers) calls a guard before Prisma. See Code patterns.
A failing architecture test names the file and the value, for example CLAUDE.md: npm run nope. Fix the file, not the test.
Pitfalls when working with agents
npm run test:e2estarted by an agent stops at the database reset, because Prisma refuses it without your consent. Run e2e tests yourself. See Testing.- A leftover phase file blocks test edits for everyone. Delete
.superpowers/phase. - Hooks only see
EditandWrite. Shell writes, other AI tools and your editor bypass them; review the diff. - Hooks run from the session’s project directory. A Claude Code session started in the main checkout uses the main checkout’s hook versions, even while working in a worktree.