@pavp/storywright 1.6.0 → 1.6.1

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,9 +1,9 @@
1
1
  ---
2
2
  name: story-generate
3
- description: Transform an ambiguous prompt, half-baked story, screenshot, or Figma link into a Jira-ready user story. Cohn+Gherkin canonical. Asks clarifications ONLY in terminal.
3
+ description: Transform an ambiguous prompt, half-baked story, screenshot, or Figma link into a Cohn+Gherkin user story. Inherits all hard rules from storywright-base.
4
4
  trigger: "/story-generate | generate a user story | write a user story | turn this into a story | crear historia de usuario"
5
- intent: Top-level orchestrator that drafts a fresh story from any input. Follows the same hard rules as story-refine v2.2 (Cohn philosophy, terminal-only Q, no mini-PRD, deterministic split gate).
6
- version: 2.2.0
5
+ intent: Top-level orchestrator that drafts a fresh story from any input. Behavior 100% identical to siblings except for source (raw / ambiguous input) and split-behavior (recommend /story-split when pre-split count ≥2).
6
+ version: 2.3.0
7
7
  inputs:
8
8
  - text
9
9
  - image
@@ -13,116 +13,25 @@ outputs:
13
13
  - story.jira-wiki.md
14
14
  - .storywright-context.json
15
15
  composes:
16
+ - _components/storywright-base
16
17
  - _components/clarification-questions
17
18
  - _components/acceptance-criteria
18
19
  - _components/invest-checklist
19
- - _components/definition-of-done
20
- - _components/business-rules
21
- - _components/edge-cases
22
- - _components/analytics-events
23
- - _components/risks-and-dependencies
24
20
  - _components/jira-wiki-formatter
25
21
  ---
26
22
 
27
23
  ## Purpose
28
24
 
29
- Take whatever the PM has — a one-liner, a half-baked story, a screenshot, a Figma link — and produce a Cohn+Gherkin story an engineer can pick up and ship without follow-up questions. If the input is too broad, recommend `/story-split` instead of producing a mini-PRD.
25
+ Take whatever the PM has — a one-liner, a half-baked story, a screenshot, a Figma link — and produce a Cohn+Gherkin story an engineer can pick up and ship without follow-up questions.
30
26
 
31
- ## Hard rules (no exceptions)
27
+ **All hard rules, canonical output shape, language detection, mechanical pre-split test, context persistence, terminal-only Q, and INVEST handling live in `[[storywright-base]]`. Read that first. Anything in this file is a SOURCE-SPECIFIC or SPLIT-BEHAVIOR delta only.**
32
28
 
33
- 1. **Terminal-only clarifications.** Never write any sidecar question file (no `clarifications.md`). All gap questions go through `AskUserQuestion` (batch in groups of ≤4). Non-blocking gaps → mark `⚠️ Assumed` inline.
29
+ ## Source-specific differential
34
30
 
35
- 2. **Cohn + Gherkin canonical.** One Use Case block. One AC scenario per story (one Given chain, one `When`, one `Then`). If the input naturally needs >1 `When`/`Then` → STOP drafting, recommend `/story-split`.
31
+ - **Source:** raw / ambiguous text, optionally fused with screenshot and/or Figma URL.
32
+ - **What changes vs base:** at intake the prompt may name only a feature; infer the implicit user goal via rule 3 (persona sharpening) + rule G (passive-goal check) of the base. Mixed inputs follow the base conflict-detection rule plus the source-priority table below.
36
33
 
