SDD Implementer
This skill handles the "last mile" of development. It focuses on speed and consistency by using verified templates (Scaffolds) and enforcing knowledge capture on completion.
Core Responsibilities
- Scaffold Execution: Use
sdd-knowledge-base templates (matched by tags) to generate boilerplate code instantly.
- Feedback Loop: If implementation reveals a spec issue, trigger
/sdd-spec-update.
- Mandatory Knowledge Capture: After feature completion, enforce pattern/lesson extraction.
Commands
/sdd-impl-start [task-id]: Load context and scaffold code. If task-id is omitted, executes all pending tasks in dependency order. If task-id is provided, executes only the specified task.
/sdd-impl-finish: Mark task complete, trigger auto-verification, and enforce knowledge extraction.
/sdd-impl-fix: Request a fix for a failed guardrail check.
Scaffolding Logic
When /sdd-impl-start is called:
Execution Mode Resolution
- If
task-id is provided: Execute scaffolding for that single task (steps below).
- If
task-id is omitted (batch mode):
- Read
.sdd/plan/<feature-id>/tasks.json.
- Filter tasks where
status is NOT "done" and NOT "verified".
- Sort remaining tasks by dependency order (tasks with no unresolved dependencies first).
- Execute the scaffolding flow below for each task sequentially.
- After completing each task, log progress (e.g., "Task 3/5 complete") and proceed to the next automatically.
Per-Task Scaffolding Flow
- Read Project Rules (MANDATORY FIRST STEP):
- Load
project_rules.md from .sdd/context/.
- Extract Coding Standards (naming conventions, function size, documentation rules).
- Extract Architecture conventions (directory structure, layer ordering, dependency direction).
- Extract Testing requirements (unit test expectations, integration test scope).
- These rules constrain ALL subsequent code generation. Every line of generated code MUST comply.
- Check Task Type (e.g., "Create Endpoint").
- Check Context: Read
.sdd/context/context.json to get current_feature.
- Read Task: Load from
.sdd/plan/<feature-id>/tasks.json using the task ID.
- Read Design Spec (MANDATORY): Load all available spec artifacts from
.sdd/spec/<feature-id>/ and identify elements relevant to this task. The following may exist depending on the feature's design:
architecture.json — component boundaries, layer structure, data flow direction (always present).
object_design.json — design unit definitions, properties, method signatures, relationships (if applicable).
data_model.json — data entity schemas, field types, relationships (if feature involves persistent data or domain entities).
openapi.yaml — API contracts, request/response schemas, status codes (if feature involves HTTP APIs).
interface_contract.json — non-HTTP interface definitions (if applicable).
The generated code MUST conform to whichever specs are present:
- Use the exact names defined in
object_design.json for all design units (classes, components, modules, hooks, etc.).
- Implement all properties and method signatures as specified.
- Respect the layer assignments and
kind designations.
- Maintain the relationships (dependency, composition, implementation, uses, emits, etc.) as defined.
- Follow component boundaries and data flow direction from
architecture.json.
- Match the contracts defined in any interface spec artifacts that are present.
- If a spec artifact does not exist for this feature, that aspect is unconstrained.
- If a task maps to no design unit in
object_design.json, proceed without constraint but log a warning in the session log.
- Validate Target Path: Ensure the task's
target_path follows project_rules.md conventions.
- Query Knowledge Base (Index-Based): Read
.sdd/knowledge/index.json, filter patterns by tags matching the current task's domain and stack. Load ONLY the matched pattern files. Do NOT scan the full patterns/ directory.
- Output the knowledge match results before generating code:
📚 **Knowledge Loaded** (stage: impl)
| Type | ID | Matched Tags | Summary |
|------|----|-------------|---------|
| <type> | <id> | `<tag1>`, `<tag2>` | <summary> |
> No knowledge matched. (if empty)
- Generate/Scaffold:
- If a pattern exists, use it as a base, but override with the design spec (names, contracts, schemas) from Step 5.
- If not, generate idiomatic code based on the available design specs from Step 5,
project_rules.md, and the technology stack.
- Place generated code at the
target_path specified in the task using the write_file tool.
Session Log (MANDATORY)
After completing each task, or when the user provides feedback/corrections during implementation, append an entry to .sdd/logs/session.md (see templates/session.md for format) with:
- Timestamp and task ID
- What was done or changed
- Any user feedback or corrections applied
- Any spec drift or guardrail failures encountered
This log persists across sessions and is the primary input for knowledge extraction at /sdd-impl-finish. Without it, lessons from previous sessions are lost.
Feedback Loop (Drift Management)
If the developer (or agent) realizes any spec artifact (openapi.yaml, object_design.json, data_model.json) is missing a field or has an inconsistency during implementation:
- Do NOT just hack the code.
- Call
/sdd-spec-update (via sdd-design-engine).
- Wait for Spec update.
- Record a lesson: the gap between spec and reality.
- Resume implementation.
Task Completion Behavior
After each task is implemented:
- Per-Task Build Verification (MANDATORY):
- Run the project's build / type-check / compile command (determined from
context.json and project_rules.md) to catch errors immediately. If no build commands are defined in project_rules.md, skip automated build verification and note this in the session log.
- Run unit tests relevant to the current task (e.g., the spec file co-located with the generated code). If no test commands are defined, skip and note in the session log.
- If either check fails, fix the errors before marking the task as done. Log all failures and fixes in the session log.
- This ensures errors are caught early per-task rather than accumulating to the finish phase.
- Update the task's status to
done in tasks.json.
- Append the session log entry as described above.
- Inform the user of progress (e.g., "Task 3/5 complete").
- In batch mode: Automatically proceed to the next pending task.
- In single-task mode: Stop after the specified task.
- Do NOT auto-trigger the finish flow. The verification, knowledge extraction, and archival steps below are ONLY executed when the user explicitly calls
/sdd-impl-finish.
Completion & Mandatory Knowledge Extraction
User-Triggered Only: This entire flow is ONLY executed when the user explicitly calls /sdd-impl-finish. Never run it automatically after completing tasks.
When /sdd-impl-finish is called:
Step 1: Verification
- Run guardrail checks (
/sdd-guard-check code) on all implemented files.
- Run the full build and all tests (unit + integration) to ensure end-to-end correctness. Use the build/test commands from
project_rules.md. Per-task verification catches local errors early; this step catches cross-task integration issues.
- Verify all tasks for the feature have status
done or verified.
- If build or tests fail, fix the issues before proceeding. Log all failures and fixes in the session log.
- Only after all checks pass, set
context.json.current_stage to "impl-complete". This is the sole trigger for impl-complete — it is NOT set automatically when tasks finish.
Step 2: Knowledge Extraction (MANDATORY)
Instead of asking "would you like to save patterns?", the agent auto-generates drafts, triages them, and presents for user confirmation:
Read Session Log: Load .sdd/logs/session.md for the full implementation history across ALL sessions. This is the primary source of truth for what happened during implementation.
Pattern Draft: Analyze the implemented code and session log for reusable patterns.
- Identify repeating code structures (e.g., "form with validation and error handling", "data fetching with caching", "reusable UI component with props/events", "CLI command with arg parsing", "API endpoint with auth middleware").
- Generate a draft pattern with suggested tags (e.g.,
["validation", "form", "error-handling"]).
Lesson Draft: Review session log AND current conversation for gaps:
- Were there spec updates (
/sdd-spec-update calls)?
- Were there guardrail failures?
- Were there user corrections during clarification?
- For each gap, generate a draft lesson.
Knowledge Triage (MANDATORY): Execute the full Knowledge Triage protocol as defined in sdd-knowledge-base/SKILL.md (Steps 1–4: Dedup → Specificity Check → Present triage table → Execute confirmed actions). Update context.json.active_patterns and context.json.applied_lessons.
Step 3: Feature Archival
- MOVE (not copy)
.sdd/spec/<feature-id>/ and .sdd/plan/<feature-id>/ into .sdd/features/<feature-id>/spec/ and .sdd/features/<feature-id>/plan/.
- Move feature from
current_feature to completed_features.
- Reset
current_stage to "init" and current_feature to null.
Step 4: Clear Session Log
Delete the contents of .sdd/logs/session.md (or remove the file) to start fresh for the next feature.
During-Implementation Lessons
Lessons are not only recorded at /sdd-impl-finish. During implementation, if:
- A spec update is triggered → record as lesson
- A guardrail fails and is fixed → record as lesson
- An unexpected framework behavior is encountered → record as lesson
These are recorded immediately via /sdd-learn (which applies Knowledge Triage — dedup and specificity check — before saving). Additionally, every such event MUST be appended to .sdd/logs/session.md so it is preserved across sessions.
Integration
- Consumes:
.sdd/plan/<feature-id>/tasks.json, .sdd/spec/<feature-id>/* (object_design.json, architecture.json, data_model.json, openapi.yaml, interface_contract.json), project_rules.md, knowledge/patterns (by tags).
- Invokes:
sdd-guardrails (for verification), sdd-design-engine (for spec updates), sdd-knowledge-base (for pattern/lesson saving).
1---2name: sdd-implementer3description: Execution engine that turns plans into code using scaffold templates and feedback loops.4---56# SDD Implementer78This skill handles the "last mile" of development. It focuses on speed and consistency by using verified templates (Scaffolds) and enforcing knowledge capture on completion.910## Core Responsibilities11121. **Scaffold Execution**: Use `sdd-knowledge-base` templates (matched by tags) to generate boilerplate code instantly.132. **Feedback Loop**: If implementation reveals a spec issue, trigger `/sdd-spec-update`.143. **Mandatory Knowledge Capture**: After feature completion, enforce pattern/lesson extraction.1516## Commands1718- `/sdd-impl-start [task-id]`: Load context and scaffold code. If `task-id` is omitted, executes **all** pending tasks in dependency order. If `task-id` is provided, executes only the specified task.19- `/sdd-impl-finish`: Mark task complete, trigger auto-verification, and enforce knowledge extraction.20- `/sdd-impl-fix`: Request a fix for a failed guardrail check.2122## Scaffolding Logic2324When `/sdd-impl-start` is called:2526### Execution Mode Resolution27- **If `task-id` is provided**: Execute scaffolding for that single task (steps below).28- **If `task-id` is omitted (batch mode)**:29 1. Read `.sdd/plan/<feature-id>/tasks.json`.30 2. Filter tasks where `status` is NOT `"done"` and NOT `"verified"`.31 3. Sort remaining tasks by dependency order (tasks with no unresolved dependencies first).32 4. Execute the scaffolding flow below **for each task sequentially**.33 5. After completing each task, log progress (e.g., "Task 3/5 complete") and proceed to the next automatically.3435### Per-Task Scaffolding Flow361. **Read Project Rules (MANDATORY FIRST STEP)**:37 1. Load `project_rules.md` from `.sdd/context/`.38 2. Extract **Coding Standards** (naming conventions, function size, documentation rules).39 3. Extract **Architecture** conventions (directory structure, layer ordering, dependency direction).40 4. Extract **Testing** requirements (unit test expectations, integration test scope).41 5. These rules constrain ALL subsequent code generation. Every line of generated code MUST comply.422. Check Task Type (e.g., "Create Endpoint").433. **Check Context**: Read `.sdd/context/context.json` to get `current_feature`.444. **Read Task**: Load from `.sdd/plan/<feature-id>/tasks.json` using the task ID.455. **Read Design Spec (MANDATORY)**: Load **all available** spec artifacts from `.sdd/spec/<feature-id>/` and identify elements relevant to this task. The following may exist depending on the feature's design:46 - `architecture.json` — component boundaries, layer structure, data flow direction (always present).47 - `object_design.json` — design unit definitions, properties, method signatures, relationships (if applicable).48 - `data_model.json` — data entity schemas, field types, relationships (if feature involves persistent data or domain entities).49 - `openapi.yaml` — API contracts, request/response schemas, status codes (if feature involves HTTP APIs).50 - `interface_contract.json` — non-HTTP interface definitions (if applicable).51 The generated code MUST conform to whichever specs are present:52 - Use the exact names defined in `object_design.json` for all design units (classes, components, modules, hooks, etc.).53 - Implement all properties and method signatures as specified.54 - Respect the layer assignments and `kind` designations.55 - Maintain the relationships (dependency, composition, implementation, uses, emits, etc.) as defined.56 - Follow component boundaries and data flow direction from `architecture.json`.57 - Match the contracts defined in any interface spec artifacts that are present.58 - If a spec artifact does not exist for this feature, that aspect is unconstrained.59 - If a task maps to no design unit in `object_design.json`, proceed without constraint but log a warning in the session log.606. **Validate Target Path**: Ensure the task's `target_path` follows `project_rules.md` conventions.617. **Query Knowledge Base (Index-Based)**: Read `.sdd/knowledge/index.json`, filter `patterns` by tags matching the current task's domain and stack. Load ONLY the matched pattern files. Do NOT scan the full `patterns/` directory.628. **Output the knowledge match results** before generating code:6364```65📚 **Knowledge Loaded** (stage: impl)6667| Type | ID | Matched Tags | Summary |68|------|----|-------------|---------|69| <type> | <id> | `<tag1>`, `<tag2>` | <summary> |7071> No knowledge matched. (if empty)72```73749. **Generate/Scaffold**:75 - If a pattern exists, use it as a base, but override with the design spec (names, contracts, schemas) from Step 5.76 - If not, generate idiomatic code based on the available design specs from Step 5, `project_rules.md`, and the technology stack.7710. Place generated code at the `target_path` specified in the task using the **write_file tool**.7879## Session Log (MANDATORY)8081After completing each task, or when the user provides feedback/corrections during implementation, **append** an entry to `.sdd/logs/session.md` (see `templates/session.md` for format) with:82- Timestamp and task ID83- What was done or changed84- Any user feedback or corrections applied85- Any spec drift or guardrail failures encountered8687This log **persists across sessions** and is the primary input for knowledge extraction at `/sdd-impl-finish`. Without it, lessons from previous sessions are lost.8889## Feedback Loop (Drift Management)9091If the developer (or agent) realizes any spec artifact (`openapi.yaml`, `object_design.json`, `data_model.json`) is missing a field or has an inconsistency during implementation:921. **Do NOT** just hack the code.932. Call `/sdd-spec-update` (via `sdd-design-engine`).943. Wait for Spec update.954. Record a lesson: the gap between spec and reality.965. Resume implementation.9798## Task Completion Behavior99100After each task is implemented:1011. **Per-Task Build Verification (MANDATORY)**:102 1. Run the project's build / type-check / compile command (determined from `context.json` and `project_rules.md`) to catch errors immediately. If no build commands are defined in `project_rules.md`, skip automated build verification and note this in the session log.103 2. Run unit tests relevant to the current task (e.g., the spec file co-located with the generated code). If no test commands are defined, skip and note in the session log.104 3. If either check fails, fix the errors **before** marking the task as done. Log all failures and fixes in the session log.105 4. This ensures errors are caught early per-task rather than accumulating to the finish phase.1062. Update the task's status to `done` in `tasks.json`.1073. Append the session log entry as described above.1084. Inform the user of progress (e.g., "Task 3/5 complete").1095. **In batch mode**: Automatically proceed to the next pending task.1106. **In single-task mode**: Stop after the specified task.1117. **Do NOT auto-trigger the finish flow.** The verification, knowledge extraction, and archival steps below are ONLY executed when the user explicitly calls `/sdd-impl-finish`.112113## Completion & Mandatory Knowledge Extraction114115> **User-Triggered Only**: This entire flow is ONLY executed when the user explicitly calls `/sdd-impl-finish`. Never run it automatically after completing tasks.116117When `/sdd-impl-finish` is called:118119### Step 1: Verification1201. Run guardrail checks (`/sdd-guard-check code`) on all implemented files.1212. Run the **full build** and **all tests** (unit + integration) to ensure end-to-end correctness. Use the build/test commands from `project_rules.md`. Per-task verification catches local errors early; this step catches cross-task integration issues.1223. Verify all tasks for the feature have status `done` or `verified`.1234. If build or tests fail, fix the issues before proceeding. Log all failures and fixes in the session log.1245. **Only after all checks pass**, set `context.json.current_stage` to `"impl-complete"`. This is the sole trigger for `impl-complete` — it is NOT set automatically when tasks finish.125126### Step 2: Knowledge Extraction (MANDATORY)127Instead of asking "would you like to save patterns?", the agent **auto-generates drafts**, triages them, and presents for user confirmation:1281291. **Read Session Log**: Load `.sdd/logs/session.md` for the full implementation history across ALL sessions. This is the primary source of truth for what happened during implementation.1301312. **Pattern Draft**: Analyze the implemented code and session log for reusable patterns.132 - Identify repeating code structures (e.g., "form with validation and error handling", "data fetching with caching", "reusable UI component with props/events", "CLI command with arg parsing", "API endpoint with auth middleware").133 - Generate a draft pattern with suggested **tags** (e.g., `["validation", "form", "error-handling"]`).1341353. **Lesson Draft**: Review session log AND current conversation for gaps:136 - Were there spec updates (`/sdd-spec-update` calls)?137 - Were there guardrail failures?138 - Were there user corrections during clarification?139 - For each gap, generate a draft lesson.1401414. **Knowledge Triage** (MANDATORY): Execute the full Knowledge Triage protocol as defined in `sdd-knowledge-base/SKILL.md` (Steps 1–4: Dedup → Specificity Check → Present triage table → Execute confirmed actions). Update `context.json.active_patterns` and `context.json.applied_lessons`.142143### Step 3: Feature Archival1441. **MOVE** (not copy) `.sdd/spec/<feature-id>/` and `.sdd/plan/<feature-id>/` into `.sdd/features/<feature-id>/spec/` and `.sdd/features/<feature-id>/plan/`.1452. Move feature from `current_feature` to `completed_features`.1463. Reset `current_stage` to `"init"` and `current_feature` to `null`.147148### Step 4: Clear Session Log149Delete the contents of `.sdd/logs/session.md` (or remove the file) to start fresh for the next feature.150151## During-Implementation Lessons152153Lessons are not only recorded at `/sdd-impl-finish`. During implementation, if:154- A spec update is triggered → record as lesson155- A guardrail fails and is fixed → record as lesson156- An unexpected framework behavior is encountered → record as lesson157158These are recorded immediately via `/sdd-learn` (which applies Knowledge Triage — dedup and specificity check — before saving). Additionally, every such event MUST be appended to `.sdd/logs/session.md` so it is preserved across sessions.159160## Integration161162- **Consumes**: `.sdd/plan/<feature-id>/tasks.json`, `.sdd/spec/<feature-id>/*` (`object_design.json`, `architecture.json`, `data_model.json`, `openapi.yaml`, `interface_contract.json`), `project_rules.md`, `knowledge/patterns` (by tags).163- **Invokes**: `sdd-guardrails` (for verification), `sdd-design-engine` (for spec updates), `sdd-knowledge-base` (for pattern/lesson saving).