opsx
Implement tasks from an OpenSpec change.
Input: Optionally specify a change name (e.g., /opsx:apply add-auth). 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: " 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")- 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)- 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/opsx:continue - 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
-
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 status
Display:
- 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
## Implementing: <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
## Implementation Complete
**Change:** <change-name>
**Schema:** <schema-name>
**Progress:** 7/7 tasks complete ✓
### Completed This Session
- [x] Task 1
- [x] Task 2
...
All tasks complete! You can archive this change with `/opsx:archive`.
Output On Pause (Issue Encountered)
## Implementation Paused
**Change:** <change-name>
**Schema:** <schema-name>
**Progress:** 4/7 tasks complete
### Issue Encountered
<description of the issue>
**Options:**
1. <option 1>
2. <option 2>
3. 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
Archive a completed change in the experimental workflow.
Input: Optionally specify a change name after /opsx:archive (e.g., /opsx:archive add-auth). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
Steps
-
If no change name provided, prompt for selection
Run
openspec list --jsonto get available changes. Use the AskUserQuestion tool to let the user select.Show only active changes (not already archived). Include the schema used for each change if available.
IMPORTANT: Do NOT guess or auto-select a change. Always let the user choose.
-
Check artifact completion status
Run
openspec status --change "<name>" --jsonto check artifact completion.Parse the JSON to understand:
schemaName: The workflow being usedartifacts: List of artifacts with their status (doneor other)
If any artifacts are not
done:- Display warning listing incomplete artifacts
- Prompt user for confirmation to continue
- Proceed if user confirms
-
Check task completion status
Read the tasks file (typically
tasks.md) to check for incomplete tasks.Count tasks marked with
- [ ](incomplete) vs- [x](complete).If incomplete tasks found:
- Display warning showing count of incomplete tasks
- Prompt user for confirmation to continue
- Proceed if user confirms
If no tasks file exists: Proceed without task-related warning.
-
Assess delta spec sync state
Check for delta specs at
openspec/changes/<name>/specs/. If none exist, proceed without sync prompt.If delta specs exist:
- Compare each delta spec with its corresponding main spec at
openspec/specs/<capability>/spec.md - Determine what changes would be applied (adds, modifications, removals, renames)
- Show a combined summary before prompting
Prompt options:
- If changes needed: "Sync now (recommended)", "Archive without syncing"
- If already synced: "Archive now", "Sync anyway", "Cancel"
If user chooses sync, use Task tool (subagent_type: "general-purpose", prompt: "Use Skill tool to invoke openspec-sync-specs for change ''. Delta spec analysis: "). Proceed to archive regardless of choice.
- Compare each delta spec with its corresponding main spec at
-
Perform the archive
Create the archive directory if it doesn't exist:
mkdir -p openspec/changes/archiveGenerate target name using current date:
YYYY-MM-DD-<change-name>Check if target already exists:
- If yes: Fail with error, suggest renaming existing archive or using different date
- If no: Move the change directory to archive
mv openspec/changes/<name> openspec/changes/archive/YYYY-MM-DD-<name> -
Display summary
Show archive completion summary including:
- Change name
- Schema that was used
- Archive location
- Spec sync status (synced / sync skipped / no delta specs)
- Note about any warnings (incomplete artifacts/tasks)
Output On Success
## Archive Complete
**Change:** <change-name>
**Schema:** <schema-name>
**Archived to:** openspec/changes/archive/YYYY-MM-DD-<name>/
**Specs:** ✓ Synced to main specs
All artifacts complete. All tasks complete.
Output On Success (No Delta Specs)
## Archive Complete
**Change:** <change-name>
**Schema:** <schema-name>
**Archived to:** openspec/changes/archive/YYYY-MM-DD-<name>/
**Specs:** No delta specs
All artifacts complete. All tasks complete.
Output On Success With Warnings
## Archive Complete (with warnings)
**Change:** <change-name>
**Schema:** <schema-name>
**Archived to:** openspec/changes/archive/YYYY-MM-DD-<name>/
**Specs:** Sync skipped (user chose to skip)
**Warnings:**
- Archived with 2 incomplete artifacts
- Archived with 3 incomplete tasks
- Delta spec sync was skipped (user chose to skip)
Review the archive if this was not intentional.
Output On Error (Archive Exists)
## Archive Failed
**Change:** <change-name>
**Target:** openspec/changes/archive/YYYY-MM-DD-<name>/
Target archive directory already exists.
**Options:**
1. Rename the existing archive
2. Delete the existing archive if it's a duplicate
3. Wait until a different date to archive
Guardrails
- Always prompt for change selection if not provided
- Use artifact graph (openspec status --json) for completion checking
- Don't block archive on warnings - just inform and confirm
- Preserve .openspec.yaml when moving to archive (it moves with the directory)
- Show clear summary of what happened
- If sync is requested, use the Skill tool to invoke
openspec-sync-specs(agent-driven) - If delta specs exist, always run the sync assessment and show the combined summary before prompting
Enter explore mode. Think deeply. Visualize freely. Follow the conversation wherever it goes.
IMPORTANT: Explore mode is for thinking, not implementing. You may read files, search code, and investigate the codebase, but you must NEVER write code or implement features. If the user asks you to implement something, remind them to exit explore mode first and create a change proposal. You MAY create OpenSpec artifacts (proposals, designs, specs) if the user asks—that's capturing thinking, not implementing.
This is a stance, not a workflow. There are no fixed steps, no required sequence, no mandatory outputs. You're a thinking partner helping the user explore.
Input: The argument after /opsx:explore is whatever the user wants to think about. Could be:
- A vague idea: "real-time collaboration"
- A specific problem: "the auth system is getting unwieldy"
- A change name: "add-dark-mode" (to explore in context of that change)
- A comparison: "postgres vs sqlite for this"
- Nothing (just enter explore mode)
The Stance
- Curious, not prescriptive - Ask questions that emerge naturally, don't follow a script
- Open threads, not interrogations - Surface multiple interesting directions and let the user follow what resonates. Don't funnel them through a single path of questions.
- Visual - Use ASCII diagrams liberally when they'd help clarify thinking
- Adaptive - Follow interesting threads, pivot when new information emerges
- Patient - Don't rush to conclusions, let the shape of the problem emerge
- Grounded - Explore the actual codebase when relevant, don't just theorize
What You Might Do
Depending on what the user brings, you might:
Explore the problem space
- Ask clarifying questions that emerge from what they said
- Challenge assumptions
- Reframe the problem
- Find analogies
Investigate the codebase
- Map existing architecture relevant to the discussion
- Find integration points
- Identify patterns already in use
- Surface hidden complexity
Compare options
- Brainstorm multiple approaches
- Build comparison tables
- Sketch tradeoffs
- Recommend a path (if asked)
Visualize
┌─────────────────────────────────────────┐
│ Use ASCII diagrams liberally │
├─────────────────────────────────────────┤
│ │
│ ┌────────┐ ┌────────┐ │
│ │ State │────────▶│ State │ │
│ │ A │ │ B │ │
│ └────────┘ └────────┘ │
│ │
│ System diagrams, state machines, │
│ data flows, architecture sketches, │
│ dependency graphs, comparison tables │
│ │
└─────────────────────────────────────────┘
Surface risks and unknowns
- Identify what could go wrong
- Find gaps in understanding
- Suggest spikes or investigations
OpenSpec Awareness
You have full context of the OpenSpec system. Use it naturally, don't force it.
Check for context
At the start, quickly check what exists:
openspec list --json
This tells you:
- If there are active changes
- Their names, schemas, and status
- What the user might be working on
If the user mentioned a specific change name, read its artifacts for context.
When no change exists
Think freely. When insights crystallize, you might offer:
- "This feels solid enough to start a change. Want me to create a proposal?"
- Or keep exploring - no pressure to formalize
When a change exists
If the user mentions a change or you detect one is relevant:
-
Read existing artifacts for context
openspec/changes/<name>/proposal.mdopenspec/changes/<name>/design.mdopenspec/changes/<name>/tasks.md- etc.
-
Reference them naturally in conversation
- "Your design mentions using Redis, but we just realized SQLite fits better..."
- "The proposal scopes this to premium users, but we're now thinking everyone..."
-
Offer to capture when decisions are made
Insight Type Where to Capture New requirement discovered specs/<capability>/spec.mdRequirement changed specs/<capability>/spec.mdDesign decision made design.mdScope changed proposal.mdNew work identified tasks.mdAssumption invalidated Relevant artifact Example offers:
- "That's a design decision. Capture it in design.md?"
- "This is a new requirement. Add it to specs?"
- "This changes scope. Update the proposal?"
-
The user decides - Offer and move on. Don't pressure. Don't auto-capture.
What You Don't Have To Do
- Follow a script
- Ask the same questions every time
- Produce a specific artifact
- Reach a conclusion
- Stay on topic if a tangent is valuable
- Be brief (this is thinking time)
Ending Discovery
There's no required ending. Discovery might:
- Flow into a proposal: "Ready to start? I can create a change proposal."
- Result in artifact updates: "Updated design.md with these decisions"
- Just provide clarity: User has what they need, moves on
- Continue later: "We can pick this up anytime"
When things crystallize, you might offer a summary - but it's optional. Sometimes the thinking IS the value.
Guardrails
- Don't implement - Never write code or implement features. Creating OpenSpec artifacts is fine, writing application code is not.
- Don't fake understanding - If something is unclear, dig deeper
- Don't rush - Discovery is thinking time, not task time
- Don't force structure - Let patterns emerge naturally
- Don't auto-capture - Offer to save insights, don't just do it
- Do visualize - A good diagram is worth many paragraphs
- Do explore the codebase - Ground discussions in reality
- Do question assumptions - Including the user's and your own
Propose a new change - create the change and generate all artifacts in one step.
I'll create a change with artifacts:
- proposal.md (what & why)
- design.md (how)
- tasks.md (implementation steps)
When ready to implement, run /opsx:apply
Input: The argument after /opsx:propose is the change name (kebab-case), OR a description of what the user wants to build.
Steps
-
If no input provided, ask what they want to build
Use the AskUserQuestion tool (open-ended, no preset options) to ask:
"What change do you want to work on? Describe what you want to build or fix."
From their description, derive a kebab-case name (e.g., "add user authentication" →
add-user-auth).IMPORTANT: Do NOT proceed without understanding what the user wants to build.
-
Create the change directory
openspec new change "<name>"This creates a scaffolded change at
openspec/changes/<name>/with.openspec.yaml. -
Get the artifact build order
openspec status --change "<name>" --jsonParse the JSON to get:
applyRequires: array of artifact IDs needed before implementation (e.g.,["tasks"])artifacts: list of all artifacts with their status and dependencies
-
Create artifacts in sequence until apply-ready
Use the TodoWrite tool to track progress through the artifacts.
Loop through artifacts in dependency order (artifacts with no pending dependencies first):
a. For each artifact that is
ready(dependencies satisfied):- Get instructions:
openspec instructions <artifact-id> --change "<name>" --json - The instructions JSON includes:
context: Project background (constraints for you - do NOT include in output)rules: Artifact-specific rules (constraints for you - do NOT include in output)template: The structure to use for your output fileinstruction: Schema-specific guidance for this artifact typeoutputPath: Where to write the artifactdependencies: Completed artifacts to read for context
- Read any completed dependency files for context
- Create the artifact file using
templateas the structure - Apply
contextandrulesas constraints - but do NOT copy them into the file - Show brief progress: "Created <artifact-id>"
b. Continue until all
applyRequiresartifacts are complete- After creating each artifact, re-run
openspec status --change "<name>" --json - Check if every artifact ID in
applyRequireshasstatus: "done"in the artifacts array - Stop when all
applyRequiresartifacts are done
c. If an artifact requires user input (unclear context):
- Use AskUserQuestion tool to clarify
- Then continue with creation
- Get instructions:
-
Show final status
openspec status --change "<name>"
Output
After completing all artifacts, summarize:
- Change name and location
- List of artifacts created with brief descriptions
- What's ready: "All artifacts created! Ready for implementation."
- Prompt: "Run
/opsx:applyto start implementing."
Artifact Creation Guidelines
- Follow the
instructionfield fromopenspec instructionsfor each artifact type - The schema defines what each artifact should contain - follow it
- Read dependency artifacts for context before creating new ones
- Use
templateas the structure for your output file - fill in its sections - IMPORTANT:
contextandrulesare constraints for YOU, not content for the file- Do NOT copy
<context>,<rules>,<project_context>blocks into the artifact - These guide what you write, but should never appear in the output
- Do NOT copy
Guardrails
- Create ALL artifacts needed for implementation (as defined by schema's
apply.requires) - Always read dependency artifacts before creating a new one
- If context is critically unclear, ask the user - but prefer making reasonable decisions to keep momentum
- If a change with that name already exists, ask if user wants to continue it or create a new one
- Verify each artifact file exists after writing before proceeding to next
执行 OpenSpec 变更中的任务。
输入:可选择性地指定变更名称(例如 /opsx:apply add-auth)。若省略,则检查是否能从对话上下文中推断。若含糊或存在歧义,你必须提示可用的变更列表。
步骤
-
选择变更
若已提供名称,则直接使用。否则:
- 如果用户提到过某个变更,则从对话上下文中推断
- 若仅存在一个进行中的变更,则自动选中
- 若存在歧义,运行
openspec list --json获取可用变更,并使用 AskUserQuestion 工具 让用户选择
始终声明:"Using change: "(正在使用变更:),并说明如何覆盖(例如
/opsx:apply <other>)。 -
检查状态以了解 schema
openspec status --change "<name>" --json解析 JSON 以了解:
schemaName:正在使用的工作流(例如 "spec-driven")- 哪个产物包含任务(spec-driven 通常为 "tasks",其他 schema 请查看 status 输出)
-
获取执行指令
openspec instructions apply --change "<name>" --json该命令返回:
contextFiles:产物 ID -> 具体文件路径数组(随 schema 变化)- 进度(总数、已完成、剩余)
- 带状态的任务列表
- 基于当前状态的动态指令
状态处理:
- 若
state: "blocked"(缺少产物):显示提示信息,建议使用/opsx:continue - 若
state: "all_done":表示祝贺,建议归档 - 其他情况:继续实施
-
读取上下文文件
读取 apply 指令输出中
contextFiles列出的每一个文件路径。 这些文件取决于所使用的 schema:- spec-driven:proposal、specs、design、tasks
- 其他 schema:遵循 CLI 输出的 contextFiles
-
展示当前进度
显示以下内容:
- 正在使用的 schema
- 进度:"N/M tasks complete"(N/M 项任务已完成)
- 剩余任务概览
- 来自 CLI 的动态指令
-
执行任务(循环直至完成或受阻)
对每个待处理任务:
- 显示正在处理的任务
- 完成所需的代码改动
- 保持改动最小化且聚焦
- 在任务文件中标记完成:
- [ ]→- [x] - 继续下一个任务
遇到以下情况应暂停:
- 任务不清晰 → 请求澄清
- 实施过程中暴露设计问题 → 建议更新产物
- 遇到错误或阻塞 → 上报并等待指示
- 用户中断
-
完成或暂停时展示状态
显示:
- 本次会话已完成的任务
- 整体进度:"N/M tasks complete"
- 若全部完成:建议归档
- 若已暂停:说明原因并等待指示
实施过程中的输出
## Implementing: <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
完成时的输出
## Implementation Complete
**Change:** <change-name>
**Schema:** <schema-name>
**Progress:** 7/7 tasks complete ✓
### Completed This Session
- [x] Task 1
- [x] Task 2
...
All tasks complete! You can archive this change with `/opsx:archive`.
暂停时的输出(遇到问题)
## Implementation Paused
**Change:** <change-name>
**Schema:** <schema-name>
**Progress:** 4/7 tasks complete
### Issue Encountered
<description of the issue>
**Options:**
1. <option 1>
2. <option 2>
3. Other approach
What would you like to do?
Guardrails(行为准则)
- 持续推进任务,直至完成或受阻
- 开始前始终先读取上下文文件(来自 apply 指令输出)
- 若任务含糊不清,先暂停并询问,再实施
- 若实施过程中暴露问题,暂停并建议更新产物
- 保持代码改动最小化,且严格限定在当前任务范围内
- 每完成一个任务立即更新任务勾选框
- 遇到错误、阻塞或需求不明时暂停 —— 不要靠猜测推进
- 使用 CLI 输出的 contextFiles,不要假定特定文件名
Fluid Workflow Integration(流式工作流集成)
本技能支持"对变更执行动作"的模型:
- 可随时调用:在所有产物完成之前(只要已存在任务)、部分实施之后、或与其他动作交错执行
- 允许更新产物:若实施过程中暴露设计问题,可建议更新产物 —— 不受阶段锁定,保持流式协作
进入探索模式。深度思考。自由构想。跟随对话自然流动。
重要:探索模式用于思考,而非实施。 你可以读取文件、搜索代码、调研代码库,但绝不能编写代码或实现功能。如果用户要求你实现某些东西,提醒他们先退出探索模式并创建变更提案。你可以创建 OpenSpec 产物(提案、设计、规格)—— 那是在沉淀思考,而非实施。
这是一种姿态,而非工作流。 没有固定步骤、没有强制顺序、没有必须产出的东西。你是一个思考伙伴,帮助用户探索。
输入:/opsx:explore 之后的参数就是用户想思考的内容,可能是:
- 一个模糊的想法:"real-time collaboration"(实时协作)
- 一个具体的问题:"the auth system is getting unwieldy"(认证系统越来越臃肿)
- 一个变更名称:"add-dark-mode"(在该变更的上下文中探索)
- 一个对比:"postgres vs sqlite for this"(这个场景用 Postgres 还是 SQLite)
- 什么都没有(只是进入探索模式)
姿态
- 好奇,而非说教 —— 提出自然涌现的问题,不要照本宣科
- 开放的话题,而非审讯 —— 呈现多个有趣的方向,让用户追随有共鸣的那条。不要把用户逼进单一的提问路径。
- 可视化 —— 只要有助于厘清思路,就大量使用 ASCII 图
- 自适应 —— 追随有价值的线索,在新信息出现时及时转向
- 耐心 —— 不要急于下结论,让问题的形状自然浮现
- 扎根现实 —— 在相关时真正去调研代码库,不要只是空谈理论
你可能会做的事
根据用户带来的内容,你可能会:
探索问题空间
- 提出从他们的话中自然浮现的澄清性问题
- 挑战既有假设
- 重新定义问题
- 寻找类比
调研代码库
- 梳理与讨论相关的现有架构
- 找到集成点
- 识别已被使用的模式
- 暴露隐藏的复杂度
对比方案
- 头脑风暴多种做法
- 构建对比表格
- 勾勒权衡取舍
- 推荐一条路径(若被问到)
可视化
┌─────────────────────────────────────────┐
│ 大量使用 ASCII 示意图 │
├─────────────────────────────────────────┤
│ │
│ ┌────────┐ ┌────────┐ │
│ │ 状态 │────────▶│ 状态 │ │
│ │ A │ │ B │ │
│ └────────┘ └────────┘ │
│ │
│ 系统图 / 状态机 / 数据流 │
│ 架构草图 / 依赖关系图 │
│ 对比表格 │
│ │
└─────────────────────────────────────────┘
暴露风险与未知
- 识别可能出错的地方
- 找出认知上的缺口
- 建议做技术预研(spike)或专项调研
OpenSpec 感知
你对 OpenSpec 体系有完整上下文。自然地使用它,不要生硬套用。
检查上下文
开始时,快速检查已存在的内容:
openspec list --json
这会告诉你:
- 是否存在进行中的变更
- 它们的名称、schema 和状态
- 用户可能正在做什么
如果用户提到了某个具体的变更名称,读取其产物以获得上下文。
当不存在变更时
自由思考。当洞见逐渐成形时,你可以提议:
- "这个想法已经足够扎实,可以启动一个变更了。要我创建一份提案吗?"
- 或者继续探索 —— 没有必须形式化的压力
当存在变更时
如果用户提到了某个变更,或你判断某个变更与之相关:
-
读取已有产物以获得上下文
openspec/changes/<name>/proposal.mdopenspec/changes/<name>/design.mdopenspec/changes/<name>/tasks.md- 等等
-
在对话中自然地引用它们
- "你的设计里提到用 Redis,但我们刚意识到 SQLite 更合适……"
- "提案把范围限定在付费用户,但我们现在在考虑所有人……"
-
在做出决策时主动提议沉淀
洞见类型 沉淀位置 发现新需求 specs/<capability>/spec.md需求发生变更 specs/<capability>/spec.md做出设计决策 design.md范围发生变化 proposal.md识别出新的工作 tasks.md假设被推翻 相关产物 提议示例:
- "这是个设计决策。要记到 design.md 里吗?"
- "这是一条新需求。要加到 specs 里吗?"
- "这改变了范围。要更新提案吗?"
-
由用户决定 —— 提议即可,然后继续。不要施压。不要自动沉淀。
你不必做的事
- 遵循固定脚本
- 每次都问同样的问题
- 产出某个特定产物
- 得出一个结论
- 在岔路有价值时还死守主题
- 保持简短(这是思考时间)
结束探索
没有强制的结尾。探索可能会:
- 流入一份提案:"准备好开始了吗?我可以创建一份变更提案。"
- 体现为产物更新:"已把这些决策更新到 design.md"
- 仅仅带来澄清:用户已获得所需信息,继续前行
- 稍后继续:"我们随时可以接着聊"
当事物逐渐成形时,你可以提供一份摘要 —— 但这是可选的。有时候,思考本身就是价值。
Guardrails(行为准则)
- 不要实施 —— 绝不编写代码或实现功能。创建 OpenSpec 产物可以,编写应用代码不行。
- 不要假装理解 —— 若有不清楚的地方,继续深挖
- 不要急于求成 —— 探索是思考时间,不是任务时间
- 不要强加结构 —— 让模式自然浮现
- 不要自动沉淀 —— 主动提议保存洞见,而不是擅自执行
- 要做可视化 —— 一张好图胜过千言万语
- 要调研代码库 —— 让讨论扎根于现实
- 要质疑假设 —— 包括用户的,也包括你自己的
提出一个新变更 —— 创建该变更并一步生成全部产物。
我将创建一个包含以下产物的变更:
- proposal.md(做什么 & 为什么)
- design.md(怎么做)
- tasks.md(实施步骤)
准备实施时,运行 /opsx:apply
输入:/opsx:propose 之后的参数是变更名称(kebab-case 短横线命名),或者一段描述用户想构建什么的内容。
步骤
-
若未提供输入,询问用户想构建什么
使用 AskUserQuestion 工具(开放式,不预设选项)提问:
"What change do you want to work on? Describe what you want to build or fix." (你想推进哪个变更?描述一下你想构建或修复什么。)
根据他们的描述推导出 kebab-case 名称(例如 "add user authentication" →
add-user-auth)。重要:在未理解用户想构建什么之前,不要继续推进。
-
创建变更目录
openspec new change "<name>"这会在
openspec/changes/<name>/创建一个带.openspec.yaml的变更脚手架。 -
获取产物构建顺序
openspec status --change "<name>" --json解析 JSON 以获取:
applyRequires:实施前所需的产物 ID 数组(例如["tasks"])artifacts:全部产物列表及其状态与依赖
-
按序创建产物,直至达到可实施状态
使用 TodoWrite 工具 跟踪产物创建进度。
按依赖顺序遍历产物(先处理无待定依赖的产物):
a. 对于每个处于
ready(依赖已满足)状态的产物:- 获取指令:
openspec instructions <artifact-id> --change "<name>" --json - 指令 JSON 包含:
context:项目背景(对你的约束 —— 不要写入输出)rules:产物专属规则(对你的约束 —— 不要写入输出)template:输出文件所使用的结构instruction:针对该产物类型的 schema 专属指引outputPath:产物的写入位置dependencies:需读取以获取上下文的已完成产物
- 读取任何已完成的依赖文件以获取上下文
- 使用
template作为结构创建产物文件 - 将
context与rules作为约束条件应用 —— 但不要把它们复制进文件 - 展示简要进度:"Created <artifact-id>"(已创建 <artifact-id>)
b. 持续推进,直至所有
applyRequires产物完成- 每创建一个产物后,重新运行
openspec status --change "<name>" --json - 检查
applyRequires中的每个产物 ID 在 artifacts 数组中是否均为status: "done" - 当所有
applyRequires产物均为 done 时停止
c. 若某个产物需要用户输入(上下文不清晰):
- 使用 AskUserQuestion 工具 澄清
- 然后继续创建
- 获取指令:
-
展示最终状态
openspec status --change "<name>"
输出
完成所有产物后,进行总结:
- 变更名称与位置
- 已创建产物列表及简要描述
- 当前就绪状态:"All artifacts created! Ready for implementation."(所有产物已创建!可以开始实施了。)
- 提示:"Run
/opsx:applyto start implementing."(运行/opsx:apply开始实施。)
产物创建指引
- 遵循
openspec instructions中针对每种产物类型的instruction字段 - schema 定义了每个产物应包含的内容 —— 严格遵循
- 创建新产物前,先读取依赖产物以获取上下文
- 使用
template作为输出文件的结构 —— 填充其各个章节 - 重要:
context和rules是给你的约束,不是文件内容- 不要把
<context>、<rules>、<project_context>代码块复制进产物 - 它们用于指导你写什么,但绝不应出现在输出中
- 不要把
Guardrails(行为准则)
- 创建实施所需的全部产物(以 schema 的
apply.requires定义为准) - 创建新产物前,始终先读取依赖产物
- 若上下文严重不清晰,询问用户 —— 但优先做出合理决策以保持推进节奏
- 若同名变更已存在,询问用户是想继续它,还是新建一个
- 在继续下一个产物之前,先校验每个产物文件确实已写入
apply.md
apply.zh.md
archive.md
archive.zh.md
explore.md
explore.zh.md
propose.md
propose.zh.md

浙公网安备 33010602011771号