37
- 3. **No mini-PRDs.** Prohibited in story output:
38
- - NFR blocks (a11y/i18n/perf/tokens) — these live in the team's DoD
39
- - Edge Cases enumerations as a section — surface inside AC failure paths only
40
- - Dependencies as prose — Jira links only
41
- - Per-claim visual specs — use single banner (rule 5)
42
- - Refinement logs >3 lines (>5 if SPLIT)
43
-
44
- 4. **Output language matches the user's chat language**, not the input's. Auto-detect first (see rule 4a); only ask via `AskUserQuestion` if signals split.
45
-
46
- 5. **Visual inference confidence — single banner only.** ONE banner at the top of the Design Reference block declares the source type. Claims under it inherit confidence:
47
- - Raster source (PNG/JPG) → `**Source: raster mockup → all visual specs are pixel-derived, not token-confirmed.**`
48
- - Figma source → `**Source: Figma → values can be tokenized at implementation.**`
49
- - Design-token source → `**Source: design tokens → values are authoritative.**`
50
- - Never assert hex / px / spacing from raster without the raster banner.
51
-
52
- 6. **Sibling task IDs.** If the draft references "next task / future task / another story" → check `<output-folder>/.storywright-context.json` first. If unresolved, ask. Tentative slugs follow rule F.
53
-
54
- 7. **Mockup chrome detection — closed list.** Chrome = `left nav rail / sidebar`, `top bar`, `footer`, `persistent toast/snackbar slot`, `persistent modal scrim`, `app-level tabs`. If image shows any AND the input does not mention them, ask via `AskUserQuestion` whether each is in-scope, sibling-scope, or out-of-scope. Anything not on the list is NOT chrome.
55
-
56
- 8. **Anti-PRD is part of INVEST `Small`.** See `[[invest-checklist]]` Small criterion (line-count ceiling lives there).
57
-
58
- 9. **Cross-skill context persistence.** When the skill resolves clarifications, write answers to `<output-folder>/.storywright-context.json`. Read only from the exact output folder of the current invocation; never search siblings or parents. Schema:
59
- ```json
60
- {
61
- "version": 1,
62
- "decided_at": "<ISO date>",
63
- "decided_by_skill": "story-generate",
64
- "language": "EN | ES | ...",
65
- "chrome_scope": "in-scope | in-scope-placeholder | sibling | out-of-scope",
66
- "siblings": "TODO | <list of IDs> | not-applicable",
67
- "design_source": "raster | figma | tokens",
68
- "naming_pattern": "<see rule F>",
69
- "extra": {}
70
- }
71
- ```
72
-
73
- 10. **Mixed input conflict detection.** When text + image + Figma disagree, surface as BLOCKING `AskUserQuestion`. Never silently pick a winner. (See source priority below.)
74
-
75
- 11. **Passive-goal downstream prompt (G).** If `I want to` verb is observational (`view, see, read, browse, look at, inspect, monitor`) and `so that` lacks a follow-up user action → ask once via `AskUserQuestion`: "What does the user do with this?". Strengthen the `so that` accordingly.
76
-
77
- ### 4a. Language auto-detect — expanded signals (E)
78
-
79
- | Signal | Where | Weight |
80
- |---|---|---|
81
- | Gherkin keywords ("Given/When/Then") | AC block | high |
82
- | Persona phrasing ("As a user" vs "Como un usuario") | Use Case | high |
83
- | Column / field names ("Phone - primary", "Teléfono - principal") | AC bullets | medium |
84
- | Domain verbs ("clicking" vs "hacer clic") | AC bullets | medium |
85
- | Title language | header | low |
86
-
87
- **Decision:**
88
- - High+medium signals agree on M → adopt M silently. Mark inline `⚠️ Assumed: output language = <M> (auto-detected from <signals>)`.
89
- - Signals split → ask once.
90
- - Persist via rule 9.
91
-
92
- ### Rule F. Naming pattern — ask once, persist
93
-
94
- When the skill needs to invent a tentative ticket slug AND `.storywright-context.json` has no `naming_pattern`, ask once:
95
- - kebab-case feature-action (`customer-search-bar-wire`)
96
- - verb-noun (`wire-search-bar`)
97
- - domain-action (`search.customer.wire-input`)
98
- - Jira prefix + numeric (`CSB-001`)
99
-
100
- Persist in `.storywright-context.json`. Reuse for all sibling slugs.
101
-
102
- ### Rule D. Surface vs styling (deterministic)
103
-
104
- A "named UI surface" counts as a separate outcome ONLY if it has its own user goal (verb where the user *does something with it*). If a noun is mentioned only in a styling context (color, padding, background) or as a sub-component of a parent surface (column inside a grid) → it is NOT a surface, it is styling. Count = 0.
105
-
106
- ## When to use
107
-
108
- - The user has a goal but not a story (e.g., "Permitir login con Google").
109
- - The user pastes a vague story and wants it production-ready.
110
- - The user drops an image/Figma link and asks for stories.
111
-
112
- For inputs that clearly cover multiple outcomes → run the deterministic split gate (step 6 below) and recommend `/story-split` instead of drafting.
113
-
114
- ## Inputs & how to interpret each
115
-
116
- ### Text prompts
117
- Anything from a phrase to a paragraph. If only a feature is named, infer the implicit user goal and confirm via rule G if passive.
118
-
119
- ### Local images (PNG/JPG)
120
- Use vision. Extract UI elements, visible states, inferred flow, confidence per inference. Anything below high confidence → mark inline `⚠️ Assumed`. NEVER assert pixel-precise visual specs inline with each claim — use the single banner (rule 5).
121
-
122
- ### Figma links
123
- If MCP Figma is available (see `[[story-from-figma]]`), use it. If not, fall back to asking the user for screenshots.
124
-
125
- ### Mixed inputs (text + image + Figma) — source priority
34
+ ### Mixed-input source priority (text + image + Figma)
126
35
 
