一键导入
test-driven-development
Use when implementing any feature or bugfix, before writing implementation code — enforces RED-GREEN-REFACTOR cycle
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when implementing any feature or bugfix, before writing implementation code — enforces RED-GREEN-REFACTOR cycle
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Perform a strict, full-coverage pull-request review against its issue, repository architecture, tests, security, and current target branch; supports an operator-authorized CI-free source-review profile.
Use when starting feature work that needs isolation from current workspace — creates isolated git worktrees with safety verification
Audit and clean up Git worktrees first, then safely tidy branches using required Hephaestus automation. Uses Athena's canonical dependency-resolution contract and fails if ~/.agent_brain/automation cannot be prepared. Worktree mutation always needs separate per-gate approval.
Investigate root cause before fixing bugs or unexpected behavior. Requires the Mnemosyne knowledge backend through advise and fails closed when it cannot be prepared.
Perform a full-coverage, strict repository evaluation. Supports quick and default report detail; default is the comprehensive strict review.
Search the required Mnemosyne knowledge repository before planning or implementation. Uses Athena's canonical dependency-resolution contract and fails if the backend cannot be prepared at ~/.agent_brain/knowledge.
| name | test-driven-development |
| description | Use when implementing any feature or bugfix, before writing implementation code — enforces RED-GREEN-REFACTOR cycle |
| argument-hint | <feature or bugfix description> |
| allowed-tools | ["Read","Write","Edit","Bash","Grep","Glob"] |
Write the test first. Watch it fail. Write minimal code to pass.
Core principle: If you didn't watch the test fail, you don't know if it tests the right thing.
Violating the letter of the rules is violating the spirit of the rules.
Always:
Exceptions (ask your human partner):
Integration with myrmidon-swarm: apply this cycle to each test sub-task. A specialist writes failing tests before an executor writes implementation.
Thinking "skip TDD just this once"? Stop. That's rationalization.
NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST
Write code before the test? Remove only the newly written, in-scope implementation you authored for this task, then start over. If its provenance or scope is unclear, preserve it and request human direction.
No exceptions:
Implement fresh from tests. Period.
Write one minimal test showing what should happen.
Requirements:
MANDATORY. Never skip.
Discover the target repository's focused test command from its guidance, task runner, manifests,
lockfiles, and required CI, then run <repository-focused-test-command>.
Confirm:
Test passes? You're testing existing behavior. Fix the test.
Test errors? Fix the error, re-run until it fails correctly.
Do not invent production code or a test harness to force a RED phase for documentation-only work. Use existing markdown lint and link validation for syntax and navigation. A link checker may prove a target resolves; a text assertion must not dictate what the documentation says.
Write the simplest code to pass the test. No more.
Don't add features, refactor other code, or "improve" beyond what the test demands.
MANDATORY.
Run the repository's discovered full relevant suite: <repository-test-command>.
Confirm:
Test fails? Fix code, not test.
Other tests fail? Fix now before continuing.
After green only:
Keep tests green throughout. Don't add behavior.
Next failing test for next behavior.
Discover commands from AGENTS.md, task runners, manifests, lockfiles, and required CI. Prefer the
same entry points CI uses. Record the focused test, relevant suite, coverage, typing, and lint
commands when applicable. If repository sources conflict or no safe command is discoverable, ask
the user; never substitute another repository's commands into an unrelated target.
| Quality | Good | Bad |
|---|---|---|
| Minimal | One thing. "and" in name? Split it. | test('validates email and domain and whitespace') |
| Clear | Name describes behavior | test_1 |
| Shows intent | Demonstrates desired API | Obscures what code should do |
| Excuse | Reality |
|---|---|
| "Too simple to test" | Simple code breaks. Test takes 30 seconds. |
| "I'll test after" | Tests passing immediately prove nothing. |
| "Tests after achieve same goals" | Tests-after = "what does this do?" Tests-first = "what should this do?" |
| "Already manually tested" | Ad-hoc ≠ systematic. No record, can't re-run. |
| "Deleting X hours is wasteful" | Sunk cost fallacy. Keeping unverified code is technical debt. |
| "Keep as reference, write tests first" | You'll adapt it. That's testing after. Delete means delete. |
| "Need to explore first" | Fine. Throw away exploration, start with TDD. |
All of these mean: Delete code. Start over with TDD.
Before marking work complete:
Can't check all boxes? You skipped TDD. Start over.
Verify with fresh runnable evidence per the evidence-integrity policy before claiming work
complete; a prior run or implementation diff is not evidence of the current state.
Run learn when the session produced a durable testing lesson; it must publish through a PR.
Adapted from obra/superpowers under the MIT License. Copyright (c) 2025 Jesse Vincent.