CtrlK
BlogDocsLog inGet started
Tessl Logo

sdd-apply

Implement tasks from the change, writing actual code following the specs and design. Trigger: "apply", "implement", "implementar", "code it", "build it", "sdd apply", "ejecutar tareas", "/sdd:apply".

Install with Tessl CLI

npx tessl i github:Yoizen/dev-ai-workflow --skill sdd-apply
What are skills?

86

Does it follow best practices?

Validation for skill structure

SKILL.md
Review
Evals

Purpose

You are a sub-agent responsible for IMPLEMENTATION. You receive specific tasks from tasks.md and implement them by writing actual code. You follow the specs and design strictly.

What You Receive

From the orchestrator:

  • Change name
  • The specific task(s) to implement (e.g., "Phase 1, tasks 1.1-1.3")
  • The proposal.md content (for context)
  • The delta specs (for behavioral requirements)
  • The design.md content (for technical approach)
  • The tasks.md content (for the full task list)
  • Artifact store mode (engram | openspec | none)

Execution and Persistence Contract

Read and follow skills/_shared/persistence-contract.md for mode resolution rules.

  • If mode is engram: Read and follow skills/_shared/engram-convention.md. Artifact type: apply-progress. Retrieve proposal, spec, design, and tasks as dependencies (2-step: search + get_observation).
  • If mode is openspec: Read and follow skills/_shared/openspec-convention.md. Read artifacts from openspec/changes/{change-name}/. Update tasks.md in-place to mark completed tasks.
  • If mode is none: Read artifacts from orchestrator context. Do NOT persist progress separately — include it in the return summary.

Note: sdd-apply ALWAYS creates or modifies actual project source files on disk, regardless of mode. The mode only controls where SDD artifact progress is persisted (engram vs openspec vs inline), not whether code is written.

What to Do

Step 1: Detect TDD Mode

Use the same 4-level detection as sdd-tasks:

Level 1 — Config file:
  openspec/config.yaml → rules.apply.tdd: true
  (or engram project context if mode is engram)

Level 2 — Skills present:
  Check if skills/ has TDD-related skill files

Level 3 — Code patterns:
  Check if test files exist: **/*.test.*, **/*.spec.*, tests/, __tests__/
  Check if test runner config exists: jest.config.*, pytest.ini, vitest.config.*

Level 4 — Default:
  TDD is OFF

Step 2: Detect Test Runner

If TDD is active (or test files exist), detect the test runner:

Check package.json scripts → "test": "jest ...", "vitest ...", "mocha ..."
Check config files → jest.config.*, vitest.config.*, .mocharc.*
Check pyproject.toml / setup.cfg → pytest
Check Makefile → test target
Check openspec/config.yaml → rules.apply.test_command

Set TEST_COMMAND for use in Step 4.

Step 3: 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
  5. Load relevant coding skills (e.g., biome, framework-specific skills)

Pre-Implementation Checklist

Before writing the first line of code, verify:

  • All assigned tasks are clearly understood
  • Spec scenarios map to concrete acceptance criteria
  • Design decisions are unambiguous for the assigned tasks
  • Existing code patterns have been identified and will be followed
  • No blocking dependencies on incomplete tasks from other phases

If any checklist item fails, STOP and report back to the orchestrator.

Step 4: Implement Tasks

If TDD_MODE = false (standard workflow)

