Skip to main content
The sdd-apply sub-agent (v2.0) implements tasks by writing actual code. It follows specs and design strictly, and supports both standard and TDD workflows.

Metadata

string
sdd-apply
string
2.0
string
gentleman-programming
string
MIT

When It’s Triggered

The orchestrator launches sdd-apply when:
  • User runs /sdd-apply or /sdd-continue
  • User wants to implement specific tasks from a change
  • Tasks are ready and user wants code written

What It Receives

From the orchestrator:
  • Change name
  • Specific task(s) to implement (e.g., “Phase 1, tasks 1.1-1.3”)
  • Artifact store mode (engram | openspec | none)

What It Does

Step 1: Read Context

Before writing ANY code:
  1. Read the specs — understand WHAT the code must do
  2. Read the design — understand HOW to structure the code
  3. Read existing code in affected files — understand current patterns
  4. Check the project’s coding conventions from config.yaml

Step 2: Detect Implementation Mode

Determines if the project uses TDD:

TDD Workflow (RED → GREEN → REFACTOR)

When TDD is active, EVERY task follows this cycle:

Standard Workflow

When TDD is not active:

Step 3: Detect Test Runner

For TDD mode, detects the test runner:

Step 4: Mark Tasks Complete

Updates tasks.md — changes - [ ] to - [x] for completed tasks:

Step 5: Return Summary

Returns a result envelope with implementation progress.

Result Envelope Example (TDD Mode)

Result Envelope Example (Standard Mode)

Rules

  • ALWAYS read specs before implementing — specs are your acceptance criteria
  • ALWAYS follow the design decisions — don’t freelance a different approach
  • ALWAYS match existing code patterns and conventions in the project
  • In openspec mode, mark tasks complete in tasks.md AS you go, not at the end
  • If you discover the design is wrong or incomplete, NOTE IT in your return summary — don’t silently deviate
  • If a task is blocked by something unexpected, STOP and report back
  • NEVER implement tasks that weren’t assigned to you
  • Load and follow any relevant coding skills for the project stack (e.g., react-19, typescript, django-drf, tdd, pytest, vitest) if available in the user’s skill set
  • Apply any rules.apply from openspec/config.yaml
  • If TDD mode is detected, ALWAYS follow the RED → GREEN → REFACTOR cycle — never skip RED (writing the failing test first)
  • When running tests during TDD, run ONLY the relevant test file/suite, not the entire test suite (for speed)
  • Return a structured envelope with: status, executive_summary, detailed_report, artifacts, next_recommended, and risks

Version 2.0 Features

v2.0 introduced:

TDD Support

  • Automatic TDD mode detection
  • RED → GREEN → REFACTOR workflow
  • Test runner detection and execution
  • Verification that tests fail before passing

Test Execution

  • Runs tests during implementation (not just verification)
  • Reports test results in the progress envelope
  • Detects test commands from config or project files

Skill Integration

  • Loads user’s installed coding skills (e.g., tdd/SKILL.md, pytest/SKILL.md, vitest/SKILL.md)
  • Follows skill-specific patterns for writing tests
  • Adapts to project-specific conventions

Enhanced Reporting

  • TDD cycle status table (RED/GREEN/REFACTOR)
  • Test file references
  • Deviations from design explicitly called out