1---2name: ase-task-preflight3description: Preflight the implementation of current or given task plan. Use when the user calls to "preflight", "dry-run" or "test-drive" 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-preflight">
12Preflight a Task Plan
13</skill>
14
15<expand name="getopt"
16 arg1="ase-task-preflight"
17 arg2="--next|-n=(none|DONE|EDIT|IMPLEMENT)... --int-reuse-task">
18 $ARGUMENTS
19</expand>
20
21<objective>
22*Preflight* the implementation of a task plan by creating a draft
23for a corresponding, *complete source code 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-preflight**, ▶ 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 Draft:**
125
126 1. Perform a *preflight* of the *implementation* of <content/> by creating a
127 draft for a corresponding, *complete artifact change set*
128 which *would* fully implement the task plan <content/>. Store
129 this artifact change set in *unified diff* format in <unified-diff/>.
130
131 2. Append this artifact change set <unified-diff/> to the end
132 of the <content/> with the following <template/>. If a section
133 named `## IMPLEMENTATION DRAFT` already exists from a
134 previous run of this skill, *replace* this entire existing
135 section.
136
137 <template>
138
139 ## IMPLEMENTATION DRAFT
140
141 ```text
142 <unified-diff/>
143 ```
144
145 </template>
146
147 3. <if condition="<content/> contains '⚙ Modified:'">
148 Update <timestamp-modified/> with the current time in
149 ISO-style format, which has to be determined by calling the
150 `ase_timestamp(format: "yyyy-LL-dd HH:mm")` tool of the `ase`
151 MCP server and use the `text` field of its response. Update
152 the `⚙ Modified: ...` line of <content/> with the new
153 `⚙ Modified: <timestamp-modified/>`.
154 Do not output anything.
155 </if>
156
157 4. Finally, call the `ase_task_save(id: "<ase-task-id/>",
158 text: "<content/>")` of the `ase` MCP server to save the updated
159 task plan content. Calculate the number of words <words/> of
160 <content/>. Do not output anything related to this MCP tool call
161 except the following <template/>:
162
163 <template>
164 ⧉ **ASE**: ◉ task: **<ase-task-id/>**, ✪ plan: **<words/>** words, ▶ status: **plan updated**
165 </template>
166
1674. **Decide Next Step:**
168
169 1. *Determine next step*:
170
171 - If <getopt-option-next/> is not equal to `none`:
172 Treat <getopt-option-next/> as a comma-separated chronological
173 list of pre-selected next-step tokens. *Split* it on `,`,
174 take the *first* token as <head/>, and store the remaining
175 tokens (joined back with `,`, or `none` if empty) into
176 <getopt-option-next/> so downstream skills can consume the tail.
177
178 - If <head/> matches the regex `^(DONE|EDIT|IMPLEMENT)$`:
179 Honor the pre-selected token.
180 Set <result><head/></result>.
181
182 - else:
183 Only output the following <template/> and then immediately
184 *STOP* processing the entire current skill:
185
186 <template>
187 ⧉ **ASE**: ☻ skill: **ase-task-preflight**, ▶ ERROR: invalid `--next` token: **<head/>**
188 </template>
189
190 - If <getopt-option-next/> is equal to `none`:
191
192 In the following, you *MUST* *NOT* use your built-in
193 <user-dialog-tool/> tool! Instead, you *MUST* just show a
194 custom dialog according to the expanded `custom-dialog`
195 definition. You *MUST* closely follow this definition:
196
197 <expand name="custom-dialog" arg1="--no-other">
198 Next Step: How would you like to proceed with the plan?
199 DONE: Stop processing.
200 EDIT: Hand processing off to editing.
201 IMPLEMENT: Hand processing off to implementation.
202 </expand>
203
204 2. Check the tool <result/> and dispatch accordingly:
205
206 - If <result/> is `DONE` or `CANCEL`:
207 Only output the following <template/> and then *STOP*.
208
209 <template>
210 ⧉ **ASE**: ◉ task: **<ase-task-id/>**, ✪ plan: **<words/>** words, ▶ status: **plan updated -- done**
211 </template>
212
213 - If <result/> is `EDIT`:
214 Set <args>--int-reuse-task</args>.
215 <if condition="<getopt-option-next/> is not equal `none`">
216 Set <args><args/> --next <getopt-option-next/></args>
217 </if>
218 Only output the following <template/> and then call the
219 tool `Skill(skill: "ase:ase-task-edit", args: "<args/>")`
220 to invoke the `ase:ase-task-edit` skill in order to *edit*
221 the updated plan. Immediately stop processing the current
222 skill once the `Skill` tool was used.
223
224 <template>
225 ⧉ **ASE**: ◉ task: **<ase-task-id/>**, ✪ plan: **<words/>** words, ▶ status: **plan updated -- hand-off to edit**
226 </template>
227
228 - If <result/> is `IMPLEMENT`:
229 Set <args>--int-reuse-task</args>.
230 <if condition="<getopt-option-next/> is not equal `none`">
231 Set <args><args/> --next <getopt-option-next/></args>
232 </if>
233 Only output the following <template/> and then call the
234 tool `Skill(skill: "ase:ase-task-implement", args: "<args/>")`
235 to invoke the `ase:ase-task-implement` skill in order to
236 *implement* the updated plan. Immediately stop processing
237 the current skill once the `Skill` tool was used.
238
239 <template>
240 ⧉ **ASE**: ◉ task: **<ase-task-id/>**, ✪ plan: **<words/>** words, ▶ status: **plan updated -- hand-off to implement**
241 </template>
242