--- name: openspec-apply-change description: Implement the tasks from a change. Use when the user wants to start implementing, continue implementation, or work through the tasks of an existing change. license: MIT compatibility: Claude Code — no external CLI required. metadata: author: openspec (adapted for Claude Code) version: "1.0-claude" source: SAP-samples/cap-agentic-engineered --- Implement the tasks from a change. > **Adapted for Claude Code.** No `openspec` CLI. A change is a folder under > `openspec/changes//`; tasks live in `tasks.md` as a Markdown checklist. Read the > artifacts directly, implement, and flip `- [ ]` → `- [x]` with the Edit tool. **Input**: Optionally specify a change name. If omitted, infer from conversation context; if ambiguous, prompt. **Steps** 1. **Select the change** If a name is provided, use it. Otherwise list active changes: ```bash ls -1 openspec/changes 2>/dev/null | grep -v '^archive$' ``` - Infer from conversation context if the user mentioned a change - Auto-select if only one active change exists - If ambiguous, use the **AskUserQuestion tool** to let the user choose Always announce: "Using change: ". 2. **Read the change artifacts** Read every artifact that exists in `openspec/changes//`: - `proposal.md` (what & why) - `design.md` (how) - `tasks.md` (the checklist you will execute) If `tasks.md` is missing, the change is not ready to implement — suggest the `openspec-propose` skill (or creating `tasks.md`) and stop. 3. **Assess progress** Count tasks in `tasks.md`: - Incomplete = lines matching `- [ ]` - Complete = lines matching `- [x]` Display: change name, "N/M tasks complete", and a short overview of what remains. If all tasks are already complete, congratulate and suggest archiving (the `openspec-archive-change` skill). 4. **Implement tasks (loop until done or blocked)** Mirror `tasks.md` into your task-tracking tool (`TaskCreate` / `TaskUpdate`) so progress is visible. For each pending task: - Show which task is being worked on - Make the code changes required — keep them minimal and focused on that task - **For SAP code, consult the relevant MCP server first** (`sap-cap`, `sap-fiori`, `sap-ui5` skills) — never guess CDS/Fiori/UI5 behavior - For non-trivial implementation, dispatch to the appropriate specialist sub-agent via the **Agent tool** rather than writing large code blocks inline - Mark the task complete by editing `tasks.md`: `- [ ]` → `- [x]` - Continue to the next task **Pause if:** - A task is unclear → ask for clarification - Implementation reveals a design issue → suggest updating `design.md`/`proposal.md` - An error or blocker is encountered → report and wait for guidance - The user interrupts 5. **On completion or pause, show status** - Tasks completed this session - Overall progress: "N/M tasks complete" - If all done: suggest archiving (`openspec-archive-change`) - If paused: explain why and wait **Output During Implementation** ``` ## Implementing: Working on task 3/7: [...implementation happening...] ✓ Task complete ``` **Output On Completion** ``` ## Implementation Complete **Change:** **Progress:** 7/7 tasks complete ✓ All tasks complete! Ready to archive this change (openspec-archive-change). ``` **Guardrails** - Keep going through tasks until done or blocked - Always read the artifacts before starting - If a 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 the `tasks.md` checkbox immediately after completing each task - Pause on errors, blockers, or unclear requirements — don't guess - Consult MCP/skills for SAP code; orchestrate via sub-agents for substantial work