skills/team/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 |
| search_knowledge("PHP implementation patterns type hints") | For PHP 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 — The canonical inner loop; orchestrates when this skill is invoked and 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
Federal / government security overlay applied ON TOP OF a base language security review (dotnet/python/php/rust/react). Language-agnostic: adds NIST SP 800-53 control mapping, FIPS 140-2/3 cryptographic compliance (with a per-language crypto table), CUI handling, EO 14028 supply-chain requirements, and DOE Order 205.1B, and emits POA&M-ready findings with FIPS 199 impact levels. Use for federal/DOE/DOD/national-laboratory systems. Triggers on "federal security review", "NIST compliance", "NIST 800-53", "FISMA", "CUI", "FIPS audit", "DOE security", "POA&M", "ATO review". Do NOT use alone — run the matching <lang>-security-review FIRST; this overlay maps and extends it.
tools
OWASP-based security review of React / TypeScript front-end applications. Detects the framework (Vite/CRA/Next), entry points, and data flows, scans against the OWASP Top 10 (2025) mapped to React client-side patterns (XSS via raw HTML, URL/protocol injection, secrets in the bundle, insecure token storage, dependency CVEs, missing CSP, open redirects), and produces a manager-friendly executive summary plus a graded technical findings table. Use to audit React code for vulnerabilities. Triggers on "react security review", "frontend security audit", "audit react for vulnerabilities", "owasp react", "react xss", "react security posture", "npm audit review". For federal / gov / DOE / NIST / FIPS / CUI context, run security-review-federal after this base review. Do NOT use to grade architecture/structure — use react-architecture-checklist.
tools
Analyzes legacy React codebases and produces actionable modernization plans. Primary migration paths include class components to function components + hooks, Create React App to Vite, React 16/17 to 18 to 19, JavaScript to TypeScript, Enzyme to React Testing Library, legacy Redux to Redux Toolkit / Zustand / Context, and deprecated lifecycle/API removal. Does NOT perform the migration — assesses, quantifies risk, and plans. Triggers on phrases like "modernize react", "class to hooks", "upgrade react", "migrate CRA to vite", "react legacy migration", "react 17 to 18", "react js to typescript", "react technical debt", "enzyme to RTL".
development
Scaffolds feature-based React / TypeScript architecture using feature folders, presentational + container components, custom hooks, a typed data layer, and structural CQRS (query hooks vs mutation hooks). React analog of dotnet-vertical-slice and python-feature-slice — no DI framework; uses props/context for dependency injection and a query cache for server state. Use when creating feature-based React projects, adding React features, organizing components by feature rather than by technical type, or scaffolding a feature's data layer. Triggers on phrases like "scaffold react feature", "create react slice", "react feature folder", "react vertical slice", "add react feature", "react feature architecture", "organize react by feature".