@groupby/ai-dev 0.5.14 → 0.5.16

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 (28) hide show
  1. package/package.json +1 -1
  2. package/teams/brain-studio/skills/arch-context/SKILL.md +135 -0
  3. package/teams/brain-studio/skills/draft-plan/SKILL.md +222 -0
  4. package/teams/brain-studio/skills/draft-pr/SKILL.md +291 -0
  5. package/teams/brain-studio/skills/git-context/SKILL.md +159 -0
  6. package/teams/brain-studio/skills/html/SKILL.md +233 -0
  7. package/teams/brain-studio/skills/javascript/SKILL.md +680 -0
  8. package/teams/brain-studio/skills/jira-context/SKILL.md +113 -0
  9. package/teams/brain-studio/skills/jira-spec/SKILL.md +247 -0
  10. package/teams/brain-studio/skills/pr-review/SKILL.md +310 -0
  11. package/teams/brain-studio/skills/react/SKILL.md +282 -0
  12. package/teams/brain-studio/skills/styled-components/SKILL.md +336 -0
  13. package/teams/brain-studio/skills/tdd-implement/SKILL.md +278 -0
  14. package/teams/brain-studio/skills/typescript/SKILL.md +491 -0
  15. package/teams/fhr-orchestration/skills/create-jira/SKILL.md +47 -0
  16. package/teams/fhr-orchestration/skills/create-jira/TEMPLATE.md +10 -0
  17. package/teams/fhr-orchestration/skills/create-plan/SKILL.md +48 -0
  18. package/teams/fhr-orchestration/skills/create-plan/TEMPLATE.md +13 -0
  19. package/teams/fhr-orchestration/skills/init-harness/SKILL.md +164 -0
  20. package/teams/fhr-orchestration/skills/init-harness/assets/TEMPLATE.CLAUDE.md +88 -0
  21. package/teams/fhr-orchestration/skills/init-harness/assets/TEMPLATE.architecture.md +152 -0
  22. package/teams/fhr-orchestration/skills/init-harness/assets/TEMPLATE.coding-guidelines.md +320 -0
  23. package/teams/fhr-orchestration/skills/init-harness/assets/TEMPLATE.glossary.md +55 -0
  24. package/teams/fhr-orchestration/skills/init-harness/assets/TEMPLATE.harness-gap-log.md +59 -0
  25. package/teams/fhr-orchestration/skills/use-case-writer/SKILL.md +123 -0
  26. package/teams/fhr-orchestration/skills/use-case-writer/TEMPLATE.md +39 -0
  27. package/teams/fhr-orchestration/skills/write-spec/SKILL.md +56 -0
  28. package/teams/fhr-orchestration/skills/write-spec/TEMPLATE.md +29 -0
