Use when writing tests or implementing code. Defines RED-GREEN-REFACTOR cycle and test execution workflow.
/plugin marketplace add craigtkhill/stdd-agents/plugin install stdd-agents@stdd-agentsThis skill inherits all available tools. When active, it can use any tool Claude has access to.
PYTHON.mdRUST.mdThis skill defines the proper TDD workflow: write ONE test, run it (RED), implement minimal code (GREEN), run ALL tests, repeat.
Language-specific details:
test-driven-development/PYTHON.md for pytest patterns, running tests, and Python-specific examplestest-driven-development/ directory as neededWrite a SINGLE test that fails.
Key principle: The test must fail for the right reason (missing implementation, not syntax error).
CRITICAL - Run the test - it MUST fail:
Why RED is mandatory:
Write the MINIMUM code to make the test pass.
Key principle: Don't add features not yet tested. Don't over-engineer.
Run the SAME test again:
CRITICAL: After each test passes, run ALL tests to ensure nothing broke.
Key principle: Never break existing functionality.
Run complete test suite:
After tests pass, consider refactoring to improve code quality.
Use the refactor skill for detailed refactoring guidance.
Key principle: Refactor only when tests are GREEN. Tests protect you during refactoring.
When to refactor:
Refactoring safety:
Note: Refactoring is optional on each cycle. You can skip if code is already clean.
Only after all tests pass, write the NEXT single test and repeat the cycle.
Updating SPEC.md markers:
[O][O] → [U][O] (test exists, code pending)[U][O] → [U][X] (test and code complete)[O][O] → [A][O] (acceptance test exists, code pending)[A][O] → [A][X] (acceptance test and code complete)[U][O] → [U][X]CRITICAL: Every test MUST go through THREE runs:
❌ NEVER skip the RED phase - Always see the test fail before implementing
Why run in isolation first?
Why run all tests after?
If all tests don't pass:
┌─────────────────────────────────────────────────┐
│ Start: Pick next requirement from spec │
└────────────────┬────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────┐
│ 1. RED: Write ONE test for requirement │
└────────────────┬────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────┐
│ 2. Run test in isolation │
│ Expected: FAIL (RED) │
└────────────────┬────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────┐
│ 3. GREEN: Write minimal implementation │
└────────────────┬────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────┐
│ 4. Run same test in isolation │
│ Expected: PASS (GREEN) │
└────────────────┬────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────┐
│ 5. VERIFY: Run ALL tests │
│ Expected: All PASS │
└────────────────┬────────────────────────────────┘
│
All pass? ──No──> Fix broken tests
│
Yes
│
▼
┌─────────────────────────────────────────────────┐
│ 6. REFACTOR: Improve code │
│ Run ALL tests after each change │
└────────────────┬────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────┐
│ 7. More requirements? ──Yes──> Repeat │
│ │ │
│ No │
│ │ │
│ ▼ │
│ Done │
└─────────────────────────────────────────────────┘
Unit Tests:
[U] in SPEC.mdAcceptance Tests:
[A] in SPEC.mdIntegration Tests:
tests/ directory at project rootTest Hierarchy:
Organize tests by requirement sections:
Follow project conventions for test names:
Each test should have:
TDD is STEP 2 of the spec-test-driven development workflow:
spec skill)tdd skill)When writing tests:
Wrong:
Write test_1
Write test_2
Write test_3
Implement all features
Run all tests
Correct:
Write test_1 → Run (RED) → Implement → Run (GREEN) → Verify all tests
Write test_2 → Run (RED) → Implement → Run (GREEN) → Verify all tests
Write test_3 → Run (RED) → Implement → Run (GREEN) → Verify all tests
Use this checklist for EVERY test in this exact order:
Critical reminder: Steps 3-6 MUST happen in order:
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.