add-implementer
[ADD v0.11.0] Write minimal implementation to pass tests (TDD GREEN phase)
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
[ADD v0.11.0] Write minimal implementation to pass tests (TDD GREEN phase)
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
[ADD v0.11.0] Generate or sync a portable AGENTS.md from ADD project state — writes, checks drift, or merges with hand-curated content
[ADD v0.11.0] Declare absence — get autonomous work plan for the duration
[ADD v0.11.0] Return from absence — get briefing on autonomous work
[ADD v0.11.0] View project branding — accent color, palette, drift detection, image gen status
[ADD v0.11.0] Update project branding — new colors, fonts, tone, audit artifacts
[ADD v0.11.0] Generate or refresh CHANGELOG.md from conventional commits
| name | add-implementer |
| description | [ADD v0.11.0] Write minimal implementation to pass tests (TDD GREEN phase) |
| argument-hint | specs/{feature}.md [--ac AC-001,AC-002] |
Write minimal production-quality code to make failing tests pass. This is the GREEN phase of TDD.
The Implementer takes failing tests (from test-writer) and writes the smallest amount of code necessary to make them all pass. The goal is:
npm test or python -m pytest1b. Read the impact hint (v0.9.0 — AC-022)
The tdd-cycle orchestrator emits a files-likely-affected block via
core/lib/impact-hint.sh. Consume it as part of this skill's context:
## Files likely to need changes
- app/auth.py
- app/session.py
## Files to be careful around (recent anti-pattern learnings exist)
- app/session.py [L-042]
Use the first list as the starting set for Step 2 (Design Implementation)
Treat the second list as warnings: those paths have recent anti-pattern learnings — read the learning (by ID) before editing
If the hint reports "No source files implied by RED diff" (AC-024), fall back to the spec's acceptance criteria for implementation targets
Read the feature spec
Load test mapping
Determine implementation structure
Read .add/config.json
Check for session handoff — per the Session-Handoff Preflight in ~/.codex/add/references/skill-epilogue.md
For each failing test:
Example analysis:
// Test:
it('should return sum of two numbers', () => {
expect(add(2, 3)).toBe(5);
});
// Requires:
// - Function named 'add'
// - Takes two number parameters
// - Returns number (sum)
Create a plan without writing code:
Start with simplest, most-dependent-upon functions first:
For JavaScript/TypeScript:
// src/feature.ts - minimal implementation
export function add(a: number, b: number): number {
return a + b;
}
export class Feature {
constructor(private config: FeatureConfig) {}
doSomething(input: string): string {
return input.toUpperCase();
}
}
For Python:
# src/feature.py - minimal implementation
def add(a: int, b: int) -> int:
return a + b
class Feature:
def __init__(self, config):
self.config = config
def do_something(self, input_str: str) -> str:
return input_str.upper()
After implementing each logical unit:
npm test or python -m pytestAs tests progress to GREEN:
If a failing test seems wrong, it is NOT your decision to delete it. Stop, surface the
discrepancy to the human, and (if confirmed) rerun the cycle with --allow-test-rewrite.
Silent deletion fails Gate 3.5 and halts the cycle. The directive is:
"Test deletion during a TDD cycle is forbidden. Fix the implementation, not the test."
Run full test suite:
npm test
# or
python -m pytest
Verify:
Example output:
PASS tests/feature.test.ts
Feature Name
AC-001: requirement
✓ test_AC_001_behavior_a (15ms)
✓ test_AC_001_behavior_b (12ms)
AC-002: requirement
✓ test_AC_002_behavior_c (8ms)
Test Suites: 1 passed, 1 total
Tests: 3 passed, 3 total
Coverage: 85%
Before returning control to the tdd-cycle orchestrator, capture the test surface snapshot for Gate 3.5:
python3 ~/.codex/add/../../scripts/check-test-count.py snapshot \
--phase green \
--cycle-id {N} \
--spec-slug {slug} \
--base-sha {cycle-base-sha}
The snapshot lives at .add/cycles/cycle-{N}/tdd-{slug}-green.json and is compared
against the RED snapshot by /add-verify Gate 3.5. If tests_removed > 0 without an
override, the cycle fails with a structured error naming each removed test.
Implementation code must:
After implementation reaches GREEN:
npm test -- --shuffleUpon successful GREEN phase completion, output:
# Implementation Complete (GREEN Phase) ✓
## Feature
{feature-name} v{spec-version}
## Test Results
- Tests Passing: {count}/{total}
- Tests Failing: 0/{total}
- Test Duration: {seconds}s
## Acceptance Criteria Implementation
- AC-001: ✓ Implemented and passing
- AC-002: ✓ Implemented and passing
... (all ACs listed)
## Code Coverage
- Line Coverage: {percentage}%
- Branch Coverage: {percentage}%
- Function Coverage: {percentage}%
## Implementation Files Created/Modified
- {file-path}: {N} functions, {N} classes
- {file-path}: {N} functions
## Next Steps
1. Run /add-reviewer to check code quality
2. Run /add-tdd-cycle REFACTOR phase to improve code
3. Merge implementation
## Notes
- All tests green as of {timestamp}
- Ready for code review and refactoring
- No over-engineering; minimal viable implementation
Tasks to create (mechanics per ~/.codex/add/references/skill-epilogue.md):
| Phase | Subject | activeForm |
|---|---|---|
| Read tests | Reading failing tests | Reading failing tests... |
| Analyze | Analyzing requirements | Analyzing requirements... |
| Implement | Writing implementation code | Writing implementation code... |
| Verify GREEN | Confirming all tests pass | Verifying tests pass (GREEN confirmed)... |
Tests still failing after implementation
Type errors or compilation failures
Tests pass but coverage is low
Existing implementation conflicts with tests
Performance issues
The implementer respects:
End-of-skill epilogue: follow ~/.codex/add/references/skill-epilogue.md (observation + learning checkpoint + progress tracking).