project-template/.claude/skills/tdd-enforced/SKILL.md
Enforce strict Test-Driven Development (RED-GREEN-REFACTOR) during implementation. Injected into teammate prompts to ensure no production code is written without a failing test first. Includes anti-rationalization table and red flags.
npx skillsauth add adrien-barret/claude-kit tdd-enforcedInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Rule: NO production code without a failing test FIRST. Code written before a test exists must be deleted and restarted. No exceptions for code stories.
For each behavior to implement:
RED — Write ONE minimal test for ONE specific behavior
GREEN — Write the MINIMUM code to make the test pass
REFACTOR — Clean up ONLY after green
REPEAT — Next behavior, next failing test
You MUST run the test suite after each step:
If you skip verification, the cycle is broken. Start over.
| Excuse | Response | |--------|----------| | "This is too simple to test" | Simple code breaks. The test takes 30 seconds to write. | | "I'll add the test after" | Tests written after code prove nothing — they're designed to pass. | | "TDD will slow me down" | TDD is faster than debugging. The test IS the specification. | | "I just need to try something first" | Try it IN a test. Write the test as an experiment. | | "The framework handles this" | Frameworks have bugs. Test YOUR usage of the framework. | | "It's just a config change" | Config changes break things. If it can break, test it. | | "I know this works" | Prove it. Write the test. | | "The test is obvious" | Then it takes 10 seconds to write. Do it. | | "I need to see the structure first" | The test IS the structure. Let the test drive the design. | | "This is just refactoring" | Refactoring requires green tests BEFORE you start changing code. | | "It's a one-liner" | One-liners have the highest bug-per-line ratio. Test it. | | "I'll test the integration instead" | Integration tests are slow and coarse. Unit test first, integrate second. |
TDD is optional for these story types (classified in the implementation plan):
For everything else: RED-GREEN-REFACTOR, no exceptions.
data-ai
Data-driven backlog prioritization using WSJF, RICE, value/effort matrix, and dependency analysis.
development
Build a traceability matrix from BMAD artifacts (problem.md, backlog.md, user-journey.md). Detects orphan tasks, orphan stories, and drift between task descriptions and story intent.
development
Generate unit and integration tests for project code. Use when new code is written or test coverage needs improvement.
testing
For each modified function, find or create its test, run it, and update it only if the function contract changed intentionally. Never silently adjust tests to make failures disappear.