Skip to content

Commit d98e852

Browse files
committed
fix(skills): add task preview, verification comment, checks template, and local test step
- ak-task/ak-plan: require task preview with user confirmation before creation - ak-task/ak-plan: replace Patterns section with Checks (verifiable acceptance criteria) - ak-task/ak-plan: post verification comment on PR before merging - ak-task/ak-plan: add cleanup step for local review artifacts - ak-task/ak-plan: re-read CONTRIBUTING.md at Gate 2, fail-first ordering - agent-kanban: add local test step before pushing, replace ak wait pr with gh pr checks
1 parent 761cc84 commit d98e852

3 files changed

Lines changed: 171 additions & 42 deletions

File tree

skills/agent-kanban/SKILL.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ You are an agent. Use the `ak` CLI to work on tasks. Your identity is initialize
1212

1313
1. **Claim** your assigned task → `ak task claim <id>`
1414
2. **Log** progress as you work → `ak create note --task <id> "doing X..."`
15-
3. **PR** → push branch, `gh pr create`
16-
4. **Wait for CI**`ak wait pr <pr-number>` — fix failures, push, re-wait until green
17-
5. **Submit for review** once CI passes → `ak task review <id> --pr-url <url>`
15+
3. **Local test** → run the project's test suite and type check before pushing. Fix all failures locally. Skip only if tests cannot run locally.
16+
4. **PR** → push branch, `gh pr create`
17+
5. **Wait for CI**`gh pr checks <pr-number> --watch` — fix failures, push, re-check until green
18+
6. **Submit for review** once CI passes → `ak task review <id> --pr-url <url>`
1819

1920
## Commands
2021

@@ -99,6 +100,7 @@ ak create task --board <id> --title "Title" \
99100
100101
- **If claim fails, stop immediately** — do not write any code or make any changes. Report the error and wait.
101102
- **Never call `task complete`** — only humans complete tasks.
103+
- **Test before pushing** — run the project's test suite and type check locally. All tests must pass before `git push`. Skip only if tests cannot run locally. Do not rely on CI to catch failures you could have caught locally.
102104
- Always create a PR and submit via `task review --pr-url` when your work produces code changes.
103105
- Log progress frequently — humans monitor the board.
104106
- **Every commit MUST include an `Agent-Profile` trailer** linking to this agent's profile page.

skills/ak-plan/SKILL.md

Lines changed: 85 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,34 @@ Use `AskUserQuestion` to interactively confirm the plan with the user. For each
9393
- **Approach** — when multiple implementation strategies exist, present them with trade-off descriptions
9494
- **Task granularity** — whether to split a large piece into subtasks or keep it as one
9595

96-
Keep iterating until all uncertainties are resolved. Only proceed to create tasks after the user confirms the final scope and approach.
96+
Keep iterating until all uncertainties are resolved.
97+
98+
Before creating any tasks, show the user a **task summary table** using `AskUserQuestion`:
99+
100+
```
101+
📋 Task Plan Preview
102+
103+
| # | Title | Repo | Priority | Labels | Depends on | Agent |
104+
|---|-------|------|----------|--------|------------|-------|
105+
| 1 | <title> | <repo> | high | backend | — | <agent> |
106+
| 2 | <title> | <repo> | medium | frontend | #1 | <agent> |
107+
| ...
108+
109+
Per-task description summary:
110+
111+
### Task 1: <title>
112+
Goal: <one sentence>
113+
Files: <file list>
114+
Spec: <key points — not the full description, but enough to judge scope>
115+
116+
### Task 2: <title>
117+
...
118+
119+
---
120+
Create all tasks? (y/n)
121+
```
122+
123+
The user must confirm before any `ak create task` calls are made. If the user requests changes, adjust and re-preview.
97124

98125
## Phase 3: Create Board & Tasks
99126

@@ -138,10 +165,13 @@ One sentence: what this task produces.
138165
POST /api/items — create item
139166
Request: { "name": string }
140167
Response: 201 { "id": 1, "name": "..." }
168+
Empty name → 400 validation error
141169
142-
## Patterns
143-
- Follow existing project conventions (read CLAUDE.md)
144-
170+
## Checks
171+
- [ ] POST /api/items returns 201 with { id, name }
172+
- [ ] Empty name returns 400 with validation error
173+
- [ ] New item appears on the list page without refresh
174+
- [ ] Empty state shows "No items yet" placeholder
145175
```
146176

147177
Vague descriptions produce vague code. Be specific.
@@ -190,35 +220,72 @@ ak task reject <task-id> --reason "CI not green — wait for CI to pass before s
190220
Two gates — both must pass before merging. Reject as soon as either fails.
191221

192222
**Gate 1: Code Review**
193-
- Read the diff: `gh pr diff <pr-number> --repo <owner>/<repo>`
194-
- Check implementation matches spec, code quality, tests
195-
- **Fails → reject immediately**, don't proceed to Gate 2
223+
224+
Read the full PR diff and review against the task spec:
225+
```bash
226+
gh pr view <pr-number> --repo <owner>/<repo> --json title,body,additions,deletions,changedFiles
227+
gh pr diff <pr-number> --repo <owner>/<repo>
228+
```
229+
230+
Check:
231+
- Does the implementation match the task spec?
232+
- Code quality — logic errors, bad abstractions, security issues
233+
- Boundary awareness — CLI user-facing output vs internal logging, public API vs private
234+
- Missing or broken test updates
235+
- Dropped functionality (lost stack traces, removed useful info, etc.)
236+
237+
**Fails → reject immediately**, don't proceed to Gate 2.
196238

197239
**Gate 2: Functional Acceptance**
198-
- Follow the target repo's CONTRIBUTING.md review process
199-
- Visit preview/staging deployment and verify the feature works end-to-end
200-
- Test golden path and edge cases from the task spec
240+
- Re-read the target repo's CONTRIBUTING.md before testing — don't rely on memory from Phase 1
241+
- Walk through every item in the task's `## Checks` section — each must pass
242+
- Visit preview/staging deployment and verify end-to-end
201243
- Check for regressions in related features
202244
- **Fails → reject with specific repro steps**
203245

