openspec-apply-subagent
Implement tasks from an OpenSpec change by delegating task execution to the spec-coder-sub subagent.
- License 许可
- MIT
- 最近更新
- 2026-09-05
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- openspec-apply-subagent
- license
- MIT
- metadata
- { "author": "openspec", "version": "1.0" }
- description
- Implement tasks from an OpenSpec change by delegating task execution to the spec-coder-sub subagent.
- allowed-tools
- bash, read, edit, glob, grep, todoread, todowrite, task, question
- compatibility
- Requires openspec CLI.
03 SKILL.md 正文
Implement tasks from an OpenSpec change via delegated subagent.
Input: Optionally specify a change name. If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
Steps
-
Select the change
If a name is provided, use it. Otherwise:
- Infer from conversation context if the user mentioned a change
- Auto-select if only one active change exists
- If ambiguous, run
openspec list --jsonto get available changes and use the AskUserQuestion tool to let the user select
Always announce: "Using change: <name>" and how to override (e.g.,
/opsx:apply <other>). -
Check status to understand the schema
openspec status --change "<name>" --jsonParse the JSON to understand:
schemaName: The workflow being used (e.g., "spec-driven")planningHome,changeRoot, andactionContext: planning scope and edit constraints- Which artifact contains the tasks (typically "tasks" for spec-driven, check status for others)
-
Get apply instructions
openspec instructions apply --change "<name>" --jsonThis returns:
contextFiles: artifact ID -> array of concrete file paths (varies by schema - could be proposal/specs/design/tasks or spec/tests/implementation/docs)- Progress (total, complete, remaining)
- Task list with status
- Dynamic instruction based on current state
Handle states:
- If
state: "blocked"(missing artifacts): show message, suggest using openspec-continue-change - If
state: "all_done": congratulate, suggest archive - Otherwise: proceed to implementation
-
Read context files
Read every file path listed under
contextFilesfrom the apply instructions output. The files depend on the schema being used:- spec-driven: proposal, specs, design, tasks
- Other schemas: follow the contextFiles from CLI output
-
Show current progress
Display:
- Schema being used
- Progress: "N/M tasks complete"
- Remaining tasks overview
- Dynamic instruction from CLI
-
Delegate Task Implementation to
spec-coder-subSubagentCRITICAL DELEGATION DIRECTIVE: Do NOT perform code edits or task implementation directly on the primary agent.
Delegate task execution to the
spec-coder-subsubagent (viatask/invoke_subagenttool):- Subagent Name:
spec-coder-sub - Instruction Prompt:
"Implement pending tasks for OpenSpec change '<name>'. Work through remaining tasks in tasks.md sequentially, perform minimal code modifications, run verification commands, and update checkboxes from - [ ] to - [x]."
- Context to pass:
- The complete output from
openspec instructions apply --change "<name>" --json. - The target change folder and file paths listed in
contextFiles.
- The complete output from
- Subagent Model Hierarchy & Fallback Protocol:
- Default (OpenCode Go Subsidized): Delegates to
spec-coder-sub(runsopencode-go/deepseek-v4-flash). - Fallback 1 (Direct DeepSeek API Pay-As-You-Go): If OpenCode Go quota or rate limit (
429) is hit, re-execute subagent specifying--model deepseek/deepseek-v4-flash. - Fallback 2 (Free Zero-Cost Tier): If direct DeepSeek API limits are reached, re-execute subagent specifying
--model opencode/deepseek-v4-flash-free.
- Default (OpenCode Go Subsidized): Delegates to
Monitor
spec-coder-subexecution until completed or paused due to a blocker/error. - Subagent Name:
-
Verify & Sync Specs
- Automatically trigger
openspec-verify-changeskill (or/opsx:verify) to validate implementation completeness and correctness. - If verification passes with no CRITICAL issues:
- Sync specs:
openspec specs apply --change "<name>" - Suggest archiving via
openspec archive <name>.
- Sync specs:
- Automatically trigger
-
Single-Pass Automated Repair (Max Retries = 1)
- If CRITICAL issues or failed test verification errors are detected on the first pass:
- Announce: "Verification failed on initial pass. Attempting a single bounded repair pass via subagent..."
- Delegate a single-pass repair task to
spec-coder-subwith the verification failure context:"Fix the specific verification failures and test errors reported for change '<name>'. Refer to the error log, make minimal targeted patches to resolve the failures, run verification commands, and update tasks.md."
- Re-run verification (
openspec-verify-change). - If verification passes after repair:
- Sync specs:
openspec specs apply --change "<name>" - Suggest archiving via
openspec archive <name>.
- Sync specs:
- If verification STILL fails after the single repair pass:
- HALT: Do NOT loop or re-run again. Present the Verification Report and remaining blockers to the user for manual guidance.
- If CRITICAL issues or failed test verification errors are detected on the first pass:
04 同仓库更多 Skills
visual-playground
Create and configure interactive or static design playgrounds (sandboxes) for playtesting visual features, layouts, animations, sound effects, or font choices. Use this skill whenever the user wants to test, playtest, experiment, compare, showcase, or prototype visual variants, designs, typography, buttons, or audio feedback, even if they don't explicitly name it a "playground."
teach
Teach the user a new skill or concept, within this workspace.
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.
setup-matt-pocock-skills
Configure this repo for the engineering skills — set up its issue tracker, triage label vocabulary, and domain doc layout. Run once before first use of the other engineering skills.
improve-codebase-architecture
Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.
grill-me
A relentless interview to sharpen a plan or design.