Use when implementing any feature or bugfix, before writing implementation code - write the test first using REAL systems (NO MOCKS), watch it fail, write minimal code to pass; ensures tests actually verify behavior by requiring failure first and real system integration
View on GitHubkrzemienski/shannon-framework
shannon
January 21, 2026
Select agents to install to:
npx add-skill https://github.com/krzemienski/shannon-framework/blob/main/skills/test-driven-development/SKILL.md -a claude-code --skill test-driven-developmentInstallation paths:
.claude/skills/test-driven-development/# Test-Driven Development (TDD)
## Overview
Write the test first using REAL systems. Watch it fail. Write minimal code to pass.
**Core principle**: If you didn't watch the test fail against a real system, you don't know if it tests the right thing.
**Violating the letter of the rules is violating the spirit of the rules.**
## Shannon Enhancement: NO MOCKS
**This is NOT optional**. Shannon TDD combines:
1. Superpowers TDD discipline (RED-GREEN-REFACTOR)
2. Shannon NO MOCKS philosophy (real systems only)
**Result**: Tests that actually prove software works in production.
## When to Use
**Always**:
- New features
- Bug fixes
- Refactoring
- Behavior changes
**Exceptions (ask your human partner)**:
- Throwaway prototypes
- Generated code
- Configuration files
Thinking "skip TDD just this once"? Stop. That's rationalization.
## The Iron Law
```
NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST
NO MOCKS IN TESTS (Shannon requirement)
```
Write code before the test? Delete it. Start over.
Use mocks in tests? Delete them. Use real systems.
**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
```dot
digraph tdd_cycle {
rankdir=LR;
red [label="RED\nWrite failing test\n(REAL systems)", shape=box, style=filled, fillcolor="#ffcccc"];
verify_red [label="Verify fails\ncorrectly", shape=diamond];
green [label="GREEN\nMinimal code", shape=box, style=filled, fillcolor="#ccffcc"];
verify_green [label="Verify passes\nAll green", shape=diamond];
refactor [label="REFACTOR\nClean up", shape=box, style=filled, fillcolor="#ccccff"];
verify_mocks [label="NO MOCKS\ncheck", shape=diamond, style=filled, fillcolor="#ffffcc"];
next [label="Next", shape=ellipse];
red -> verify_mocks;
verify_mocks -> verify_red [label="no mocks"];
verify_mocks -> red [label="MOCKS\nFOUND"];
verify_red -> green [label=