Use when implementing any feature or bugfix, in any language or framework, before writing implementation code — write the test first, watch it fail, then write minimal code to pass. Covers the red-green-refactor loop, test-quality principles, rationalization counters, and test-layer selection.
Collected from public GitHub. Every version is saved exactly as it was and never changes. Install it at an exact version with the mdr tool, and every file is checked before it reaches your agent. The main file is checked against the SHA-256 fingerprint recorded here, and the others against the fingerprints GitHub keeps for its source commit. The automatic checks below grade the latest version, and the same checks always give the same file the same grade.
What the file says
# 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.**
This skill is language-agnostic. Wherever it says "test runner", use your stack's tool (Jest, pytest, RSpec, go test, JUnit, cargo test, …). Wherever it shows pseudocode, translate to your language's testing idiom.
## When to Use
**Always:**
- New features
- Bug fixes
- Refactoring
- Behavior changes
**Exceptions (ask your human partner):**
- Throwaway prototypes
- Generated code (scaffolds you immediately rewrite)
- Configuration files
Thinking "skip TDD just this once"? Stop. That's rationalization.
## The Iron Law
```
NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST
```
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 the tests. Period.
## Red-Green-Refactor
```dot
digraph tdd_cycle {
rankdir=LR;
…
The line at the top of this page pins the label git:20260731.4cba6d1, which is what most people want. This one pins the sha256 fingerprint of the contents instead, so it survives a label being moved. Either way the exact version is written to mdr.lock, and mdr install downloads and checks those contents again, so it installs them exactly or stops with an error.
GET https://markdownregistry.com/api/v1/artifacts/art_rci2l47cunh4zckg
GET https://markdownregistry.com/api/v1/resolve?ref=endorphin-ai/hasbrains-agent-kit/test-driven-development
GET https://markdownregistry.com/api/v1/blob/a7fe22aa9e69874f723bcec83511e7106943abdf9a43c3f42d53087726973ad9
Your AI assistant does the legwork. You hear about the deals worth your word. Hand yours the standing instructions at modelranch.com and it joins the network that reads files like this one.
endorphin-ai/hasbrains-agent-kit · agent-engineering/skills/convert-to-copilot/SKILL.md · This skill should be used when converting a Claude Code agent (+ its launch command + its skills) into a single GitHub…
endorphin-ai/hasbrains-agent-kit · agent-engineering/skills/docs-project-management/SKILL.md · Universal, project-agnostic playbook for managing an ENTIRE project inside the repo's docs/ folder — the docs/-native…
endorphin-ai/hasbrains-agent-kit · agent-engineering/skills/four-principles/SKILL.md · Four always-on engineering principles for ALL work before, during, and after coding — Think Before Coding (surface…
endorphin-ai/hasbrains-agent-kit · agent-engineering/skills/pm/SKILL.md · Universal, project-agnostic PRODUCT MANAGER playbook — the scope-disciplined PM that plans a project, gates its launch…
endorphin-ai/hasbrains-agent-kit · agent-engineering/skills/system-architecture/SKILL.md · Use when designing a system, choosing an architecture pattern, making a technology decision, or doing…
endorphin-ai/hasbrains-agent-kit · agent-engineering/skills/verification-before-completion/SKILL.md · Use when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running…
endorphin-ai/hasbrains-agent-kit · content-creation/skills/soc-media-writer/SKILL.md · Write high-performing social media content engineered around named copywriting frameworks, scroll-stopping hooks, and…
endorphin-ai/hasbrains-agent-kit · context-engineering/skills/build-brain/SKILL.md · Turn a skill or raw data into an AI-optimized "second brain" skill — a lean SKILL.md map backed by atomized, tagged…
endorphin-ai/hasbrains-agent-kit · context-engineering/skills/pipeline-state/SKILL.md · Durable, file-backed pipeline handoff BUS for a whole multi-agent run (the orchestrator + every worker agent). Persists…
endorphin-ai/hasbrains-agent-kit · context-engineering/skills/prompt-expert/SKILL.md · Expert prompt engineer that interviews users and builds high-quality prompts for any AI (Claude, Gemini, Copilot…
endorphin-ai/hasbrains-agent-kit · utils/statusline-kit/skills/setup/SKILL.md · Turn on the statusline-kit status line. Use when the user asks to set up, enable, switch on or fix the status line from…
endorphin-ai/hasbrains-agent-kit · web-dev/skills/designer-frontend-contract/SKILL.md · The universal, tech-agnostic DESIGNER ↔ FRONTEND contract — how the web designer and the frontend dev help each other…
addyosmani/agent-skills · skills/test-driven-development/SKILL.md · Drives development with tests using the red-green-refactor loop. Use when implementing any logic, fixing any bug, or…
mvschwarz/openrig · skills/_canonical/process/test-driven-development/SKILL.md · Use when implementing any feature or bugfix, before writing implementation code
mvschwarz/openrig · packages/daemon/specs/agents/shared/skills/process/test-driven-development/SKILL.md · Use when implementing any feature or bugfix, before writing implementation code
cbrock84/headcount · plugins/technology/skills/test-driven-development/SKILL.md · Drives implementation by writing a failing test first, then the smallest code that passes it. Use this before writing…
a5c-ai/babysitter · library/methodologies/superpowers/skills/test-driven-development/SKILL.md · Use when implementing any feature or bugfix, before writing implementation code. Enforces RED-GREEN-REFACTOR cycle.
a5c-ai/babysitter · library/methodologies/rpikit/skills/test-driven-development/SKILL.md · Test-first development practice where test specifications are written before production code, integrated into plan…