test-driven-development
/test-driven-development
Use when implementing a feature or fixing a bug test-first: write a failing test, make it pass with the minimum code, then refactor. Covers the red-green-refactor loop, what is worth testing, and the common pitfalls that make TDD backfire.
- Author
- alisinadevelo ↗
- Repository
- md-files ↗
- Licence
- MIT
- Last repository change
- 03.10.2026
Assessment and security
- Files in this package
- 1
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 03.10.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
Use when implementing a feature or fixing a bug test-first: write a failing test, make it pass with the minimum code, then refactor. Covers the red-green-refactor loop, what is worth testing, and the common pitfalls that make TDD backfire.
Original author description
Use when implementing a feature or fixing a bug test-first: write a failing test, make it pass with the minimum code, then refactor. Covers the red-green-refactor loop, what is worth testing, and the common pitfalls that make TDD backfire.
How it works
- The loop: Red → Green → Refactor
- Bug fixing with TDD
- What to test
- Pitfalls
- When strict TDD doesn't fit
SKILL.md preview
--- name: test-driven-development description: >- Use when implementing a feature or fixing a bug test-first: write a failing test, make it pass with the minimum code, then refactor. Covers the red-green-refactor loop, what is worth testing, and the common pitfalls that make TDD backfire. --- # Test-Driven Development Write the test before the code. The test specifies the behavior; the code satisfies it. This keeps the design testable, catches regressions immediately, and produces a suite that documents intent. ## The loop: Red → Green → Refactor 1. **Red.** Write one small test for the next increment of behavior. Run it. It must fail — and fail for the *right reason* (the behavior is missing, not a typo). A test that passes before you write the code tests nothing. 2. **Green.** Write the minimum code to make it pass. Resist building beyond the test. Ugly-but-correct is fine here. 3. **Refactor.** With the test green as a safety net, clean up — names, duplication, structure. Re-run; stay green. Refactor the test too if it got messy. Keep the steps small. A cycle should be minutes, not an afternoon. Commit at green. ## Bug fixing with TDD Reproduce the bug as a failing test *first*. It pins the defect, proves the fix works, and prevents regression. If you can't write a test that fails on the current code, you don't yet understand the bug — go investigate before fixing. ## What to test - The contract: inputs → outputs and side effects, not internal mechanics. - Boundaries: 0, 1, n, max, empty, null, overflow. - Failure paths: invalid input, downstream errors, partial failure. - The specific behavior this change introduces. ## Pitfalls - **Testing implementation, not behavior** → tests break on every refactor and stop catching real bugs. Assert observable results. - **Tests that can't fail** → no negative-control; verify the test fails before you make it pass. - **Over-mocking** → a test of mocks proving mocks were called. Mock only at real boundaries (network, clock, filesystem). - **Skipping refactor** → green-and-move-on accrues mess. The third step isn't optional. - **Giant tests** → many reasons to fail. One behavior per test. ## When strict TDD doesn't fit Exploratory spikes, throwaway prototypes, and hard-to-test legacy edges may warrant test-after or characterization tests instead. Be deliberate about the exception rather than abandoning the discipline by default.
Versions
| Repository | Score | Licence |
|---|---|---|
| This page · alisinadevelo/md-files | 90 | MIT |
| GanyuanRan/Aegis | 100 | MIT |
| lucasouzadev/agent-kit-skill | 100 | MIT |
| zeative/satgas | 100 | AGPL-3.0 |
| nikospavlopoulos/devops-mutant-powers | 100 | MIT |
| JohnStrunk/CommonCast | 100 | LGPL |
| Sanit-mann/The-Insectoids | 100 | MIT |
| mastro993/fstack | 100 | MIT |
| jelvodev/yaap | 100 | MIT |
Database snapshot: 13.11.2026 · package version f3741acb847b (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100tdd
Test-driven development. Use when building a feature or fixing a bug test-first, when the user asks for red-green-refactor, or when a change needs its tests written before its implementation. - 100red-green-refactor
Guides the red-green-refactor TDD workflow: write a failing test first, implement the minimum code to make it pass, then refactor while keeping tests green. Use when a user asks to practice TDD, write tests first, follow red-green-refactor, do test-driven development, write… - 100tdd
Test-Driven Development facilitation using the red-green-refactor cycle. Guides users through writing tests first, implementing minimal code to pass, and refactoring for quality. Use when users want to practice TDD, need help writing tests before code, are developing new… - 90tdd-red-green-refactor
Drive a change with test-driven development in short red-green-refactor cycles, with Claude as a disciplined pair: write one failing test, the minimum code to pass, refactor with tests green, repeat; keeps a visible test list. Use when implementing new logic, fixing a bug the… - 100tdd
Test-driven development with red-green-refactor loop. Use when user wants to build features or fix bugs using TDD, mentions "red-green-refactor", wants integration tests, or asks for test-first development. - 100tdd
Test-driven development with red-green-refactor loop. Use when user wants to build features or fix bugs using TDD, mentions "red-green-refactor", wants integration tests, or asks for test-first development.