1---2name: ase-task-implement3description: Implement current or given task plan. Use when the user calls to "implement", "realize" or "apply" the "task", "plan", "spec", or "specification".4---5
6@${CLAUDE_SKILL_DIR}/../../meta/ase-control.md
7@${CLAUDE_SKILL_DIR}/../../meta/ase-skill.md
8@${CLAUDE_SKILL_DIR}/../../meta/ase-dialog.md
9@${CLAUDE_SKILL_DIR}/../../meta/ase-getopt.md
10
11<skill name="ase-task-implement">
12Implement a Task Plan
13</skill>
14
15<expand name="getopt"
16 arg1="ase-task-implement"
17 arg2="--next|-n=(none|DONE|DELETE)... --int-reuse-task">
18 $ARGUMENTS
19</expand>
20
21<objective>
22*Implement* the task plan by modifying the *artifacts*
23with a corresponding, complete *change set*.
24</objective>
25
26@${CLAUDE_SKILL_DIR}/../../meta/ase-format-task.md
27
28Procedure
29---------
30
311. **Determine Task:**
32
33 1. Set <instruction><getopt-arguments/></instruction> initially.
34 Inherit the always existing <ase-task-id/> from the current context.
35 Inherit the always existing <ase-session-id/> from the current context.
36 Do not output anything.
37
38 2. React on task id:
39
40 1. <if condition="
41 <instruction/> matches the regexp `^[a-zA-Z][a-zA-Z0-9_-]*$`
42 ">
43 Set <ase-task-id><instruction/></ase-task-id> (set task
44 id to instruction) and <instruction></instruction> (set
45 instruction empty), call the `ase_task_id(id: "<ase-task-id/>",
46 session: "<ase-session-id/>")` tool from the `ase` MCP
47 server to switch the task, and then only output the
48 following <template/>:
49
50 <template>
51 ⧉ **ASE**: ◉ task: **<ase-task-id/>**, ▶ status: **task given**
52 </template>
53 </if>
54
55 2. <elseif condition="
56 <instruction/> has the format `<id/>: <text/>` where
57 <id/> matches the regexp `^[a-zA-Z][a-zA-Z0-9_-]*$` and
58 <text/> is *empty*
59 ">
60 Set <instruction></instruction> (set instruction to empty)
61 and <ase-task-id><id/></ase-task-id> (set task id to
62 id) and call the `ase_task_id(id: "<ase-task-id/>", session:
63 "<ase-session-id/>")` tool from the `ase` MCP server to
64 switch the task, and then only output the following
65 <template/>:
66
67 <template>
68 ⧉ **ASE**: ◉ task: **<ase-task-id/>**, ▶ status: **task given**
69 </template>
70 </elseif>
71
72 3. <elseif condition="<instruction/> is NOT empty">
73 The argument is neither empty nor a valid task id. As this
74 skill only accepts an optional `[<id>]` argument and *never*
75 a free-text instruction, only output the following <template/>
76 and then immediately *STOP* processing the entire current skill:
77
78 <template>
79 ⧉ **ASE**: ☻ skill: **ase-task-implement**, ▶ ERROR: expected single `[<id>]` argument
80 </template>
81 </elseif>
82
832. **Determine Operation**:
84
85 1. Determine the current task plan content:
86
87 <if condition="
88 <getopt-option-int-reuse-task/> is equal `true`
89 *and* a `ase_task_save(id: '<ase-task-id/>', ...)` tool call
90 exists earlier in the current session
91 ">
92 Set <text/> to the `text` argument of the most recent
93 `ase_task_save(id: '<ase-task-id/>', ...)` tool call,
94 *without* calling `ase_task_load` again. Set <status>plan
95 reused</status>. Do not output anything.
96 </if>
97 <else>
98 Call the `ase_task_load(id: "<ase-task-id/>")` tool of the
99 `ase` MCP server to load the current task plan content and
100 set <text/> to the `text` output field of this `ase_task_load`
101 tool call. Do not output anything related to this MCP tool
102 call. Set <status>plan loaded</status>.
103 </else>
104
105 - If <text/> starts with `ERROR:` or `WARNING:`:
106 Set <content></content> (set content to empty).
107 Set <words/> to "0".
108
109 - If <text/> starts NOT with `ERROR:` and NOT with `WARNING:`:
110 Set <content><text/></content> (set content to text).
111 Calculate the number of words <words/> of <content/>.
112
113 Only output the following <template/>:
114
115 <template>
116 ⧉ **ASE**: ◉ task: **<ase-task-id/>**, ✪ plan: **<words/>** words, ▶ status: **<status/>**
117 </template>
118
119 2. If the <content/> is still empty, complain and tell the user to
120 use the `ase-code-resolve`, `ase-code-refactor`, `ase-code-craft`,
121 or `ase-task-edit` skills first to create a task plan. Then
122 immediately stop processing this skill.
123
1243. **Create Implementation:**
125
126 1. Perform a *final implementation* of the task plan
127 by modifying the *artifacts* with a corresponding, complete
128 *change set*.
129
130 For this, primarily follow and honor the task plan in <content/>.
131
132 Secondarily, derive hints from the optionally existing
133 `IMPLEMENTATION DRAFT` section (from skill `ase-task-preflight`)
134 in <content/>. But the specification text in <content/> always
135 overrules the implementation draft in the `IMPLEMENTATION DRAFT`
136 section of <content/>.
137
138 <if condition="<content/> does NOT contain a `## VERIFICATION` section heading">
139 The task plan deliberately *omits* the `## VERIFICATION`
140 section. You *MUST* therefore *strictly skip* the entire
141 verification phase after modifying the source files: do *NOT*
142 run any build, do *NOT* run any tests, do *NOT* run any linter,
143 do *NOT* run any type-checker, do *NOT* execute the modified
144 program, and do *NOT* otherwise verify the change set in any
145 way.
146 </if>
147
148 2. Only output the following <template/>:
149
150 <template>
151 ⧉ **ASE**: ◉ task: **<ase-task-id/>**, ✪ plan: **<words/>** words, ▶ status: **plan implemented**
152 </template>
153
1544. **Decide Next Step:**
155
156 1. *Determine next step*:
157
158 - If <getopt-option-next/> is not equal to `none`:
159 Treat <getopt-option-next/> as a comma-separated chronological
160 list of pre-selected next-step tokens. *Split* it on `,`,
161 take the *first* token as <head/>, and store the remaining
162 tokens (joined back with `,`, or `none` if empty) into
163 <getopt-option-next/> so downstream skills can consume the tail.
164
165 - If <head/> matches the regex `^(DONE|DELETE)$`:
166 Honor the pre-selected token.
167 Set <result><head/></result>.
168
169 - else:
170 Only output the following <template/> and then immediately
171 *STOP* processing the entire current skill:
172
173 <template>
174 ⧉ **ASE**: ☻ skill: **ase-task-implement**, ▶ ERROR: invalid `--next` token: **<head/>**
175 </template>
176
177 - If <getopt-option-next/> is equal to `none`:
178
179 In the following, you *MUST* *NOT* use your built-in
180 <user-dialog-tool/> tool! Instead, you *MUST* just show a
181 custom dialog according to the expanded `custom-dialog`
182 definition. You *MUST* closely follow this definition:
183
184 <expand name="custom-dialog" arg1="--no-other">
185 Next Step: How would you like to proceed with the plan?
186 DONE: Stop processing and PRESERVE task plan.
187 DELETE: Stop processing and DELETE the task plan.
188 </expand>
189
190 2. Check the tool <result/> and dispatch accordingly:
191
192 - If <result/> is `DONE` or `CANCEL`:
193 Only output the following <template/> and then *STOP*.
194
195 <template>
196 ⧉ **ASE**: ◉ task: **<ase-task-id/>**, ✪ plan: **<words/>** words, ▶ status: **plan implemented -- done**
197 </template>
198
199 - If <result/> is `DELETE`:
200 Set <args></args> (empty). Do *not* forward any remaining
201 `--next` list tokens, because the `ase:ase-task-delete`
202 skill accepts only an optional `[<id>]` argument and no
203 `--next` option; remaining tokens are intentionally discarded.
204 Only output the following <template/> and then call the
205 tool `Skill(skill: "ase:ase-task-delete", args: "<args/>")`
206 to invoke the `ase:ase-task-delete` skill in order to
207 *delete* the updated plan. Immediately stop processing the
208 current skill once the `Skill` tool was used.
209
210 <template>
211 ⧉ **ASE**: ◉ task: **<ase-task-id/>**, ✪ plan: **<words/>** words, ▶ status: **plan implemented -- hand-off to delete task**
212 </template>
213