Implements a strict Red-Green-Refactor loop to ensure zero production code is written without a prior failing test. Use when: creating new features, fixing bugs, or expanding test coverage.
Never mock: Fast internal services (<200ms), pure domain logic.
See Test Runner Reference for environment-specific commands.
Step 4: Principles & Mocks
Watch it Fail: Prove test works before writing code.
Minimalism: Don't add features/options beyond current test (YAGNI).
Isolation: Mock external APIs (HTTP) and Time.
Realism: Prefer real DBs (test containers) and fast internal services (<200ms).
Rationalization Prevention
"Too small to test": Small code still regresses. Write the test.
"Manual testing is enough": Manual checks do not prove the RED step.
"Keep code as reference": Pre-test code biases the implementation. Delete it.
"Tests after are equivalent": Passing immediately proves little.
Verification Checklist
[ ] Every new function/method failing test first?
[ ] Failure message expected?
[ ] Minimal code implemented passed?
[ ] AAA structure followed?
[ ] Coverage thresholds met?
Expert References
AAA Example
AAA Methodology
Test Runners
TDD Patterns
Testing Anti-Patterns
Anti-Patterns
No test-after: Writing tests post-implementation defeats TDD. Delete and restart.
No assertion-free tests: test without assert not test.
No testing implementation: Test behavior and contracts, not internal calls.
A passing test alone is not enough: the failing test must demonstrate missing behavior before implementation.
How to use it
Copy the folder
Take hoangnguyen0403/agent-skills-standard-common-common-tdd from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
Check the name does not clash
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.