@chris1807/claude-kit 2.1.45 → 2.1.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -28,7 +28,7 @@ Every session Claude learns from your feedback and gets better at helping you sp
28
28
  | **Global Agents** | 10 | `~/.claude/agents/` (your machine, all projects) | backend, frontend, legacy (Lucee/CFML), mockup, reviewer, test-runner, build-validator, lint-checker, azure-ops, security-auditor |
29
29
  | **Project Agents** | 2 | `.claude/agents/` (in the project) | deployer, db-admin |
30
30
  | **Hooks** | 9 | `.claude/hooks/` (in the project) | Secret blocker, sensitive data blocker (Bash + MCP + output), protected files, auto-format, test suggestions, UAT reminder, self-improve |
31
- | **Slash Commands** | 23 | `.claude/commands/` (in the project) | `/implement`, `/review`, `/deep-review`, `/resolve-feedback`, `/fix-review`, `/deploy`, `/create-release`, `/deploy-release`, `/add-to-release`, `/cherry-pick`, `/promote`, `/rollback`, `/status`, `/plan-backlog`, `/plan-sprint`, `/quote-backlog`, `/cleanup-branches`, `/close-orphan-tasks`, `/quote`, `/explain` |
31
+ | **Slash Commands** | 24 | `.claude/commands/` (in the project) | `/implement`, `/review`, `/deep-review`, `/resolve-feedback`, `/fix-review`, `/deploy`, `/create-release`, `/deploy-release`, `/add-to-release`, `/cherry-pick`, `/promote`, `/rollback`, `/status`, `/plan-backlog`, `/plan-sprint`, `/quote-backlog`, `/cleanup-branches`, `/close-orphan-tasks`, `/quote`, `/explain`, `/create-work-item`, `/edit-work-item` |
32
32
  | **MCP Servers** | Up to 6 | `.mcp.json` (in the project) | **Azure DevOps** (work items, repos, pipelines, wiki), Playwright, MongoDB/SQL/Postgres, Teams, Stripe, Azure CLI |
33
33
  | **Workflow Template** | 1 | Appended to `CLAUDE.md` | Documents the full development process |
34
34
  | **Settings** | 1 | `.claude/settings.json` (in the project) | Registers all hooks and MCP servers |
@@ -652,6 +652,8 @@ Claude reviews for:
652
652
  | `/quote-backlog` | `/quote-backlog [project]` | Sweep backlog for Design Approved items without points → review completeness, check for duplicates, suggest rewrites, propose points + creator comments (10 at a time, approval-gated) |
653
653
  | `/quote` | `/quote AB#1234` | Estimate a work item in story points (senior-calibrated Fibonacci rubric) |
654
654
  | `/explain` | `/explain AB#1234` | Summarize and explain a work item in plain language |
655
+ | `/create-work-item` | `/create-work-item [description]` | Interactively draft and create a Feature, Bug, or User Story — proposes story points (user must agree), creates pointed items in Dev Ready; on a Feature, also drafts its child stories with `Custom.Order` waves |
656
+ | `/edit-work-item` | `/edit-work-item AB#1234 [what to change]` | Revise an existing work item field-by-field. On a Feature, cascades into its child stories — updates, adds, retires, and re-sequences `Custom.Order` waves — with a safety gate on anything already past Dev Ready |
655
657
  | `/cleanup-branches` | `/cleanup-branches` | Delete merged feature/work branches |
656
658
  | `/close-orphan-tasks` | `/close-orphan-tasks --dry-run` | Close open Tasks whose parent is Ready to Deploy / Deployed / Closed |
657
659
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chris1807/claude-kit",
3
- "version": "2.1.45",
3
+ "version": "2.1.47",
4
4
  "description": "Claude Code starter kit for Azure DevOps teams — agents, hooks, MCP servers, slash commands, and end-to-end work item → PR → release → deploy workflow automation",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,6 +1,6 @@
1
1
  Create a new Azure DevOps work item interactively. Usage: `/create-work-item`
2
2
 
3
- This command walks the user through creating a Bug or User Story, develops an acceptance-criteria-ready plan, optionally embeds a UI mockup in the description, and creates the item in the chosen Azure DevOps project.
3
+ This command walks the user through creating a Feature, Bug, or User Story, develops an acceptance-criteria-ready plan, optionally embeds a UI mockup in the description, and creates the item in the chosen Azure DevOps project. For a Feature it can also draft and create the child User Stories that make the Feature implementable.
4
4
 
5
5
  Treat `$ARGUMENTS` as an optional rough description that the user may have typed inline (e.g. `/create-work-item users should be able to export payments`). If provided, skip the initial "describe your requirements" prompt in Step 2 and use it as the starting requirements text — but still confirm with the user before proceeding.
6
6
 
@@ -11,20 +11,23 @@ Ask the user:
11
11
  ```
12
12
  What type of work item do you want to create?
13
13
 
14
- 1. Bug
15
- 2. User Story
14
+ 1. Bug — something deployed is behaving wrong
15
+ 2. User Story — one shippable slice of user-facing behavior
16
+ 3. Feature — a container for several related user stories
16
17
 
17
- Reply with 1, 2, "bug", or "user story".
18
+ Reply with 1, 2, 3, "bug", "user story", or "feature".
18
19
  ```
19
20
 
20
- **Wait for the user's response.** Map the answer to either `Bug` or `User Story`. If the user types something else, ask again — do not guess.
21
+ **Wait for the user's response.** Map the answer to `Bug`, `User Story`, or `Feature`. If the user types something else, ask again — do not guess.
22
+
23
+ If the requirements clearly span several independently shippable slices, say so and recommend `Feature` — but the type is still the user's call.
21
24
 
22
25
  ## Step 2: Gather Requirements
23
26
 
24
27
  Ask the user to describe the requirements:
25
28
 
26
29
  ```
27
- Describe the {bug | user story} in your own words. Include:
30
+ Describe the {feature | bug | user story} in your own words. Include:
28
31
 
29
32
  - What the user is trying to do (or what is broken)
30
33
  - Why it matters / who is affected
@@ -53,6 +56,38 @@ For each image found, plan to embed it in the final description as an `<img src=
53
56
 
