openspec-apply-change
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseImplement tasks from an OpenSpec change.
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 changeIf 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 to get available changes and use the AskUserQuestion tool to let the user select
openspec list --json
Always announce: "Using change: <name>" and how to override (e.g.,)./opsx:apply <other> -
Check status to understand the schemabash
openspec status --change "<name>" --jsonParse the JSON to understand:- : The workflow being used (e.g., "spec-driven", "tdd")
schemaName - Which artifact contains the tasks (typically "tasks" for spec-driven, check status for others)
-
Get apply instructionsbash
openspec instructions apply --change "<name>" --jsonThis returns:- Context 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 (missing artifacts): show message, suggest using openspec-continue-change
state: "blocked" - If : congratulate, suggest archive
state: "all_done" - Otherwise: proceed to implementation
-
Read context filesRead the files listed infrom the apply instructions output. The files depend on the schema being used:
contextFiles- spec-driven: proposal, specs, design, tasks
- tdd: spec, tests, implementation, docs
- Other schemas: follow the contextFiles from CLI output
-
Show current progressDisplay:
- Schema being used
- Progress: "N/M tasks complete"
- Remaining tasks overview
- Dynamic instruction from CLI
-
Implement tasks (loop until done or blocked)For each pending task:
- Show which task is being worked on
- Make the code changes required
- Keep changes minimal and focused
- Mark task complete in the tasks file: →
- [ ]- [x] - Continue to next task
Pause if:- Task is unclear → ask for clarification
- Implementation reveals a design issue → suggest updating artifacts
- Error or blocker encountered → report and wait for guidance
- User interrupts
-
On completion or pause, show statusDisplay:
- Tasks completed this session
- Overall progress: "N/M tasks complete"
- If all done: suggest archive
- If paused: explain why and wait for guidance
Output During Implementation
undefined根据OpenSpec变更内容实现任务。
输入:可选择性指定变更名称。如果未指定,尝试从对话上下文推断。如果模糊或有歧义,必须提示用户选择可用的变更。
步骤
-
选择变更如果提供了名称,则直接使用。否则:
- 从对话上下文推断用户是否提到过某个变更
- 如果仅存在一个活跃变更,则自动选择
- 如果存在歧义,运行 获取可用变更列表,并使用AskUserQuestion工具让用户选择
openspec list --json
必须告知用户:"正在使用变更:<名称>",以及如何覆盖当前选择(例如:)。/opsx:apply <其他变更名称> -
检查状态以了解架构bash
openspec status --change "<name>" --json解析JSON输出以了解:- : 当前使用的工作流(例如:"spec-driven"、"tdd")
schemaName - 哪个工件包含任务(通常在spec-driven模式下为"tasks",其他模式请查看状态输出)
-
获取实施说明bash
openspec instructions apply --change "<name>" --json该命令返回:- 上下文文件路径(根据架构不同而变化,可能是proposal/specs/design/tasks或spec/tests/implementation/docs)
- 进度信息(总任务数、已完成数、剩余数)
- 带状态的任务列表
- 基于当前状态的动态说明
状态处理:- 如果(缺少工件):显示提示信息,建议使用openspec-continue-change
state: "blocked" - 如果:向用户表示祝贺,建议归档该变更
state: "all_done" - 其他情况:继续实施
-
读取上下文文件读取实施说明输出中列出的所有文件。 文件内容取决于所使用的架构:
contextFiles- spec-driven:proposal、specs、design、tasks
- tdd:spec、tests、implementation、docs
- 其他架构:遵循CLI输出中的contextFiles指定
-
展示当前进度显示以下内容:
- 当前使用的架构
- 进度:"已完成N/M个任务"
- 剩余任务概览
- CLI返回的动态说明
-
实施任务(循环直到完成或受阻)针对每个待处理任务:
- 显示当前正在处理的任务
- 进行所需的代码变更
- 确保变更尽可能精简且聚焦于当前任务
- 在任务文件中标记任务为已完成:将修改为
- [ ]- [x] - 继续处理下一个任务
在以下情况暂停:- 任务描述不清晰 → 暂停并请求澄清
- 实施过程中发现设计问题 → 建议更新工件
- 遇到错误或阻碍 → 报告情况并等待指导
- 用户中断操作
-
完成或暂停时展示状态显示以下内容:
- 本次会话中已完成的任务
- 整体进度:"已完成N/M个任务"
- 如果全部完成:建议归档该变更
- 如果暂停:说明原因并等待用户指示
实施过程中的输出格式
undefinedImplementing: <change-name> (schema: <schema-name>)
正在实施:<变更名称>(架构:<架构名称>)
Working on task 3/7: <task description>
[...implementation happening...]
✓ Task complete
Working on task 4/7: <task description>
[...implementation happening...]
✓ Task complete
**Output On Completion**
正在处理第3/7个任务:<任务描述>
[...实施中...]
✓ 任务完成
正在处理第4/7个任务:<任务描述>
[...实施中...]
✓ 任务完成
**完成时的输出格式**
Implementation Complete
实施完成
Change: <change-name>
Schema: <schema-name>
Progress: 7/7 tasks complete ✓
变更:<变更名称>
架构:<架构名称>
进度:7/7个任务已完成 ✓
Completed This Session
本次会话完成的任务
- Task 1
- Task 2 ...
All tasks complete! Ready to archive this change.
**Output On Pause (Issue Encountered)**
- 任务1
- 任务2 ...
所有任务已完成!可以归档该变更了。
**遇到问题暂停时的输出格式**
Implementation Paused
实施已暂停
Change: <change-name>
Schema: <schema-name>
Progress: 4/7 tasks complete
变更:<变更名称>
架构:<架构名称>
进度:4/7个任务已完成
Issue Encountered
遇到的问题
<description of the issue>
Options:
- <option 1>
- <option 2>
- Other approach
What would you like to do?
**Guardrails**
- Keep going through tasks until done or blocked
- Always read context files before starting (from the apply instructions output)
- If task is ambiguous, pause and ask before implementing
- If implementation reveals issues, pause and suggest artifact updates
- Keep code changes minimal and scoped to each task
- Update task checkbox immediately after completing each task
- Pause on errors, blockers, or unclear requirements - don't guess
- Use contextFiles from CLI output, don't assume specific file names
**Fluid Workflow Integration**
This skill supports the "actions on a change" model:
- **Can be invoked anytime**: Before all artifacts are done (if tasks exist), after partial implementation, interleaved
with other actions
- **Allows artifact updates**: If implementation reveals design issues, suggest updating artifacts - not phase-locked,
work fluidly<问题描述>
可选操作:
- <选项1>
- <选项2>
- 其他方案
您想要如何处理?
**约束规则**
- 持续处理任务直到完成或受阻
- 开始实施前必须读取上下文文件(来自实施说明的输出)
- 如果任务描述有歧义,在实施前暂停并询问用户
- 如果实施过程中发现问题,暂停并建议更新工件
- 确保代码变更精简且仅针对当前任务
- 完成每个任务后立即更新任务复选框状态
- 遇到错误、阻碍或需求不明确时暂停 - 不要猜测
- 使用CLI输出中的contextFiles,不要假设特定的文件名
**流畅的工作流集成**
该技能支持“变更操作”模型:
- **可随时调用**:在所有工件完成前(如果任务已存在)、部分实施后、与其他操作交替进行时均可调用
- **支持工件更新**:如果实施过程中发现设计问题,建议更新工件 - 不限制于特定阶段,支持流畅协作