@@ -0,0 +1,113 @@
1
+ ---
2
+ name: jira-context
3
+ description: Provides standardized procedures for fetching Jira ticket data via the Atlassian MCP in agent workflows — resolving the ticket key (from caller input or branch name), fetching all relevant fields (summary, description, acceptance criteria, comments, issue type, priority, linked issues), and handling auth failures or missing tickets gracefully. Outputs a `<ticket-context>` object consumed by downstream review and planning workflow steps (whether skills or prompts). Auto-apply before any prompt that needs Jira ticket content to evaluate code, plan work, or write a PR description.
4
+ ---
5
+
6
+ # Jira Context Guide
7
+
8
+ ## Relationship to other repository skills
9
+
10
+ - **git-context** — must be read first when `<ticket-key>` is not provided by the caller; the key is extracted from `<branch-name>` produced there.
11
+
12
+ This skill does not replace the git-context skill. It adds the Jira data layer on top of
13
+ the git context.
14
+
15
+ ## Mandatory application (agents)
16
+
17
+ Whenever a prompt requires Jira ticket content:
18
+
19
+ 1. **Confirm `<ticket-key>` is available.** If not, run the git-context skill first to
20
+ extract it from the branch name, or ask the user to provide it.
21
+ 2. **Read this skill file** before calling the Atlassian MCP.
22
+ 3. Follow the **Working method** steps in order.
23
+ 4. Store the result as `<ticket-context>` for use by the calling prompt.
24
+
25
+ This skill is optional when the calling prompt explicitly says no Jira ticket is needed.
26
+
27
+ ## When to use
28
+
29
+ - Before a code review that evaluates whether changes fulfil a ticket's acceptance criteria.
30
+ - Before writing an implementation plan for a ticket.
31
+ - Before writing a PR description that references a ticket.
32
+ - Any time a prompt says "fetch the Jira ticket" or "check the acceptance criteria".
33
+
34
+ ## When not to use
35
+
36
+ - The task has no associated Jira ticket and the caller confirms this — skip entirely.
37
+ - The caller has already provided full ticket content inline — skip the MCP call.
38
+
39
+ ## Truthfulness and claims
40
+
41
+ - Do not fabricate acceptance criteria — if the AC field is empty or absent, report that
42
+ explicitly; do not infer AC from the description.
43
+ - Do not claim the ticket exists if the MCP returns an error — report the actual error.
44
+ - Do not assume the ticket key format — use the value from `<ticket-key>` as-is.
45
+ - Auth failures are expected in some environments — always note this clearly and continue
46
+ the workflow without ticket context rather than blocking.
47
+
48
+ ## Self-contained operating mode
49
+
50
+ The Atlassian MCP server is configured for this project — treat it as always available. Do not skip the Jira fetch on the assumption that MCP is not set up; only skip it when the caller explicitly says no ticket is needed or when `401` / timeout errors occur (see §3 error table).
51
+
52
+ Use the procedures in the **Embedded implementation standard** below as the sole
53
+ authority for Jira ticket fetching. Do not substitute cached ticket content from a
54
+ previous conversation turn — always make a fresh MCP call.
55
+
56
+ ---
57
+
58
+ ## Embedded implementation standard
59
+
60
+ ### 1) Resolve the ticket key
61
+
62
+ - If the caller provided a key explicitly (e.g. as a command argument such as `S4R-10620`), use it.
63
+ - If not, use `<ticket-key>` from the git-context skill output.
64
+ - If neither source provides a key, ask the user before proceeding.
65
+
66
+ ### 2) Fetch the Jira issue
67
+
68
+ Call the Atlassian MCP with the resolved ticket key. Collect all of:
69
+
70
+ | Field | MCP field / location |
71
+ |-------|---------------------|
72
+ | Summary | `fields.summary` |
73
+ | Description | `fields.description` (render as markdown) |
74
+ | Acceptance criteria | `fields.customfield_10972` or embedded in description |
75
+ | Comments | `fields.comment.comments` — focus on those that clarify scope or root cause |
76
+ | Issue type | `fields.issuetype.name` (Bug / Story / Task / Spike) |
77
+ | Priority | `fields.priority.name` |
78
+ | Linked issues | `fields.issuelinks` — blocked-by / blocks / relates-to |
79
+ | Status | `fields.status.name` |
80
+
81
+ ### 3) Handle errors
82
+
83
+ | Error | Action |
84
+ |-------|--------|
85
+ | `Unauthorized` / `401` | Note "Atlassian auth unavailable"; continue workflow without ticket context; do not block. |
86
+ | `Not Found` / `404` | Report "Ticket `<key>` not found"; stop and ask the user to verify the key. |
87
+ | Network timeout | Retry once; if it fails again, treat as Unauthorized above. |
88
+
89
+ ### 4) Store ticket context
90
+
91
+ Store all collected fields as `<ticket-context>`. At minimum, subsequent steps need:
92
+
93
+ - `<ticket-summary>` — one-line description of what the ticket asks for.
94
+ - `<ticket-ac>` — list of acceptance criteria items, or `none` if absent.
95
+ - `<ticket-type>` — Bug / Story / Task / Spike; affects how the plan or review is framed.
96
+
97
+ ---
98
+
99
+ ## Working method (apply in this order)
100
+
101
+ 1. **Resolve** — Confirm or extract `<ticket-key>`; ask the user if both sources fail.
102
+ 2. **Fetch** — Call the Atlassian MCP; collect all fields listed in §2.
103
+ 3. **Handle errors** — Apply the error table in §3; never block on auth failures.
104
+ 4. **Store** — Set `<ticket-context>`, `<ticket-summary>`, `<ticket-ac>`, `<ticket-type>`.
105
+ 5. **Confirm** — Report to the caller: ticket key, summary, and whether AC was found.
106
+
107
+ ## Quality bar before final answer
108
+
109
+ - `<ticket-key>` was resolved from caller input or branch name — not guessed.
110
+ - The MCP was called with the actual key — not a paraphrased or reconstructed one.
111
+ - Auth failures are reported as a note, not as a blocking error.
112
+ - `<ticket-ac>` is either a concrete list or explicitly `none` — not fabricated.
113
+ - `<ticket-context>` is set before the skill returns to the caller.
@@ -0,0 +1,247 @@
1
+ ---
2
+ name: jira-spec
3
+ description: Fetch a Jira ticket and write a development spec to .ai/tasks/{KEY}/spec.md in the current repo. First step of the AI-assisted development workflow. Only run when the user explicitly invokes this command via /jira-spec — do NOT auto-trigger on Jira keys, ticket links, or the word "spec".
4
+ ---
5
+
6
+ # Jira Spec
7
+
8
+ ## ⚠️ Prerequisite: Jira access
9
+
10
+ This skill **cannot run without working Jira access**. The very first thing
11
+ it does is fetch the ticket — if that fails, the skill stops. Most failures
12
+ happen here. Before running, verify at least ONE of these works:
13
+
14
+ - **Atlassian MCP** is configured (preferred): the Atlassian MCP is available
15
+ in the current session (fetch the accessible resources, then the issue).
16
+ - **go-jira CLI** is installed and authenticated: `jira issue view <KEY>`
17
+ returns the ticket.
18
+ - **`curl` + stored credentials**: `${JIRA_BASE_URL}` is set and a
19
+ credential (`JIRA_TOKEN` or `.netrc` entry) authorizes
20
+ `${JIRA_BASE_URL}/rest/api/3/issue/<KEY>`.
21
+
22
+ If none of these is in place, the skill will refuse to proceed.
23
+ **Never fabricate ticket content** — the value of the spec is the verbatim
24
+ audit record from Jira.
25
+
26
+ ## Overview
27
+
28
+ Given a Jira ticket reference (key like `S4R-1234` or a browse URL), fetch the
29
+ ticket from Jira and produce a markdown spec at `.ai/tasks/{KEY}/spec.md`.
30
+ The spec preserves the original ticket verbatim (for audit) and adds AI-gathered
31
+ repo context so a future session can start implementation immediately.
32
+
33
+ This is **Step 1** of the AI-assisted development workflow.
34
+
35
+ ## When to Use
36
+
37
+ Trigger on inputs like:
38
+
39
+ - A Jira key alone: `S4R-1234`, `SRE-7348`, `AIP-123`
40
+ - A Jira URL: `https://*.atlassian.net/browse/S4R-1234`
41
+ - Requests like "draft a spec for S4R-1234", "prep this ticket", "create
42
+ ticket doc for <link>"
43
+
44
+ Do NOT use for: generic note-taking, non-Jira tickets (GitHub issues, Linear),
45
+ or when the user already has a spec file and just wants to edit it.
46
+
47
+ ## Workflow
48
+
49
+ ### 1. Parse the input
50
+
51
+ Extract the ticket key (uppercase letters, hyphen, digits — e.g. `S4R-1234`).
52
+ Accept both bare keys and `…/browse/KEY` URLs.
53
+
54
+ ### 2. Fetch the ticket from Jira
55
+
56
+ The most common failure point — see Prerequisite above. Try in this order:
57
+
58
+ - **Atlassian MCP** (preferred when available): via the Atlassian MCP, fetch
59
+ the accessible resources, then fetch the issue for the resolved ticket key.
60
+ Also fetch comments if the description references them.
61
+ - **CLI fallback**: `jira issue view KEY` (go-jira) or a `curl` against
62
+ `${JIRA_BASE_URL}/rest/api/3/issue/KEY` using stored credentials.
63
+ - **If none of these works, STOP.** Print which mechanism was tried, the
64
+ error, and what the user needs to configure. Do NOT proceed to the repo
65
+ scan. Do NOT invent ticket content.
66
+
67
+ ### 3. Determine change types and load architecture docs
68
+
69
+ Based on the ticket summary/description, classify the likely change types
70
+ using the categories from the arch-context skill:
71
+
72
+ - Component / hook (`.tsx`)
73
+ - Styling (`.styles.ts`)
74
+ - API / data fetching
75
+ - State management
76
+ - Test changes
77
+ - Auth / permissions
78
+ - Feature flags
79
+ - i18n
80
+ - Config / build
81
+
82
+ Then load architecture context: if `.github/copilot-instructions.md` exists,
83
+ use its Doc Routing Table to load the relevant `docs/architecture/` files for
84
+ these change types; otherwise, if `docs/architecture/` exists, load the
85
+ relevant docs directly. If `docs/architecture/12-code-conventions/README.md`
86
+ exists, load it as baseline. If neither path exists, skip this step.
87
+
88
+ This gives the repo scan (next step) much better direction.
89
+
90
+ ### 4. Investigate the repo (medium depth)
91
+
92
+ Based on the ticket summary/description AND any loaded architecture docs:
93
+
94
+ - Identify the most relevant files/modules (use Grep/Glob, check the
95
+ module structure from loaded docs).
96
+ - Read the key files end-to-end where useful; skim larger ones.
97
+ - Note conventions, patterns, and any nearby code the change will touch.
98
+ - If `.ai/patterns.md` exists, check it for relevant past solutions.
99
+ - Keep this targeted — don't tour the whole codebase.
100
+
101
+ ### 5. Determine the output path
102
+
103
+ - Directory: `.ai/tasks/{KEY}/` (create if missing).
104
+ - Filename: `spec.md` (always this name within the task folder).
105
+ - If the file already exists, ask the user before overwriting.
106
+
107
+ ### 6. Generate slug for future branch naming
108
+
109
+ Derive a slug from the ticket summary. This slug will be used by subsequent
110
+ workflow steps (branch creation, plan file, etc.). Include it in the spec
111
+ metadata.
112
+
113
+ **Slug rules:** 3–6 words, ≤ 50 characters, kebab-case.
114
+
115
+ - Lowercase. Replace any run of non-`[a-z0-9]` with a single `-`. Trim
116
+ leading/trailing `-`.
117
+ - Strip a leading `KEY:` if the summary repeats the key.
118
+ - Drop filler: `implement-the-`, `add-support-for-`, `feature-from-`,
119
+ `the-`, `a-`, `for-`, `from-`, `in-`, `of-`, etc.
120
+ - Keep the **distinctive core**: the noun/verb that names the change.
121
+
122
+ Examples:
123
+ - "Implement the does not affect feature from Mongo for Facet Exclusion" → `does-not-affect`
124
+ - "Add MongoDB command listener logging" → `mongodb-command-listener-logging`
125
+ - "Fix: NPE in /search when filters empty" → `npe-search-empty-filters`
126
+
127
+ ### 7. Write the spec
128
+
129
+ Use the template below.
130
+
131
+ ### 8. Report and stop
132
+
133
+ Report the path of the file and a one-line summary. Remind the user of the
134
+ next workflow step:
135
+
136
+ > "Spec saved at `.ai/tasks/{KEY}/spec.md` (local-only — the `.ai/` folder is
137
+ > gitignored; it reaches the team later via the PR). Next step: create a branch
138
+ > and run `/draft-plan` when ready."
139
+
140
+ Do not start implementation unless the user explicitly asks.
141
+
142
+ ## Spec Template
143
+
144
+ ```markdown
145
+ # {KEY}: {Summary}
146
+
147
+ - **Jira:** {browse URL}
148
+ - **Status:** {status} · **Type:** {issuetype} · **Priority:** {priority}
149
+ - **Assignee:** {assignee} · **Reporter:** {reporter}
150
+ - **Labels:** {labels} · **Components:** {components}
151
+ - **Parent / Epic:** {parent or epic link, if any}
152
+ - **Fetched:** {YYYY-MM-DD}
153
+ - **Slug:** {slug} (for branch: `<type>/{KEY}-{slug}`)
154
+
155
+ ## Original Description (verbatim, for audit)
156
+
157
+ > {Jira description, rendered to markdown. Preserve formatting, bullet lists,
158
+ > code blocks, and links. Do not edit or paraphrase.}
159
+
160
+ ### Acceptance Criteria (verbatim)
161
+
162
+ > {If present as a separate field or section, include verbatim. Omit the heading
163
+ > if there is none — do not invent acceptance criteria.}
164
+
165
+ ### Relevant Comments (verbatim, optional)
166
+
167
+ > {Include only comments that add load-bearing context — decisions, scope
168
+ > changes, clarifications from the reporter. Skip chatter. Quote verbatim with
169
+ > author and date. Omit the section entirely if nothing qualifies.}
170
+
171
+ ## Implementation Notes (AI-gathered)
172
+
173
+ > ⚠️ The items below are AI guesses from a medium-depth repo scan. Verify
174
+ > against the current code before relying on any specific file path, line
175
+ > range, or claim — they may be stale, incomplete, or wrong.
176
+
177
+ ### Architecture docs loaded
178
+ - {List which docs/architecture/* files were consulted and why, or "none — no
179
+ architecture doc source was present"}
180
+
181
+ ### Touch points in this repo
182
+ - `path/to/file` — what lives here and why it matters for this ticket
183
+ - `path/to/other:120-180` — specific region of interest
184
+
185
+ ### Patterns and conventions to follow
186
+ - {From docs/architecture/* (if loaded) and .ai/patterns.md (if present)}
187
+ - {e.g. "Forms in linguistic-controls use Formik + Yup; validation in
188
+ src/search-for-retail/validation/"}
189
+
190
+ ### Suggested approach (sketch, not a plan)
191
+ - {2–5 bullets outlining the most plausible shape of the change. Keep loose —
192
+ the actual plan belongs in a separate planning step.}
193
+
194
+ ### Test surface
195
+ - {Which test files in test/unit/ and test/integration/ will need updates}
196
+ - {Use custom render() from test-utils.tsx for component tests}
197
+
198
+ ## Open Questions
199
+
200
+ > Include this section **only** when at least one truly blocking question
201
+ > exists — i.e. its answer would change the implementation and cannot be
202
+ > resolved by reading the repo or the ticket. If there are no such questions,
203
+ > omit this entire section (heading included). Don't print a placeholder.
204
+
205
+ - [ ] {question, with the reason it blocks progress}
206
+ ```
207
+
208
+ ## Rules
209
+
210
+ - **Verbatim means verbatim.** Do not summarize, "clean up", or translate the
211
+ Jira description. Quote it as-is in a blockquote so an auditor can compare
212
+ to Jira.
213
+ - **One spec file per ticket.** Don't append to a different ticket's file.
214
+ - **No invented metadata.** If a field is missing in Jira, omit it from the
215
+ spec rather than guessing.
216
+ - **Minimize open questions.** Prefer to resolve uncertainty by reading the
217
+ code. Only escalate questions that are genuinely blocking.
218
+ - **Don't start coding.** This skill produces the spec only. Implementation
219
+ comes later.
220
+ - **Local-only artifact.** `.ai/` is gitignored — the spec is never committed.
221
+ It reaches the team only when `/draft-pr` embeds it in the PR body. Do not
222
+ try to `git add` or commit it.
223
+ - **Load architecture docs if available.** If `.github/copilot-instructions.md`
224
+ exists, use its Doc Routing Table; otherwise, if `docs/architecture/` exists,
225
+ load the relevant docs directly — this produces better implementation notes.
226
+ - **Check patterns.** Read `.ai/patterns.md` if it exists — past solutions
227
+ may be directly relevant.
228
+
229
+ ## Common Mistakes
230
+
231
+ - Writing the spec without fetching Jira (hallucinating description).
232
+ **Never do this** — if Jira is unreachable, stop and report.
233
+ - Saving to wrong location. Output is always `.ai/tasks/{KEY}/spec.md`.
234
+ - Paraphrasing the description. The "Original Description" section must be
235
+ verbatim.
236
+ - Padding "Open Questions" with nice-to-knows. Omit the section unless a
237
+ question is truly blocking.
238
+ - Skipping the architecture-doc-loading step when a source is available (the
239
+ Doc Routing Table in `.github/copilot-instructions.md`, or `docs/architecture/`
240
+ directly). Architecture docs give the repo scan direction — without them
241
+ the implementation notes will be shallow.
242
+ - Presenting AI-gathered touch points as ground truth. They are guesses —
243
+ keep the verify-before-relying banner above that section.
244
+ - Doing deep design work here. This is a spec, not a plan — medium-depth
245
+ repo investigation only. The actual approach belongs in `/draft-plan`.
246
+ - Forgetting to include the slug. Subsequent workflow steps (branch creation,
247
+ plan) depend on it.
@@ -0,0 +1,310 @@
1
+ ---
2
+ name: pr-review
3
+ description: >-
4
+ Use when the user invokes `/pr-review` (or asks to "review this branch", "review before PR",
5
+ "PR review", "standalone review"). Performs a self-contained review of the current branch's
6
+ changes against the live Jira ticket, architecture docs, code conventions, and accessibility —
7
+ works on ANY branch without requiring the `.ai/tasks/{KEY}/` workflow artifacts (uses them only
8
+ if present, otherwise fetches the ticket live via the Atlassian MCP). Produces a verdict
9
+ (PASS / PASS WITH NOTES / FAIL) and writes a report to `.ai/tasks/{KEY}/review.md`. Read-only by
10
+ default; offers to fix on FAIL. Checks plan compliance when `.ai/tasks/{KEY}/plan.md`
11
+ is present; skips the axis gracefully when the plan is absent. Only runs when
12
+ explicitly invoked — do NOT auto-trigger on the word "review".
13
+ ---
14
+
15
+ # pr-review
16
+
17
+ Standalone, ticket-driven review of the current branch's changes — runnable at any
18
+ point, on any branch, **without** the `/jira-spec` → `/draft-plan` → `/tdd-implement`
19
+ workflow having produced `spec.md`/`plan.md`.
20
+
21
+ ## Relationship to other repository skills
22
+
23
+ This skill is the **primary review skill** for this repository. It handles both
24
+ scenarios — the full AI workflow (with spec/plan) and standalone reviews (no artifacts):
25
+
26
+ | Situation | This skill's behaviour |
27
+ |---|---|
28
+ | Full workflow — `spec.md` + `plan.md` present | All 6 axes run, including Plan compliance |
29
+ | Standalone — no artifacts (hotfix, handwritten, another dev's branch) | Axes 1 and 2 degrade gracefully; all others run |
30
+
31
+ `pr-review` **composes** the foundational context skills instead of re-implementing them:
32
+
33
+ - `git-context` — sync, branch name, `<ticket-key>`, diff, `<change-types>`
34
+ - `jira-context` — live `<ticket-context>` (acceptance criteria) via the Atlassian MCP
35
+ - `arch-context` — `<loaded-docs>` + `<arch-constraints>` via the Doc Routing Table
36
+
37
+ Read those three first; this skill assumes their outputs are available.
38
+
39
+ ## Mandatory application (agents)
40
+
41
+ When the user invokes `/pr-review`:
42
+
43
+ 1. **Read this skill file** before doing anything else.
44
+ 2. Run the **Working method** steps in order, delegating context gathering to the three
45
+ skills above (do not re-derive their logic here).
46
+ 3. Review is **read-only** until the user explicitly chooses `[fix]` or `[fix-and-ask]`.
47
+
48
+ ## When to use
49
+
50
+ - Reviewing a branch before opening a PR when there is **no** `spec.md`/`plan.md`.
51
+ - Reviewing a hotfix, a hand-written change, or another developer's branch.
52
+ - Any standalone review of the current branch, focused on the live ticket and accessibility.
53
+
54
+ ## When not to use
55
+
56
+ - The user did not explicitly invoke it. Do **not** auto-trigger on the word "review".
57
+
58
+ ## Invocation
59
+
60
+ ```
61
+ /pr-review [S4R-XXXX] [full|quick]
62
+ ```
63
+
64
+ - **Ticket key** — optional. If omitted, it's extracted from the branch name by
65
+ `git-context` (regex `[A-Z]+-[0-9]+`, e.g. `S4R-10559` from `feat/S4R-10559-slug`).
66
+ If the branch has no key, the key is not in the branch (common here — keys often live
67
+ only in commits/PR), so: scan commit subjects on the branch for `[A-Z]+-[0-9]+`, then
68
+ ask the user. Never invent a key.
69
+ - **Mode** — `full` (default) or `quick`.
70
+
71
+ ## Modes
72
+
73
+ | Mode | Trigger | Scope |
74
+ |------|---------|-------|
75
+ | **Full** (default) | `/pr-review` or `/pr-review full` | All 6 axes below |
76
+ | **Quick** | `/pr-review quick` | Axes 3–5 only (Architecture + Code quality + Accessibility) |
77
+
78
+ ## Review axes
79
+
80
+ ### Axis 1: Ticket compliance
81
+
82
+ - Obtain acceptance criteria. Order of preference:
83
+ 1. `.ai/tasks/{KEY}/spec.md` if it exists (richest, already distilled).
84
+ 2. Otherwise `<ticket-context>` from `jira-context` (live AC from Jira).
85
+ - For each AC, verify it is addressed in the diff. Flag: not covered, partially covered,
86
+ or contradicted.
87
+ - If no ticket key resolves and no spec exists, state that AC could not be verified and
88
+ continue with the remaining axes (do not block).
89
+ - Skip if mode = quick.
90
+
91
+ ### Axis 2: Plan compliance
92
+
93
+ If `.ai/tasks/{KEY}/plan.md` exists, load it and verify the implementation matches
94
+ the approved plan. Skip this axis entirely if the plan file is absent — note
95
+ "Plan not found — Axis 2 skipped" in the report header.
96
+
97
+ - **Affected areas** — files changed in the diff should correspond to the areas
98
+ listed in the plan. Flag significant additions or deletions not reflected there.
99
+ - **Out of scope** — nothing listed in the plan’s “Out of scope” section should
100
+ appear in the diff. Flag any such additions.
101
+ - **Approach** — the implementation should follow the plan’s stated direction.
102
+ Flag architectural choices that contradict the approved approach.
103
+ - **Revisions** — if the plan has a `## Revision` section, treat it as the
104
+ updated source of truth for the sections it overrides.
105
+ - Skip if mode = quick.
106
+
107
+ ### Axis 3: Architecture compliance
108
+
109
+ Use `<loaded-docs>` and `<arch-constraints>` from `arch-context` (it applies the Doc
110
+ Routing Table to `<change-types>`). Check the diff for:
111
+
112
+ - Pattern violations (wrong file location, wrong abstraction level).
113
+ - Import path violations (`@/` aliases required).
114
+ - State management violations (direct store access instead of `useAppSelector`/`useAppDispatch`).
115
+ - i18n violations (raw strings in JSX instead of FormatJS `useLocalization`/`useIntl`).
116
+ - Currency violations (ad-hoc formatting instead of `useCurrencyFormatter`).
117
+ - If the code contradicts a loaded doc, the **doc is the target state** — flag the
118
+ discrepancy; do not normalise the legacy pattern.
119
+
120
+ ### Axis 4: Code quality
121
+
122
+ Load the code-generation skills relevant to the changed file types, in order:
123
+
124
+ - `javascript` skill → `typescript` skill
125
+ - `react` skill (if `.tsx`)
126
+ - `styled-components` skill (if `.styles.ts`/`.styles.tsx`)
127
+
128
+ Check for:
129
+
130
+ - TypeScript: strict types, no `any`, proper narrowing, explicit return types.
131
+ - React: function declarations with explicit `JSX.Element`, no `React.FC`, correct hook usage.
132
+ - Styling: PascalCase named exports (no `Styled` prefix), `baseColors`, `theme.spacing()`,
133
+ `$` transient props, no `!important`.
134
+ - JavaScript: Airbnb style, semicolons, braces on all control bodies, proper destructuring.
135
+ - Security: OWASP-relevant concerns (XSS via `dangerouslySetInnerHTML`, injection, unsafe
136
+ URL handling, secrets in code).
137
+ - Performance: unnecessary re-renders, missing/over-eager memoization, missing effect
138
+ cleanups, over-importing.
139
+
140
+ ### Axis 5: Accessibility
141
+
142
+ For any changed `.tsx`/markup, check:
143
+
144
+ - **Semantics** — real elements for their role (`button` for actions, `a` for navigation);
145
+ no `div`/`span` used as interactive controls.
146
+ - **Labelling** — every interactive control has an accessible name (visible `<label>`,
147
+ `aria-label`, or `aria-labelledby`); icons-only buttons are labelled; placeholder is
148
+ never the only label.
149
+ - **Keyboard** — all interactive elements are reachable and operable by keyboard; no
150
+ positive `tabindex`; custom widgets handle Enter/Space/Escape as expected.
151
+ - **Focus management** — focus is moved into newly opened dialogs/menus and restored on
152
+ close; no focus traps outside modals; visible focus indicator preserved.
153
+ - **ARIA** — used only when native semantics are insufficient; roles/states valid and not
154
+ contradicting the element; live regions for async status updates.
155
+ - **Images/media** — meaningful `alt`; decorative images `alt=""`.
156
+ - **Color/contrast** — meaning is not conveyed by color alone; obvious contrast regressions
157
+ flagged (note: exact ratios may need manual/tool verification — say so).
158
+
159
+ If `docs/architecture/` defines accessibility conventions, those take precedence over the
160
+ generic checklist above.
161
+
162
+ ### Axis 6: Test quality
163
+
164
+ - Tests exist for new behaviour (not just the happy path).
165
+ - Tests are in the correct location (`test/unit/` or `test/integration/`).
166
+ - Custom `render()` from `test-utils.tsx` is used for component tests.
167
+ - Assertions are meaningful (not "renders without crashing").
168
+ - Edge cases from the AC are covered.
169
+ - No snapshot tests without justification.
170
+ - Skip if mode = quick.
171
+
172
+ ## Working method
173
+
174
+ ### 1. Gather context (delegate, don't re-implement)
175
+
176
+ 1. Run **`git-context`**: sync with `origin/main`, get `<branch-name>`, `<ticket-key>`,
177
+ the committed diff `git diff $(git merge-base HEAD origin/main)..HEAD`, the
178
+ `--name-only` file list, and `<change-types>`.
179
+ 2. Run **`jira-context`** with `<ticket-key>` to get `<ticket-context>`. If auth fails
180
+ (`401`/timeout) or there is no key, note it and continue without ticket context.
181
+ 3. Run **`arch-context`** with `<change-types>` to get `<loaded-docs>` + `<arch-constraints>`.
182
+ 4. Load the code-generation skills for the changed file types (Axis 4).
183
+ 5. If `.ai/tasks/{KEY}/plan.md` exists, read it for Axis 2 (Plan compliance).
184
+ If absent, note "Plan not found — Axis 2 skipped" in the report header.
185
+
186
+ ### 2. Run review
187
+
188
+ For each in-scope axis, analyse the diff against the loaded standards and classify each
189
+ finding's severity:
190
+
191
+ - **Critical** — must fix before merge (breaks an AC, security issue, architecture
192
+ violation that forces later refactor, a11y barrier that blocks a user).
193
+ - **Warning** — should fix, not a blocker (style/convention mismatch, missing edge-case
194
+ test, minor a11y nit).
195
+ - **Note** — informational (suggestion, future watch-item).
196
+
197
+ ### 3. Produce verdict
198
+
199
+ | Verdict | Criteria |
200
+ |---------|----------|
201
+ | **PASS** | Zero findings, or only Notes |
202
+ | **PASS WITH NOTES** | Warnings only, no Criticals |
203
+ | **FAIL** | One or more Critical findings |
204
+
205
+ ### 4. Present results in chat
206
+
207
+ ```markdown
208
+ ## PR Review — {KEY or branch}
209
+
210
+ **Verdict: {PASS / PASS WITH NOTES / FAIL}** · Mode: {full/quick}
211
+ Ticket AC source: {spec.md / live Jira / none}
212
+ Plan: {plan.md found / not found — Axis 2 skipped}
213
+
214
+ ### Critical ({count})
215
+ 1. **[Axis N: title]** — what's wrong
216
+ - File: `path/to/file.tsx` (line ~XX)
217
+ - Fix: what needs to change
218
+
219
+ ### Warnings ({count})
220
+ 1. **[Axis N: title]** — description
221
+ - File: `path/to/file.tsx`
222
+ - Suggestion: what to improve
223
+
224
+ ### Notes ({count})
225
+ 1. **[Axis N: title]** — observation
226
+ ```
227
+
228
+ Do **not** print your reasoning steps or to-do list.
229
+
230
+ ### 5. On FAIL — offer resolution
231
+
232
+ > *"Review found {N} critical issues. Options:*
233
+ > - *`[fix]` — I'll fix all critical issues, run verification, and re-review*
234
+ > - *`[fix-and-ask]` — I'll propose each fix and wait for your approval*
235
+ > - *`[skip]` — proceed anyway (not recommended)"*
236
+
237
+ On `[fix]`: apply fixes following the same code-gen skills → run
238
+ `yarn lint && yarn typecheck && yarn test` → re-review (quick mode on the fixed areas)
239
+ → show updated verdict.
240
+
241
+ On `[fix-and-ask]`: propose each critical fix in chat, wait for approval before applying,
242
+ then run verification.
243
+
244
+ On `[skip]`: record in the report that criticals were acknowledged but not fixed.
245
+
246
+ ### 6. Write review report
247
+
248
+ Write to a **single** location: `.ai/tasks/{KEY}/review.md`. If no ticket key resolves,
249
+ fall back to `.ai/tasks/{branch-slug}/review.md` (slugified branch name) so everything
250
+ still lives under `.ai/tasks/`. Create the folder if missing.
251
+
252
+ ```markdown
253
+ # PR Review — {KEY or branch}
254
+
255
+ **Date:** {date}
256
+ **Branch:** {branch}
257
+ **Verdict:** {final verdict}
258
+ **Mode:** {full/quick}
259
+ **Ticket AC source:** {spec.md / live Jira / none}
260
+
261
+ ## Summary
262
+ {1–2 sentences on what was reviewed}
263
+
264
+ ## Findings
265
+ ### Critical
266
+ {list or "None"}
267
+ ### Warnings
268
+ {list or "None"}
269
+ ### Notes
270
+ {list or "None"}
271
+
272
+ ## Verification
273
+ `yarn lint && yarn typecheck && yarn test` — {PASS/FAIL + summary, or "not run (read-only)"}
274
+
275
+ ## Context loaded
276
+ - Ticket: {key + AC source, or "none / auth failed"}
277
+ - Plan: {plan.md found / not found}
278
+ - Architecture docs: {list from arch-context, or "none"}
279
+ - Code-gen skills: {list}
280
+ ```
281
+
282
+ ### 7. Report next step
283
+
284
+ > *"Review saved at `.ai/tasks/{…}/review.md`. Next: address criticals, or run
285
+ > `/draft-pr` to open a draft pull request."*
286
+
287
+ ## Hard rules
288
+
289
+ - **Read-only by default.** Do not modify source until the user picks `[fix]` or `[fix-and-ask]`.
290
+ - **Do not invent acceptance criteria.** Check only against `spec.md` or the live ticket;
291
+ if AC is absent, say so — do not infer it from the description.
292
+ - **Architecture docs win over general advice.** Flag only when the code violates a loaded doc.
293
+ - **Skills override internet advice.** The loaded code-gen skills are the standard.
294
+ - **Auth failure is not a blocker.** If the Atlassian MCP fails, note it and review the
295
+ remaining axes; never silently claim AC passed.
296
+ - **Verification must actually run.** Never claim tests pass without
297
+ `yarn lint && yarn typecheck && yarn test` output.
298
+ - **Never push or create a PR.** That's `/draft-pr`.
299
+ - **Never modify `spec.md` or `plan.md`.**
300
+
301
+ ## Common mistakes
302
+
303
+ - Re-implementing git/Jira/arch context inline instead of delegating to the three context skills.
304
+ - Reviewing without resolving the ticket key, then silently skipping Axis 1.
305
+ - Treating an MCP auth failure as "no AC issues".
306
+ - Checking generic TypeScript best practices instead of the loaded code-gen skills.
307
+ - Missing i18n/currency violations (raw strings and ad-hoc formatting are easy to overlook).
308
+ - Skipping the accessibility axis on `.tsx` changes.
309
+ - Claiming contrast/keyboard pass without noting what needs manual verification.
310
+ - Applying fixes on FAIL without explicit user consent.