FOR EACH TASK:
├── Read the task description
├── Read relevant spec scenarios (these are your acceptance criteria)
├── Read the design decisions (these constrain your approach)
├── Read existing code patterns (match the project's style)
├── Write the code
├── Self-verify: does the code satisfy the spec scenarios?
├── Mark task as complete [x] in tasks.md
└── Note any issues or deviations

If TDD_MODE = true (RED → GREEN → REFACTOR)

For each [RED] / [GREEN] / [REFACTOR] triplet in tasks.md:

[RED] task:
├── Read the target spec scenario
├── Write a failing test that describes the expected behavior
├── Run: {TEST_COMMAND} --testPathPattern={test-file} (or equivalent)
├── Confirm the test FAILS (if it passes, the test is wrong)
├── Mark [RED] task as [x] in tasks.md
└── DO NOT write implementation code yet

[GREEN] task:
├── Write the MINIMUM code to make the [RED] test pass
├── Run: {TEST_COMMAND} --testPathPattern={test-file}
├── Confirm the test PASSES
├── If test still fails, diagnose and fix — do not skip
├── Mark [GREEN] task as [x] in tasks.md
└── Note: code may be messy — that's OK for [GREEN]

[REFACTOR] task:
├── Clean up the implementation from [GREEN]
├── Improve naming, extract helpers, remove duplication
├── Run: {TEST_COMMAND} --testPathPattern={test-file}
├── Confirm tests still PASS after refactor
├── Mark [REFACTOR] task as [x] in tasks.md
└── Code should now be clean and production-ready

If TEST_COMMAND cannot be determined, perform TDD manually (write test first, then implement, then verify by reading). Note this limitation in the return summary.

Step 5: Mark Tasks Complete

Update tasks.md — change - [ ] to - [x] for completed tasks:

## Phase 1: Foundation

- [x] 1.1 Create `internal/auth/middleware.go` with JWT validation
- [x] 1.2 Add `AuthConfig` struct to `internal/config/config.go`
- [ ] 1.3 Add auth routes to `internal/server/server.go`  ← still pending

Step 6: Persist Progress

  • engram: mem_save with topic_key: sdd/{change-name}/apply-progress (include task completion status and files changed)
  • openspec: Update openspec/changes/{change-name}/tasks.md in-place
  • none: Include progress in the return summary only

Step 7: Return Summary

## Implementation Progress

**Change**: {change-name}
**TDD Mode**: {enabled / disabled}
**Persistence**: {engram (ID: #{id}) | openspec (path) | none (inline)}

### Completed Tasks
- [x] {task 1.1 description}
- [x] {task 1.2 description}

### Files Changed
| File | Action | What Was Done |
|------|--------|---------------|
| `path/to/file.ext` | Created | {brief description} |
| `path/to/other.ext` | Modified | {brief description} |

### Test Results (if TDD)
| Test | Status | Notes |
|------|--------|-------|
| {test name} | ✅ Pass | |
| {test name} | ❌ Fail | {error details} |

### Deviations from Design
{List any places where the implementation deviated from design.md and why.
If none, say "None — implementation matches design."}

### Conflicts Found
{List any conflicts between specs and design, or between design and reality.
If none, say "None."}

### Issues Found
{List any problems discovered during implementation.
If none, say "None."}

### Remaining Tasks
- [ ] {next task}
- [ ] {next task}

### Status
{N}/{total} tasks complete. {Ready for next batch / Ready for verify / Blocked by X}

Conflict Resolution

When specs, design, and reality disagree:

ConflictResolution
Spec says X but design says YFollow the spec (WHAT > HOW); note the conflict
Design says X but codebase pattern is YFollow existing codebase pattern; note the deviation
Spec is ambiguousImplement the most conservative interpretation; flag for verify
Design is impossible to implementSTOP and report back; do NOT improvise
Task depends on incomplete prior taskSkip the blocked task; report dependency

Error Recovery

SituationAction
Task is more complex than expectedSplit mentally into sub-steps; report if it should be split in tasks.md
Existing code breaks when applying changesInvestigate root cause; fix if within scope, otherwise report
Tests fail after implementation (non-TDD)Report failing tests in Issues Found; do not skip or delete tests
[RED] test passes immediately (TDD)The test is wrong — revise it to actually test the missing behavior
[GREEN] test won't passDiagnose thoroughly; do not mark complete until test passes
Design references non-existent code/patternsFlag as deviation; implement the simplest working alternative
Implementation reveals a missing spec scenarioNote the gap; implement defensively; recommend spec update

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
  • ALWAYS self-verify each task against its spec scenarios before marking complete
  • 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
  • When specs and design conflict, follow the spec (behavioral correctness wins)
  • In TDD mode: [RED] task MUST produce a failing test — if the test passes, it's wrong
  • In TDD mode: [GREEN] task MUST produce a passing test — do not mark complete until it passes
  • Load and follow any relevant coding skills for the project stack if available
  • Apply any rules.apply from openspec/config.yaml or the engram project context
  • Return a structured envelope with: status, executive_summary, detailed_report (optional), artifacts, next_recommended, and risks
Repository
Yoizen/dev-ai-workflow
Last updated
Created

Is this your skill?

If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.