tdd-process
Strict test-driven development state machine with red-green-refactor cycles. Enforces test-first development, meaningful failures, minimum implementations, and full verification. Activates when user requests: 'use a TDD approach', 'start TDD', 'test-drive this'.
What this skill does
**In Plan Mode: Plans should be test specifications, not implementation designs. Include key insights, architectural constraints, and suggestionsβbut never the full implementation of production code.**
# π¨ CRITICAL: TDD STATE MACHINE GOVERNANCE π¨
**EVERY SINGLE MESSAGE MUST START WITH YOUR CURRENT TDD STATE**
Format:
```
π΄ TDD: RED
π’ TDD: GREEN
π΅ TDD: REFACTOR
βͺ TDD: PLANNING
π‘ TDD: VERIFY
β οΈ TDD: BLOCKED
```
**NOT JUST THE FIRST MESSAGE. EVERY. SINGLE. MESSAGE.**
When you read a file β prefix with TDD state
When you run tests β prefix with TDD state
When you explain results β prefix with TDD state
When you ask a question β prefix with TDD state
Example:
```
βͺ TDD: PLANNING
Writing test for negative price validation...
βͺ TDD: PLANNING
Running npm test to see it fail...
βͺ TDD: PLANNING
Test output shows: Expected CannotHaveNegativePrice error but received -50
Test fails correctly. Transitioning to RED.
π΄ TDD: RED
Test IS failing. Addressing what the error message demands...
```
**π¨ FAILURE TO ANNOUNCE TDD STATE = SEVERE VIOLATION π¨**
---
<meta_governance>
π¨ STRICT STATE MACHINE GOVERNANCE π¨
- CANNOT skip states or assume completion without evidence
- MUST announce state on EVERY message
- MUST validate post-conditions before transitioning
**Before each response:** Verify your claimed state matches your tool call evidence.
If mismatch: `π₯ STATE VIOLATION DETECTED` β announce correct state β recover.
**State announcement:** Every message starts with `π΄ TDD: RED` (or current state).
Forgot prefix? Announce violation immediately, then continue.
</meta_governance>
<state_machine>
<diagram>
```
user request
β
ββββββββββββ
ββββββ PLANNING ββββββ
β βββββββ¬βββββ β
β β β
β test fails β
β correctly β
unclear β β β blocker
β ββββββββββββ β
ββββββ RED β β
β β β
β Test IS β β
β failing β β
ββββββ¬ββββββ β
β β
test β β
passes β β
β β
ββββββββββββ β
β GREEN β β
β β β
β Test IS β β
β passing β β
ββββββ¬βββββββββββ
β
refactoring β
needed β
β
ββββββββββββ
ββββββ REFACTOR β
β β β
β β Improve β
β β design β
β ββββββ¬ββββββ
β β
β done β
β β
β β
β ββββββββββββ
β β VERIFY β
β β β
β β Run full β
fail β β suite + β
β β lint + β
ββββββ build β
ββββββ¬ββββββ
β
pass β
β
β
[COMPLETE]
```
</diagram>
<states>
<state name="PLANNING">
<prefix>βͺ TDD: PLANNING</prefix>
<purpose>Writing a failing test to prove requirement</purpose>
<pre_conditions>
β User has provided a task/requirement/bug report
β No other TDD cycle in progress
</pre_conditions>
<actions>
1. Analyze requirement/bug
2. Ask clarifying questions if needed
3. Determine what behavior needs testing
4. Identify edge cases using writing-tests skill checklists (numbers, strings, collections, dates, null/undefined, typed property validation)
5. Write test for specific behavior
6. Run test (use Bash tool to execute test command)
7. VERIFY test fails correctly
8. Show exact failure message to user (copy/paste verbatim output)
9. Justify why failure message proves test is correct
10. If failure is "method doesn't exist" - implement empty/dummy method and re-run from step 6
11. Repeat until you get a "meaningful" failure
12. Improve the code to produce a more explicit error message. Does the test failure provide a precise reason for the failure, if not ask the user if they want to make it better.
13. Transition to RED
</actions>
<post_conditions>
β Test written and executed
β Test FAILED correctly (red bar achieved)
β Failure message shown to user verbatim
β Failure reason justified (proves test is correct)
β Failure is "meaningful" (not setup/syntax error)
</post_conditions>
<validation_before_transition>
BEFORE transitioning to RED, announce:
"Pre-transition validation:
β Test written: [yes]
β Test executed: [yes]
β Test failed correctly: [yes]
β Failure message shown: [yes - output above]
β Meaningful failure: [yes - justification]
Transitioning to RED - test is now failing for the right reason."
</validation_before_transition>
<transitions>
- PLANNING β RED (when test fails correctly - red milestone achieved)
- PLANNING β BLOCKED (when cannot write valid test)
</transitions>
</state>
<state name="RED">
<prefix>π΄ TDD: RED</prefix>
<purpose>Test IS failing for the right reason. Implement ONLY what the error message demands.</purpose>
π¨ CRITICAL: You are in RED state - test IS CURRENTLY FAILING. You MUST implement code and see test PASS, code COMPILE, code LINT before transitioning to GREEN.
DO NOT transition to GREEN until you have:
1. Implemented ONLY what the error message demands
2. Executed the test with Bash tool
3. Seen the SUCCESS output (green bar)
4. Executed compile check and seen SUCCESS
5. Executed lint check and seen PASS
6. Shown all success outputs to the user
<pre_conditions>
β Test written and executed (from PLANNING)
β Test IS FAILING correctly (red bar visible)
β Failure message shown and justified
β Failure is "meaningful" (not setup/syntax error)
</pre_conditions>
<actions>
1. Read the error message - what does it literally ask for?
2. π¨ MANDATORY SELF-CHECK - announce before implementing:
"Minimal implementation check:
- Error demands: [what the error literally says]
- Could hardcoded value work? [yes/no]
- If yes: [what hardcoded value]
- If no: [why real logic is required]"
Guidelines:
- If test asserts `x === 5` β return `5`
- If test asserts `count === 0` β return object with `count: 0`
- If test asserts type β return minimal stub of that type
- Only add logic when tests FORCE you to (multiple cases, different inputs)
3. Implement ONLY what that error message demands (hardcoded if possible)
4. Do NOT anticipate future errors - address THIS error only
5. Run test (use Bash tool to execute test command)
6. VERIFY test PASSES (green bar)
7. Show exact success message to user (copy/paste verbatim output)
8. Run quick compilation check (e.g., tsc --noEmit, or project-specific compile command)
9. Run lint on changed code
10. If compile/lint fails: Fix issues and return to step 5 (re-run test)
11. Show compile/lint success output to user
12. Justify why implementation is minimum
13. ONLY AFTER completing steps 5-12: Announce post-condition validation
14. ONLY AFTER validation passes: Transition to GREEN
π¨ YOU CANNOT TRANSITION TO GREEN UNTIL TEST PASSES, CODE COMPILES, AND CODE LINTS π¨
Related in Code Review
gstack
IncludedFast headless browser for QA testing and site dogfooding. Navigate pages, interact with elements, verify state, diff before/after, take annotated screenshots, test responsive layouts, forms, uploads, dialogs, and capture bug evidence. Use when asked to open or test a site, verify a deployment, dogfood a user flow, or file a bug with screenshots. (gstack)
startup-due-diligence
IncludedLegal due diligence review for seed-stage and Series A startups (US, Delaware C-Corp focus). Supports both investor and founder perspectives. Capabilities include: (1) Interactive document review and issue spotting; (2) Document request list generation; (3) Cap table and SAFE/convertible note analysis; (4) Red flag identification with severity ratings; (5) Diligence report generation. TRIGGERS: due diligence, DD, startup investment, cap table review, Series A, seed round, investor diligence, legal review startup, SAFE analysis, convertible note, 409A, founder vesting.
interview-master
IncludedThis skill should be used when the user asks to "generate interview questions", "prepare for interview", "optimize resume", "conduct mock interview", "analyze git commits for resume", "generate resume from code", "review my resume", or mentions interview preparation, career assistance, or extracting project experience from git history. Provides comprehensive interview and career development guidance for both job seekers and interviewers.
fix-issue
IncludedFixes GitHub issues using parallel analysis agents for root cause investigation, code exploration, and regression detection. Reads issue context from gh CLI, searches codebase and memory for related patterns, generates a fix with tests, and links the resolution back to the issue via PR. Includes prevention analysis to avoid recurrence. Use when debugging errors, resolving regressions, fixing bugs, or triaging issues.
sf-apex
IncludedGenerates and reviews Salesforce Apex code with 150-point scoring. TRIGGER when: user writes, reviews, or fixes Apex classes, triggers, test classes, batch/queueable/schedulable jobs, or touches .cls/.trigger files. DO NOT TRIGGER when: LWC JavaScript (use sf-lwc), Flow XML (use sf-flow), SOQL-only queries (use sf-soql), or non-Salesforce code.
swift-development
IncludedComprehensive Swift development for building, testing, and deploying iOS/macOS applications. Use when Claude needs to: (1) Build Swift packages or Xcode projects from command line, (2) Run tests with XCTest or Swift Testing framework, (3) Manage iOS simulators with simctl, (4) Handle code signing, provisioning profiles, and app distribution, (5) Format or lint Swift code with SwiftFormat/SwiftLint, (6) Work with Swift Package Manager (SPM), (7) Implement Swift 6 concurrency patterns (async/await, actors, Sendable), (8) Create SwiftUI views with MVVM architecture, (9) Set up Core Data or SwiftData persistence, or any other Swift/iOS/macOS development tasks.