54
57
  Translate the user's free-form requirements into a structured work item draft. The shape depends on the type:
55
58
 
59
+ ### For a Feature:
60
+
61
+ ```
62
+ ## Draft: {Prefix} - {proposed title}
63
+
64
+ **Type:** Feature
65
+
66
+ ### Description
67
+ {2–4 sentences describing the capability being delivered and who it serves.
68
+ A Feature is a container — describe the outcome, not the implementation.}
69
+
70
+ ### Business Value
71
+ {Why this is worth building — the problem it removes or the opportunity it opens.}
72
+
73
+ ### Scope
74
+ - {each coherent, independently shippable chunk of work — these become the
75
+ child User Stories in Step 9}
76
+ - ...
77
+
78
+ ### Out of Scope
79
+ - {anything the user mentioned that shouldn't ride along with this feature}
80
+
81
+ ### Success Criteria
82
+ 1. {observable, feature-level outcome that proves the capability landed}
83
+ 2. ...
84
+
85
+ ### Open Questions
86
+ - {anything ambiguous that you couldn't infer}
87
+ ```
88
+
89
+ A Feature carries **no story points** and **never moves to `Dev Ready`** — sizing and state live on its child stories. Step 4 is skipped for Features.
90
+
56
91
  ### For a User Story:
57
92
 
58
93
  ```
@@ -146,7 +181,9 @@ Approve this draft? (yes / suggest changes / cancel)
146
181
 
147
182
  ## Step 4: Propose Story Points
148
183
 
149
- Every work item this command creates gets a story point estimate proposed automatically, applied only with the user's agreement.
184
+ **Skip this step entirely for a Feature.** A Feature's size is the sum of its child stories — the Feature itself gets no `StoryPoints` value and stays in `New`. Its stories are pointed in Step 9. Go to Step 5.
185
+
186
+ For a **Bug** or **User Story**, every work item this command creates gets a story point estimate — proposed automatically, applied only with the user's agreement.
150
187
 
151
188
  Estimate using the same rubric as `/quote`: the **modified Fibonacci scale** (`1, 2, 3, 5, 8, 13, 21`), calibrated for a **senior developer working with Claude assistance** in a codebase they know. Don't pad for ramp-up, routine architectural decisions, or stack familiarity — only for things a senior cannot shortcut: genuinely novel work, unresolved open questions, cross-team coordination, external dependencies. If the work looks larger than 21 points, recommend splitting the item instead of proposing a number.
152
189
 
@@ -167,9 +204,9 @@ Agree? (yes / different number / skip)
167
204
 
168
205
  Points are never written without the user's explicit agreement.
169
206
 
170
- ## Step 5: Offer a Mockup (User Stories only — skip for Bugs)
207
+ ## Step 5: Offer a Mockup (User Stories and Features — skip for Bugs)
171
208
 
172
- If the work item type is **User Story** and the requirements appear to involve UI (a screen, a form, a button, a workflow), ask:
209
+ If the work item type is **User Story** or **Feature** and the requirements appear to involve UI (a screen, a form, a button, a workflow), ask:
173
210
 
174
211
  ```
175
212
  Want me to generate an HTML mockup and embed it in the description? (yes / no)
@@ -222,14 +259,17 @@ Before creating anything in Azure DevOps, present a final summary and ask for on
222
259
  ## Ready to Create
223
260
 
224
261
  **Title:** {Prefix} - {title}
225
- **Type:** {Bug | User Story}
262
+ **Type:** {Feature | Bug | User Story}
226
263
  **Project:** {project}
227
264
  {for Bugs:}
228
265
  **Priority:** {n}
229
266
  **Severity:** {n - Label}
230
267
  {end for Bugs}
