@qa-gentic/stlc-agents 1.0.4 → 1.0.6

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.
Files changed (29) hide show
  1. package/README.md +175 -34
  2. package/bin/postinstall.js +100 -44
  3. package/bin/qa-stlc.js +26 -6
  4. package/package.json +2 -2
  5. package/skills/{qa-stlc/AGENT-BEHAVIOR.md → AGENT-BEHAVIOR.md} +7 -6
  6. package/skills/{qa-stlc/deduplication-protocol.md → deduplication-protocol/SKILL.md} +16 -21
  7. package/skills/generate-gherkin/SKILL.md +287 -0
  8. package/skills/generate-gherkin/references/step-by-step.md +267 -0
  9. package/skills/{qa-stlc/generate-playwright-code.md → generate-playwright-code/SKILL.md} +13 -23
  10. package/skills/{qa-stlc/generate-test-cases.md → generate-test-cases/SKILL.md} +16 -2
  11. package/skills/qa-jira-manager/SKILL.md +287 -0
  12. package/skills/{qa-stlc/write-helix-files.md → write-helix-files/SKILL.md} +11 -17
  13. package/src/{boilerplate-bundle.js → cli/boilerplate-bundle.js} +8 -8
  14. package/src/cli/cmd-init.js +145 -0
  15. package/src/{cmd-mcp-config.js → cli/cmd-mcp-config.js} +72 -9
  16. package/src/cli/cmd-skills.js +209 -0
  17. package/src/{cmd-verify.js → cli/cmd-verify.js} +35 -3
  18. package/src/cli/prompt-integration.js +87 -0
  19. package/src/stlc_agents/agent_helix_writer/tools/boilerplate.py +8 -8
  20. package/src/stlc_agents/agent_jira_manager/__init__.py +0 -0
  21. package/src/stlc_agents/agent_jira_manager/server.py +500 -0
  22. package/src/stlc_agents/agent_jira_manager/tools/__init__.py +0 -0
  23. package/src/stlc_agents/agent_jira_manager/tools/jira_workitem.py +467 -0
  24. package/src/stlc_agents/shared_jira/__init__.py +0 -0
  25. package/src/stlc_agents/shared_jira/auth.py +270 -0
  26. package/skills/qa-stlc/generate-gherkin.md +0 -550
  27. package/src/cmd-init.js +0 -92
  28. package/src/cmd-skills.js +0 -124
  29. /package/src/{cmd-scaffold.js → cli/cmd-scaffold.js} +0 -0
@@ -1,23 +1,18 @@
1
1
  ---
2
2
  name: deduplication-protocol
3
- description: >
4
- MANDATORY pre-flight protocol for every QA STLC agent run. Must be read and applied BEFORE
5
- creating any test cases, Gherkin feature files, Playwright locators, page objects, or step
6
- definitions in Azure DevOps. Prevents duplicate test cases, duplicate feature file attachments,
7
- and duplicate Playwright code being created across multiple runs or agents on the same work item.
8
- Triggers on any task involving: ADO work items, test cases, feature files, Gherkin BDD, Playwright
9
- automation, locators, page objects, step definitions, qa-gherkin-generator, qa-test-case-manager,
10
- qa-playwright-generator tools.
11
- compatibility:
12
- tools:
13
- - qa-test-case-manager:get_linked_test_cases
14
- - qa-test-case-manager:fetch_work_item
15
- - qa-test-case-manager:create_and_link_test_cases
16
- - qa-gherkin-generator:fetch_feature_hierarchy
17
- - qa-gherkin-generator:attach_gherkin_to_feature
18
- - qa-playwright-generator:generate_playwright_code
19
- - qa-playwright-generator:attach_code_to_work_item
20
- - qa-playwright-generator:validate_gherkin_steps
3
+ description: >-
4
+ MANDATORY pre-flight protocol for every QA STLC agent run. Must be applied BEFORE creating
5
+ any test cases, Gherkin feature files, Playwright locators, page objects, or step definitions
6
+ in Azure DevOps. Prevents duplicate test cases, duplicate feature file attachments, and
7
+ duplicate Playwright code across multiple runs or agents on the same work item. Triggers on
8
+ any task involving: ADO work items, test cases, feature files, Gherkin BDD, Playwright
9
+ automation, locators, page objects, step definitions, qa-gherkin-generator,
10
+ qa-test-case-manager, or qa-playwright-generator tools.
11
+ license: MIT
12
+ compatibility: "Requires qa-test-case-manager, qa-gherkin-generator, qa-playwright-generator MCP servers. Works with Claude Code, GitHub Copilot, Cursor, Windsurf."
13
+ metadata:
14
+ author: qa-gentic
15
+ version: "1.0"
21
16
  ---
