@pavp/storywright 1.13.4 → 1.15.0

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "storywright",
3
- "version": "1.13.4",
3
+ "version": "1.15.0",
4
4
  "description": "PM skills for Claude Code — turn ambiguous inputs (prompts, screenshots, Figma links) into Jira-ready user stories.",
5
5
  "author": "pavp",
6
6
  "license": "MIT",
@@ -11,6 +11,7 @@
11
11
  "skills/story-refine",
12
12
  "skills/story-split",
13
13
  "skills/story-from-figma",
14
+ "skills/story-batch",
14
15
  "skills/_components/storywright-base",
15
16
  "skills/_components/clarification-questions",
16
17
  "skills/_components/acceptance-criteria",
@@ -26,7 +27,8 @@
26
27
  "commands/story-generate.md",
27
28
  "commands/story-refine.md",
28
29
  "commands/story-split.md",
29
- "commands/story-from-figma.md"
30
+ "commands/story-from-figma.md",
31
+ "commands/story-batch.md"
30
32
  ],
31
33
  "tags": ["product-management", "user-stories", "jira", "agile", "invest"]
32
34
  }
@@ -0,0 +1,19 @@
1
+ ---
2
+ description: Generate N user stories from a multi-item backlog in one pass (one story per item, cohesion-aware clarifications)
3
+ argument-hint: <multi-item backlog>
4
+ ---
5
+
6
+ Invoke the `story-batch` skill from the storywright pack to process:
7
+
8
+ $ARGUMENTS
9
+
10
+ Follow the skill's procedure:
11
+
12
+ 1. Phase 0 — parse the input structurally (numbered → bullets → blank-line blocks). Guard: if no items found, stop with guidance. If exactly 1 item, abort and redirect to `/storywright-story-generate`. Present parsed boundaries and wait for user confirmation.
13
+ 2. Phase 1 — run the cohesion gate: extract persona and feature-area nouns per item, build the sharing graph, compute the largest-connected-component percentage. Announce verdict inline as `⚠️ Assumed:` blockquote. Honor PM overrides.
14
+ 3. Phase 2 — cohesive batch: one shared clarification round (≤4 questions) over the union of items. Disparate batch: per-item clarifications deferred to base step 5.
15
+ 4. Phase 3 — per-item pipeline: run base Application steps 3–11 for each confirmed item. Items with pre-split count ≥2 → SPLIT RECOMMENDED (no trio, flag in summary, continue). Items with INVEST V = FAIL → NOT A STORY (no trio, flag, continue). All other items emit the full `story-N.{standard,jira-wiki,dev}.md` trio.
16
+ 5. Phase 4 — cross-item analysis over DRAFTED items only: mechanical NxN dependency matrix, per-story V audit, topological build order.
17
+ 6. Phase 5 — emit `backlog-summary.md` (cohesion verdict, INVEST table, dep matrix, V audit, build order, SPLIT RECOMMENDED notes) + `.storywright-context.json`. All files in flat folder `docs/storywright/YYYY-MM-DD-HHmm-batch-<slug>/`.
18
+
19
+ Output in the input language.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pavp/storywright",
3
- "version": "1.13.4",
3
+ "version": "1.15.0",
4
4
  "description": "PM Skills pack for Claude Code — turn ambiguous inputs (prompts, screenshots, Figma links) into Jira-ready user stories.",
