ワンクリックで
code-implementation
Contract-first single-task implementation dispatched by Coder Coordinator
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Contract-first single-task implementation dispatched by Coder Coordinator
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Test failure diagnosis, source code fixes, and regression detection
Environment verification, dependency installation, baseline test verification
Integration test writing for component boundaries and external dependencies
Unit test writing and execution with coverage threshold enforcement
API reference documentation skill. Produces and updates API endpoint documentation from contract files in .sdd/docs/api-reference.md.
Architecture documentation skill. Produces and updates architecture overview, component diagrams, technology stack, design decisions, and directory structure in .sdd/docs/architecture.md.
| name | code-implementation |
| description | Contract-first single-task implementation dispatched by Coder Coordinator |
| argument-hint | Invoked by Coder Coordinator - do not call directly |
Phase: 2 (Core Implementation) Common contract:
.github/skills/CODER-SKILL-CONTRACT.mdSpec refs: FR-023, FR-024, FR-025, FR-026
This skill is dispatched by the Coder Coordinator during Phase 2. It implements a single task contract-first, matching function signatures, field names, types, and error codes from contract files verbatim. Each invocation handles one task as dispatched by the Coder agent.
| # | Input | Description |
|---|---|---|
| 1 | skill_path | Path to this SKILL.md file |
| 2 | wp_path | Path to the WP file being implemented |
| 3 | contracts_dir | Path to contract files for this WP (.sdd/plans/contracts/<WP-slug>/) |
| 4 | shared_contracts_dir | Path to shared cross-WP contracts (.sdd/plans/contracts/shared/) |
| 5 | spec_path | Path to the source spec file |
| 6 | patterns | Active code-domain patterns to avoid (from code-patterns.md) |
| 7 | target_language | Programming language (e.g., TypeScript, Python) |
| 8 | target_framework | Framework (e.g., Express, FastAPI, React) |
| 9 | task_list | Tasks with acceptance criteria and spec refs |
| 10 | dependency_source_summary | Actual file paths, exports, and import paths from completed dependency WPs |
Report to the coordinator with these fields:
| Field | Type | Constraints | Description |
|---|---|---|---|
status | enum | success or failure | Skill outcome |
files_modified | list(string) | file paths | Files created or changed |
tasks_completed | list(string) | T-XX format | Tasks finished |
test_results | object | pass_count, fail_count, coverage_pct | Test run summary (may be empty for this skill) |
issues | list(string) | free text | Problems encountered |
failure_reason | string | nullable | Why the skill failed (if status is failure) |
Each code-implementation invocation handles a single task dispatched by the Coder agent. The Coder dispatches one task at a time in dependency order.
task_list input (single task with acceptance criteria)Execute Steps 2-4 for this task.
Before implementing each task, read the contract files it references. Contract files live in contracts_dir and may include:
| Contract File | Contents | Spec Ref |
|---|---|---|
interfaces.<ext> | Function/method signatures with parameter names, types, and return types | FR-024.1 |
data-schemas.<ext> | Entity/model definitions with field names, types, defaults, and validation rules | FR-024.2 |
api-contracts.<ext> | API endpoint paths, HTTP methods, request/response types | FR-024.3 |
state-machines.<ext> | State enums, valid transitions, guard conditions | FR-024.4 |
error-catalog.<ext> | Error codes, messages, HTTP status codes | FR-024.5 |
The <ext> matches the target language (e.g., .ts, .py, .go).
Shared contracts: Also read contract files from shared_contracts_dir (.sdd/plans/contracts/shared/). These contain entity types and interfaces defined by earlier WPs that the current WP may depend on. Import shared types from the shared contracts rather than re-defining them.
Missing contract file handling: If a task references a contract file that does not exist in contracts_dir or shared_contracts_dir:
status: failure and failure_reason: "Contract file <path> referenced by task <task_id> not found"Implement the code that satisfies every acceptance criterion for the assigned task. The Coder dispatches this skill once per task, so focus on implementing ONLY the task specified in the prompt. Follow this sequence:
Read the task's spec refs (FR-XXX, Section N.X) from the spec file. Understand every SHALL obligation, precondition, postcondition, and error path.
Read the task's Implementation Guidance section from the WP file. This section contains specific instructions, recommended libraries, doc links, patterns, and constraints for how to implement this task. Follow its guidance precisely -- it was written by the Planner with knowledge of the target stack and architecture.
Beyond the basic FR obligations, extract and implement ALL business logic specified:
total = sum(items.price * items.qty)), implement the exact computation. Do NOT approximate or use different formulas.If the spec references an invariant, decision table, or side effect but the task description does not repeat it, still implement it -- the spec is the source of truth.
If this is the first task of the first WP (no existing source files), read the spec's Section 9.3 Directory Structure to determine where files should be placed. Create directories as needed. For subsequent tasks and WPs, follow the directory structure already established by prior tasks.
Copy interface and type definitions from contract files into the implementation. "Verbatim" means exact:
interfaces.<ext> exactly: same parameter names, same types, same return typesdata-schemas.<ext> exactly: same field names, same types, same defaults, same validation rulesTool guidance for implementation efficiency:
#tool:edit/editFiles with multi-replace mode when making multiple independent edits across files in a single operation#tool:read/problems after each file edit to catch syntax and type errors immediately -- do not wait until all edits are done#tool:search/usages to verify contract symbol implementations when checking interface complianceExample: Given a contract defining:
createUser(input: CreateUserInput): Promise<User>
The implemented function SHALL have exactly that signature -- not addUser, not createNewUser, not createUser(data: any).
API endpoint paths, HTTP methods, and request/response types SHALL match api-contracts.<ext> exactly:
/api/users -- not /users, not /api/v1/users (unless the contract says so)POST -- not PUT, not PATCH (unless the contract says so)State transitions SHALL match state-machines.<ext> exactly:
Error codes and messages SHALL match error-catalog.<ext> exactly:
USR-001)From the spec sections, identify every error condition mentioned and implement it:
Match the existing codebase style:
If the codebase is empty (greenfield), follow the conventions specified in the spec or standard conventions for the target language/framework.
When the current WP depends on modules from earlier WPs (per dependency_source_summary input):
After implementing each task, update the WP file:
- [ ] to - [x] for each acceptance criterion that is satisfiedIf a requirement is ambiguous (multiple valid interpretations exist):
[IMPL ISSUE: <description of the ambiguity and the interpretation chosen>]
issues output fieldDo NOT halt for ambiguous requirements. Flag, choose the best interpretation, and continue.
.sdd/plans/contracts/code-implementation invocation handles a single task dispatched by the Coder agent| Scenario | Behavior |
|---|---|
| Missing contract file | Halt. Set status: failure. Report to coordinator. |
| Ambiguous requirement | Flag with [IMPL ISSUE] in WP. Continue with best interpretation. |
| Circular task dependency | Halt. Set status: failure. Report cycle details. |
| Implementation error (e.g., compile failure) | Attempt to fix. If unfixable, report as issue and continue with remaining tasks. |
| Contract appears incorrect | Implement as written. Report as issue. Coordinator escalates to Planner. |
Before implementing, review the patterns input. These are mistakes caught in prior code reviews. Avoid repeating them. If the patterns list is empty ("No active patterns"), proceed normally.