skills/tdd-implementer/SKILL.md
Implement minimal code to make failing tests pass (GREEN phase). Use when you have a failing test and need to write just enough code to make it pass. Do NOT use when no failing test exists; do NOT use for refactoring — use tdd-refactor instead.
npx skillsauth add michaelalber/ai-toolkit tdd-implementerInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
"Do the simplest thing that could possibly work." — Ward Cunningham
The GREEN phase has one job: make the failing test pass with minimal code. This is not the time for elegance, optimization, or handling edge cases not covered by tests.
The Three Strategies (in order of preference):
Use search_knowledge (grounded-code-mcp) to ground decisions in authoritative references.
| Query | When to Call |
|-------|--------------|
| search_knowledge("TDD fake it triangulation obvious implementation strategies") | When choosing an implementation strategy — confirms Fake It / Triangulation / Obvious Implementation order |
| search_knowledge("minimal implementation GREEN phase test passes") | When writing GREEN phase code — authoritative guidance on "minimum code to pass" |
| search_knowledge("unit test AAA arrange act assert pattern") | When reviewing the failing test before implementing — confirms test structure is sound |
| search_knowledge("Python implementation patterns type hints") | For Python projects — idiomatic implementation patterns |
| search_knowledge("C# implementation patterns minimal") | For .NET projects — idiomatic implementation patterns |
Protocol: Search at the start of a GREEN phase session to confirm the implementation strategy. Cite the source path in your response.
During GREEN, prioritize these properties:
| Property | GREEN Phase Application | |----------|------------------------| | Predictive | Implementation must make test pass predictably | | Fast | Don't slow down the feedback loop | | Isolated | Implementation shouldn't break other tests | | Deterministic | Same input → same output, always |
BEFORE writing ANY implementation code:
Pre-Flight Verification:
├── Failing test exists?
│ └── NO → STOP. Return to RED phase.
│ └── YES → Continue
├── Test suite was just run?
│ └── NO → Run it now, verify failure
│ └── YES → Continue
├── Failure is for expected reason?
│ └── NO → Test may be wrong, investigate
│ └── YES → Continue
├── Clear what behavior is needed?
│ └── NO → Re-read test, understand intent
│ └── YES → Proceed to implement
Return exactly what the test expects. Use when:
Example:
# Test expects
def test_add_returns_sum():
assert add(2, 3) == 5
# Fake it
def add(a, b):
return 5 # Just return what the test expects
Next cycle: Write another test that forces generalization.
Write the real code when it's trivially simple:
# Test expects
def test_add_returns_sum():
assert add(2, 3) == 5
# Obvious implementation
def add(a, b):
return a + b # So obvious, just do it
Use when:
When you're unsure, use multiple test cases to guide generalization:
# First test
def test_add_2_and_3():
assert add(2, 3) == 5
# Fake implementation works
# Second test (triangulation)
def test_add_5_and_7():
assert add(5, 7) == 12
# Now must generalize
def add(a, b):
return a + b
Read the failing test carefully:
Decision tree:
Is the implementation obvious (< 3 lines, no edge cases)?
├── YES → Obvious Implementation
├── NO → Is this the first test for this behavior?
│ ├── YES → Fake It
│ └── NO → Triangulation (generalize from fakes)
Rules:
Execute the full test suite:
Confirm:
### GREEN Phase: Implementation
**Failing test**: `test_name` in `file_path`
**Failure reason**: [error message or assertion failure]
**Strategy**: [Fake It | Obvious | Triangulation]
**Implementation**:
[code block with minimal implementation]
**Verification**:
- Tests run: Yes
- Result: All passing (N tests)
- Minimal: [Yes, only what test requires | No, explain why more was needed]
<tdd-state>
phase: REFACTOR
...
</tdd-state>
Ready for REFACTOR phase.
If asked to implement something without a failing test:
Common temptations to avoid:
Only implement what the current test requires:
add(2, 3) == 5 → Can return hardcoded 5Never say "tests pass" without actually running them:
See reference files for idioms:
# Test
def test_user_has_email():
user = User("[email protected]")
assert user.email == "[email protected]"
# Minimal implementation
class User:
def __init__(self, email):
self.email = email
That's it. Don't add:
# Test
def test_divide_by_zero_raises():
with pytest.raises(ValueError):
divide(10, 0)
# Minimal implementation
def divide(a, b):
if b == 0:
raise ValueError()
return a / b # or even just: raise ValueError() if faking
Test the observable outcome (the user can be retrieved), not the internal call:
# Test (with in-memory fake — tests behavior, not implementation)
def test_saved_user_can_be_retrieved():
repo = UserRepository(InMemoryDatabase())
user = User("alice")
repo.save(user)
assert repo.find_by_name("alice") == user
# Minimal implementation
class UserRepository:
def __init__(self, db):
self.db = db
def save(self, user):
self.db.insert("users", user)
def find_by_name(self, name):
return self.db.find("users", name=name)
Why not mock.assert_called_once_with? Verifying the internal call is Over-Mocking — it tests implementation details, not behavior. If you rename insert to upsert, the test breaks even though behavior is unchanged. Test what the system produces, not how it produces it.
tdd-cycle — Orchestrates when this skill is invoked; confirms a failing test exists before handing off to GREENtdd-agent — Calls this skill during its autonomous GREEN phasetdd-pair — Calls this skill when it is the AI's turn to implement in ping-pong modetdd-refactor — Invoked immediately after GREEN is complete; receives code that is working but possibly uncleantdd-verify — Can audit the output of this skill to check for over-engineering or implementation-coupled patternsdevelopment
Interviews the user relentlessly about a plan, decision, or idea — one question at a time, each with a recommended answer. Shared engine behind "grill-me" and "grill-with-docs". Use on any "grill" trigger phrase or to stress-test thinking. Do NOT use to build the plan; it ends at shared understanding, not implementation.
testing
Runs a relentless interview to sharpen a plan or design, capturing the decisions as ADRs and a glossary along the way. Use when the user wants to be grilled AND wants the session to leave durable domain documentation behind. Do NOT use for a throwaway stress-test with no artifacts; use grill-me instead.
tools
OWASP-based security review of Vue/TypeScript front-ends. Detects framework (Vite/Vue CLI/Nuxt), entry points, and data flows; scans the OWASP Top 10 (2025) mapped to Vue client-side risks (raw-HTML XSS via v-html, URL/protocol injection, bundled secrets, insecure token storage, dependency CVEs, missing CSP, open redirects, router guard bypass); emits an exec summary plus graded findings. Use to audit Vue for vulnerabilities. Not for architecture grading (vue-architecture-checklist).
tools
Analyzes legacy Vue codebases and produces actionable modernization plans. Primary migration paths include Options API to Composition API, Vue 2 to Vue 3, Vue CLI to Vite, JavaScript to TypeScript, Vue Test Utils/Karma/Mocha to Vitest + Vue Testing Library, legacy Vuex to Pinia, and removed-in-Vue-3 pattern cleanup (filters, event bus, `$listeners`). Does NOT perform the migration — assesses, quantifies risk, and plans.