一键导入
openspec-apply-change
Implement tasks from an OpenSpec change. Use when the user wants to start implementing, continue implementation, or work through tasks.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Implement tasks from an OpenSpec change. Use when the user wants to start implementing, continue implementation, or work through tasks.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
PTX-EMU 项目经验沉淀 — 跨模块状态翻译、递归锁、分 Phase commit、基线 worktree、qualifier 类型判断等具体失败模式与可复用 checklist。来自 2026-06 barrier module 迁移 + 2026-07 cute_rmsnorm float 类型判断实战
ADR 合规检查 — 开发完成后对照 ADR 检查清单验证实现是否符合架构决策
Archive a completed change in the experimental workflow. Use when the user wants to finalize and archive a change after implementation is complete.
Propose a new change with all artifacts generated in one step. Use when the user wants to quickly describe what they want to build and get a complete proposal with design, specs, and tasks ready for implementation.
PTX-EMU 专用调试技能 - 自动化调试配置选择和场景化调试方法
三模式 PTX 测试生成框架 — 从任意 CUDA 程序自动生成 PTX/IR/执行三种测试模式
| name | openspec-apply-change |
| description | Implement tasks from an OpenSpec change. Use when the user wants to start implementing, continue implementation, or work through tasks. |
| license | MIT |
| compatibility | Requires openspec CLI. |
| metadata | {"author":"openspec","version":"1.0","generatedBy":"1.4.1"} |
Implement 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 change
If a name is provided, use it. Otherwise:
openspec list --json to get available changes and use the AskUserQuestion tool to let the user selectAlways announce: "Using change: " and how to override (e.g., /opsx-apply <other>).
Check status to understand the schema
openspec status --change "<name>" --json
Parse the JSON to understand:
schemaName: The workflow being used (e.g., "spec-driven")planningHome, changeRoot, and actionContext: planning scope and edit constraintsGet apply instructions
openspec instructions apply --change "<name>" --json
This returns:
contextFiles: artifact ID -> array of concrete file paths (varies by schema - could be proposal/specs/design/tasks or spec/tests/implementation/docs)Handle states:
state: "blocked" (missing artifacts): show message, suggest using openspec-continue-changestate: "all_done": congratulate, suggest archiveWorkspace guard: If status JSON reports actionContext.mode: "workspace-planning" and allowedEditRoots is empty, explain that full workspace apply is not supported in this slice. Treat linked repos and folders as read-only context, ask the user to select an affected area through an explicit implementation workflow, and STOP before editing files.
Read context files
Read every file path listed under contextFiles from the apply instructions output.
The files depend on the schema being used:
Show current progress
Display:
Implement tasks (loop until done or blocked)
For each pending task:
- [ ] → - [x]Pause if:
On completion or pause, show status
Display:
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! Ready to archive this change.
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
Fluid Workflow Integration
This skill supports the "actions on a change" model:
加载 skill:
ptx-lessons-learned适用: 所有涉及代码改动、API 迁移、状态修改的 OpenSpec change 实施 来源: 2026-06-18 commitf033312实战经验沉淀
在开始实施 任何 Phase 之前,必须执行以下检查:
判定标准(满足任一即需要基线):
标准操作:
# 1. 找到当前 baseline commit
git log --oneline -1
# 2. 建立基线 worktree
git worktree add .worktrees/baseline-check <baseline-commit>
# 3. 验证基线测试通过
cd .worktrees/baseline-check
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build
cd build && ctest -L <relevant-label> # 确认基线通过
根据本次实施的领域,加载对应 skill:
| 实施领域 | 加载的 skill |
|---|---|
| 屏障 / barrier | ptx-barrier-mechanism + ptx-lessons-learned |
| 指令 pipeline | ptx-instruction-pipeline + ptx-lessons-learned |
| PTX 语法 | ptx-grammar-modification + ptx-lessons-learned |
| 状态修改 | state-modification-audit + ptx-lessons-learned |
| 回归定位 | regression-bisect + ptx-lessons-learned |
每个 Phase 开始前:
# 1. 列出 baseline 函数所有 set_* / commit_* / force_* / lock_* 调用
grep -n "set_state\|set_pc\|set_next_pc\|commit_pc\|force_set_pc\|lock_guard\|unique_lock" <baseline-file>
# 2. 列出所有下游消费者
grep -rn "state == BAR_SYNC\|is_at_barrier\|is_blocked" src/ include/
# 3. 写行级 diff 计划到 commit message
每个 Phase 完成后:
| 症状 | 行动 |
|---|---|
| 集成测试断言 N+1 处挂起 | 查 ptx-lessons-learned 失败模式速查表 → 递归锁死锁 |
CHECK(!is_blocked) 失败 | 查 → 跨模块状态翻译缺失 |
ctest -L <label> 整体超时 | 立即切到 single-test + per-test timeout |
| Phase N 通过但 Phase N+1 失败 | 查 → 跨 Phase invariant 冲突 |
git revert 后 git status 异常 | 查 → stash/pop 改变了 staged 状态 |
任何失败:先查 ptx-lessons-learned 失败模式速查表,再继续诊断。
任何已有测试回归 → 立即 revert 该 Phase,不混入后续 commit:
# 1. 暂存当前 working tree 改动(如果有未完成的工作)
git stash
# 2. Revert 失败的 Phase commit
git revert --no-commit <failing-commit>
# 3. 验证 revert 后测试通过
cmake --build build && ctest -L <relevant-label>
# 4. 决定:放弃该 Phase 或重新设计
# - 放弃:git revert --continue + 在 tasks.md 标记 [~] DEFERRED
# - 重新设计:reset 改动,修改 design.md,重新提案
绝对禁止:
as any / @ts-ignore 抑制类型错误每写一个 set_state / set_pc / lock_guard / 任何状态修改,必须写注释说明:
grep 出的所有下游)判断标准:
这条注释能否让 3 个月后的陌生人避免犯同样的错?
- 是 → 写
- 否 → 不写
- 例外:警告"不要做 X"必须写
□ 跑过 baseline worktree 对比(确认非本次引入的失败)
□ AGENTS.md 是否需要同步
□ ADR 是否需要追加
□ OpenSpec tasks.md 是否需要更新(标记完成的 Phase)
□ commit message 列出独立的 fix 编号
□ 如果是复合 fix(多个 bug 在一个 commit),在 commit message 详细列出每个 fix 的原因和影响
commit message 模板(修复 bug 时):
fix(<area>): <one-line summary>
Three fixes bundled:
1. <Fix 1 title>:
- Root cause: <specific file:line>
- Symptom: <which test, what assertion>
- Fix: <specific change>
2. <Fix 2 title>:
...
Test results (vs baseline <commit>):
- e2e: N/M pass
- integration: N/M pass (X pre-existing failures on baseline)
- unit: N/M pass
- Zero regressions introduced
# 1. 对比基线
cd .worktrees/baseline-check/build && ctest -R <affected-test>
cd <main-build> && ctest -R <affected-test>
# 对比输出,确认没有新增 FAIL
# 2. 检查 AGENTS.md 同步
grep -n "DO NOT\|MUST" src/ptxsim/<modified-area>/AGENTS.md
# 3. 检查 commit message 包含 fix 编号
git log -1 --format="%B" | grep "^[0-9]\."
ptx-lessons-learned: 本 skill 的源,提供所有 checklist 和失败模式adr-compliance-check: 在实施完成后使用,验证 ADR 合规ptx-barrier-mechanism / ptx-instruction-pipeline: 领域知识,实施时必读regression-bisect: 当测试回归时使用,定位根因state-modification-audit: 当怀疑状态被意外修改时使用在实施每个 Phase 时,建议创建 docs/superpowers/plans/<date>-<change-name>-fix.md 记录:
(参考 docs/superpowers/plans/2026-06-18-integrate-barrier-module-cta-warp-fix.md)