tdd
Test-Driven Development enforcement with rationalization prevention, verification checklist, and delete-and-restart rule.
Skill by lshtram
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/lshtram-tdd
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: testing
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/tdd
What's inside
- Skill name
tdd- Description
- Test-Driven Development enforcement with rationalization prevention, verification checklist, and delete-and-restart rule.
- License
- MIT
- Instructions
- 253 lines in SKILL.md · view on GitHub
Files (1)
- SKILL.md
SKILL.md (first lines)
# Test-Driven Development (TDD) — Mandatory Skill
**Agent:** Builder (primary), Janitor (verification)
**Phase:** BUILD Phase 3 (Implementation), DEBUG Phase 2 (Fix)
**Priority:** CRITICAL — This skill is NON-NEGOTIABLE
---
## IRON LAW
**NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST.**
This is not a guideline. This is not a suggestion. This is not "when practical."
This is an absolute rule with zero exceptions.
---
## The RED → GREEN → REFACTOR Cycle
```mermaid
graph TD
A[Start: New Requirement or Bug Fix] --> B{Write a Failing Test}
B --> C[RED: Test MUST fail]
C --> D{Test fails?}
D -->|No| E[STOP: Your test is wrong.<br/>Fix the test first.]
D -->|Yes| F[Write MINIMAL production code]
F --> G[GREEN: Run tests]
G --> H{All tests pass?}
H -->|No| I[Fix production code.<br/>Do NOT touch the test.]
I --> G
H -->|Yes| J[REFACTOR: Improve code quality]
J --> K[Run ALL tests again]
K --> L{All tests still pass?}
L -->|No| M[Revert refactor. Try again.]
M --> J
L -->|Yes| N{More requirements?}
N -->|Yes| B
N -->|No| O[Done: Write result.md]
```
### Phase Details
#### RED Phase
1. Write exactly ONE test that describes the behavior you want.
2. Run the test. It MUST fail.
3. If the test passes immediately, you have a problem:
- The feature already exists (check before writing).
- Your test is not testing the right thing.
- You wrote production code first (delete it).
#### GREEN Phase
1. Write the MINIMUM code to make the failing test pass.
2. "Minimum" means: ugly, duplicated, hardcoded — all acceptable at this stage.
3. Do NOT write "clean" code yet. Do NOT refactor. Do NOT add features.
4. Run ALL tests (not just the new one). Every test must pass.
#### REFACTOR Phase
1. Now improve the code: extract functions, remove duplication, improve names.
2. Run ALL tests after EVERY refactor step. If a test fails, REVERT immediately.
3. Refactoring MUST NOT change behavior. Tests prove this.
---
## The Delete-and-Restart Rule
**If you wrote production code before writing the test: DELETE THE PRODUCTION CODE.**
Not "keep it as reference." Not "I'll write the test now." DELETE IT.
Why? Because:
- You will unconsciously shape the test to match the code you already wrote.
- The test becomes a description of your implementation, not a specification of behavior.
- You lose the design benefit of TDD — tests drive the interface, not the other way around.
### What "Delete" Means
- `git checkout -- <file>` or manually remove the code.
- Do NOT keep a copy in comments, clipboard, or another file.
- Start fresh. Write the test. Then write the code to pass it.
---
## Rationalization Table
| What You'll Think | Why It's Wrong |
|---|---|
| "I'll write tests after — same result." | No. You'll unconsciously shape tests to match existing code, missing edge cases and alternative designs. |
| "This is so simple it doesn't need a test." | Simple code in complex systems breaks in complex ways. The test takes 30 seconds. Write it. |
| "I'm just refactoring, not adding features." | Refactoring without tests is hoping. Tests prove behavior is preserved. |
| "The test is obvious — I'll skip straight to code." | If it's obvious, writing it takes 10 seconds. If you skip it, you skip the design thinking. |
| "I need to spike/prototype first." | Spikes are fine. But spike code MUST be deleted before real implementation. Then: test first. |
| "Oracle/contract said to skip tests." | Oracle CANNOT override TDD. No agent can. If the contract contradicts TDD, write `questions.md` and STOP. |
| "I already know exactly what the code looks like." | Knowing what to write ≠ having proof it works. The test IS the proof. |
| "Tests slow me down." | Debugging code without tests slows you down 10x more. TDD is faster, not slower. |
| "I'll write a big integration test later." | Integration tests catch integration bugs. Unit tests catch unit bugs. You need both. Write the unit test now. |
| "This is a UI component — hard to test." | Test the logic, not the pixels. Extract logic into testable functions. |
| "I'm under time pressure." | TDD under pressure produces working code. Code-first under pressure produces bugs under pressure. |
---
## Red Flags — If You Notice These, STOP
1. **Test passes immediately after writing.** You either didn't write it first, or it's testing nothing.
2. **You're writing production code and thinking "I should add a test for this."** Too late. Delete the code. Test first.
3. **You have more production code than test code.** Ratio should be roughly 1:1 or tests > production.
4. **You're debugging production code.** If you had a test, you'd know exactly what broke. Write the test now.
5. **You're refactoring without running tests between changes.** Each refactor step must be verified.
6. **You wrote a test that tests implementation details** (e.g., "function was called 3 times"). Test behavior, not implementation.
7. **You skipped the RED phase** because "you know it will fail." Run it anyway. Verify your assumption.
---
## Good vs. Bad Examples (TypeScript)
### BAD: Code First, Test After
```typescript
// BAD: Builder writes this first
export function calculateDiscount(price: number, tier: 'gold' | 'silver' | 'bronze'): number {
const rates = { gold: 0.2, silver: 0.1, bronze: 0.05 };From lshtram/nso, MIT.
More from lshtram/nso
- 0.408score
integration-verifier
lshtram
Verify integration tests and E2E scenarios, detect failures, and provide rollback options
SkillDFreshness: DClaude Code +9 - 0.408score
skill-creator
lshtram
Create or improve skills using the Claude Code skill standard.
SkillDFreshness: DClaude Code +9 - 0.406score
router
lshtram
Intelligent intent detection and workflow routing for NSO.
SkillDFreshness: DClaude Code +9 - 0.404score
memory-update
lshtram
Force an on-demand update of NSO memory files with comprehensive context.
SkillDFreshness: DClaude Code +9 - 0.404score
verification-gate
lshtram
IDENTIFY→RUN→READ→VERIFY→CLAIM gate function with forbidden language detection and fresh evidence requirement.
SkillDFreshness: DClaude Code +9 - 0.404score
post-mortem
lshtram
Session analysis, pattern detection, and self-improvement orchestration for workflow closure.
SkillDFreshness: DClaude Code +9 - 0.404score
ui-design-system
lshtram
Comprehensive UI/UX design system skill — component generation, design tokens, accessibility, and responsive design.
SkillDFreshness: DClaude Code +9 - 0.404score
architectural-review
lshtram
Multi-expert architecture review with simplicity checklist and debate-driven analysis.
SkillDFreshness: DClaude Code +9 - 0.404score
bug-investigator
lshtram
Investigate bugs with LOG FIRST approach, regression tests, and variant coverage.
SkillDFreshness: DClaude Code +9 - 0.404score
code-reviewer
lshtram
Review code with confidence scoring (≥80), two-stage review, and CRITICAL issue blocking.
SkillDFreshness: DClaude Code +9 - 0.404score
systematic-debugging
lshtram
4-phase debugging methodology with root cause analysis, 3-fix escalation, and scientific method enforcement.
SkillDFreshness: DClaude Code +9 - 0.401score
rm-multi-perspective-audit
lshtram
Audit requirements from multiple stakeholder perspectives.
SkillDFreshness: DClaude Code +9
Signals
- Stars
- 0
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Feb 12, 2026 (8 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/lshtram/nso
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from lshtram
- 0.408score
integration-verifier
lshtram
Verify integration tests and E2E scenarios, detect failures, and provide rollback options
SkillDFreshness: DClaude Code +9 - 0.408score
skill-creator
lshtram
Create or improve skills using the Claude Code skill standard.
SkillDFreshness: DClaude Code +9 - 0.406score
router
lshtram
Intelligent intent detection and workflow routing for NSO.
SkillDFreshness: DClaude Code +9 - 0.405score
platform-agentic-cicd-orchestrator
lshtram
Use when doing cross-layer planning, drift reconciliation, and CI/CD promotion across UI, n8n, and backend layers
SkillDFreshness: DClaude Code +9 - 0.404score
bug-investigator
lshtram
Investigate bugs with LOG FIRST approach, regression tests, and variant coverage.
SkillDFreshness: DClaude Code +9 - 0.404score
code-reviewer
lshtram
Review code with confidence scoring (≥80), two-stage review, and CRITICAL issue blocking.
SkillDFreshness: DClaude Code +9
Cite this page
tdd skill. Agent Mart. https://agentmart.dev/skills/lshtram-tdd (last updated 2026-10-24)