ravila4/test-driven-development
(TDD) Use when implementing any feature or bugfix. Apply the Logic Gate to identify what needs tests, then use the Iron Rule for strict test-first development on logic.
npx skills add https://github.com/ravila4/claude-adhd-skills --skill test-driven-development
Before writing any code, pass it through two gates:
flowchart TD
A[New code to write] --> B[Decompose into pieces]
B --> C{{"Logic Gate: Does this piece contain logic?"}}
C -->|"Conditionals, transformations, validation, state changes, error handling"| D["Iron Rule: TDD"]
C -->|"Dataclasses, config, thin wrappers, type aliases, formatting"| E[Write directly]
D --> F["RED: Write failing test"]
F --> G["GREEN: Minimal implementation"]
G --> H["REFACTOR: Clean up"]
H --> I{More pieces?}
E --> I
I -->|Yes| C
I -->|No| J[Done]
Decompose the work into its constituent pieces. For each piece, ask: does this contain logic?
Passes the Logic Gate (requires TDD):
Does NOT pass the Logic Gate (write directly):
__init__.py, module-level setup)When in doubt: If you can't point to a conditional, transformation, or state change, it probably doesn't pass the Logic Gate.
Before writing code, briefly identify what passes and what doesn't:
For code that passes the Logic Gate: never write logic without a preceding failing test.
If logic is written before its test:
Write a single minimal test demonstrating intended behavior:
Run tests and confirm:
Write the simplest possible code satisfying the test:
Confirm:
Improve code quality while maintaining green status:
Minimal: Single responsibility per test
Clear: Descriptive name revealing behavior
Realistic: Demonstrate intended API usage
Focused: One assertion per test (generally)
"I'll test afterward"
"Manual testing covered edge cases"
"Tests-after achieve identical goals"
Before considering work complete:
Bug found? Write failing test reproducing it. Follow TDD cycle. Test proves fix and prevents regression.
Never fix bugs without a test.
Take ravila4/test-driven-development from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.