From pxp
Enforces the strict red-green-refactor cycle when implementing features or fixing bugs: write one failing test, minimal code to pass, then refactor.
How this skill is triggered — by the user, by Claude, or both
Slash command
/pxp:test-driven-developmentThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
A disciplined cycle for writing code one behavior at a time: red (failing test) → green (minimal code) → refactor.
A disciplined cycle for writing code one behavior at a time: red (failing test) → green (minimal code) → refactor.
No production code without a failing test first. Not even one line. Not even "I'll just sketch this out." Not even "the test is obvious — I'll add it after."
Write a single test for one behavior. The test should:
Run the test. Confirm it fails for the expected reason.
Write the simplest code that makes the test pass. Resist the urge to add more.
Run the test. Confirm it passes. Run the full suite to check for regressions.
Look at the code you just wrote and the code around it:
If you see an improvement, make it. Re-run tests. If nothing needs refactoring, say so out loud and move on.
| Excuse | Reality |
|---|---|
| "Test is trivial, I'll skip it" | Trivial tests catch real regressions later. Write it. |
| "I already manually tested it" | Manual tests don't run in CI. Write the automated test. |
| "I'll write the test after" | Tests-after asks "what does this do?" Tests-first asks "what should this do?" Different exercises. |
| "Refactor isn't needed here" | Say so explicitly. Don't silently skip Step 5. |
| "I'll batch the refactor at the end" | Refactor with context fresh, not after you've moved on. |
All of these mean: stop, delete the unprotected code, start the cycle properly.
npx claudepluginhub infews/pxp_skillGuides implementation of features and bug fixes using the red-green-refactor TDD cycle: write failing test first, minimal code to pass, then refactor.
Enforces RED-GREEN-REFACTOR TDD cycle: write a failing test first, then minimal code to pass, then refactor. Use when implementing features or fixing bugs during the implement phase.