127
36
  | Section | Primary | Secondary | Tertiary |
128
37
  |---|---|---|---|
@@ -131,133 +40,57 @@ If MCP Figma is available (see `[[story-from-figma]]`), use it. If not, fall bac
131
40
  | UI Components / States | Figma | Image | Text |
132
41
  | AC observable outcomes | Triangulate | — | — |
133
42
 
134
- **Conflicts → BLOCKING `AskUserQuestion`.** Never silently pick a winner.
135
-
136
- ## Canonical output shape
137
-
138
- ```markdown
139
- ### [Title]
140
-
141
- #### Use Case
142
- - **As a** [persona — never just "user"]
143
- - **I want to** [action]
144
- - **so that** [outcome with downstream action — rule G]
145
-
146
- #### Preconditions (optional)
147
- - ...
43
+ Conflicts → BLOCKING `AskUserQuestion` per base rule 1.
148
44
 
149
- #### Out of Scope (optional)
150
- - ...
45
+ ## Split behavior differential
151
46
 
152
- #### Acceptance Criteria
153
- - **Scenario:** [single-outcome scenario name]
154
- - **Given:** [context surface nouns drive downstream dep matrix]
155
- - **and Given:** [context]
156
- - **When:** [single trigger]
157
- - **Then:** [single observable outcome]
47
+ If the base **deterministic pre-split test** returns count ≥2:
48
+ - **STOP drafting.**
49
+ - Output a terminal message listing candidate children + per-pair dep notes (base rule 10) + V audit (base rule 11).
50
+ - Recommend `/story-split` to the user.
51
+ - Do NOT auto-split, do NOT produce a 15-section story.
158
52
 
159
- #### Design Reference (optional)
160
- **Source: <raster | figma | tokens><banner from rule 5>**
161
- - [link or path]
162
- - visual notes: [...]
163
-
164
- #### INVEST
165
- - I/N/V/E/S/T — one line each.
166
- - **Verdict:** READY | SPLIT RECOMMENDED | NEEDS REFINEMENT | NOT A STORY
167
-
168
- #### Generation log (≤3 lines; ≤5 if SPLIT)
169
- - ...
170
- ```
171
-
172
- Nothing else. No NFR. No edge-cases enumeration. No deps prose. No Assumptions block.
53
+ If count ≤1:
54
+ - Proceed with the base step-by-step Application skeleton (read context language persona → passive-goal → gap-check → siblings → fill canonical block → INVEST → render).
173
55
 
174
56
  ## Application (step-by-step)
175
57
 
176
- 0. **Detect input types** text / image / figma-link / combination. Run conflict detection (rule 10) BEFORE drafting. Run chrome detection (rule 7).
177
-
178
- 1. **Read prior context.** If `<output-folder>/.storywright-context.json` exists (exact folder only), load it.
179
-
180
- 2. **Language resolution** (rule 4 + 4a). Auto-detect using expanded signals; ask only on split.
181
-
182
- 3. **Persona sharpening.** If persona is "user" / "customer" / "person", ask via `AskUserQuestion` for the specific role (e.g., "Sales person", "Workspace admin"). Generic personas hide motivation.
183
-
184
- 4. **Passive-goal check (rule G).** If `I want to` verb is observational + `so that` lacks downstream action → ask once.
185
-
186
- 5. **Gap-check** via `[[clarification-questions]]`. BLOCKING gaps → `AskUserQuestion` batched ≤4. Non-blocking → fill inline `⚠️ Assumed`.
187
-
188
- 6. **Deterministic pre-split test.** Count outcomes using the same rule as `[[story-refine]]`:
189
- - +1 per AC bullet with action verb at user level
190
- - +1 per distinct `When [event]`
191
- - +1 per named UI surface with its own user goal (rule D)
192
- - 0 for styling, sub-components, passive layout assertions
193
- - Count ≥2 → STOP. Recommend `/story-split`. List candidate children + per-pair dep notes (rule A) + V audit (rule C from refine).
194
-
195
- 7. **Draft the canonical block** (Use Case + AC + Design Ref + INVEST). Preserve user wording where good.
196
-
197
- 8. **Run INVEST** via `[[invest-checklist]]`.
198
- - `READY` → render.
199
- - `SPLIT RECOMMENDED` → STOP, recommend split.
200
- - `NEEDS REFINEMENT` → iterate failing dimension, max 1 cycle, then STOP.
201
- - `NOT A STORY` → tell user it's a tech task and stop.
202
-
203
- 9. **Render** both outputs via `[[jira-wiki-formatter]]`. Files: `story.standard.md` + `story.jira-wiki.md`. Plus `.storywright-context.json`. No other files.
204
-
205
- 10. **Generation log** ≤3 bullets (≤5 if SPLIT) at end of story.
58
+ Follow the **base Application** skeleton exactly. The only override is step 7's split branch (above): on count ≥2, route to `/story-split` recommendation instead of host-side recursion.
206
59
 