231
- **Story Points:** {n (agreed) | skipped}
232
- **Initial State:** {Dev Ready (pointed) | New (no points)}
268
+ {for Features:}
269
+ **Scope items:** {count} offered as child stories after creation
270
+ {end for Features}
271
+ **Story Points:** {n (agreed) | skipped | n/a — Features aren't pointed}
272
+ **Initial State:** {Dev Ready (pointed) | New (no points) | New (Feature)}
233
273
  **Mockup:** {Embedded | Not requested | Skipped (non-UI)}
234
274
  **Images:** {count} user-supplied image(s) embedded in description
235
275
  **Open Questions:** {count}
@@ -278,12 +318,16 @@ Apply this pass to every section (Description, Acceptance Criteria, Steps to Rep
278
318
  Call `mcp__azure-devops__wit_create_work_item` with:
279
319
 
280
320
  - **project**: the chosen project
281
- - **workItemType**: `Bug` or `User Story`
321
+ - **workItemType**: `Feature`, `Bug`, or `User Story`
282
322
  - **title**: the approved title (with prefix)
283
323
  - **fields**: a JSON Patch document setting:
284
324
  - `System.Description` — the rendered HTML description (with embedded mockup `<img>` and any user-supplied images)
285
325
  - `Microsoft.VSTS.Common.AcceptanceCriteria` — the rendered HTML acceptance criteria block
286
- - `Microsoft.VSTS.Scheduling.StoryPoints` — the points agreed in Step 4 (omit entirely if the user skipped)
326
+ - `Microsoft.VSTS.Scheduling.StoryPoints` — the points agreed in Step 4 (omit entirely if the user skipped, and **always** for a Feature)
327
+ - For Features:
328
+ - Render `Business Value`, `Scope`, `Out of Scope`, and `Success Criteria` into the description. Put `Success Criteria` in `Microsoft.VSTS.Common.AcceptanceCriteria` **only if** the process template exposes that field on Feature — if the create call rejects it, fold the block into the description and retry rather than dropping it.
329
+ - `Microsoft.VSTS.Common.BusinessValue` — only if the user supplied a number. Never invent one.
330
+ - Omit `Microsoft.VSTS.Scheduling.StoryPoints` entirely.
287
331
  - For Bugs:
288
332
  - `Microsoft.VSTS.TCM.ReproSteps` — the rendered HTML repro steps (Azure DevOps puts repro steps in this field for the Bug template; if the project uses the Agile template instead, fold repro steps into Description)
289
333
  - `Microsoft.VSTS.Common.Priority` — the chosen Priority (1–4)
@@ -295,7 +339,46 @@ If the `Open Questions` section is non-empty, append it to the description as a
295
339
 
296
340
  If story points were agreed in Step 4, set `System.State` to `Dev Ready` via `mcp__azure-devops__wit_update_work_item` **after** the item is created (a separate call — new items start in `New`, and some process templates reject a non-initial state in the create call). If the state transition is rejected, report the error and leave the state as-is — don't silently retry through intermediate states. Items created without points stay in `New`.
297
341
 
298
- ## Step 9: Confirm
342
+ **Features are never moved.** A Feature stays in `New` and advances only as its child stories are verified and closed — the same rule `/implement` follows.
343
+
344
+ ## Step 9: Offer Child User Stories (Features only)
345
+
346
+ Skip this step for Bugs and User Stories.
347
+
348
+ A Feature is a container — `/implement AB#{id}` on a Feature implements its **child User Stories in `Custom.Order` waves**, so a Feature with no children can't be worked. After the Feature is created, ask:
349
+
350
+ ```
351
+ Draft child user stories for this feature now? (yes / no — I'll add them later)
352
+ ```
353
+
354
+ **Wait for the user.** On `no`, skip to Step 10 and point them at `/plan-backlog` for later.
355
+
356
+ On `yes`:
357
+
358
+ 1. Turn each bullet from the Feature's **Scope** section into a candidate User Story using the User Story draft shape from Step 3 — plain-language description plus testable acceptance criteria. Keep each one independently shippable; if a bullet is really two stories, split it.
359
+ 2. Assign each story a **`Custom.Order`** value. Stories that can be built in parallel share the same number; a story that depends on an earlier one gets a higher number. Start at `1` and increment per wave. This field drives the wave ordering in `/implement` — a story with no value lands in a catch-all wave, so set it on every story.
360
+ 3. Propose story points for each using the Step 4 rubric.
361
+ 4. Present the whole set for approval at once:
362
+
363
+ | # | Order | Proposed Title | Points | Summary |
364
+ |---|-------|----------------|--------|---------|
365
+
366
+ ```
367
+ Approve these child stories? (yes / change N / drop N / cancel)
368
+ ```
369
+
370
+ **Wait for the user.** Revise and re-present until approved. Do not create anything before approval.
371
+ 5. On approval, create each story with `mcp__azure-devops__wit_create_work_item` in the same project, setting:
372
+ - `System.Description` and `Microsoft.VSTS.Common.AcceptanceCriteria` — rendered to HTML per the Step 8 rules
373
+ - `Custom.Order` — the wave number
374
+ - `Microsoft.VSTS.Scheduling.StoryPoints` — the agreed points
375
+ - `System.AssignedTo` — copied from the Feature if the Feature has an assignee; otherwise leave unset
376
+ 6. Link each story to the Feature as a child via `mcp__azure-devops__wit_work_item_link_write` (`System.LinkTypes.Hierarchy-Reverse` from the story to the Feature).
377
+ 7. Move each pointed story to `Dev Ready` in a follow-up update, per the Step 8 rule. **The Feature's state is never changed.**
378
+
379
+ If a story fails to create or link, report which ones succeeded and which didn't — don't roll back the Feature.
380
+
381
+ ## Step 10: Confirm
299
382
 
300
383
  After creation, report:
301
384
 
@@ -303,11 +386,16 @@ After creation, report:
303
386
  Created AB#{id}: {title}
304
387
  Project: {project}
305
388
  Type: {type}
306
- Story Points: {n | not set}
389
+ Story Points: {n | not set | n/a (Feature)}
307
390
  State: {Dev Ready | New}
308
391
  URL: {work item URL}
309
392
  Mockup attached: {yes / no}
310
393
  Open questions: {count}
394
+ {Features only:}
395
+ Child stories: {n created | none — add them later with /plan-backlog}
396
+ AB#{id} (order {n}, {p} pts) — {title}
397
+ ...
398
+ {end Features only}
311
399
 
312
400
  Next steps:
313
401
  /explain AB#{id} — re-read the item in plain language
@@ -315,4 +403,13 @@ Next steps:
315
403
  /implement AB#{id} — start working on it
316
404
  ```
317
405
 
406
+ For a **Feature**, use these next steps instead:
407
+
408
+ ```
409
+ Next steps:
410
+ /explain AB#{id} — re-read the feature in plain language
411
+ /plan-backlog — propose child Tasks for the Dev Ready stories
412
+ /implement AB#{id} — implement the child stories in Custom.Order waves
413
+ ```
414
+
318
415
  Do not assign the work item, set an iteration, or add tags unless the user explicitly asks — those are downstream decisions.
@@ -0,0 +1,237 @@
1
+ Edit an existing Azure DevOps work item. Usage: `/edit-work-item <work-item-id> [what to change]`
2
+
3
+ This command revises a work item that already exists — title, description, acceptance criteria, points, priority/severity, order. On a **Feature** it treats the Feature and its child User Stories as **one unit**: a change to the Feature's scope cascades into the children, new stories are drafted for new scope, stories that fell out of scope are retired, and `Custom.Order` is re-sequenced so the implementation waves still make sense.
4
+
5
+ Parse `$ARGUMENTS`:
6
+ - **Work item ID** — accept `AB#1234`, `#1234`, or `1234`. Required. If missing, ask for it and stop.
7
+ - **Change request** — any remaining text is the user's description of what to change (e.g. `/edit-work-item AB#6240 add SSO to the scope, drop the CSV export story`). Optional — if absent, Step 3 asks for it.
8
+ - **`--dry-run`** — do every step including the full change set, but make no writes. Report what would have changed and stop.
9
+
10
+ ## Step 1: Fetch the Work Item
11
+
12
+ Read the work item with `expand: Relations` so links and children come back. Collect:
13
+
14
+ - `System.Title`, `System.WorkItemType`, `System.State`, `System.AssignedTo`, `System.Tags`
15
+ - `System.Description`, `Microsoft.VSTS.Common.AcceptanceCriteria`
16
+ - `Microsoft.VSTS.Scheduling.StoryPoints`, `Custom.Order`
17
+ - For Bugs / Hot Fixes: `Microsoft.VSTS.TCM.ReproSteps`, `Microsoft.VSTS.Common.Priority`, `Microsoft.VSTS.Common.Severity`
18
+ - Parent, children, and **linked pull requests** (`ArtifactLink` relations)
19
+ - Comments — recent discussion often explains why a field says what it says
20
+
21
+ If the work item is not found, report the error and stop.
22
+
23
+ ### If the item is a Feature
24
+
25
+ Also fetch every child via `wit_work_item` `get_batch` with fields `System.Id`, `System.Title`, `System.WorkItemType`, `System.State`, `System.AssignedTo`, `Custom.Order`, `Microsoft.VSTS.Scheduling.StoryPoints`, `System.Description`, `Microsoft.VSTS.Common.AcceptanceCriteria`. Children are the `System.LinkTypes.Hierarchy-Forward` relations. You need their full text — you cannot judge whether a story still fits the revised scope from its title alone.
26
+
27
+ ## Step 2: Show the Current Item
28
+
29
+ Present what exists today, so the user is editing against reality and not memory:
30
+
31
+ ```
32
+ ## AB#{id}: {title}
33
+
34
+ **Type:** {type} **State:** {state} **Points:** {n | not set} **Assigned:** {name | unassigned}
35
+ **Linked PRs:** {#id (status), ... | none}
36
+
37
+ ### Description
38
+ {current description, rendered as readable text}
39
+
40
+ ### Acceptance Criteria
41
+ {current AC}
42
+ {for Bugs:}
43
+ **Priority:** {n} **Severity:** {n - Label}
44
+ {end for Bugs}
45
+ ```
46
+
47
+ For a **Feature**, append the current wave layout:
48
+
49
+ ```
50
+ ### Child Stories (current Custom.Order waves)
51
+
52
+ | Wave | Order | Story | Title | Points | State |
53
+ |------|-------|-------|-------|--------|-------|
54
+ | 1 | 1 | AB#6242 | ... | 3 | Dev Ready |
55
+ | 1 | 1 | AB#6243 | ... | 2 | Dev Ready |
56
+ | 2 | 2 | AB#6244 | ... | 5 | Code Review |
57
+ | 3 | — | AB#6245 | ... | 3 | New | ← no Custom.Order set
58
+ ```
59
+
60
+ ## Step 3: Gather the Change Request
61
+
62
+ If the user supplied a change request inline, restate your reading of it in one line and move on. Otherwise ask:
63
+
64
+ ```
65
+ What should change on AB#{id}?
66
+
67
+ Describe it however you like — "the scope should also cover SSO", "tighten AC 3",
68
+ "this is really two stories", "bump severity to 2". You can paste image URLs or
69
+ links; they'll be preserved.
70
+ ```
71
+
72
+ **Wait for the user's response.** Ask at most one targeted clarifying question if the request is ambiguous about *which* field or *which* child it touches.
73
+
74
+ Scan the response for images and links and preserve them exactly as `/create-work-item` Step 2 describes — an edit must never silently strip an image, attachment URL, or reference link that is already in the description.
75
+
76
+ ## Step 4: Draft the Change Set
77
+
78
+ Produce a **field-level diff**, not a rewritten item. For every field you propose to touch, show before and after. Fields not listed are not touched.
79
+
80
+ ```
81
+ ## Proposed Changes — AB#{id}
82
+
83
+ **Title**
84
+ - {current}
85
+ + {proposed}
86
+
87
+ **Description**
88
+ {a readable summary of what's being added, removed, or reworded — not a raw dump}
89
+
90
+ **Acceptance Criteria**
91
+ - 3. {removed criterion}
92
+ + 3. {new criterion}
93
+ + 4. {added criterion}
94
+
95
+ **Story Points:** {n} → {m} ({one-line rationale})
96
+ **Priority / Severity:** {n} → {m} (Bugs only)
97
+
98
+ **Unchanged:** {list the fields you deliberately left alone}
99
+ ```
100
+
101
+ Rules for the draft:
102
+
103
+ - **Preserve, don't regenerate.** Keep existing wording that the change request doesn't touch. Never drop existing `<img>` tags, attachment URLs, or reference links.
104
+ - **Points follow the `/quote` rubric** — modified Fibonacci (`1, 2, 3, 5, 8, 13, 21`), calibrated for a senior developer working with Claude assistance. Only propose a change if the scope actually moved. If the revised item now looks bigger than 21 points, recommend splitting it into a Feature instead of writing the number.
105
+ - **Never point a Feature** and never change a Feature's `System.State`.
106
+ - **Prefix rule holds** — if the title changes, it keeps its `PREFIX - ` prefix from the project's CLAUDE.md table.
107
+
108
+ ### If the item is a Feature — cascade to the children
109
+
110
+ This is the point of the command. After drafting the Feature's own changes, evaluate **every child story against the revised scope** and classify each one:
111
+
112
+ | Verdict | Meaning | Action |
113
+ |---------|---------|--------|
114
+ | **Unchanged** | Still correct under the new scope | Leave it entirely alone |
115
+ | **Update** | Still belongs, but its title / description / AC / points no longer match | Draft a field-level diff for it |
116
+ | **Add** | The revised scope introduces work no existing story covers | Draft a new User Story (`/create-work-item` Step 3 shape) with proposed points |
117
+ | **Retire** | The revised scope no longer includes this work | Propose `System.State` = `Removed`, or unlinking from the Feature — user picks |
118
+ | **Split** | The story now carries two independently shippable slices | Propose narrowing the existing story and adding a sibling |
119
+
120
+ Then **re-sequence `Custom.Order`**, because adding, retiring, or re-scoping stories usually breaks the wave plan:
121
+
122
+ 1. Rebuild the dependency picture across the surviving + added stories: a story that needs another story's work merged first must land in a **later** wave.
123
+ 2. Stories with no dependency on each other share a wave (same `Custom.Order` value) so `/implement` runs them in parallel.
124
+ 3. Number waves as **consecutive integers starting at 1**, no gaps. Stories that previously had no `Custom.Order` get one now.
125
+ 4. **Only write `Custom.Order` where the value actually changes.** A re-sequence that renumbers every story to the same value it already had is not a change — don't issue the write.
126
+ 5. Stories already past `Dev Ready` (see the safety gate below) keep their existing order unless the user explicitly says otherwise — moving an in-flight story between waves has no effect on work that's already done and only confuses the record.
127
+
128
+ Present the cascade as one table, old order → new order:
129
+
130
+ ```
131
+ ### Child Story Changes
132
+
133
+ | Story | Title | Verdict | Order | Points | State | Notes |
134
+ |-------|-------|---------|-------|--------|-------|-------|
135
+ | AB#6242 | ... | Unchanged | 1 | 3 | Dev Ready | — |
136
+ | AB#6243 | ... | Update | 1 | 2 → 3 | Dev Ready | AC 2 reworded for SSO |
137
+ | AB#6244 | ... | Unchanged | 2 → 2 | 5 | Code Review | in flight — order held |
138
+ | (new) | ... | Add | 2 | 5 | → Dev Ready | covers new SSO scope |
139
+ | AB#6245 | ... | Retire | — | 3 | New | dropped from scope → Removed |
140
+
141
+ ### Resulting Waves
142
+
143
+ | Wave | Order | Stories |
144
+ |------|-------|---------|
145
+ | 1 | 1 | AB#6242, AB#6243 |
146
+ | 2 | 2 | AB#6244, (new SSO story) |
147
+ ```
148
+
149
+ Show the field-level diff for every story marked **Update**, and the full draft for every story marked **Add**, below the table. The user is approving specific text, not a summary.
150
+
151
+ ## Step 5: Safety Gate — In-Flight Work
152
+
153
+ Before asking for approval, check the state of everything you propose to write and flag anything that is **past `Dev Ready`** in the workflow (`Active`, `Code Review`, `Ready for Testing`, `Testing`, `Ready to Deploy`, `Deployed`, `Closed`) or has a **linked pull request**.
154
+
155
+ Editing the acceptance criteria of a story that is already implemented silently invalidates a PR that was reviewed against the old criteria. So for each such item, call it out explicitly:
156
+
157
+ ```
158
+ ⚠️ AB#6244 is in **Code Review** with PR #142 open.
159
+
160
+ Changing its acceptance criteria now means the open PR no longer matches the story.
161
+ 1. Edit it anyway — I'll note the change in a work item comment
162
+ 2. Leave it alone and put the new behavior in a new story
163
+ 3. Use /rework AB#6244 instead — that's the flow built for post-PR changes
164
+
165
+ Which?
166
+ ```
167
+
168
+ **Wait for the user on each flagged item.** Default to option 2 if the user is vague — adding a story is always recoverable; rewriting an implemented one is not.
169
+
170
+ Never move an item **backward** through the workflow. If setting points on an item that is already past `Dev Ready`, set the points only, leave the state alone, and say so.
171
+
172
+ ## Step 6: Approve
173
+
174
+ ```
175
+ ## Ready to Apply — AB#{id}
176
+
177
+ **Feature/item changes:** {n} field(s)
178
+ **Child stories:** {a} updated, {b} added, {c} retired, {d} re-ordered, {e} unchanged
179
+ **In-flight items being edited:** {list | none}
180
+ **Post a comment recording this change on each edited item?** {yes | no}
181
+
182
+ Apply these changes? (yes / edit / cancel)
183
+ ```
184
+
185
+ **Wait for the user.**
186
+ - `yes` → Step 7
187
+ - `edit` → ask which part to revise, revise it, re-show the diff from Step 4, then return here
188
+ - `cancel` → abort with no writes and confirm "Cancelled — nothing was changed."
189
+
190
+ If `--dry-run` was passed, stop here instead and report the change set as final output. Make no writes.
191
+
192
+ Default the comment question to **yes** for any item past `New`, and **no** for items still in `New` (nobody has looked at them yet).
193
+
194
+ ## Step 7: Apply
195
+
196
+ Render every Markdown section to HTML first — Azure DevOps description and acceptance criteria fields do not render Markdown. Use the conversion table and the **emphasis and code spans** rules from `/create-work-item` Step 8: bold the noun phrase carrying each claim, wrap identifiers in `<code>`, use lists for 2+ parallel items, keep `### Headings` as `<h3>`. Preserve existing `<img>` tags exactly.
197
+
198
+ Apply writes in this order, so a failure partway through leaves the most useful state behind:
199
+
200
+ 1. **Update the parent item** — one `mcp__azure-devops__wit_update_work_item` call with every changed field. Never include `System.State` for a Feature.
201
+ 2. **Update existing children** (verdict `Update`) — one call per story, points and `Custom.Order` in the same call as the text changes. If points were set on a story still at or before `Dev Ready`, set `System.State` = `Dev Ready` in that same call.
202
+ 3. **Create added children** — `mcp__azure-devops__wit_create_work_item` with description, acceptance criteria, `Custom.Order`, agreed `Microsoft.VSTS.Scheduling.StoryPoints`, and `System.AssignedTo` copied from the Feature if it has an assignee. Then link each to the Feature as a child via `mcp__azure-devops__wit_work_item_link_write` (`System.LinkTypes.Hierarchy-Reverse`), then move pointed ones to `Dev Ready` in a follow-up call.
203
+ 4. **Re-order** any story whose only change is `Custom.Order` — one call each, touching that field alone.
204
+ 5. **Retire** stories the user approved — set `System.State` = `Removed`, or remove the parent link, whichever the user chose. **Never delete a work item.**
205
+ 6. **Post comments** (if the user said yes) via `mcp__azure-devops__wit_work_item_comment_write` — one short comment per edited item saying what changed and why, and naming the Feature edit that drove it (e.g. `Scope updated via edit of AB#6240: acceptance criteria 2 reworded to cover SSO; re-ordered from wave 3 to wave 2.`).
206
+
207
+ Touch no field that wasn't in the approved change set. Assignee, iteration, and tags stay as they are unless the user asked.
208
+
209
+ If any write fails, stop, report exactly which items were changed and which weren't, and do not retry blindly — a half-applied re-sequence needs the user to see the real state before you try again.
210
+
211
+ ## Step 8: Confirm
212
+
213
+ ```
214
+ Updated AB#{id}: {title}
215
+ Type: {type}
216
+ Fields changed: {list}
217
+ Points: {n → m | unchanged}
218
+ State: {state} {(unchanged — Features are never moved) | (→ Dev Ready)}
219
+ URL: {work item URL}
220
+
221
+ {Features only:}
222
+ Child stories:
223
+ updated: AB#{id} ({what changed})
224
+ added: AB#{id} — {title} (order {n}, {p} pts, Dev Ready)
225
+ retired: AB#{id} — {title} (Removed)
226
+ re-ordered: AB#{id} (wave {old} → {new})
227
+ unchanged: {count}
228
+
229
+ Resulting waves: {1: AB#..., AB#... | 2: AB#...}
230
+ {end Features only}
231
+
232
+ Next steps:
233
+ /explain AB#{id} — re-read the item as it now stands
234
+ /implement AB#{id} — {implement the child stories in Custom.Order waves | start working on it}
235
+ ```
236
+
237
+ If nothing ended up changing (the user cancelled every proposed edit at the safety gate), say that plainly rather than reporting a successful edit.
@@ -161,6 +161,78 @@ Once the branch is created, move the work item (User Story, Bug, Hot Fix, or oth
161
161
 
162
162
  If the work item is already `Active`, skip the update. If the project's process template does not have an `Active` state (the update call returns an invalid-state error), fall back in this order: `In Progress` → `Doing` → leave the current state and warn the user that the state could not be advanced automatically. Do not silently swallow the error.
163
163
 
164
+ ### Ensure an Open Child Task Exists
165
+
166
+ The child **Task** is where hours live: Step 10 closes it and logs the hours worked when the PR goes up. So an implementation run must never proceed without one — if there's nothing to close, nothing gets logged.
167
+
168
+ Right after moving the work item to `Active`, look at its child Tasks (relations of type `System.LinkTypes.Hierarchy-Forward` whose target's `System.WorkItemType` is `Task`). A Task counts as **open** if its state is **not** `Closed`, `Done`, or `Removed`.
169
+
170
+ **Never do this for a Feature.** Features don't carry Tasks of their own — the Feature path creates them per child story in F4.
171
+
172
+ #### If an open child Task already exists
173
+
174
+ Use it. **Do not create a second one** — one Task per story, always. Two touch-ups, then move on:
175
+
176
+ - If it's still `New`, move it to `Active` alongside the parent.
177
+ - If `Microsoft.VSTS.Scheduling.OriginalEstimate` is empty, propose hours (below) and, once the user agrees, set both `OriginalEstimate` and `RemainingWork` to that value.
178
+
179
+ If **more than one** open Task exists, don't guess — list them and ask which one this run should log against. Leave the others alone.
180
+
181
+ #### If there is no open child Task, create exactly one
182
+
183
+ This includes the case where child Tasks exist but every one of them is already closed — a closed Task is not somewhere to log new work.
184
+
185
+ Propose the hours from the parent's Story Points (this mirrors `/plan-backlog` Step 5b — keep the two tables in sync):
186
+
187
+ | Points | Hour budget |
188
+ |--------|-------------|
189
+ | 1 | 3 hrs |
190
+ | 2 | 6 hrs |
191
+ | 3 | 10 hrs |
192
+ | 5 | 16 hrs |
193
+ | 8 | 28 hrs |
194
+ | 13 | 48 hrs |
195
+ | 21 | 75 hrs |
196
+
197
+ Calibrated for a **senior developer** at ~6 productive hours per day — the discount is already in the numbers, so don't apply a second one. Round non-Fibonacci point values up to the nearest row. Add 20–30% for `spike` / `research` / `unknown-stack` tags.
198
+
199
+ If the work item has **no Story Points**, estimate the hours from the plan just approved in Step 3 — files to create and modify, plus the unit tests listed — using the same senior calibration. Say which basis you used.
200
+
201
+ Show the proposal and **wait for the user**:
202
+
203
+ ```
204
+ AB#{id} has no open child Task — one is needed to log hours against.
205
+
206
+ | Task title | Hours |
207
+ |----------------------------------------------|-------|
208
+ | {PREFIX} - Implement: {short summary} | 16 |
209
+
210
+ Basis: {n} story points → {n}h (or: no points — estimated from the approved plan)
211
+
212
+ Create it? (yes / edit / skip)
213
+ ```
214
+
215
+ - `yes` → create it
216
+ - `edit` → ask what to change (title or hours), revise, re-show, ask again
217
+ - `skip` → continue without a Task, and **warn** that Step 10 will have no Task to close and no hours will be logged for this story
218
+
219
+ On `yes`, create it with `mcp__azure-devops__wit_create_work_item`:
220
+
221
+ - **workItemType**: `Task`
222
+ - **title**: `{PREFIX} - Implement: {short summary of the story}` — reuse the parent's product prefix (`COM`, `PAY`, `CDA`, …), extracted from the parent's title
223
+ - **fields**:
224
+ - `Microsoft.VSTS.Scheduling.OriginalEstimate` — the agreed hours (as a number)
225
+ - `Microsoft.VSTS.Scheduling.RemainingWork` — the same value
226
+ - `System.AreaPath` and `System.IterationPath` — copy from the parent
227
+ - `System.AssignedTo` — copy from the parent (pass the parent's `uniqueName` / email if the value is an identity object). If the parent is unassigned, leave it unset rather than failing.
228
+ - `System.State` — `Active`, since implementation is starting right now (fall back to the template's in-progress equivalent, or leave it at the default and note it)
229
+
230
+ Then link it as a child of the work item with `mcp__azure-devops__wit_add_child_work_items` (or `wit_work_items_link` with `System.LinkTypes.Hierarchy-Forward`, parent → task).
231
+
232
+ If the create or link call fails, report it and ask whether to implement without a Task or stop. Don't silently continue — the user needs to know hours won't be tracked.
233
+
234
+ Remember the Task ID. Step 10 closes it.
235
+
164
236
  ## Step 5: Implement
165
237
 
166
238
  1. **Implement** using backend and/or frontend agents according to the approved plan
@@ -275,11 +347,13 @@ Wait for the user's response before proceeding. Do NOT create a PR until confirm
275
347
 
276
348
  If the project's process template does not have a `Code Review` state (the update call returns an invalid-state error), fall back in this order: `Resolved` → `In Review` → leave the current state and warn the user that the state could not be advanced automatically. Do not silently swallow the error.
277
349
 
278
- > **PR completion closes the Task only.** When this PR is later completed/merged, only the child **Task** may be closed never the parent User Story or Bug. Azure DevOps's "Complete associated work items" option transitions *every* linked work item (including the parent this PR is linked to), so do **not** enable it when completing the PR. Close the child Task explicitly instead; the parent stays in `Code Review` until QA/UAT and any sibling Tasks are done.
350
+ > **Only the Task ever gets closed — never the parent.** The child Task is closed here, at PR creation (step 4 above). When the PR is later completed/merged, do **not** enable Azure DevOps's "Complete associated work items" option: it transitions *every* linked work item, including the parent this PR is linked to. The parent User Story or Bug stays in `Code Review` until QA/UAT and any sibling Tasks are done.
279
351
 
280
352
  ### Closing Related Tasks
281
353
 
282
- After the PR is created, find every child Task of this work item (relations of type `System.LinkTypes.Hierarchy-Forward` where the target's `System.WorkItemType` is `Task`). Skip this step if there are no child Tasks.
354
+ After the PR is created, find every child Task of this work item (relations of type `System.LinkTypes.Hierarchy-Forward` where the target's `System.WorkItemType` is `Task`).
355
+
356
+ There should be at least one open Task — Step 4 guarantees it. If there are **no** child Tasks at all (the user chose `skip` in Step 4, or the create call failed), create one now so the work that just shipped is recorded: same fields and prefix convention as Step 4, hours proposed the same way, then close it in the same pass. Say plainly that you're creating it after the fact.
283
357
 
284
358
  For each child Task, capture:
285
359
  - ID, title, state
@@ -330,12 +404,15 @@ For each task being processed, prompt for completed hours:
330
404
 
331
405
  **Wait for the user's response on every task.** Accept the suggested/current value (enter), a new numeric value, or `skip` to leave that one untouched.
332
406
 
333
- Once the user has answered, update each task via `wit_update_work_item`:
407
+ Once the user has answered, update each task in a **single** `wit_update_work_item` call per task:
334
408
  - `Microsoft.VSTS.Scheduling.CompletedWork` → the agreed value
335
409
  - `Microsoft.VSTS.Scheduling.RemainingWork` → `0`
410
+ - `Microsoft.VSTS.Scheduling.OriginalEstimate` → only if it is still empty; set it to the agreed completed hours so the Task isn't left with no estimate at all. Never overwrite an estimate that's already there — the gap between estimate and actual is the useful signal.
336
411
  - `System.State` → `Closed` (fall back to `Done` if the project's task template uses Agile; warn if neither is valid)
337
412
 
338
- Confirm with a summary line per task: `Closed AB#xxxx — {hours}h logged`.
413
+ Confirm with a summary line per task: `Closed AB#xxxx — {hours}h logged (estimate was {n}h)`.
414
+
415
+ **The Task closes now, at PR creation — not at merge.** The work is done and the hours are known; waiting until merge means the hours get logged days later, or not at all.
339
416
 
340
417
  ## Feature Workflow (ordered story waves)
341
418
 
@@ -393,6 +470,18 @@ For each wave in ascending order:
393
470
  1. **Explore & plan** each story in the wave (Step 3 rules; Ultracode fan-outs apply per story if opted in). Present **one combined plan** with a section per story — each section covering approach, files, unit tests, and agents — plus a note on any files touched by more than one story in the wave (a conflict warning). **One approval gate per wave**; wait for the user.
394
471
  2. **Implement:**
395
472
  - **Move every story in the wave to `Active`** first (same rules and fallbacks as "Move the Work Item to Active" in Step 4). The Feature's state is never changed.
473
+ - **Ensure each story in the wave has an open child Task** (Step 4's "Ensure an Open Child Task Exists" rules, applied per story — Tasks hang off the stories, never off the Feature). Batch the proposals into **one** table covering the whole wave and take a single approval, so parallel agents never wait on a prompt:
474
+
475
+ ```
476
+ Stories in this wave with no open child Task:
477
+
478
+ | Story | Task title | Hours | Basis |
479
+ |----------|-----------------------------------------|-------|---------|
480
+ | AB#1235 | COM - Implement: export endpoint | 10 | 3 pts |
481
+ | AB#1236 | COM - Implement: export screen | 16 | 5 pts |
482
+
483
+ Create these? (yes / edit N / skip N / skip all)
484
+ ```
396
485
  - **Single-story wave** → implement directly on the feature branch in the main loop (Step 5).
397
486
  - **Multi-story wave** → isolate each story in its own worktree so parallel agents never clobber each other:
398
487
 
@@ -420,6 +509,6 @@ Present **one combined UAT checklist grouped by story** (Step 9 rules). Wait for
420
509
 
421
510
  1. Push the feature branch and create **one PR**: title `AB#{feature-id}: {feature title}`, source `feature/...`, target `BASE_BRANCH`.
422
511
  2. Link the **Feature and every implemented story** to the PR.
423
- 3. Run **Closing Related Tasks** (Step 10) once, covering the child Tasks of every implemented story — one combined table, then the usual per-task hour prompts.
512
+ 3. Run **Closing Related Tasks** (Step 10) once, covering the child Tasks of every implemented story — one combined table, then the usual per-task hour prompts. Every story that got a Task in F4 has one to close here; a story whose Task creation was skipped gets one created and closed now, as in Step 10.
424
513
  4. Move each implemented story to `Code Review` (same fallback rules as Step 10). **Do not change the Feature's state** — the Feature is a parent container; it advances only when its child stories are verified/closed, not when the PR goes up for review.
425
- 5. The Step 10 PR-completion rule applies unchanged: when the PR merges, only child **Tasks** may be closed — never the stories or the Feature.
514
+ 5. The Step 10 closing rule applies unchanged: only child **Tasks** are ever closed — here at PR creation, never the stories and never the Feature. Don't enable "Complete associated work items" when the PR is merged; it would transition the stories and the Feature along with the Tasks.
@@ -232,7 +232,9 @@ Hot Fix work items follow the same automated checks (build, lint, tests, review)
232
232
 
233
233
  Running `/implement` on a **Feature** implements its child User Stories in **waves** driven by the `Custom.Order` field: stories sharing the same order value are implemented **in parallel** (one agent per story, each in an isolated git worktree), and waves run sequentially in ascending order so later stories build on earlier ones. All work merges into a single `feature/AB#<id>-...` branch; quality checks, code review, UAT, and one PR happen at the feature level, and every implemented story is linked to that PR. Stories without a `Custom.Order` value run in a final catch-all wave (flagged for confirmation first).
234
234
 
235
- **Work item states:** `/implement` moves the work item to `Active` when implementation starts — for a single work item (User Story, Bug, Hot Fix) right after the branch is created; for a Feature, each child story goes `Active` as its wave begins. When the PR is created, each implemented child **User Story** moves to `Code Review` — the **Feature's state is never changed**. The Feature is a parent container; it advances only as its child stories are verified/closed. When the PR merges, only child **Tasks** are closed — never the stories or the Feature.
235
+ **Work item states:** `/implement` moves the work item to `Active` when implementation starts — for a single work item (User Story, Bug, Hot Fix) right after the branch is created; for a Feature, each child story goes `Active` as its wave begins. When the PR is created, each implemented child **User Story** moves to `Code Review` — the **Feature's state is never changed**. The Feature is a parent container; it advances only as its child stories are verified/closed. Only child **Tasks** are ever closed — never the stories or the Feature.
236
+
237
+ **Hours live on the Task.** `/implement` will not implement a story that has no open child Task: if there isn't one, it proposes a title and an hour estimate (from the story's points, same mapping `/plan-backlog` uses) and creates it once the user agrees — exactly one per story, inheriting the parent's assignee, area, and iteration. When the PR is created, that Task is closed with the hours worked logged to `CompletedWork` and `RemainingWork` zeroed. Closing happens at **PR creation**, not at merge, so hours are recorded while they're still known. Never enable Azure DevOps's "Complete associated work items" when merging — it transitions the parent too.
236
238
 
237
239
  #### Slash Commands Reference
238
240
 
@@ -240,7 +242,7 @@ All deployment and release operations are available as slash commands:
240
242
 
241
243
  | Command | Usage | What It Does |
242
244
  |---|---|---|
243
- | `/implement` | `/implement AB#1234` | Summarize work item → approve plan → implement → PR. On a Feature: child stories in `Custom.Order` waves, same-order stories in parallel |
245
+ | `/implement` | `/implement AB#1234` | Summarize work item → approve plan → ensure an open child Task with hours → implement → PR (closes the Task, logs hours). On a Feature: child stories in `Custom.Order` waves, same-order stories in parallel |
244
246
  | `/review` | `/review 142` | Automated code review on a PR |
245
247
  | `/resolve-feedback` | `/resolve-feedback 142` | Address unresolved PR comment threads, push fixes, reply + resolve threads |
246
248
  | `/deploy` | `/deploy "commit message"` | Commit, push, trigger pipeline |
@@ -255,7 +257,8 @@ All deployment and release operations are available as slash commands:
255
257
  | `/plan-sprint` | `/plan-sprint [project]` | Sweep the current sprint for stories/bugs with no child tasks → propose one child task with hours per item |
256
258
  | `/quote-backlog` | `/quote-backlog [project]` | Sweep backlog for Design Approved items without points → review completeness, check for duplicates, suggest rewrites, propose points + creator comments (10 at a time, approval-gated). Pointed items move to Dev Ready; items that can't be quoted move back to **Design Review** so the next sweep skips them |
257
259
  | `/quote` | `/quote AB#1234` | Estimate story points for one work item; on approval, sets the points and moves the item to Dev Ready. If it can't be estimated, offers to move it back to **Design Review** |
258
- | `/create-work-item` | `/create-work-item [description]` | Interactively draft and create a Bug or User Story — proposes story points (user must agree) and creates pointed items in Dev Ready |
260
+ | `/create-work-item` | `/create-work-item [description]` | Interactively draft and create a Feature, Bug, or User Story — proposes story points (user must agree) and creates pointed items in Dev Ready; on a Feature, also drafts its child stories with `Custom.Order` waves |
261
+ | `/edit-work-item` | `/edit-work-item AB#1234 [what to change]` | Revise an existing work item field-by-field. On a Feature, cascades the change into its child stories — updates, adds, retires, and re-sequences `Custom.Order` waves — with a safety gate on anything already past Dev Ready |
259
262
  | `/cleanup-branches` | `/cleanup-branches` | Delete merged branches |
260
263
  | `/close-orphan-tasks` | `/close-orphan-tasks [scope] [--dry-run]` | Close open Tasks whose parent is Ready to Deploy / Deployed / Closed |
261
264