204-
**Both gates pass → Merge.**
205-
CI was already verified by the worker agent before submitting for review.
246+
**Either gate fails → Reject.** List all issues in the reason.
206247
```bash
207-
gh pr merge <pr-number> --repo <owner>/<repo> --squash --delete-branch
248+
ak task reject <task-id> --reason "<all issues, specific and actionable>"
208249
```
209-
The daemon's PR Monitor will automatically complete the task — do NOT manually `ak task complete`.
210250

211-
**Either gate fails → Reject with all issues.**
251+
**Both gates pass → Post verification comment, then merge.**
252+
253+
Post evidence on the PR before merging:
212254
```bash
213-
ak task reject <task-id> --reason "<all issues, specific and actionable>"
255+
gh pr comment <pr-number> --repo <owner>/<repo> --body "$(cat <<'EOF'
256+
## Verification
257+
258+
### Functional Test
259+
- Visited: <staging/preview URL tested>
260+
- Golden path: <what was tested and result>
261+
- Edge cases: <what was tested and result>
262+
263+
### Test Suite
264+
<test commands run and pass/fail summary>
265+
266+
### Conclusion
267+
All checks pass — merging.
268+
EOF
269+
)"
214270
```
215271

216-
### Handle merge conflicts:
217-
If a PR can't merge cleanly, reject — the worker agent will rebase, fix, and resubmit:
272+
If the PR has merge conflicts, reject instead of merging — the worker agent will rebase, fix, and resubmit:
218273
```bash
219274
ak task reject <task-id> --reason "merge conflicts with main — rebase and resubmit"
220275
```
221276

277+
Then merge:
278+
```bash
279+
gh pr merge <pr-number> --repo <owner>/<repo> --squash --delete-branch
280+
```
281+
The daemon's PR Monitor will automatically complete the task — do NOT manually `ak task complete`.
282+
283+
#### Cleanup after merge
284+
Remove local review artifacts from the repo root:
285+
```bash
286+
rm -rf /tmp/ak-review-* playwright-report/ test-results/
287+
```
288+
222289
### Completion:
223290
When all tasks are done, report the final summary to the user.
224291

skills/ak-task/SKILL.md

Lines changed: 81 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,49 @@ Use `AskUserQuestion` to interactively resolve any uncertainties before creating
5757

5858
Keep iterating — each answer may reveal new questions. Only proceed to create when all points are resolved and the user has confirmed the final task spec.
5959

60-
If nothing is ambiguous (simple, clear-cut request), skip straight to presenting a summary and asking for a single confirmation.
60+
If nothing is ambiguous (simple, clear-cut request), skip straight to the task preview below.
6161

62-
### Step 4: Create Task
62+
### Step 4: Preview & Create Task
6363

64-
Write a detailed description with:
65-
- Goal (one sentence)
66-
- Files to modify
67-
- Specific behavior/spec
68-
- Patterns to follow
64+
Before creating, show the user the **exact task that will be created** using `AskUserQuestion`. Format the preview as:
65+
66+
```
67+
📋 Task Preview
68+
69+
Title: <concise action phrase>
70+
Board: <board-name>
71+
Repo: <repo-name>
72+
Agent: <agent-name>
73+
Priority: <priority>
74+
Labels: <labels>
75+
Depends on: <task-ids or "none">
76+
77+
## Goal
78+
<one sentence>
79+
80+
## Files
81+
- <file path> — <what changes>
82+
83+
## Spec
84+
<concrete behavior: inputs, outputs, edge cases, error handling>
85+
86+
## Checks
87+
- [ ] <verifiable condition — reviewer will check each one in Gate 2>
88+
89+
Examples by task type:
90+
- API: "POST /api/items returns 201 with { id, name }"
91+
- API: "empty name returns 400 with validation error"
92+
- UI: "clicking Submit creates the item and navigates to detail page"
93+
- UI: "empty form shows inline validation, submit button stays disabled"
94+
- CLI: "ak get task --board xxx prints task table with status column"
95+
96+
---
97+
Create this task? (y/n)
98+
```
99+
100+
Everything from `## Goal` through `## Checks` is the exact text that will be passed to `--description`. The header fields above it (Title, Board, Agent, etc.) are metadata for display only — do not include them in `--description`. The user must see the full description before it's sent to the agent.
101+
102+
**On confirmation**, create the task:
69103

