agent-briefing
Use when writing a prompt for a subagent or teammate, deciding how much context another agent needs, writing or reading a handoff…
Use when implementing a feature, fixing a bug, refactoring, or changing behaviour in any codebase, before writing the production code that does it.
Claude Code
$ npx -y skills add NoobyGains/godmode --skill test-first --agent claude-code
Codex
$ npx skills add NoobyGains/godmode --skill test-first -a codex -y
Cursor
$ npx skills add NoobyGains/godmode --skill test-first -a cursor -y
Gemini CLI
$ npx skills add NoobyGains/godmode --skill test-first -a gemini-cli -y
GitHub Copilot
$ npx skills add NoobyGains/godmode --skill test-first -a github-copilot -y
OpenCode
$ npx skills add NoobyGains/godmode --skill test-first -a opencode -y
Windsurf
$ npx skills add NoobyGains/godmode --skill test-first -a windsurf -y
name: test-first description: "Use when implementing a feature, fixing a bug, refactoring, or changing behaviour in any codebase, before writing the production code that does it."
Every change in behaviour starts as a test that fails for the right reason. You write the test, run it, watch it fail, write the least code that makes it pass, and only then clean up. **A test you never saw fail is a test you have no evidence for.**
NO PRODUCTION CODE WITHOUT A FAILING TEST THAT YOU WATCHED FAIL
No exceptions. No workarounds. No shortcuts.
Production code written before its test is deleted, not kept "for reference" and not adapted while the test is written. Delete it and build it again from the test.
**Required:**
**Skip (only with the user's agreement, stated in the conversation):**
digraph test_first {
rankdir=LR;
red [label="RED\nwrite one failing test", shape=box];
red_ok [label="fails for the\nexpected reason?", shape=diamond];
green [label="GREEN\nleast code to pass", shape=box];
green_ok [label="this test and\nall others pass?", shape=diamond];
refactor [label="REFACTOR\nclean, stay green", shape=box];
next [label="next behaviour", shape=ellipse];
red -> red_ok;
red_ok -> green [label="yes"];
red_ok -> red [label="no: fix the test"];
green -> green_ok;
green_ok -> refactor [label="yes"];
green_ok -> green [label="no: fix the code"];
refactor -> green_ok [label="after each edit"];
refactor -> next;
next -> red;
}1. **Name the behaviour.** Write one sentence: "When X, the code does Y." If you cannot write it, you do not yet know what to build; go back to the plan or ask the user one question.
2. **Name the break.** Before writing the test body, name the production mistake that would make this test fail (a wrong branch, a missing side effect, an off-by-one, an unhandled error). A test that no realistic bug can fail is not worth writing.
3. **RED: write one test.** One behaviour per test, a name that reads as the behaviour, real code wherever possible. Derive the expected value by hand (a literal or a hand-checked fixture), never by calling the code under test.
4. **Watch it fail.** Run only that test (`npm test -- path/to/file`, `pytest path::test_name`, `go test -run Name ./pkg`). Read the output and confirm three things:
If it passes, you are testing behaviour that already exists, or the test cannot fail; rewrite it. If it errors, fix the error and run it again until it fails cleanly. Keep the failing output: it is the evidence for this step.
5. **GREEN: write the least code that passes.** Hard-code if that is the least code; the next test will force the generalisation. No options, parameters or abstractions the tests do not demand. No "while I am here" edits elsewhere.
6. **Watch it pass.** Run the test, then the whole suite. The new test passes, every other test still passes, and the output carries no new warnings. If the new test fails, fix the code, not the test. If another test broke, fix that now, before anything else.
7. **REFACTOR.** Only on green. Remove duplication, improve names, extract helpers. Run the suite after every edit. Refactoring adds no behaviour; a new behaviour needs a new failing test.
8. **Repeat** from step 1 for the next behaviour. Commit at green points so every commit has passing tests. For a bug fix, commit the reproducing test on its own first (`test: reproduce <bug>`), then the fix (`fix: ...`): the red evidence then survives in history, and a reviewer can check out the first commit and watch it fail.
A bug report is a test you have not written yet.
1. Write a test that reproduces the reported symptom through the same entry point the user hit. 2. Watch it fail with the symptom the user described. If it passes, your reproduction is wrong; keep working on the test, not the fix. 3. Find the root cause with `godmode:fault-diagnosis` before you change production code. 4. Fix at the root cause, watch the test pass, run the suite. 5. Prove the test guards the fix: revert the fix, watch the test fail again, restore the fix, watch it pass. This red-green-red-green loop is what `godmode:completion-gate` asks for when you claim a regression test works.
| Quality | Good | Bad | |---|---|---| | One behaviour | `rejects an empty email` | `validates email and domain and whitespace` | | Behaviour, not implementation | Asserts the returned value, the stored row, the emitted event | Asserts which private helper was called | | Independent expectation | `expect(slug('A B')).toBe('a-b')` | `expect(slug(x)).toBe(slug(x))` | | Real collaborators | Uses the real parser and an in-memory store | Mocks every collaborator, then asserts on the mocks | | Deterministic | Waits for the condition it needs | Sleeps for a guessed number of milliseconds | | Readable failure | The failure message says what was expected | `expected true, got false` |
Before adding a mock, a test helper or a cleanup method, rea
Engineering discipline for AI coding agents: question the request, verify against current docs, plan, build test-first on the cheapest capable model, review with a second model family, prove it before saying done. One repo for Claude Code, Codex, Antigravity, Cursor, Gemini CLI and OpenCode.
Use when writing a prompt for a subagent or teammate, deciding how much context another agent needs, writing or reading a handoff…
Use when a task, feature or bug fix is implemented and before it is committed, merged or handed back to the user, and when the…
Use when about to add or change code in an existing codebase: a new file, module, route, component, service, test, migration,…
Use when about to say that work is done, fixed, passing, working, deployed or ready, before committing, opening or merging a pull…
Use when a reviewed change is about to land on a shared branch, be released or be deployed, and when the user asks for a second…
Use when a written implementation plan is ready to execute in the current session and its tasks are mostly independent, so each…
Use your assigned AgentMail inbox to read email tasks, explicitly send or reply, and check delivery. Provided automatically by…
Create a new Architecture Decision Record with sequential numbering and AgentDB registration