Agent skill · software engineering · nousresearch
test-driven-development
TDD: enforce RED-GREEN-REFACTOR, tests before code.
Why this skill is useful
Codifies a strict TDD process that the AI could infer but now has a clear standard to follow.
What it needs
About 6k tokens when loaded. Last updated 2026-08-07. 226,679 stars on the source repository.
What this skill does
Test-Driven Development (TDD) Overview Write the test first. Watch it fail. Write minimal code to pass. Core principle: If you didn't watch the test fail, you don't know if it tests the right thing. Violating the letter of the rules is violating the spirit of the rules. When to Use Always: New features Bug fixes Refactoring Behavior changes Exceptions (ask the user first): Throwaway prototypes Generated code Configuration files Thinking "skip TDD just this once"? Stop. That's rationalization. The Iron Law Write code before the test? Delete it. Start over. No exceptions: Don't keep it as "reference" Don't "adapt" it while writing tests Don't look at it Delete means delete Implement fresh from tests. Period. Red-Green-Refactor Cycle RED — Write Failing Test Write one minimal test showing what should happen. Good test: Clear name, tests real behavior, one thing. Bad test: Vague name, tests mock not real code. Requirements: One behavior per test Clear descriptive name ("and" in name? Split it) Real code, not mocks (unless truly unavoidable) Name describes behavior, not implementation Verify RED — Watch It Fail MANDATORY. Never skip. Confirm: Test fails (not errors from typos) Failure message is expected Fails because the feature is missing Test passes immediately? You're testing existing behavior. Fix the test. Test errors? Fix the error, re-run until it fails correctly. GREEN — Minimal Code Write the simplest code to pass the test. Nothing more. Good: Bad: Don't add features, refactor other code, or "improve" beyond the test. Cheating is OK in GREEN: Hardcode return values Copy-paste Duplicate code Skip edge cases We'll fix it in REFACTOR. Verify GREEN — Watch It Pass MANDATORY. Confirm: Test passes Other tests still pass Output pristine (no errors, warnings) Test fails? Fix the code, not the test. Other tests fail? Fix regressions now. …
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills nousresearch/test-driven-development