一键导入
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 职业分类
| 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.1","generatedBy":"1.3.0"} |
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
Write apply-session start marker (required, added v1.1)
Before reading any context files or performing implementation, signal that
this apply session is skill-orchestrated. The PreToolUse hook installed
per specs/apply-skill-enforcement.md BLOCKS the first Edit/Write on a
slice's write_paths unless this marker exists for the current session.
python .ai-playbook/scripts/openspec_apply_marker.py start --change-id "<name>" --skill-version 1.1
The marker is appended to openspec/changes/<name>/.apply_log.jsonl (one
JSONL record per session start; committed to git for audit). If the helper
script is missing (consumer pre-v0.14.0 of ai-playbook), the hook is also
missing — proceed; older consumers see no enforcement. Inform the user that
their playbook bump is overdue.
See: specs/apply-skill-enforcement.md §1 (marker contract) and §3
(break-glass via AIPLAYBOOK_APPLY_ENFORCE_OVERRIDE env).
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")Get apply instructions
openspec instructions apply --change "<name>" --json
This returns:
Handle states:
state: "blocked" (missing artifacts): show message, suggest using openspec-continue-changestate: "all_done": congratulate, suggest archiveRead context files
Read the files listed in contextFiles from the apply instructions output.
The files depend on the schema being used:
4b. Preflight re-grep cited identifiers (added v0.11.0)
Per release-management.md §6.5 (pre-flight rebase) the worktree base is fresh, but proposal.md may have been written days earlier. Identifiers cited in the proposal (class names, function names, file paths, migration slot numbers, fact-kind enum values, ADR numbers) may have changed on main since the proposal landed. Apply silently against stale citations produces silent divergence.
Before starting implementation, re-grep every identifier the proposal/design/tasks cites:
Walk proposal.md + design.md + tasks.md and extract:
apps/api/src/.../foo.py).`IBClient`, `place_order`).0007_*, 0010_*).ADR-021).For each, run git grep -n "<identifier>" (or Grep tool) on main.
If any cited identifier returns 0 hits, surface as a divergence warning:
⚠ Citation drift detected
proposal.md cites `FactKindEnum.MOMENTUM_SCORE` but no occurrence found on main.
Likely renamed or removed in a parallel slice merged after this proposal landed.
Options:
1. Re-read the current main code to find the new name; update tasks.md citations.
2. Re-open Gate D for design refresh (recommended for ≥3 drifted citations).
3. Override with --skip-preflight-grep (logs deviation in retro carry-forward).
If 1-2 identifiers drifted, show the diff and let the user decide (small drift is normal across week-old proposals).
If ≥3 identifiers drifted OR a critical surface (migration slot, FK, public API) drifted, refuse to proceed without explicit --skip-preflight-grep flag.
This catches the failure mode surfaced 2026-05-06 in iguanatrader (proposals written before parallel slices renamed cited classes) — without preflight grep, the worker AI would silently apply against drifted state and either fail at typecheck (best case) or ship broken code (worst case).
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:
Mine architecture decision records (ADRs), gotcha files, runbooks, and docs/archive for cross-project lessons that warrant ai-playbook canonical specs. Use when a project lacks a populated retros/ directory but has equivalent material in other forms.
Archive a completed change in the experimental workflow. Use when the user wants to finalize and archive a change after implementation is complete.
Orchestrate the canonical task↔PR↔release flow end-to-end. Two modes — `/dev-flow start <description>` scaffolds an OpenSpec change + branch + (optional) worktree + git hook ready for commits; `/dev-flow ship` validates the current branch + pushes + opens PR + monitors CI. Use whenever you start any non-trivial change in a playbook-consuming project. LLM-agnostic — works for Claude Code, Cursor, Antigravity, Gemini CLI, OpenCode, and humans.
Implement an OpenSpec change in parallel using multiple subagents (one per disjoint task group inside the same slice). Use when the slice's tasks.md has ≥2 task groups with disjoint write-paths AND >30 min of parallelisable work. For sequential implementation use openspec-apply-change instead.
Review code changes adversarially using parallel review layers (Blind Hunter, Edge Case Hunter, Acceptance Auditor) with structured triage into actionable categories. Use when the user says "run code review" or "review this code"
Create architecture solution design decisions for AI agent consistency. Use when the user says "lets create architecture" or "create technical architecture" or "create a solution design"