test-driven-development
When implementing logic changes during develop-feature or implement-task. Use the Red-Green-Refactor cycle to write a failing test before any production code.
- License 许可
- MIT
- 最近更新
- 2026-11-07
- Stars
- ★ 13
- Forks
- 3
01 前言 Front Matter
- name
- test-driven-development
- license
- MIT
- description
- When implementing logic changes during develop-feature or implement-task. Use the Red-Green-Refactor cycle to write a failing test before any production code.
03 SKILL.md 正文
Test-Driven Development Skill
Cycle: RED → GREEN → REFACTOR
Highly recommended during any logic implementation. Do not write production code before a failing test exists.
RED Phase — Write a Failing Test
- Identify the smallest unit of behavior to implement next.
- Write a test that asserts the expected output or behavior.
- Run the test. Confirm it fails.
- If it passes before any implementation, the test is wrong — fix it.
- Record:
[RED] <test name> — fails as expected
GREEN Phase — Minimum Code to Pass
- Write the minimum production code to make the test pass.
- No premature abstractions. No extra features. Bare minimum only.
- Run the test. Confirm it passes.
- Record:
[GREEN] <test name> — passes
- Record:
REFACTOR Phase — Clean Without Changing Behavior
- Refactor implementation if needed (remove duplication, improve names, simplify).
- Run the full test suite. All tests must still pass.
- Record:
[REFACTOR] <test name> — clean, all pass
- Record:
Rules
- Never skip RED. A test that was never failing proves nothing.
- Refactor only when GREEN — never while RED.
- One cycle = one behavior unit. Do not batch multiple behaviors into one RED-GREEN.
- Note failing test evidence in RESUME.md before moving to the next unit.
Exemptions
Skip this cycle only for: trivial config/boilerplate, pure UI layout with no logic, or when the user explicitly opts out. Document the exemption reason.
Gate: Do not write production code for a behavior unit without first having a failing test for that unit.
04 同仓库更多 Skills
setup-project
When setting up agentskel on a new project that does not yet have .memory/ or .agents/. Use when the user says "set up agentskel", "install agentskel", or "add agent memory to this project".
using-git-worktrees
When running long feature implementations, parallel branch work, or build/test scripts that must not interfere with the user's active working directory. Creates isolated execution environments via git worktrees in sibling directories.
test-engineer
When designing test strategy, analysing coverage, or writing tests outside the TDD cycle. Also use when working with CI pipelines or validating changes end-to-end.
test-driven-development
When implementing logic changes during develop-feature or implement-task. Use the Red-Green-Refactor cycle to write a failing test before any production code.
task-planner
When decomposing a feature or spec into implementable subtasks, estimating scope, or orchestrating multi-step work across subagents.
systematic-debugger
When applying debugging techniques during any investigation — root cause tracing, bisect, defense-in-depth. Enforces hypothesis-first analysis and prohibits guess-and-check changes. Use standalone or inside the debug-issue workflow.