22
17
 
23
18
  # QA Deduplication Protocol
@@ -100,7 +95,7 @@ Extract and store:
100
95
  - **All child PBIs and Bugs** with their titles + acceptance criteria
101
96
  - All existing test cases across the whole feature
102
97
  - All `.feature` file attachments already on the feature
103
- - Build the **flow map** from sibling work items (see generate-gherkin.md Step 1D)
98
+ - Build the **flow map** from sibling work items (see generate-gherkin skill Step 1D)
104
99
 
105
100
  > **Why sibling PBIs matter:** A PBI is one slice of a larger flow defined across multiple
106
101
  > work items. Siblings often represent prerequisite or downstream steps. Without reading all
@@ -240,8 +235,8 @@ work_item_id = 222 → PHASE 1 runs in full → CACHE[222] populated (CACHE[11
240
235
 
241
236
  Skills that delegate here:
242
237
  ```
243
- skills/generate-gherkin.md → delegates here; reads work-item cache
244
- skills/generate-playwright-code.md → delegates here; reads work-item cache
238
+ skills/generate-gherkin/SKILL.md → delegates here; reads work-item cache
239
+ skills/generate-playwright-code/SKILL.md → delegates here; reads work-item cache
245
240
  ```
246
241
 
247
242
  ### Work-Item Cache Schema
@@ -0,0 +1,287 @@
1
+ ---
2
+ name: generate-gherkin
3
+ description: >-
4
+ Use when generating Gherkin feature files, BDD scenarios, or .feature files from Azure DevOps
5
+ or Jira work items. Triggers on: "Gherkin", "feature file", "BDD", "scenarios", "acceptance
6
+ criteria automation", "Given When Then", "regression suite". Enforces live navigation before
7
+ writing any scenario and links generated files back to work items. Works with Epic, Feature,
8
+ PBI, and Bug work item types.
9
+ license: MIT
10
+ compatibility: "Requires qa-gherkin-generator, qa-playwright-generator, qa-test-case-manager MCP servers and Playwright MCP running at localhost:8931 for live locator verification."
11
+ metadata:
12
+ author: qa-gentic
13
+ version: "1.1"
14
+ ---
15
+
16
+ # Generate Gherkin Skill
17
+
18
+ > **Read `AGENT-BEHAVIOR.md` before this skill.** The behavior rules there override any
19
+ > inference. This skill provides the step-by-step workflow only.
20
+
21
+ Generate production-quality Gherkin regression suites from ADO work items (PBI, Bug, or Feature),
22
+ with full navigation context in every scenario, then optionally produce Playwright automation.
23
+
24
+ For the live navigation workflow, scenario writing, validation, delivery gate, quality gates,
25
+ and navigation step wording catalogue → see [references/step-by-step.md](references/step-by-step.md).
26
+
27
+ ---
28
+
29
+ ## 🚨 HARD STOP RULES — Read Before Anything Else
30
+
31
+ These rules override every other instruction in this skill.
32
+
33
+ **HARD STOP 1 — Never write Gherkin for a screen you have not navigated to live.**
34
+ If a scenario requires a state-dependent screen (one that only appears after an upload,
35
+ form submit, error trigger, or multi-step flow), you MUST reach that screen in the live app
36
+ before writing the scenario. If you cannot reach it with the information you currently have,
37
+ ask the user and wait. Do not proceed.
38
+
39
+ **HARD STOP 2 — Never invent test data.**
40
+ Email addresses, file contents, record IDs, duplicate rows — every piece of test data used
41
+ in a `Given` step must come from the user or be confirmed in a live snapshot.
42
+ Do not hardcode emails or file names you made up.
43
+
44
+ **HARD STOP 3 — Never proceed past the Gap Check (Step 2) with open gaps.**
45
+ If even one gap is found, output the questions and stop. Do not write Gherkin, do not
46
+ navigate, do not infer. Wait for the user's answers.
47
+
48
+ **HARD STOP 4 — Never read only the target work item.**
49
+ Always fetch the parent Feature hierarchy and all sibling PBIs/Bugs first. A single PBI or
50
+ Bug is one slice of a flow defined across multiple work items. Writing Gherkin from one item
51
+ alone produces orphaned scenarios with invented preconditions.
52
+
53
+ ---
54
+
55
+ ## Tool Routing — Read This First
56
+
57
+ The correct tool sequence depends on what the user gives you. **Never substitute one path
58
+ for the other — they produce different scopes, different file names, and attach to different
59
+ work items in ADO.**
60
+
61
+ | ID type given by user | Goal | Fetch tool | Attach tool | Scope |
62
+ |---|---|---|---|---|
63
+ | **Epic ID** | Full regression suite across ALL child Features and their PBIs/Bugs | `fetch_epic_hierarchy` | `attach_gherkin_to_feature` (once per child Feature) | 5–10 scenarios per Feature |
64
+ | **Feature ID** | Full regression suite across all child PBIs | `fetch_feature_hierarchy` | `attach_gherkin_to_feature` | 5–10 scenarios |
65
+ | **PBI or Bug ID** | Scoped file for that single story in the current sprint | `fetch_work_item_for_gherkin` | `attach_gherkin_to_work_item` | 3–9 scenarios |
66
+
67
+ **Decision rule (apply exactly):**
68
+
69
+ ```
70
+ if user_input contains an Epic ID:
71
+ → ALWAYS use fetch_epic_hierarchy (never fall through to fetch_feature_hierarchy)
72
+ → fetch_epic_hierarchy returns ALL child Features, their PBIs/Bugs, and all linked TCs
73
+ → analyse every Feature and every child PBI/Bug before generating any Gherkin
74
+ → generate one .feature file per child Feature (5–10 scenarios each)
75
+ → attach each via attach_gherkin_to_feature on the respective Feature ID
76
+ → DO NOT create manual test cases (create_and_link_test_cases) for the Epic itself
77
+ → inform the user: "Test cases cannot be created for an Epic. They can only be
78
+ created for PBIs, Bugs, or Features. Would you like me to create test cases for
79
+ the individual child Features or PBIs instead?"
80
+
81
+ if user_input contains a Feature ID:
82
+ → use fetch_feature_hierarchy + attach_gherkin_to_feature
83
+ → before calling create_and_link_test_cases, ALWAYS ask the user to confirm:
84
+ "I'm about to create {N} manual test cases linked to Feature #{id} — {title}.
85
+ Please confirm (yes/no) before I proceed."
86
+ → do not upload until the user replies affirmatively
87
+
88
+ if user_input contains a PBI ID or Bug ID:
89
+ → use fetch_work_item_for_gherkin + attach_gherkin_to_work_item
90
+
91
+ if ambiguous (no ID, just a title or description):
92
+ → ask the user: "Is this an Epic, Feature, PBI, or Bug? Please share the work item ID."
93
+ → do not guess or default to either path
94
+ ```
95
+
96
+ When using the **Epic path**, `fetch_epic_hierarchy` returns a `features` list where each
97
+ entry contains the Feature's metadata plus its `child_work_items` (PBIs/Bugs) and
98
+ `existing_test_cases`. **Read every Feature and every child PBI/Bug in this list** before
99
+ writing a single scenario — the full cross-Feature flow is the only correct input for an
100
+ Epic-scope suite.
101
+
102
+ When using the **PBI/Bug path**, `fetch_work_item_for_gherkin` returns `parent_feature`
103
+ metadata. Use it for context when writing scenarios — but the generated file covers **only
104
+ the PBI/Bug's own acceptance criteria**, not the full Feature. The file is attached to the
105
+ PBI/Bug, not the Feature.
106
+
107
+ ---
108
+
109
+ ## Core Rule: Navigation Steps in Every Scenario
110
+
111
+ Every scenario MUST include an explicit navigation step — in `Background` (when all scenarios
112
+ share the same starting screen) or as a `Given` step in each individual scenario.
113
+
114
+ ```gherkin
115
+ Background:
116
+ Given I am logged in to Amplify as "<email>"
117
+ And I navigate to the "Users > Add Multiple" screen
118
+ ```
119
+
120
+ ```gherkin
121
+ Scenario: Export failed users after partial mass add
122
+ Given I am logged in to Amplify as "<email>"
123
+ And I navigate to the "Users > Add Multiple" screen
124
+ ...
125
+ ```
126
+
127
+ Navigation path derivation priority:
128
+ 1. Figma link in work item → use the frame/page name from the URL node-id
129
+ 2. Screen name in acceptance criteria → use verbatim
130
+ 3. Work item title → infer path
131
+ 4. Playwright MCP live inspection → read real URL and breadcrumb text
132
+ 5. Unknown → placeholder: `And I navigate to the "<!-- TODO: confirm screen name -->" page`
133
+
134
+ ---
135
+
136
+ ## ⛔ Mandatory Pre-Flight: Deduplication Protocol
137
+
138
+ Before executing any step below, run the deduplication protocol
139
+ (see the `deduplication-protocol` skill).
140
+
141
+ The protocol is **work-item-scoped**: PHASE 1 runs once per `work_item_id` and its results
142
+ are cached. If this skill is invoked for the same `work_item_id` that another agent already
143
+ processed, skip PHASE 1 and read from `CACHE[work_item_id]` directly.
144
+ A different `work_item_id` always triggers a fresh PHASE 1.
145
+
146
+ ---
147
+
148
+ ## Steps
149
+
150
+ ### Step 1 — Build the full picture (always, no exceptions)
151
+
152
+ A single work item never tells the whole story.
153
+
154
+ **1A — Route to the correct fetch tool (see Tool Routing above):**
155
+
156
+ *Epic path (ALWAYS use when an Epic ID is provided):*
157
+ ```
158
+ qa-gherkin-generator:fetch_epic_hierarchy(
159
+ epic_id : <Epic ID>
160
+ organization_url : ...
161
+ project_name : ...
162
+ )
163
+ ```
164
+ Extract: epic title/description, **all child Features**, each Feature's child PBIs/Bugs
165
+ with their ACs, and all existing test cases. Analyse the ENTIRE hierarchy — every Feature
166
+ and every PBI/Bug — before writing a single scenario. Generate one .feature file per
167
+ child Feature.
168
+
169
+ *Feature path:*
170
+ ```
171
+ qa-gherkin-generator:fetch_feature_hierarchy(
172
+ feature_id : <Feature ID>
173
+ organization_url : ...
174
+ project_name : ...
175
+ )
176
+ ```
177
+ Extract: feature title/description, **all child PBIs and Bugs** with their ACs, existing test
178
+ cases, existing `.feature` attachments.
179
+
180
+ *PBI/Bug path:*
181
+ ```
182
+ qa-gherkin-generator:fetch_work_item_for_gherkin(
183
+ work_item_id : <PBI or Bug ID>
184
+ organization_url : ...
185
+ project_name : ...
186
+ )
187
+ ```
188
+ Extract: work item title, acceptance_criteria, repro_steps (for Bugs), linked test cases
189
+ with full steps, parent_feature metadata, suggested_file_name.
190
+
191
+ **1B — get_linked_test_cases on the target work item (both paths):**
192
+ ```
193
+ qa-test-case-manager:get_linked_test_cases(organization_url, project_name, work_item_id)
194
+ ```
195
+
196
+ **1C — Build the full flow map:**
197
+
198
+ After fetching, assemble a flow map before writing anything:
199
+
200
+ ```
201
+ FEATURE: <feature title>
202
+ PBI/Bug A: <title> — <AC summary> ← prerequisite step?
203
+ PBI/Bug B: <title> — <AC summary> ← the work item you were given (PBI/Bug path)
204
+ PBI/Bug C: <title> — <AC summary> ← downstream step?
205
+
206
+ FLOW (inferred from ACs + titles + states):
207
+ Step 1: <what happens — which PBI owns it>
208
+ Step 2: <what happens — which PBI owns it>
209
+ Step 3: <target work item's step>
210
+ Step 4: <downstream step>
211
+
212
+ STATE-DEPENDENT SCREENS (screens only reachable after a prior action):
213
+ - <screen name> → requires: <what action / data to reach it>
214
+ ```
215
+
216
+ Scenarios for the target work item must reflect the **real prerequisites** shown in the flow
217
+ map, not invented ones. Note: only include **active** siblings (state ≠ Removed) when building
218
+ the flow; Removed PBIs are superseded and should not be relied on.
219
+
220
+ ---
221
+
222
+ ### Step 2 — GAP CHECK: identify unknowns and STOP to ask (mandatory, no exceptions)
223
+
224
+ After building the flow map, scan every step in the user journey for the following gap types.
225
+ **If even one gap is found, output the questions below and STOP. Do not write a single line of
226
+ Gherkin or locator code until all gaps are resolved. This is a hard stop — not a suggestion.**
227
+
228
+ #### Gap types that always trigger a user question
229
+
230
+ | # | Gap type | Example |
231
+ |---|---|---|
232
+ | G1 | **State-dependent screen** — only appears after a prior action | Failure summary only exists after a CSV upload with bad rows |
233
+ | G2 | **Required test data** — agent needs a real file, email, or record ID | "What CSV should I upload to trigger failures?" |
234
+ | G3 | **Ambiguous flow step** — AC says something happens but not what screen follows | "After clicking Next, does a loading screen appear?" |
235
+ | G4 | **Unverified screen name** — referenced in AC but not yet snapshotted | "What is the exact URL/route for the failure summary?" |
236
+ | G5 | **Unseen element** — AC references a button only visible after an action | "Export List only appears on the failure summary — I need to reach it first" |
237
+ | G6 | **Figma link present** — work item has a Figma URL not yet inspected | Fetch the Figma frame name; verify it matches a real screen |
238
+ | G7 | **Sibling PBI defines the prerequisite** — the agent must replay a step from another PBI to set up state | "Should I replay the upload step, or is there a shortcut?" |
239
+
240
+ #### Question format — use this exactly
241
+
242
+ ```
243
+ Before I generate Gherkin scenarios and locators for "<work item title>", I need answers
244
+ to the following — I cannot invent these without producing inaccurate, unrunnable tests:
245
+
246
+ **G1 / G2 — [gap type]: [screen or element name]**
247
+ [One sentence describing what I observed from the flow map]
248
+ → [Specific question asking for what I need]
249
+
250
+ **G3 — [gap type]: [ambiguous step]**
251
+ [One sentence describing the ambiguity]
252
+ → [Specific yes/no or multiple-choice question]
253
+
254
+ Please answer these and I will then navigate the live app through the full flow,
255
+ capture real locators from every screen, and generate accurate Gherkin + code.
256
+ I will not proceed until these are answered.
257
+ ```
258
+
259
+ #### Hard rules
260
+
261
+ - **NEVER invent test data.** A `buildCsv()` helper with a hardcoded email constant is
262
+ invented test data — it will fail unless the agent confirmed that email exists in the target org.
263
+ - **NEVER write a `Given` step that sets up state the agent has not actually observed.**
264
+ - **NEVER assign `stability: 0` silently.** Every `stability: 0` locator is a screen the agent
265
+ invented without seeing. Flag each one explicitly and get sign-off before attaching.
266
+ - **Do not proceed to Step 3 until every G1–G7 gap is answered OR the user explicitly
267
+ accepts the gaps and grants sign-off to proceed with known limitations.**
268
+
269
+ #### Pre-navigation checklist (run before Step 3)
270
+
271
+ ```
272
+ □ Parent Feature hierarchy fetched — all active sibling PBIs/Bugs read?
273
+ □ Full flow map built — which work item owns each step?
274
+ □ Every state-dependent screen identified?
275
+ □ For each state-dependent screen: real test data available to reach it?
276
+ □ If a file upload is required: has the user provided or described the file?
277
+ □ Every screen sequence after major actions (upload, submit, click) known?
278
+ □ Every email / record ID / test value confirmed from live snapshot or user input?
279
+ ```
280
+
281
+ If any box is unchecked: output gap questions and stop.
282
+
283
+ ---
284
+
285
+ > **Steps 3–7** (live navigation, scenario writing, validation, delivery gate), the quality
286
+ > gates checklist, and the navigation step wording catalogue are in
287
+ > [references/step-by-step.md](references/step-by-step.md).
@@ -0,0 +1,267 @@
1
+ # Generate Gherkin — Steps 3–7 Reference
2
+
3
+ > Companion to [SKILL.md](../SKILL.md). Covers live navigation, scenario writing,
4
+ > validation, delivery gate, quality gates, and the navigation step wording catalogue.
5
+
6
+ ---
7
+
8
+ ### Step 3 — Live navigation through the FULL flow using real test data
9
+
10
+ Once all gaps from Step 2 are resolved (or user has granted explicit sign-off), navigate
11
+ the live app through **every screen in the flow map** using the real test data provided.
12
+ Never skip a screen. Never snapshot only the landing page and infer the rest.
13
+
14
+ ```
15
+ playwright:browser_navigate(APP_BASE_URL)
16
+ playwright:browser_fill_form(...) ← login
17
+ playwright:browser_click(...) ← Log In
18
+ playwright:browser_snapshot() ← verify dashboard
19
+
20
+ ← Navigate prerequisite steps with real test data
21
+ playwright:browser_click(...) ← each step in the flow map
22
+ playwright:browser_snapshot() ← capture locators at each screen
23
+
24
+ ← For file-upload-gated screens:
25
+ playwright:browser_file_upload(
26
+ files: ["<real file path provided by user>"],
27
+ element: "file upload input",
28
+ ref: "<ref from snapshot>"
29
+ )
30
+ playwright:browser_snapshot() ← verify file accepted
31
+ playwright:browser_click(...) ← Next / Submit
32
+ playwright:browser_snapshot() ← capture processing screen (if any)
33
+ playwright:browser_snapshot() ← capture result / state-dependent screen
34
+ ← capture ALL elements on this screen
35
+ playwright:browser_click(...) ← any further actions (Export, Close, etc.)
36
+ playwright:browser_snapshot() ← capture post-action state
37
+ ```
38
+
39
+ **Every element captured in a live snapshot gets `stability ≥ 60`.**
40
+ **Every element NOT reached gets `stability: 0` and a `⚠ NOT VERIFIED — screen not reached` comment.**
41
+ A `stability: 0` locator for a reachable screen means you missed a step — go back to Step 2.
42
+
43
+ ---
44
+
45
+ ### Step 4 — Write net-new scenarios only
46
+
47
+ Map each acceptance criterion to one or more net-new scenarios (post-deduplication diff).
48
+ Scenarios must reflect the **real flow** from Step 1 — prerequisite steps come from the
49
+ flow map, not invented placeholders.
50
+
51
+ ```gherkin
52
+ @{feature_tag} @regression
53
+ Feature: {feature.title}
54
+ As a {persona}
55
+ I want {goal}
56
+ So that {benefit}
57
+
58
+ Background:
59
+ Given I am logged in to Amplify as "<email>"
60
+ And I navigate to the "<ScreenName>" page
61
+
62
+ @smoke
63
+ Scenario: {primary happy path — real flow, real test data}
64
+ Given {initial state — from flow map, not invented}
65
+ When {user action — verified in live snapshot}
66
+ Then {observable outcome — verified in live snapshot}
67
+
68
+ @regression
69
+ Scenario: {error / boundary / negative case}
70
+ Given {precondition from flow map}
71
+ When {action}
72
+ Then {expected outcome}
73
+
74
+ @regression
75
+ Scenario Outline: {data-driven boundary test}
76
+ When {action with "<param>"}
77
+ Then {expected outcome}
78
+ Examples:
79
+ | param |
80
+ | value |
81
+ ```
82
+
83
+ **Scenario count:**
84
+ - Feature-scoped file: **5–10 scenarios**
85
+ - Work-item-scoped file (single PBI or Bug): **3–9 scenarios**
86
+
87
+ **Coverage checklist:**
88
+
89
+ | Tag | When to include |
90
+ |---|---|
91
+ | `@smoke` | Always — exactly one primary happy path |
92
+ | `@regression` | Additional journeys, error cases, boundary conditions |
93
+ | `@regression` | Cancel/discard flows (when in ACs) |
94
+ | `@regression` | Persistence after refresh/re-login (when in ACs) |
95
+ | `@accessibility` | When ACs or coverage hints mention keyboard nav or ARIA |
96
+
97
+ **Style rules:**
98
+ - `Given` = state, `When` = user action, `Then` = observable outcome
99
+ - One assertion per `Then` where possible
100
+ - `Background` only when multiple scenarios share identical preconditions
101
+ - `Scenario Outline` + `Examples` for data-driven boundary tests
102
+
103
+ ---
104
+
105
+ ### Step 5 — Validate (two checks — both required)
106
+
107
+ **5A — Structural validation (tags, scenario count, When steps):**
108
+ ```
109
+ qa-gherkin-generator:validate_gherkin_content(
110
+ gherkin_content : <your .feature file content>,
111
+ scope : "feature" ← Feature path
112
+ | "work_item" ← PBI/Bug path
113
+ )
114
+ ```
115
+
116
+ If `valid` is `false`, **stop and fix all errors before proceeding**. Do not call the attach
117
+ tool with a file that failed validation — the attach tool will also block it and return the
118
+ same errors. Correct the content and re-validate until `valid` is `true`.
119
+
120
+ Review `warnings` even when valid — they are non-blocking but indicate style issues worth
121
+ addressing (e.g. multiple @smoke tags, missing Background block).
122
+
123
+ **5B — Step uniqueness check:**
124
+ ```
125
+ qa-playwright-generator:validate_gherkin_steps(gherkin_content)
126
+ ```
127
+
128
+ Check: zero duplicate step strings, every scenario has at least one `When`, navigation step
129
+ present in every scenario or Background.
130
+
131
+ ---
132
+
133
+ ### Step 6 — Delivery gate (mandatory before attaching to ADO)
134
+
135
+ Before calling any attach tool, present the following to the user and wait:
136
+
137
+ ```
138
+ I've generated a .feature file for {work_item_type} #{id} — "{title}".
139
+
140
+ {N} scenarios | validation: ✅ passed | scope: {feature | work_item}
141
+
142
+ **Do you want me to attach this file to ADO now? (yes / no)**
143
+
144
+ Note:
145
+ - Saying yes here only attaches the Gherkin file.
146
+ - It does NOT generate Playwright code or create manual test cases.
147
+ - If you want those as well, say so separately after this step.
148
+ ```
149
+
150
+ **Do not call any attach tool until the user replies "yes".**
151
+
152
+ **If user says "yes":**
153
+
154
+ Only attach if the deduplication diff confirms net-new scenarios exist.
155
+
156
+ *Feature path:*
157
+ ```
158
+ qa-gherkin-generator:attach_gherkin_to_feature(
159
+ organization_url, project_name,
160
+ feature_id, feature_title, gherkin_content
161
+ )
162
+ ```
163
+ File name produced: `{feature_id}_{feature_title}_regression.feature`
164
+ Attaches to: the Feature work item.
165
+
166
+ *PBI/Bug path:*
167
+ ```
168
+ qa-gherkin-generator:attach_gherkin_to_work_item(
169
+ organization_url, project_name,
170
+ work_item_id, work_item_title, gherkin_content
171
+ )
172
+ ```
173
+ File name produced: `{work_item_id}_{title_kebab}.feature`
174
+ Attaches to: the PBI or Bug work item directly.
175
+
176
+ Both attach tools run `validate_gherkin_content` internally. If the file still fails
177
+ validation at this point, the upload is blocked and errors are returned. Fix and retry.
178
+
179
+ **If user says "no":** Stop. Offer the content inline. Do not create a local file
180
+ unless the user explicitly says "save" or "download".
181
+
182
+ **After attach completes — STOP. Do not proceed to Playwright.**
183
+ Playwright code generation is a separate decision. Wait for the user to ask.
184
+
185
+ ---
186
+
187
+ ### Step 7 — Generate Playwright automation (only if user explicitly asks)
188
+
189
+ **Do not start this step unless the user has explicitly requested Playwright code.**
190
+ A "yes" at Step 6 (attach Gherkin) does not request Playwright generation.
191
+
192
+ If the user does ask for Playwright code, use the `generate-playwright-code` skill
193
+ for the full workflow. That skill has its own independent delivery gate at Step 7 of
194
+ that document — do not carry over the Gherkin attachment confirmation.
195
+
196
+ ---
197
+
198
+ ## Quality Gates — Do Not Attach Without These
199
+
200
+ - [ ] Work item type identified — **correct tool-routing path selected** (Epic vs Feature vs PBI/Bug)
201
+ - [ ] **Epic path**: `fetch_epic_hierarchy` called — NOT `fetch_feature_hierarchy` or `fetch_work_item_for_gherkin`
202
+ - [ ] **Epic path**: ALL child Features and ALL child PBIs/Bugs read and analysed before any Gherkin written
203
+ - [ ] **Epic path**: One .feature file generated per child Feature (not one file for the whole Epic)
204
+ - [ ] **Epic path**: `create_and_link_test_cases` NOT called on the Epic ID — user informed that test cases are scoped to Features/PBIs/Bugs only
205
+ - [ ] **Feature path**: `fetch_feature_hierarchy` called — all child PBIs/Bugs reviewed
206
+ - [ ] **Feature path**: User confirmation received before calling `create_and_link_test_cases`
207
+ - [ ] **PBI/Bug path**: `fetch_work_item_for_gherkin` called — parent Feature context reviewed
208
+ - [ ] Correct fetch tool called: `fetch_epic_hierarchy` for Epic, `fetch_feature_hierarchy` for Feature, `fetch_work_item_for_gherkin` for PBI/Bug
209
+ - [ ] Parent Feature hierarchy context reviewed — all active sibling PBIs/Bugs read and flow map built
210
+ - [ ] Gap check (Step 2) completed — every G1–G7 gap type checked
211
+ - [ ] **All gaps answered by user before any Gherkin was written** (or explicit sign-off obtained)
212
+ - [ ] **Real test data used** — no invented CSV content, emails, or record IDs
213
+ - [ ] Live Playwright MCP snapshots taken of **every screen in the full flow**
214
+ - [ ] **Zero `stability: 0` locators** for screens reachable with provided test data
215
+ - [ ] Every unverified locator has `⚠ NOT VERIFIED` comment with explicit user sign-off
216
+ - [ ] Deduplication report shown to user
217
+ - [ ] Every scenario has a navigation step (Background or inline `Given`)
218
+ - [ ] **`validate_gherkin_content` returned `valid: true`** (Step 5A — required before attach)
219
+ - [ ] `validate_gherkin_steps` returns zero duplicate steps (Step 5B)
220
+ - [ ] At least one `@smoke` scenario
221
+ - [ ] At least one `@regression` scenario
222
+ - [ ] Scenario count within range: 5–10 for Feature scope, 3–9 for PBI/Bug scope
223
+ - [ ] All `Then` assertions verified in a live snapshot
224
+ - [ ] Credentials sourced from `process.env` in any generated code, not hardcoded
225
+ - [ ] Correct attach tool called: `attach_gherkin_to_work_item` for PBI/Bug, `attach_gherkin_to_feature` for Feature (also used per Feature in Epic path)
226
+
227
+ ---
228
+
229
+ ## Navigation Step Wording Catalogue
230
+
231
+ Reuse these exact phrasings so a single step definition covers all scenarios:
232
+
233
+ ```gherkin
234
+ # Auth
235
+ Given I am logged in to Amplify as "<email>"
236
+ Given I am logged in as an admin user
237
+
238
+ # Navigation
239
+ And I navigate to the "Dashboard" page
240
+ And I navigate to the "Users" page
241
+ And I navigate to "Users > Add Multiple"
242
+ And I navigate to "Users > Add Multiple > Failure Summary"
243
+
244
+ # Direct route
245
+ And I navigate to "/manage/people"
246
+ And I navigate to "/manage/people/mass-add"
247
+
248
+ # Post-action state
249
+ And I am on the "Failure Summary" screen
250
+ And I am redirected to the "Dashboard"
251
+ ```
252
+
253
+ ---
254
+
255
+ ## Explicit Delivery Rules — No Inference
256
+
257
+ | Decision | Rule |
258
+ |---|---|
259
+ | Generate Gherkin | Always: show the file content first |
260
+ | Attach to ADO | Requires explicit "yes" at Step 6 gate |
261
+ | User says "no" at Step 6 | Present inline; offer local download only if user asks |
262
+ | Local file creation | Only if user says "save" or "download" |
263
+ | Playwright code generation | Must be a separate user request — not triggered by this skill completing |
264
+ | Manual test case creation | Must be a separate user request — not triggered by this skill completing |
265
+ | Next work item (Epic path) | Each child Feature's attachment requires its own separate "yes" |
266
+
267
+ **Each artifact delivery is independent. A yes/no for one does not answer any other.**
@@ -1,26 +1,16 @@
1
1
  ---
2
2
  name: generate-playwright-code
3
- description: >
4
- Use this skill whenever the user asks to generate, create, or update Playwright TypeScript
5
- automation code for a Feature, PBI, or Bug. Triggers when the user mentions "Playwright",
6
- "page object", "locators", "step definitions", "automation", "self-healing", "locator
7
- repository", "TimingHealer", "VisualIntentChecker", or asks to automate a Gherkin feature
8
- file. Always reads existing attached Playwright files from the ADO work item before generating
9
- anything, to avoid duplicate locators, page methods, and step definitions. Works with any ADO
10
- work item type: PBI, Bug, or Feature ID.
11
- compatibility:
12
- tools:
13
- - qa-playwright-generator:scaffold_locator_repository
14
- - qa-playwright-generator:generate_playwright_code
15
- - qa-playwright-generator:attach_code_to_work_item
16
- - qa-playwright-generator:validate_gherkin_steps
17
- - qa-test-case-manager:get_linked_test_cases
18
- - qa-gherkin-generator:fetch_feature_hierarchy
19
- - playwright:browser_navigate
20
- - playwright:browser_snapshot
21
- - playwright:browser_fill_form
22
- - playwright:browser_click
23
- - playwright:browser_file_upload
3
+ description: >-
4
+ Use when generating Playwright TypeScript automation code from Gherkin feature files or ADO
5
+ work items. Triggers on: "Playwright", "page object", "locators", "step definitions",
6
+ "automation", "self-healing", "TimingHealer", "VisualIntentChecker", "locator repository".
7
+ Reads existing files before generating to prevent duplicates. Works with PBI, Bug, and
8
+ Feature work item types.
9
+ license: MIT
10
+ compatibility: "Requires qa-playwright-generator, qa-test-case-manager, qa-gherkin-generator MCP servers and Playwright MCP running at localhost:8931 for live locator capture."
11
+ metadata:
12
+ author: qa-gentic
13
+ version: "1.1"
24
14
  ---
25
15
 
26
16
  # Generate Playwright Code Skill
@@ -51,8 +41,8 @@ HealingDashboard runs at `http://localhost:7890` during test execution for appro
51
41
 
52
42
  ## ⛔ Mandatory Pre-Flight: Deduplication Protocol
53
43
 
54
- Before generating or attaching any file, run the deduplication protocol:
55
- `skills/deduplication-protocol.md`
44
+ Before generating or attaching any file, run the deduplication protocol
45
+ (see the `deduplication-protocol` skill).
56
46
 
57
47
  The protocol is **work-item-scoped**: PHASE 1 runs once per `work_item_id` and results are
58
48
  cached. If `generate-gherkin` already ran for this `work_item_id`, skip PHASE 1 and read from