70104
```bash
71105
ak create task \
@@ -86,14 +120,14 @@ Report to user: task ID, title, assigned agent.
86120

87121
## Phase 2: Monitor & Review
88122

89-
### Step 6: Monitor
123+
### Step 5: Monitor
90124

91125
**Block on `ak wait` instead of writing polling loops.** Exit codes: 0 condition met, 2 task cancelled, 124 timeout.
92126

93127
```bash
94128
ak wait task <task-id> --until in_review --timeout 1h
95129
case $? in
96-
0) ;; # ready for review → Step 7
130+
0) ;; # ready for review → Step 6
97131
2) echo "task cancelled — abort" ; exit 1 ;;
98132
124) echo "timed out — investigate" ;; # fall through to investigation
99133
esac
@@ -107,7 +141,7 @@ Run `ak wait task --help` for the full flag list.
107141
3. Check agent session log for what it's doing or where it's stuck
108142
4. Check child processes: the agent may be stuck on a hook, install, or network call
109143

110-
### Step 7: Review PR
144+
### Step 6: Review PR
111145

112146
**Pre-check: CI status.** Before reviewing, verify CI has passed on the PR:
113147
```bash
@@ -124,8 +158,8 @@ Two gates — both must pass before merging. Reject as soon as either fails.
124158

125159
Read the full PR diff and review against the task spec:
126160
```bash
127-
gh pr view <pr-number> --repo <owner/repo> --json title,body,additions,deletions,changedFiles
128-
gh pr diff <pr-number> --repo <owner/repo>
161+
gh pr view <pr-number> --repo <owner>/<repo> --json title,body,additions,deletions,changedFiles
162+
gh pr diff <pr-number> --repo <owner>/<repo>
129163
```
130164

131165
Check:
@@ -139,32 +173,58 @@ Check:
139173

140174
#### Gate 2: Functional Acceptance
141175

142-
Follow the target repo's CONTRIBUTING.md review process. This typically includes:
143-
- Visit the preview/staging deployment and manually verify the feature works end-to-end
144-
- Test the golden path and edge cases described in the task spec
176+
Re-read the target repo's CONTRIBUTING.md before testing — don't rely on memory from Step 2.
177+
- Walk through every item in the task's `## Checks` section — each must pass
178+
- Visit the preview/staging deployment and verify end-to-end
145179
- Check for regressions in related features
146180
- Run any project-specific verification steps defined in CONTRIBUTING.md
147181

148182
**Fails → reject with specific repro steps.**
149183

150-
### Step 8: Decide — act immediately, do not ask the user
184+
### Step 7: Decide — act immediately, do not ask the user
151185

152186
**Either gate fails → Reject.** List all issues in the reason.
153187
```bash
154188
ak task reject <task-id> --reason "<all issues, specific and actionable>"
155189
```
156-
After reject, go back to Step 6 and keep monitoring.
190+
After reject, go back to Step 5 and keep monitoring.
157191

158-
**Both gates pass → Merge the PR, daemon auto-completes the task.**
159-
CI was already verified by the worker agent before submitting for review.
192+
**Both gates pass → Post verification comment, then merge.**
193+
194+
Post a verification comment on the PR with evidence before merging:
195+
```bash
196+
gh pr comment <pr-number> --repo <owner>/<repo> --body "$(cat <<'EOF'
197+
## Verification
198+
199+
### Functional Test
200+
- Visited: <staging/preview URL tested>
201+
- Golden path: <what was tested and result>
202+
- Edge cases: <what was tested and result>
203+
204+
### Test Suite
205+
<test commands run and pass/fail summary>
206+
207+
### Conclusion
208+
All checks pass — merging.
209+
EOF
210+
)"
211+
```
212+
213+
If the PR has merge conflicts, reject instead of merging — the worker agent will rebase, fix, and resubmit:
214+
```bash
215+
ak task reject <task-id> --reason "merge conflicts with main — rebase and resubmit"
216+
```
217+
218+
Then merge:
160219
```bash
161220
gh pr merge <pr-number> --repo <owner>/<repo> --squash --delete-branch
162221
```
163222
The daemon's PR Monitor will mark the task done — do NOT manually `ak task complete`.
164223

165-
If a PR has merge conflicts, reject the task — the worker agent will rebase, fix, and resubmit:
224+
#### Cleanup after merge
225+
Remove local review artifacts from the repo root:
166226
```bash
167-
ak task reject <task-id> --reason "merge conflicts with main — rebase and resubmit"
227+
rm -rf /tmp/ak-review-* playwright-report/ test-results/
168228
```
169229

170230
## Phase 3: Exception Handling

0 commit comments

Comments
 (0)