5
5
  "keywords": [
6
6
  "claude",
@@ -0,0 +1,224 @@
1
+ ---
2
+ name: story-batch
3
+ description: Generate N Cohn+Gherkin stories from one multi-item backlog in a single pass. One story per item, shared clarification round when cohesive. Inherits all hard rules from storywright-base.
4
+ trigger: "/story-batch | story batch | batch backlog | generate backlog | multiple stories at once | generar backlog | varias historias"
5
+ intent: Batch entrypoint; behavior identical to siblings except source (one raw multi-item backlog) and split-behavior (one story per item; cohesive→shared clarification round, disparate→per-item; any item pre-split count ≥2→SPLIT RECOMMENDED+continue, never auto-split).
6
+ version: 1.0.0
7
+ inputs:
8
+ - backlog-text
9
+ outputs:
10
+ - story-1.standard.md
11
+ - story-1.jira-wiki.md
12
+ - story-1.dev.md
13
+ - backlog-summary.md
14
+ - .storywright-context.json
15
+ composes:
16
+ - _components/storywright-base
17
+ - _components/clarification-questions
18
+ - _components/business-rules
19
+ - _components/acceptance-criteria
20
+ - _components/edge-cases
21
+ - _components/analytics-events
22
+ - _components/risks-and-dependencies
23
+ - _components/definition-of-done
24
+ - _components/invest-checklist
25
+ - _components/jira-wiki-formatter
26
+ ---
27
+
28
+ ## Purpose
29
+
30
+ A backlog input usually contains N discrete items — different features, improvements, or requirements listed together. This skill maps that multi-item input into Cohn+Gherkin stories — **one story per item, processed in a single invocation**.
31
+
32
+ **All hard rules, canonical output shape, language detection, terminal-only Q, mechanical NxN dep matrix, per-child V audit, context persistence, and INVEST handling live in `[[storywright-base]]`. Read that first. Anything in this file is a SOURCE-SPECIFIC or SPLIT-BEHAVIOR delta only.**
33
+
34
+ ## Source-specific differential
35
+
36
+ - **Source:** one raw multi-item backlog (numbered list, bulleted list, blank-line-separated blocks, or prose with multiple goals).
37
+ - **What changes vs base:**
38
+ - **Input is N items, not one item.** Structural parsing identifies item boundaries first; LLM fallback infers boundaries when structural signals are absent or ambiguous.
39
+ - **Boundary confirmation is mandatory.** The skill presents the parsed item list and waits for user confirmation before proceeding (non-skippable).
40
+ - **Cohesion gate runs before clarifications.** Items sharing persona or feature-area context are processed with a single shared clarification round; disparate items get per-item clarifications.
41
+ - **Output uses story-N.* prefix** so all items share one flat batch folder without collisions.
42
+ - **backlog-summary.md replaces flow-summary.md.** Same structural role as figma's flow-summary; carries INVEST verdicts, dep matrix, V audit, build order, cohesion verdict, and SPLIT RECOMMENDED markers.
43
+
44
+ ## Split behavior differential
45
+
46
+ This skill produces **multiple stories in one invocation** (one per confirmed item). When N>1:
47
+ - **MANDATORY: emit `backlog-summary.md`** with:
48
+ - Cohesion verdict and percentage
49
+ - Per-story INVEST verdict
50
+ - Mechanical NxN dep matrix (base rule 10) parsed from each story's Given lines
51
+ - Per-story V audit (base rule 11) with merge-upstream flags
52
+ - Topological build order
53
+ - SPLIT RECOMMENDED and NOT A STORY markers
54
+
55
+ For any item whose deterministic pre-split count ≥2 → STOP that item's draft, mark it `SPLIT RECOMMENDED` in `backlog-summary.md`, and continue with the remaining items. NEVER auto-invoke `[[story-split]]`.
56
+
57
+ For any item whose INVEST V dimension FAILS → mark it `NOT A STORY` in `backlog-summary.md`, emit no trio, and continue. NEVER stop the batch.
58
+
59
+ If N=1 after boundary confirmation → abort and instruct the user to use `/storywright-story-generate` instead.
60
+
61
+ ## Application (step-by-step)
62
+
63
+ Follow the **base Application** skeleton for per-item story production (steps 3–11 per item). Batch-specific steps:
64
+
65
+ ### Phase 0 — Parse, guard, and boundary confirmation
66
+
67
+ 1. Read prior context per base rule 9.
68
+ 2. Apply structural parsing to the input: numbered lists → bullets → blank-line-separated blocks. Each structural unit is one candidate item.
69
+ 3. **N=0 guard:** if the parsed item list is empty (zero items after structural parsing and LLM fallback), emit: "No items found — paste a numbered list, bulleted list, or blank-line-separated blocks and try again." Stop. No further phases run.
70
+ 4. If structural parsing yields fewer than 2 items or ambiguous boundaries, invoke LLM segmentation: infer one item per distinct user goal expressed in the input.
71
+ 5. **N=1 abort:** if after parsing exactly 1 item is identified, emit: "Only one item found — use `/storywright-story-generate` for a single story." Stop.
72
+ 6. Present the parsed boundary list via `AskUserQuestion`: "I found N items — does this look right? Reply to confirm, merge two items, split one, or edit the list."
73
+ 7. Apply any user corrections and re-present if the count changed. Proceed only after the user confirms.
74
+
75
+ **Slug derivation (ONE rule, applied consistently):** derive the batch slug from the first item's inferred feature area. Lowercase, replace spaces with hyphens, truncate to ≤30 characters. No other slug rule applies.
76
+
77
+ Example: first item "Add checkout summary page" → feature area "checkout" → slug `checkout`.
78
+
79
+ ### Phase 1 — Cohesion gate
80
+
81
+ Run the following deterministic algorithm before any clarification round:
82
+
83
+ - **Step A:** for each item i, extract:
84
+ - `persona_i` — the primary actor noun (lowercase, singular; exclude generic terms: user, customer, usuario, cliente)
85
+ - `area_i` — up to 2 highest-salience feature-area nouns in goal or verb-object position (e.g. "checkout", "cart", "authentication")
86
+ - **Step B:** items i and j **share context** when `persona_i ∩ persona_j ≠ ∅` OR `area_i ∩ area_j ≠ ∅`. Use stem/synonym matching (checkout/check-out, cart/basket). Build an undirected graph G with one edge per sharing pair.
87
+ - **Step C:** `cohesion% = |largest connected component| / N × 100`, rounded to the nearest integer.
88
+ - **Step D:** if `cohesion% ≥ 60` → **COHESIVE**; if `cohesion% < 60` → **DISPARATE**.
89
+ - **Step E:** announce the verdict inline as a blockquote (not a question):
90
+
91
+ COHESIVE example:
92
+ > ⚠️ Assumed: batch is cohesive (shared context: checkout / buyer, 80%, threshold 60%). Running one shared clarification round. Reply "per-item" to override.
93
+
94
+ DISPARATE example:
95
+ > ⚠️ Assumed: batch is disparate (no shared context detected, 40%, threshold 60%). Running per-item clarifications. Reply "cohesive" or "one round" to override.
96
+
97
+ If the PM replies with an override, honor it and re-announce the new mode before proceeding.
98
+
99
+ ### Phase 2 — Clarification scope
100
+
101
+ **COHESIVE batch:** run `[[clarification-questions]]` over the UNION of all items. Deduplicate overlapping questions. Ask at most 4 questions in one batched round. Persist answers via base rule 9. These answers seed `.storywright-context.json` so each item's base step 5 gap-check finds them pre-answered.
102
+
103
+ **DISPARATE batch:** defer clarifications to per-item base step 5. Only infrastructure-level answers (output language, naming conventions, technical stack) are shared across items; content answers (persona, goal, AC specifics) stay per-item.
104
+
105
+ ### Phase 3 — Per-item pipeline
106
+
107
+ For each confirmed item (1-based index N):
108
+
109
+ 1. Run base Application steps 3–11 verbatim (persona, passive-goal check, gap-check, pre-split count, canonical block, rule H audit, dev enrichment, INVEST, render trio, log).
110
+ 2. Use filename prefix `story-<N>.` (all items share one flat batch folder).
111
+ 3. **Pre-split ≥2:** mark item as `SPLIT RECOMMENDED`, skip drafting the canonical block, emit no trio. Continue to the next item.
112
+ 4. **INVEST V = FAIL:** mark item as `NOT A STORY`, emit no trio. Continue to the next item.
113
+ 5. **INVEST other failures (T, N, E, I, S):** flag inline with `⚠️` in `backlog-summary.md` but still emit the trio (base behavior).
114
+
115
+ Only items in `DRAFTED` status (step 10 logged) proceed to the Phase 4 matrix.
116
+
117
+ ### Phase 4 — Cross-item analysis (N>1, DRAFTED items only)
118
+
119
+ Scope: only items that reached `DRAFTED` in Phase 3 participate in the matrix and V audit.
120
+
121
+ 1. **Mechanical NxN matrix (base rule 10).** Parse each DRAFTED story's Given lines to detect dependencies.
122
+ 2. **Per-story V audit (base rule 11).** Flag merge-upstream candidates.
123
+ 3. **Topological build order.** Derive from the dependency matrix.
124
+
125
+ ### Phase 5 — Output
126
+
127
+ Trios are already written by Phase 3 step 10. Emit:
128
+
129
+ 1. **`backlog-summary.md`** at the batch folder root when N>1 OR any item is SPLIT RECOMMENDED or NOT A STORY:
130
+
131
+ ```
132
+ # Backlog Summary — <slug>
133
+
134
+ Generated: YYYY-MM-DD HH:mm
135
+ Items: N
136
+ Drafted: D (story trios emitted)
137
+ Split recommended: S (no trio — run /storywright-story-split per item)
138
+
139
+ **Cohesion:** COHESIVE | DISPARATE (<cohesion%>, threshold 60%, driver: persona/area/both)
140
+
141
+ ## Stories
142
+
143
+ | # | Title | INVEST verdict | Independence |
144
+ |---|-------|----------------|--------------|
145
+ | 1 | ... | PASS / FAIL(T) | ... |
146
+
147
+ ## Dependency matrix
148
+
149
+ (base rule 10 — NxN over DRAFTED items only, with Given citations and build order)
150
+
151
+ ## V audit
152
+
153
+ (base rule 11 per DRAFTED item)
154
+
155
+ ## Notes
156
+
157
+ - Item N: SPLIT RECOMMENDED (pre-split count: X). Run `/storywright-story-split` on this item manually.
158
+ - Item M: NOT A STORY (INVEST V = FAIL). Rework or discard.
159
+ ```
160
+
161
+ **GUARD — banned sections:** do not use headings that start with "Dependencies", "Dependencias", "Risks", or "Riesgos" — use "Dependency matrix" and "Notes" instead (base rule H).
162
+
163
+ 2. **`.storywright-context.json`** updated per base rule 9 (one file per batch folder). No `clarifications.md`.
164
+
165
+ 3. **Flat folder structure:** all files in `docs/storywright/YYYY-MM-DD-HHmm-batch-<slug>/` with no subdirectories. Slug derived per Phase 0 rule (first item's feature area, ≤30 chars, lowercase, hyphens).
166
+
167
+ NO `clarifications.md`. NO Edge Cases / NFR sections **in PM files** (they live in `story-<N>.dev.md` per base rule 3a). NO per-claim visual tags.
168
+
169
+ ## Examples
170
+
171
+ ### Good
172
+ Input: numbered list of 3 checkout-related items.
173
+ - Phase 0 finds 3 items structurally.
174
+ - Phase 1: cohesion% = 100% → COHESIVE, one shared clarification round.
175
+ - Phase 3: items 1 and 2 pass INVEST → trios emitted; item 3 has pre-split ≥2 → SPLIT RECOMMENDED, no trio.
176
+ - Phase 5: `backlog-summary.md` with 3-row table (2 DRAFTED, 1 SPLIT RECOMMENDED), 2×2 dep matrix over items 1–2.
177
+
178
+ ### Good — disparate batch
179
+ Input: 4 items spanning auth, analytics, notifications, and payments.
180
+ - Phase 1: cohesion% = 25% → DISPARATE, per-item clarifications.
181
+ - Phase 3: each item runs base steps 3–11 independently.
182
+
183
+ ### Good — N=0 guard fires
184
+ Input: "Let's work on some backlog items." (no parseable items)
185
+ - Phase 0 N=0 guard fires. Emits error message. Stops.
186
+
187
+ ### Bad
188
+ Emitting per-story subdirectories inside the batch folder. All files must be flat.
189
+
190
+ ### Bad
191
+ Auto-invoking `[[story-split]]` on a SPLIT RECOMMENDED item. Only flag and continue.
192
+
193
+ ### Bad
194
+ Including edge cases, analytics events, or risk details in `backlog-summary.md`. Those live in `story-<N>.dev.md`.
195
+
196
+ ### Bad
197
+ Skipping the dependency matrix in `backlog-summary.md` when N>1 with DRAFTED items.
198
+
199
+ ## Common Pitfalls
200
+
201
+ - Running the cohesion gate AFTER starting clarifications — gate must run first.
202
+ - Including all items (including SPLIT RECOMMENDED and NOT A STORY) in the Phase 4 matrix — matrix is over DRAFTED items only.
203
+ - Using nested subfolders: `batch-checkout/story-1/story-1.standard.md` — wrong. All files flat in the batch folder.
204
+ - Applying the slug derivation rule inconsistently — one rule only: first item's feature area, ≤30 chars, lowercase, hyphens.
205
+ - Emitting `clarifications.md` — violates base rule 1.
206
+ - All other pitfalls in `[[storywright-base]]` apply equally.
207
+
208
+ ## References
209
+
210
+ - [[storywright-base]] — the rulebook (base Purpose section)
211
+ - [[story-generate]]
212
+ - [[story-refine]]
213
+ - [[story-split]]
214
+ - [[story-from-figma]]
215
+
216
+ <claude-specific>
217
+ - Read `[[storywright-base]]` before applying. Do not duplicate its rules in your reasoning.
218
+ - Phase 0 boundary confirmation is non-skippable — always use `AskUserQuestion`.
219
+ - The cohesion-gate algorithm (Steps A–E) is deterministic: same items → same graph → same verdict regardless of order.
220
+ - Phase 4 matrix is over DRAFTED items only. SPLIT RECOMMENDED and NOT A STORY items do not participate.
221
+ - Slug rule is fixed: first item's feature area, ≤30 chars, lowercase, hyphens. Do not invent variations.
222
+ - Build the dep matrix from Given-text parsing (base rule 10), not intuition.
223
+ - `backlog-summary.md` is PM-facing — no edge cases, analytics, risks, or technical DoD.
224
+ </claude-specific>