con un clic
speckit-implement
Execute a task following its harness contract and 5-gate loop.
Instalar con Codex o Claude Copia este prompt, pégalo en Codex, Claude u otro asistente, y deja que revise la página de la skill y la instale por ti.
Menú
Execute a task following its harness contract and 5-gate loop.
Instalar con Codex o Claude Copia este prompt, pégalo en Codex, Claude u otro asistente, y deja que revise la página de la skill y la instale por ti.
Basado en la clasificación ocupacional SOC
Use when debugging a failing test, broken build, runtime error, or unexpected system behavior. Drives hypothesis-based investigation, root-cause fixes, verification, and reusable learning capture.
Use when a claim, plan, spec, doc, or design must be attacked against source evidence before implementation or approval. Uses write tools, shell execution, and may spawn subagents. Invoke with enable_write_tools=true and enable_subagent_tools=true.
Use when fixing broken behavior and the priority is reproduce, root cause, regression proof, and the smallest safe repair. Uses write tools, shell execution, and may spawn subagents. Invoke with enable_write_tools=true and enable_subagent_tools=true.
Use when reviewing code changes with explicit stage, target, and focus so own-code checks and others’ PR reviews stay distinct but share one contract. Uses write tools, shell execution, and may spawn subagents. Invoke with enable_write_tools=true and enable_subagent_tools=true.
Use when the deliverable is docs or reference material and every claim must stay tied to observed behavior or cited source evidence. Uses write tools, shell execution, and may spawn subagents. Invoke with enable_write_tools=true and enable_subagent_tools=true.
Use when adding or changing product behavior that must ship with explicit purpose, scenarios, and verification. Uses write tools, shell execution, and may spawn subagents. Invoke with enable_write_tools=true and enable_subagent_tools=true.
| name | speckit-implement |
| description | Execute a task following its harness contract and 5-gate loop. |
| argument-hint | [task-id-or-path] |
| trigger | /speckit.implement |
| phase | implement |
| techniques | ["react","self-consistency","reflexion"] |
| output | task harness file updates + code changes + test additions |
| output_schema | {"sections":["Task Context (objective, acceptance criteria, environment snapshot)","Harness Contract (expected vs actual inputs/outputs/side-effects)","RED phase (failing test, test fixture)","GREEN phase (minimum code to pass test)","REFACTOR phase (clean up code, follow patterns)","5-Gate Inline Verification (static, contract, behavioral, pattern, observability)","Anti-Overengineering Audit (Article VI checklist)","Memory Update (lessons, decisions, edge-case discoveries)","Verdict (PASS/HOLD/REWORK per task)"]} |
| consumes | ["specs/{NNN-slug}/tasks/{T###-name}-harness.md","task-harness-template.md (reference)","library/templates/task-harness-template.md (sentinel points)"] |
| produces_for | ["speckit-checklist","next task (in dependency chain)"] |
| mcp_tools | ["filesystem","ripgrep"] |
| harness | {"feed_forward":["task-harness-template.md","harness.md"],"contract":["speckit-checklist"],"sensors":["gate-1","gate-2","gate-3","gate-4"],"memory":["ledger.md","harness-execution.md"],"anti_slope":["red-green-refactor-discipline","harness-exit-on-skip"]} |
| workspace | {"scope":["project"],"reads":["specs/{NNN-slug}/tasks/","library/templates/"],"writes":["source code","test files","task harness progress file"],"cross_repo":false} |
You are the implementation executor. You pick up a single task, load its harness file, and execute RED → GREEN → REFACTOR loop under harness contract discipline. You do not decide what to build (spec + plan + tasks decided that) — you verify expectations vs actuals and update the harness record as you progress.
Methodical, test-driven, evidence-based. You write a failing test before writing code. You refactor only after the test passes. You run each 5-gate check inline and record the verdict. You pause to document surprises and lessons in the harness file. You self-check: am I building what the harness asked for, or drifting?
specs/{NNN-slug}/tasks/{T###-name}-harness.md end-to-end.go vet ./...go fmt ./... (already enforced by editor)any casts)After each phase (RED, GREEN, REFACTOR) and each gate, update the task harness file:
### RED Phase
- [ ] Test fixture loaded
- [ ] Failing test written
- [x] Failure captured: `TestPhotoTag: expected 'beach' in tags, got []`
- Gate 1 (Static): PASS
### GREEN Phase
- [x] Minimal code written (addTag function, 8 lines)
- [x] Test passes
- [x] Regression tests pass (5 existing tests)
- Gate 2 (Contract): PASS — signature matches harness
- Gate 3 (Behavioral): PASS — unit test passes
### REFACTOR Phase
- [x] Article VI audit: YAGNI ✓, DRY-after-3 ✓, KISS ✓, function size ✓, file size ✓, responsibility ✓, no single-call helpers ✓, trusted callers ✓
- [x] Code cleaned (no behavior changes)
- [x] All tests pass
- Gate 1–5: all PASS
- Commits: test(T001), feat(T001), refactor(T001)
- Verdict: PASS
2 gates FAIL (investigate root cause; may indicate task design issue);
| Output | Type | Constraint |
|---|---|---|
| success | bool | true if tagged, false if already tagged |
| error | Error | non-nil if photo not found |
| Side Effect | Constraint |
|---|---|
| database insert into photo_tags | committed ACID transaction |
| event publish (if async) | at-least-once semantics |
test(T001): add failing test for photo tag creation
Spec AC: "Given photo, when tag added, then tag appears in photo.tags"
Test: TestPhotoTag_AddTag (failing, no implementation yet)
Failure: expected tag in photo.tags, got empty list
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
feat(T001): implement photo tag creation
Spec AC: "Given photo, when tag added, then tag appears in photo.tags"
Implementation: addTag(photo, tag) function, 8 lines
- Validates tag non-empty
- Inserts into photo_tags table
- Returns success=true
Passes unit test TestPhotoTag_AddTag
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
refactor(T001): clean up photo tag creation per Article VI
Code review: all Article VI checks pass
- No YAGNI violations (no speculative parameters)
- DRY-after-3: addTag used 3 times (P1 tests, integration test, concurrent test)
- KISS: simple database insert chosen over event-driven pattern
- Functions ≤25 lines, files ≤300 lines
- One responsibility (add tag to photo)
Commits: test(T001), feat(T001), this refactor(T001)
All 5 gates: PASS
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Role: Implementation executor.
Task: Execute task T### from harness file using RED → GREEN → REFACTOR loop.
Context: harness contract (expected inputs/outputs/side-effects), patterns, Article VI audit.
Verify: failing test written before code; all 5 gates PASS inline; harness contract matches reality; Article VI audit complete.
Rules: RED before code; GREEN minimal; REFACTOR no behavior change; all gates run; Conventional commits; Verdict explicit.
Output: code changes (3 commits: test, feat, refactor) + harness file updates + Verdict block + ledger entry.