sdd-apply
Implement SDD tasks from specs and design. Trigger: orchestrator launches apply for one or more change tasks.
- License 许可
- MIT
- 最近更新
- 2026-11-15
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- sdd-apply
- license
- MIT
- metadata
- { "author": "gentleman-programming", "version": "3.0", "delegate_only": true }
- description
- Implement SDD tasks from specs and design. Trigger: orchestrator launches apply for one or more change tasks.
- user-invocable
- false
- disable-model-invocation
- true
02 资源文件 1
- 参考文档strict-tdd.md18.1 KB
03 SKILL.md 正文
ORCHESTRATOR GATE: If you loaded this skill via the
skill()tool, you are the ORCHESTRATOR — STOP. Do NOT execute these instructions inline. Delegate to the dedicatedsdd-applysub-agent using your platform's delegation primitive (e.g.,task(...), sub-agent invocation, etc.). This skill is for EXECUTORS only.
Executor Override
If you ARE the sdd-apply sub-agent (NOT the orchestrator), the gate above does NOT apply to you. Continue with the phase work below. Do NOT delegate. Do NOT call the Skill tool. You are the executor — execute.
Language Domain Contract
Generated technical artifacts default to English. Do not inherit the user's conversational language or the active persona's regional voice for SDD artifacts unless the user explicitly requests that artifact language or the project convention requires it.
If Spanish technical artifacts are explicitly requested, use neutral/professional Spanish unless the user explicitly asks for a regional variant.
Public/contextual comments follow the target context language by default. Explicit user language or tone overrides win; Spanish comments default to neutral/professional Spanish unless the user or target context clearly calls for regional tone.
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")
- Artifact store mode (
engram | openspec | hybrid | none) - Structured status from
skills/_shared/sdd-status-contract.md:schemaName,planningHome,changeRoot,artifactPaths,contextFiles,applyState, task progress, dependency states, andactionContext - Delivery strategy and resolved workload decision (
ask-on-risk | auto-chain | single-pr | exception-ok, plus PR slice orsize:exceptionwhen applicable)
Execution and Persistence Contract
Follow Section B (retrieval) and Section C (persistence) from
skills/_shared/sdd-phase-common.md.
- engram: Read
sdd/{change-name}/proposal,sdd/{change-name}/spec,sdd/{change-name}/design,sdd/{change-name}/tasks(all required — keep tasks ID for updates). Mark tasks complete viamem_update(id: {tasks-observation-id}, content: "..."). Save progress assdd/{change-name}/apply-progress. - openspec: Read and follow
skills/_shared/openspec-convention.md. Updatetasks.mdwith[x]marks. - hybrid: Follow BOTH conventions — persist progress to Engram (
mem_updatefor tasks) AND updatetasks.mdwith[x]marks on filesystem. - none: Return progress only. Do not update project artifacts.
Status and Workspace Guard
Before reading implementation files or writing code, consume the structured status provided by the orchestrator or build the equivalent status from artifacts.
- If
applyStateisblocked, STOP and returnblockedwith the missing artifacts or unsafe context. - If
applyStateisall_done, do not edit. Returnsuccesswithnext_recommended: sdd-verifyorsdd-archivebased on dependency state. - If
applyStateisready, proceed only on the assigned pending tasks. - Read context from
contextFiles/artifactPathsinstead of assuming fixed filenames. For spec-driven OpenSpec, these normally map to proposal, specs, design, and tasks. - If
actionContext.modeisworkspace-planningandallowedEditRootsis empty, STOP before editing. Treat linked repos and folders as read-only planning context. - If
allowedEditRootsis present, edit only files under those roots. If a needed edit is outside the allowed roots, STOP and report the unsafe path.
What to Do
Step 1: Load Skills
Follow Section A from skills/_shared/sdd-phase-common.md.
Step 2: Read Context
Before writing ANY code:
- Read the structured status and confirm
applyState: ready - Read every applicable artifact path/topic in
contextFiles - Read the specs — understand WHAT the code must do
- Read the design — understand HOW to structure the code
- Read existing code in affected files — understand current patterns
- Check the project's coding conventions from
config.yaml
Step 2a: Enforce Review Workload Decision
Before implementing, inspect the tasks artifact for Review Workload Forecast.
If the forecast says any of the following:
400-line budget risk: HighChained PRs recommended: YesDecision needed before apply: Yes
Then you MUST confirm the orchestrator/user provided a resolved delivery path:
auto-chainor chosen chained/stacked PR mode: implement only the assigned work-unit slice, keep scope autonomous, and report the intended PR boundary. Follow theChain strategyfrom the tasks artifact (stacked-to-mainorfeature-branch-chain) for branch targeting.exception-okor single PR with exception: continue only if the prompt explicitly says the maintainer acceptssize:exception.single-prabove budget: continue only after the prompt explicitly recordssize:exception.
Also check for Chain strategy in the tasks artifact. If present and not pending, follow it consistently:
stacked-to-main: each PR targets the previous PR's branch (ormainafter the previous merges).feature-branch-chain: PR #1 targets the feature/tracker branch; later PRs target the immediate previous PR branch. The tracker PR aggregates the feature branch tomain; child PR diffs must stay focused on only the current work unit and must never targetmaindirectly.
If neither delivery decision nor chain strategy is present, STOP before writing code and return blocked with: Workload decision required before apply: estimated work may exceed 400 changed lines. Ask the user which chain strategy to use (stacked-to-main, feature-branch-chain, or size-exception).
Step 2b: Read Previous Apply-Progress (if exists)
Before starting work, check for existing apply-progress:
mem_search(query: "sdd/{change-name}/apply-progress", project: "{project}")- If found:
mem_get_observation(id)→ read the full content - Parse which tasks are already marked complete
- Skip those tasks — start from the first incomplete task
- When saving your apply-progress in Step 6, MERGE: include all previously completed tasks PLUS your newly completed tasks in a single combined artifact
CRITICAL: If the orchestrator told you previous progress exists, you MUST read it. If you overwrite without reading, completed work from prior batches is permanently lost.
Step 3: Read Testing Capabilities and Resolve Mode
Read the cached testing capabilities to determine implementation mode:
Read testing capabilities from:
├── engram: mem_search("sdd/{project}/testing-capabilities") → mem_get_observation(id)
├── openspec: openspec/config.yaml → strict_tdd + testing section
└── Fallback: check project files directly (package.json, go.mod, etc.)
Resolve mode:
├── IF strict_tdd: true AND test runner exists
│ └── STRICT TDD MODE → Load and follow strict-tdd.md module
│ (read the file: skills/sdd-apply/strict-tdd.md)
│
├── IF strict_tdd: false OR no test runner
│ └── STANDARD MODE → use Step 4 below (no TDD module loaded)
│
└── Cache the resolved mode for the return summary
Key principle: If Strict TDD Mode is not active, ZERO TDD instructions are loaded. The strict-tdd.md module is never read, never processed, never consumes tokens.
Hard Gate (Strict TDD Only)
If Strict TDD Mode is active (either from orchestrator injection or self-discovery):
- You MUST produce a TDD Cycle Evidence table in your apply-progress artifact
- Each task row MUST have: RED (test written first) → GREEN (implementation passes) → REFACTOR columns
- If you complete a task WITHOUT writing tests first, mark it as FAILED in the evidence table
- The verify phase WILL reject your work if the TDD Evidence table is missing or incomplete
There is no silent fallback. If you resolved Strict TDD as active, you follow it or you report failure. You do NOT quietly switch to Standard Mode.
Step 4: Implement Tasks (Standard Workflow)
This step is used when Strict TDD Mode is NOT active:
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
├── Mark task as complete [x] in the persisted tasks artifact immediately
└── Note any issues or deviations
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
This step is MANDATORY — do NOT skip it.
Follow Section C from skills/_shared/sdd-phase-common.md.
- artifact:
apply-progress - topic_key:
sdd/{change-name}/apply-progress - type:
architecture - Also update the tasks artifact with
[x]marks viamem_update(engram) or file edit (openspec/hybrid).
Merge Protocol
When saving apply-progress:
- If you read previous progress in Step 2b, your artifact MUST include ALL previously completed tasks (copy their status and evidence) PLUS your new completions
- The final artifact should show the cumulative state of ALL tasks across ALL batches
- Format: keep the same structure but ensure no completed task is lost from prior batches
Step 7: Return Summary
Before returning, re-read the persisted tasks artifact and confirm every task you report as completed is marked [x] there. If the artifact still shows a completed task as - [ ], fix the checkbox before returning. Do not report Ready for verify while completed work is only reflected in internal todos or apply-progress.
Return to the orchestrator:
## Implementation Progress
**Change**: {change-name}
**Mode**: {Strict TDD | Standard}
### 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} |
{IF Strict TDD Mode → include TDD Cycle Evidence table from strict-tdd.md}
### Deviations from Design
{List any places where the implementation deviated from design.md and why.
If none, say "None — implementation matches design."}
### Issues Found
{List any problems discovered during implementation.
If none, say "None."}
### Remaining Tasks
- [ ] {next task}
- [ ] {next task}
### Workload / PR Boundary
- Mode: {single PR | chained PR slice | stacked PR slice | size:exception}
- Current work unit: {unit name or "N/A"}
- Boundary: {what this apply batch starts from and ends with}
- Estimated review budget impact: {brief note}
### Status
{N}/{total} tasks complete. {Ready for next batch / Ready for verify / Blocked by X}
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 consume or produce structured status before implementation; do not infer readiness from conversation alone
- STOP on
applyState: blockedand do not edit; STOP on unsafeactionContextor edit roots - In
openspecmode, mark tasks complete intasks.mdAS you go, not at the end - Before returning, re-read the persisted tasks artifact and ensure completed tasks are visibly marked
[x]; internal todos are not completion evidence - 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
- If workload forecast requires a decision and none was provided, STOP before writing code
- When applying a chained/stacked PR slice, keep the batch autonomous: one deliverable scope, verification included, and clear rollback boundary
- When applying
size:exception, state it explicitly in apply-progress and the return summary - NEVER implement tasks that weren't assigned to you
- Skill loading is handled in Step 1 — follow any loaded skills strictly when writing code
- Apply any
rules.applyfromopenspec/config.yaml - If Strict TDD Mode is active (Step 3), load
strict-tdd.mdand follow its cycle INSTEAD of Step 4 - When Strict TDD is active, the
strict-tdd.mdmodule's rules OVERRIDE Step 4 entirely - Return envelope per Section D from
skills/_shared/sdd-phase-common.md.
04 同仓库更多 Skills
invocable-skill
Run a security audit on the specified target. Use when asked to audit, scan, or assess security posture.
invocable-skill
Run a security audit on the specified target. Use when asked to audit, scan, or assess security posture.
work-unit-commits
Plan commits as reviewable work units. Trigger: implementation, commit splitting, chained PRs, or keeping tests and docs with code.
skill-registry
Trigger: update skills, skill registry, actualizar skills, after skill changes. Index available skills by trigger and path.
skill-improver
Trigger: improve skills, audit skills, refactor skills, skill quality. Audit and upgrade existing LLM-first skills.
skill-creator
Trigger: new skills, agent instructions, documenting AI usage patterns. Create LLM-first skills with valid frontmatter.