207
60
  ## Examples
208
61
 
209
62
  ### Good — text prompt
210
63
  Input: *"Permitir login con Google"*
211
- 1. Language auto-detect → ES (persona "usuario", verbs "permitir").
212
- 2. Persona sharpening → ask: trial user? admin? signed-out visitor?
213
- 3. Pre-split count = 1 (one auth flow). Continue.
214
- 4. Draft Use Case + 1 AC (happy path, failure as `and Given`).
215
- 5. INVEST → READY.
216
- 6. Render.
217
-
218
- ### Good — image input
219
- Input: dashboard screenshot with filter sidebar.
220
- 1. Vision extracts filters; one inference at MEDIUM confidence → mark `⚠️ Assumed` inline.
221
- 2. Pre-split count = 1 (one filter interaction surface).
222
- 3. Draft + INVEST → READY.
64
+ - Language auto-detect → ES.
65
+ - Persona sharpening → ask: trial user? admin? signed-out visitor?
66
+ - Pre-split count = 1 (one auth flow). Continue.
67
+ - Draft canonical block; INVEST READY. Render.
223
68
 
224
- ### Good — passive-goal prompt fires
225
- Input: "As a user, I want to view list of customers, so that I find details."
226
- - Detected: `view` (passive) + thin `so that`.
227
- - Ask: "What does the user do with the customer they find?"
228
- - User: "Call them."
229
- - Refined `so that`: "so that I can find and call a customer to schedule a service."
230
-
231
- ### Bad — broad input drafted as one story
69
+ ### Good — broad input routed to split
232
70
  Input: *"Build the new dashboard"*
233
- - Pre-split count ≥2 → STOP. Recommend `/story-split`. Do NOT draft a 15-section story.
234
-
235
- ### Bad — clarifications.md
236
- Writing any sidecar question file. Violates rule 1.
71
+ - Pre-split count ≥2 → STOP. Terminal message: candidate children + dep notes + V audit + "Run `/story-split`".
72
+ - No drafted story written.
237
73
 
238
- ### Badper-claim visual tag
239
- `[mockup-pixel-derived]` on every line instead of the single banner. Violates rule 5.
74
+ ### Goodpassive goal fires
75
+ Input: *"As a user, I want to view list of customers, so that I find details."*
76
+ - Rule G fires. Ask: "What does the user do with the customer they find?"
77
+ - User: "Call them." → so-that strengthened.
240
78
 
241
- ## Common Pitfalls
79
+ ### Bad
80
+ Writing any sidecar question file (violates base rule 1).
242
81
 
243
- - Drafting before running the deterministic split gate (step 6).
244
- - Auto-splitting. Never. Propose, wait for `/story-split`.
245
- - Mixing languages. Pick one via rule 4 + 4a.
246
- - Re-asking questions already resolved in `.storywright-context.json`.
247
- - Letting per-claim `[mockup-pixel-derived]` tags litter the output.
248
- - Treating image visual specs as authoritative without the rule-5 banner.
82
+ ### Bad
83
+ Drafting a 15-section story when pre-split count ≥2 (violates split behavior differential).
249
84
 
250
85
  ## References
251
86
 
87
+ - [[storywright-base]] — the rulebook
252
88
  - [[story-refine]] (when input is an existing story)
253
- - [[story-split]] (when INVEST fails on I/E/S)
89
+ - [[story-split]] (when count ≥2)
254
90
  - [[story-from-figma]] (when input is Figma URL)
255
- - [[clarification-questions]]
256
91
 
257
92
  <claude-specific>
258
- - Use extended thinking for INVEST + pre-split counting.
259
- - Attach images in the same message for native vision; don't describe-then-reason in two steps.
260
- - Read `.storywright-context.json` ONLY from the exact target output folder.
261
- - Never call Write for any sidecar question file. Use `AskUserQuestion`.
262
- - Treat step 6 (deterministic pre-split test) as a hard gate; do not skip even when the user wants a single story.
93
+ - Read `[[storywright-base]]` before applying. Do not duplicate its rules in your reasoning.
94
+ - For mixed inputs, attach images in the same message for native vision.
95
+ - Use extended thinking for INVEST and pre-split counting.
263
96
  </claude-specific>