This skill should be used when the user asks to "implement using TDD", "test-driven development", "RED-GREEN-REFACTOR", or "write failing test first". Enforces test-first approach with RED-GREEN-REFACTOR cycle and execution-based verification.
View on GitHubFebruary 4, 2026
Select agents to install to:
npx add-skill https://github.com/edwinhu/workflows/blob/main/skills/dev-tdd/SKILL.md -a claude-code --skill dev-tddInstallation paths:
.claude/skills/dev-tdd/## Contents - [The Iron Law](#the-iron-law-of-tdd) - [The TDD Cycle](#the-tdd-cycle) - [What Counts as a Test](#what-counts-as-a-test) - [Logging TDD Progress](#logging-tdd-progress) - [Red Flags - Thoughts That Mean STOP](#red-flags---thoughts-that-mean-stop) - [Delete & Restart](#delete--restart) - [E2E Test Requirement](#e2e-test-requirement) # Test-Driven Development <EXTREMELY-IMPORTANT> ## Task Reframing: What Your Job Actually Is **Your job is NOT to implement features. Your job is to write tests that prove features work.** Reframe every task: - ❌ "Implement user login" - ✅ "Write a test that proves user login works. Then make it pass." - ❌ "Fix the icon rendering bug" - ✅ "Write a test that fails when icons render wrong. Then fix it." **The test IS your deliverable. The implementation just makes the test pass.** </EXTREMELY-IMPORTANT> <EXTREMELY-IMPORTANT> ## File-Based Logging (MANDATORY) **ALL CODE MUST USE FILE-BASED LOGGING.** Every application you write MUST redirect output to a log file: - CLI apps: `./app > /tmp/app.log 2>&1 &` - GUI apps: `./app --log-file=/tmp/app.log 2>&1 &` - Test runners: `pytest -v > /tmp/test.log 2>&1` **Why:** Without log files, you have NO EVIDENCE of what happened. "I saw it in terminal" is not verification. **Read the full requirements:** `@references/logging-requirements.md` </EXTREMELY-IMPORTANT> <EXTREMELY-IMPORTANT> ## The Execution Gate (MANDATORY) **NO E2E TESTS WITHOUT PASSING THE EXECUTION GATE FIRST.** Before running E2E tests or taking screenshots, you MUST complete all 6 gates in order: ``` GATE 1: BUILD GATE 2: LAUNCH (with file-based logging) GATE 3: WAIT GATE 4: CHECK PROCESS GATE 5: READ LOGS ← MANDATORY, CANNOT SKIP GATE 6: VERIFY LOGS THEN AND ONLY THEN: E2E tests/screenshots ``` **Key enforcement:** - If you catch yourself thinking "let me take a screenshot" → STOP, you skipped gates 1-6 - If process is running → READ LOGS (GATE 5) before testing - Logs come BEFORE screenshots, not after