@groupby/ai-dev 0.5.13 → 0.5.15

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 (32) 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-andromeda/github/PULL_REQUEST_TEMPLATE.md +51 -0
  16. package/teams/fhr-andromeda/github/copilot-instructions.md +47 -0
  17. package/teams/fhr-andromeda/instructions/CLAUDE.md +66 -0
  18. package/teams/fhr-andromeda/instructions/ai-instructions.md +312 -0
  19. package/teams/fhr-andromeda/instructions/architecture.md +181 -0
  20. package/teams/fhr-andromeda/instructions/code-review.md +127 -0
  21. package/teams/fhr-andromeda/instructions/coding-guidelines.md +139 -0
  22. package/teams/fhr-andromeda/instructions/domain.md +125 -0
  23. package/teams/fhr-andromeda/instructions/jira-ticket-template.md +55 -0
  24. package/teams/fhr-andromeda/instructions/modules/data-quality-frontend.md +57 -0
  25. package/teams/fhr-andromeda/instructions/modules/data-quality.md +62 -0
  26. package/teams/fhr-andromeda/instructions/modules/fhr-custom-transforms.md +59 -0
  27. package/teams/fhr-andromeda/instructions/modules/hop-dev-platform-frontend.md +60 -0
  28. package/teams/fhr-andromeda/instructions/modules/hop-dev-platform.md +62 -0
  29. package/teams/fhr-andromeda/instructions/modules/workflow-scripts.md +119 -0
  30. package/teams/fhr-andromeda/skills/fhr-pr/SKILL.md +71 -0
  31. package/teams/fhr-andromeda/skills/fhr-review/SKILL.md +78 -0
  32. package/teams/fhr-andromeda/skills/fhr-spec/SKILL.md +96 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@groupby/ai-dev",
3
- "version": "0.5.13",
3
+ "version": "0.5.15",
4
4
  "description": "Interactive installer for Rezolve Ai development content",
5
5
  "type": "module",
6
6
  "bin": {
@@ -0,0 +1,135 @@
1
+ ---
2
+ name: arch-context
3
+ description: Provides standardized procedures for loading the minimum required architecture documentation for any agent workflow in this repository — if `.github/copilot-instructions.md` exists, reading it and applying its Doc Routing Table to the detected change types; otherwise consulting `docs/architecture/` directly if present — then loading each required doc and noting any gaps. Outputs a `<loaded-docs>` list and `<arch-constraints>` summary consumed by downstream review and planning workflow steps (whether skills or prompts). Auto-apply before any prompt that must evaluate code or plan changes against project architecture standards.
4
+ ---
5
+
6
+ # Architecture Context Guide
7
+
8
+ ## Relationship to other repository skills
9
+
10
+ - the git-context skill — must be read first; `<change-types>` produced there is the
11
+ primary input to this skill's routing step.
12
+
13
+ This skill governs *which* architecture docs to load and *how* to apply them. The docs
14
+ themselves (under `docs/architecture/`, if present) are the source-of-truth for architecture
15
+ decisions and override this skill when they conflict.
16
+
17
+ ## Mandatory application (agents)
18
+
19
+ Whenever a prompt must evaluate or plan changes against project architecture standards:
20
+
21
+ 1. **Confirm `<change-types>` is available** from the git-context skill.
22
+ 2. **Read this skill file** before opening any architecture doc.
23
+ 3. Follow the **Working method** steps in order.
24
+ 4. Do not load docs outside those mapped by the routing table unless the task explicitly
25
+ requires it — always document why in a `## Documentation Gaps` note.
26
+
27
+ This skill is optional for purely mechanical tasks (e.g. renaming a file) where no
28
+ architecture evaluation is needed.
29
+
30
+ ## When to use
31
+
32
+ - Before a code review — to know which docs govern the changed files.
33
+ - Before writing an implementation plan — to understand architectural constraints.
34
+ - Before writing a PR description that references architectural patterns.
35
+ - Any time a prompt says "load the architecture docs" or "apply the routing table".
36
+
37
+ ## When not to use
38
+
39
+ - The task is exclusively about workflow (git commands, Jira, CI) with no code changes.
40
+ - The caller has already identified and loaded the required docs in the current session.
41
+
42
+ ## Truthfulness and claims
43
+
44
+ - Do not claim a doc was loaded if it was not — unavailable docs must be noted.
45
+ - Do not invent architecture rules not found in the loaded docs.
46
+ - If the codebase contradicts a loaded doc, the doc represents the target state — flag
47
+ the discrepancy; do not normalise the legacy pattern.
48
+ - Do not load `docs/architecture/README.md` or `docs/architecture/00-developer-quick-start.md`
49
+ — those are human-facing indexes, not agent context.
50
+
51
+ ## Self-contained operating mode
52
+
53
+ The routing table (embedded below, or in `.github/copilot-instructions.md` if present)
54
+ is the canonical map for this project. Always apply it from the `<change-types>` list.
55
+ Do not apply generic online advice about architecture documentation loading — use this
56
+ table only.
57
+
58
+ ---
59
+
60
+ ## Embedded implementation standard
61
+
62
+ ### 1) Always-load doc
63
+
64
+ Regardless of change type, always load (if present):
65
+
66
+ ```
67
+ docs/architecture/12-code-conventions/README.md
68
+ ```
69
+
70
+ This is the baseline for all code-generation and review tasks.
71
+
72
+ ### 2) Doc Routing Table
73
+
74
+ If `.github/copilot-instructions.md` exists and contains the Doc Routing Table, apply
75
+ each row whose **Change type** appears in `<change-types>` and load the additional docs
76
+ listed in the **Load these extra docs** column. Otherwise, if `docs/architecture/` is
77
+ present, load the applicable docs from the routing table below for each change type.
78
+
79
+ | Change type | Load these extra docs |
80
+ |-------------|-----------------------|
81
+ | Styling / styled-components | `docs/architecture/12-code-conventions/04-styled-components.md`, `docs/architecture/12-code-conventions/12-css-antipatterns.md` |
82
+ | New component or hook | `docs/architecture/01-system-overview-tech-stack.md`, `docs/architecture/02-module-structure/README.md`, `docs/architecture/03-state-management.md` |
83
+ | API / data fetching | `docs/architecture/03-state-management.md`, `docs/architecture/04-data-flow-api.md` |
84
+ | Auth / permissions | `docs/architecture/05-authentication.md` |
85
+ | Tenant / area / collection scoping | `docs/architecture/06-tenant-and-data-context.md` |
86
+ | Feature flags | `docs/architecture/07-feature-flags.md` |
87
+ | Utilities / shared services | `docs/architecture/08-services-utilities.md` |
88
+ | External integrations | `docs/architecture/09-external-integrations.md` |
89
+ | Config / build | `docs/architecture/10-build-deployment.md` |
90
+ | Test changes | `docs/architecture/11-testing-strategy/README.md` |
91
+
92
+ > `docs/architecture/13-git-workflow.md` (if present) is **developer-facing only**. Load
93
+ > it only when drafting a commit message or PR title.
94
+
95
+ ### 3) Load procedure
96
+
97
+ For each doc identified in steps 1 and 2:
98
+
99
+ 1. Open the file and read its full content.
100
+ 2. Follow any cross-links it contains to additional referenced docs.
101
+ 3. If a doc cannot be loaded (file missing, permission error), record it in
102
+ `<missing-docs>` and note it in the `## Documentation Gaps` section of the output.
103
+
104
+ ### 4) Record loaded docs
105
+
106
+ After loading, store:
107
+
108
+ - `<loaded-docs>` — list of every doc path successfully loaded.
109
+ - `<missing-docs>` — list of every doc that could not be loaded (empty if none).
110
+ - `<arch-constraints>` — a one-sentence summary of the key constraint each doc imposes,
111
+ for quick reference during review or planning.
112
+
113
+ ---
114
+
115
+ ## Working method (apply in this order)
116
+
117
+ 1. **Baseline** — Always load `docs/architecture/12-code-conventions/README.md` first
118
+ (if present).
119
+ 2. **Route** — For each entry in `<change-types>`, apply the routing table in §2 and
120
+ collect the additional docs to load.
121
+ 3. **Load** — Open and read each identified doc; follow any intra-doc cross-links.
122
+ 4. **Record** — Populate `<loaded-docs>`, `<missing-docs>`, and `<arch-constraints>`.
123
+ 5. **Report** — Return `<loaded-docs>` to the caller; include `<missing-docs>` in a
124
+ `## Documentation Gaps` note if non-empty.
125
+
126
+ ## Quality bar before final answer
127
+
128
+ - `<loaded-docs>` lists every doc that was actually read — not intended to be read.
129
+ - The always-load baseline doc appears first in `<loaded-docs>`.
130
+ - No doc from outside the routing table was loaded without an explicit justification.
131
+ - `<missing-docs>` is present and either empty or lists actual failures.
132
+ - `docs/architecture/README.md` and `docs/architecture/00-developer-quick-start.md` do
133
+ not appear in `<loaded-docs>`.
134
+ - Architecture rules cited in subsequent output come from `<loaded-docs>` — not invented.
135
+
@@ -0,0 +1,222 @@
1
+ ---
2
+ name: draft-plan
3
+ description: Use when the user invokes `/draft-plan` (or asks to "draft a plan", "plan this spec"). Only runs when explicitly invoked — do NOT auto-trigger on the word "plan".
4
+ ---
5
+
6
+ # draft-plan
7
+
8
+ Turn a spec into a discussed, approved, high-level implementation plan.
9
+ This is **Step 3** of the AI-assisted development workflow.
10
+
11
+ ## Inputs
12
+
13
+ - **Spec file path** — typically `.ai/tasks/{KEY}/spec.md`. The user may pass
14
+ it explicitly (`/draft-plan S4R-10559`) or by ticket key.
15
+ - **If no argument is given:** list all `spec.md` files in `.ai/tasks/*/`
16
+ with their last-modified dates and ask which one to plan.
17
+ - **If no spec.md exists** (no argument given and none found under
18
+ `.ai/tasks/*/`, or an explicit key/path was given but the file is missing):
19
+ do **not** guess or fabricate a spec, and do **not** silently proceed with
20
+ nothing. Ask the user for a ticket key or a spec-file path. Mentioning
21
+ `/jira-spec` as one possible next step is fine, but the skill must stop and
22
+ wait for the user's answer rather than assuming that path.
23
+ - **Do not invent a spec.** If no matching spec file exists, stop and tell the
24
+ user to run `/jira-spec` first.
25
+
26
+ ## Workflow
27
+
28
+ ### 1. Read the spec verbatim
29
+
30
+ - Read the entire spec file.
31
+ - Pay attention to: Original Description, Acceptance Criteria, AI-gathered
32
+ Implementation Notes, Open Questions. The first two are authoritative; the
33
+ third is a starting hypothesis, not a constraint.
34
+ - Note the slug from the spec metadata (for branch naming consistency).
35
+
36
+ ### 2. Load architecture docs, if available
37
+
38
+ Using the change types identified in the spec (or inferred from its content):
39
+
40
+ 1. **If `docs/architecture/12-code-conventions/README.md` exists,** always
41
+ load it first.
42
+ 2. **If `.github/copilot-instructions.md` exists,** apply the Doc Routing
43
+ Table it defines:
44
+ - Component/hook → `01-system-overview`, `02-module-structure`, `03-state-management`
45
+ - Styling → `docs/architecture/12-code-conventions/04-styled-components.md`, `docs/architecture/12-code-conventions/12-css-antipatterns.md`
46
+ - API/data → `03-state-management`, `04-data-flow-api`
47
+ - Tests → `11-testing-strategy/README.md`
48
+ - etc.
49
+ 3. **Load `.ai/patterns.md`** if it exists — check for relevant past solutions.
50
+ 4. Follow cross-links within loaded docs.
51
+
52
+ If neither `docs/architecture/` nor `.github/copilot-instructions.md` exists
53
+ in this repo, skip this step and rely on direct codebase investigation
54
+ instead.
55
+
56
+ ### 3. Investigate the codebase (deeper than `/jira-spec`)
57
+
58
+ The spec used **medium-depth** scanning. This skill uses **deep** scanning.
59
+ For each likely touch point:
60
+
61
+ - Read the relevant files **end-to-end**, not just excerpts.
62
+ - Trace data flow across layers (e.g. component → hook → Redux slice →
63
+ API client) for any feature that crosses them.
64
+ - Identify shared abstractions the change must conform to (factories,
65
+ interfaces, base classes, validators, mappers).
66
+ - Find related tests in `test/unit/` and `test/integration/` — understand
67
+ the existing test shape before proposing new tests.
68
+ - If `docs/architecture/` exists, check its cross-links for constraints the
69
+ plan must respect.
70
+ - Run `git log --oneline -- <path>` on key files to see recent changes that
71
+ suggest active areas / patterns.
72
+
73
+ Time-box this: deep does not mean exhaustive. Stop when you can describe the
74
+ shape of the change confidently.
75
+
76
+ ### 4. Draft the plan structure (in chat, not yet written)
77
+
78
+ Present the plan to the user in chat first, using this shape:
79
+
80
+ ```markdown
81
+ # Plan — {KEY}: {short summary}
82
+
83
+ ## Goal
84
+ <1–2 sentences in plain English. Tied to the spec's Acceptance Criteria.>
85
+
86
+ ## Approach
87
+ <3–6 sentences describing the chosen direction. Why this shape rather than
88
+ alternatives. Reference architecture docs where they constrain the choice.>
89
+
90
+ ## Affected areas
91
+
92
+ ### <Module or layer 1, e.g. "src/search-for-retail/filters/">
93
+ - `path/to/file` — what role this file plays in the change
94
+ - `path/to/other` — likewise
95
+
96
+ ### <Module or layer 2>
97
+ - ...
98
+
99
+ ### Tests
100
+ - `test/unit/...` — existing tests to extend
101
+ - `test/integration/...` — integration tests to add/update
102
+ - Use custom `render()` from `test-utils.tsx` for component tests
103
+
104
+ (Group by module/layer, not by file. Include test paths explicitly.)
105
+
106
+ ## Sequencing
107
+ 1. <First phase — what gets done, in what order, why this order>
108
+ 2. <Second phase>
109
+ 3. <Third phase>
110
+
111
+ (Each phase should be independently committable / verifiable where possible.)
112
+
113
+ ## Test strategy
114
+ TDD applies by default: failing tests are written before each implementation
115
+ phase (Red → Green → Refactor). Note any phase that is exempt and why
116
+ (e.g. pure config change with no testable behaviour).
117
+ - <Which existing test files will be extended; which new tests are needed>
118
+ - <Unit tests in test/unit/, integration tests in test/integration/>
119
+ - <Follow conventions from `docs/architecture/11-testing-strategy/`, if present>
120
+
121
+ ## Risks & open questions
122
+ - <Anything that could derail the plan.>
123
+ - <Anything the spec leaves ambiguous that the user should decide.>
124
+
125
+ ## Out of scope
126
+ - <Explicit non-goals — things that look related but won't be addressed.>
127
+ ```
128
+
129
+ ### 5. Discuss with the user
130
+
131
+ After presenting the plan, ask the user:
132
+
133
+ > *"Does this plan capture the right approach? Reply `approve` to write
134
+ > the plan to a file, or tell me what to change."*
135
+
136
+ Iterate:
137
+ - If the user asks "why X over Y?" — explain, update plan if needed.
138
+ - If the user asks for more detail on an area — investigate further and add.
139
+ - If the user disagrees — revise. Do not write a plan the user hasn't endorsed.
140
+ - Track decisions made during discussion in a "Decisions during planning"
141
+ section.
142
+
143
+ ### 6. Write the plan on approval, then stop
144
+
145
+ Trigger: user replies `approve` (or equivalent).
146
+
147
+ - **Output path:** `.ai/tasks/{KEY}/plan.md`
148
+ - **If the plan file already exists,** ask before overwriting.
149
+ - Write the plan using the same structure as the in-chat preview, plus:
150
+ - A header block with the spec file, ticket key, slug, and the date.
151
+ - A "Decisions during planning" section capturing anything clarified.
152
+ - After writing, report the path and remind of next steps:
153
+
154
+ > *"Plan saved at `.ai/tasks/{KEY}/plan.md` (local-only — `.ai/` is gitignored).
155
+ > Next: run `/tdd-implement` when ready."*
156
+
157
+ **Then stop.**
158
+
159
+ ### What "stop" means after approval
160
+
161
+ Approval authorizes **writing the plan file — nothing else.** Do **not**:
162
+
163
+ - Start implementation, even partially.
164
+ - Edit any source file, test, config, or build file.
165
+ - Create a branch, stage changes, or run a build / test / lint.
166
+ - Suggest next actions beyond the single closing line.
167
+
168
+ ## Plan Revision
169
+
170
+ If during implementation the plan proves wrong, a `## Revision` section is
171
+ **appended** (not overwritten). Format:
172
+
173
+ ```markdown
174
+ ## Revision (added during implementation)
175
+
176
+ - **Trigger:** AI review found that X approach doesn't work because Y
177
+ - **Change:** Switched from A to B
178
+ - **Impact:** Phase 3 replaced, Phase 4 added
179
+ - **Approved by:** user (date)
180
+ ```
181
+
182
+ Old content stays for audit trail. This section is added by `/tdd-implement`,
183
+ not by this skill.
184
+
185
+ ## Content rules
186
+
187
+ - **High-level by default.** No line numbers. No code snippets. No method bodies.
188
+ - **Affected files are allowed.** Pointing at `path/to/Service` is fine;
189
+ saying "change line 142 to call `foo()`" is not.
190
+ - **Verify every file path cited in "Affected areas".** Confirm each listed
191
+ path exists. Mark new files as `(new)`. Remove hallucinated paths.
192
+ - **Acceptance Criteria must be addressable.** Each AC should map to something
193
+ in "Affected areas" or "Test strategy".
194
+ - **No implementation, ever.** Approval means "save the plan", not "start coding".
195
+
196
+ ## Hard rules
197
+
198
+ - **Do not write the plan file until the user approves.**
199
+ - **Do not modify the spec file.** Specs are audit records.
200
+ - **One plan file per spec.**
201
+ - **Do not start implementation after writing the plan.**
202
+ - **Local-only artifact.** `.ai/` is gitignored — the plan is never committed.
203
+ It reaches the team only when `/draft-pr` embeds it in the PR body.
204
+
205
+ ## Common Mistakes
206
+
207
+ - Writing the plan without reading the spec end-to-end. The Original Description
208
+ and Acceptance Criteria are authoritative — guessing from the ticket title
209
+ produces a plan that misses scope.
210
+ - Starting implementation after approval. Approval means "save the plan", not
211
+ "start coding". Stop after the file is written.
212
+ - Citing file paths that do not exist in the repo. Verify every path in
213
+ "Affected areas" before presenting the plan. Mark genuinely new files `(new)`.
214
+ - Including code snippets, line numbers, or method-level prescriptions. The plan
215
+ is high-level — what changes and why, not how line by line.
216
+ - Overwriting an existing plan file without asking the user first.
217
+ - Not tracking decisions made during discussion. Anything resolved in chat goes
218
+ into the "Decisions during planning" section of the written plan.
219
+ - Modifying the spec file. Specs are append-only audit records — only
220
+ `/tdd-implement` appends a `## Revision`, and only on explicit user approval.
221
+ - Guessing which spec to plan, or fabricating one, when none can be found.
222
+ Ask the user for a ticket key or spec-file path instead.
@@ -0,0 +1,291 @@
1
+ ---
2
+ name: draft-pr
3
+ description: Use when the user invokes `/draft-pr` (or asks to "draft a PR", "open a draft PR", "create a draft pull request"). Pushes the current branch and opens a DRAFT pull request on GitHub, filling the body from the plan/spec/review files and mapping to the repo's PR template. Always opens as draft, never marks it ready, never assigns reviewers. Only runs when explicitly invoked — do NOT auto-trigger on the word "PR".
4
+ ---
5
+
6
+ # draft-pr
7
+
8
+ Push the current branch and open a **draft** pull request on GitHub.
9
+ This is **Step 7** of the AI-assisted development workflow.
10
+
11
+ ## Prerequisite
12
+
13
+ - `gh` CLI installed and authenticated (`gh auth status` succeeds).
14
+ - The repo's remote points at GitHub (`git remote -v` shows github.com).
15
+ - The current branch is **not** the default branch and has commits ahead.
16
+
17
+ If any fails, stop with a specific actionable message.
18
+
19
+ ## Workflow
20
+
21
+ ### 1. Pre-flight
22
+
23
+ 1. Detect the default branch (same logic as `/tdd-implement`):
24
+ - `git symbolic-ref --short refs/remotes/origin/HEAD` → strip `origin/`.
25
+ - Fallback: `git config init.defaultBranch`.
26
+ - Fallback: ask the user.
27
+ 2. Confirm current branch is not the default. If it is, stop.
28
+ 3. `git status` — working tree must be clean. If not, ask (commit / stash / abort).
29
+ 4. Branch has commits ahead: `git rev-list --count {default}..HEAD > 0`. If zero, stop.
30
+ 5. Check existing PR for this branch:
31
+ ```bash
32
+ gh pr view --json url,state,isDraft,title --jq '.'
33
+ ```
34
+ - If PR exists, show URL and ask: update description or skip?
35
+ - On `update`: use `gh pr edit --body-file` instead of `gh pr create`.
36
+ - On `skip`: stop.
37
+
38
+ ### 2. Derive ticket key and PR title
39
+
40
+ - **Ticket key:** parse from branch name `<type>/{KEY}-{slug}` first;
41
+ fallback to commit messages `... ({KEY})`. If not found in either,
42
+ ask the user before continuing — store as `<ticket-key>`.
43
+ - **PR title:** use the squashed commit's first line. It should already be:
44
+ ```
45
+ <type>(<scope>): <description> ({KEY})
46
+ ```
47
+ This format is validated by CI (`amannn/action-semantic-pull-request`).
48
+ If the title doesn't match, warn the user.
49
+
50
+ ### 3. Validate commit format
51
+
52
+ Verify the commit(s) follow Conventional Commits with ticket key:
53
+
54
+ ```
55
+ <type>(<scope>): <description> (<ticket-key>)
56
+ ```
57
+
58
+ Run: `git log {default}..HEAD --pretty=%s`
59
+
60
+ - If `<ticket-key>` was found: each message must match
61
+ `^(feat|fix|chore|refactor|test|docs|style|perf|ci|build)(\(.+\))?: .+ \([A-Z]+-\d+\)$`
62
+ - If `<ticket-key>` is unknown (user confirmed): validate only the
63
+ Conventional Commits prefix — `^(feat|fix|chore|refactor|test|docs|style|perf|ci|build)(\(.+\))?: .+$`
64
+ — and warn that the `({KEY})` suffix is missing.
65
+ - If any commit doesn't match, show the offending message and ask the user
66
+ to amend before pushing.
67
+ - **Do not amend automatically.**
68
+
69
+ ### 4. Gather content sources
70
+
71
+ In priority order:
72
+
73
+ 1. **Plan file** — `.ai/tasks/{KEY}/plan.md`: Goal, Approach, Test strategy,
74
+ Out of scope, plus the `## Deviations` / `## Post-Mortem` appended by
75
+ `/tdd-implement`. Its **full contents** are embedded in the PR (see Step 5).
76
+ 2. **Review file** — `.ai/tasks/{KEY}/review.md`: Verdict, findings summary.
77
+ 3. **Spec file** — `.ai/tasks/{KEY}/spec.md`: Acceptance Criteria. Its **full
78
+ contents** are embedded in the PR (see Step 5).
79
+ 4. **Commit body** — `git log -1 --pretty=%B` (the squashed commit message).
80
+ 5. **Commit history** — `git log {default}..HEAD --oneline` (fallback).
81
+
82
+ The `.ai/` folder is gitignored, so spec/plan/review are **not in the repo** —
83
+ this PR is the only channel through which the team can read them, when they
84
+ exist. Note which sources were used.
85
+
86
+ **Graceful degradation:** none of `plan.md`, `review.md`, or `spec.md` need to
87
+ exist — this skill never fails or blocks because an `.ai/` artifact is
88
+ missing. If some or all are absent, fall back to the commit body / commit
89
+ history sources above; the PR still opens either way. State plainly in the
90
+ chat preview (Step 6) and in the final "content sources used" list which
91
+ artifacts were found and which were not (e.g. "Plan and review not found —
92
+ composed from commit history only").
93
+
94
+ ### 5. Compose the PR body
95
+
96
+ #### 5a. Read the PR template, with fallback
97
+
98
+ Read `.github/pull_request_template.md` if it exists, and use it to shape the
99
+ body:
100
+
101
+ - **Template present with recognizable sections** (headings matching, loosely,
102
+ "Summary", "Testing Notes" / "How was this tested", "Related Ticket" /
103
+ "Ticket" / "Jira", "PR Quality Checklist" / "Checklist"): map content into
104
+ those sections **using the template's own heading text and order** — do not
105
+ rename or reorder them. The mapping guidance below (5b–5e) describes what
106
+ content goes where.
107
+ - **Template present but shaped differently** (different headings, extra or
108
+ missing sections, different grouping): map content best-effort onto
109
+ whichever sections exist. If a piece of content has no obvious home (e.g.
110
+ the AI Evidence block), append it as its own section near the end of the
111
+ body rather than forcing it into an unrelated section, and call this out in
112
+ the chat preview (Step 6) so the user can move or drop it.
113
+ - **Template absent:** compose the body using the default shape in 5b–5e
114
+ (`# Summary`, `## Testing Notes`, `## Related Ticket`, `## PR Quality
115
+ Checklist`) and say so explicitly in the chat preview, so the user knows no
116
+ template was found and can confirm the shape is acceptable.
117
+ - **Never fail or block** on a missing or differently-structured template —
118
+ always produce a best-effort body. Ambiguities get surfaced in the Step 6
119
+ preview, where the user can reply `edit` to adjust before anything is
120
+ pushed.
121
+
122
+ The subsections below describe content mapping using the default section
123
+ names; apply the same content to whatever the template actually calls them.
124
+
125
+ #### 5b. Summary
126
+
127
+ - 2–4 sentences from Plan's Goal + Approach.
128
+ - If the review had a PASS WITH NOTES verdict, mention it briefly.
129
+ - Keep it skimmable — a reviewer grasps the change in 30 seconds.
130
+ - End the Summary with a one-line pointer to the embedded artifacts, if any
131
+ were found in Step 4:
132
+
133
+ ```markdown
134
+ > Note: AI artifacts (spec & plan) are embedded at the bottom of this PR.
135
+ ```
136
+
137
+ Omit this pointer line if neither spec.md nor plan.md was found.
138
+
139
+ #### 5c. Testing Notes
140
+
141
+ - From Plan's Test Strategy: what test surfaces were added/extended.
142
+ - From Review: verification result (`yarn lint && yarn typecheck && yarn test` — PASS).
143
+ - Mention if e2e tests were added (Playwright).
144
+ - List edge cases considered (from spec AC).
145
+ - If plan/review/spec are unavailable, derive this section from the commit
146
+ body/history instead and say so — never invent test results.
147
+
148
+ #### 5d. Related Ticket
149
+
150
+ - Format: `[{KEY}](https://rezolvetech.atlassian.net/browse/{KEY})`
151
+
152
+ #### 5e. PR Quality Checklist
153
+
154
+ Read the checklist section verbatim from `.github/pull_request_template.md`
155
+ at PR time — whatever it is titled there (`## PR Quality Checklist`,
156
+ `## Checklist`, etc.). **Leave all boxes unchecked.** Do not invent, reorder,
157
+ or modify checklist items — use exactly what is in the file. If the template
158
+ has no checklist-like section (or no template exists at all), omit this
159
+ section from the PR body rather than fabricating checklist items.
160
+
161
+ #### 5f. AI Evidence (appended after checklist)
162
+
163
+ The `.ai/` folder is gitignored, so the spec and plan — when they exist — are
164
+ **not in the repo**; this PR is the only place teammates can read them. Embed
165
+ their **full contents** in collapsible blocks at the very end of the body.
166
+ The top-of-Summary pointer (added in 5b, if present) tells reviewers the
167
+ blocks are there.
168
+
169
+ ```markdown
170
+ ---
171
+
172
+ ## AI Development Evidence
173
+
174
+ - [ ] Spec — embedded below
175
+ - [ ] Plan reviewed and approved — embedded below
176
+ - [ ] TDD: tests written before implementation
177
+ - [ ] AI code review passed — Verdict: {verdict}
178
+ - Verification: `yarn lint && yarn typecheck && yarn test` — PASS
179
+
180
+ <details>
181
+ <summary>Spec (.ai/tasks/{KEY}/spec.md)</summary>
182
+
183
+ {full verbatim contents of spec.md}
184
+
185
+ </details>
186
+
187
+ <details>
188
+ <summary>Plan (.ai/tasks/{KEY}/plan.md — includes Deviations & Post-Mortem)</summary>
189
+
190
+ {full verbatim contents of plan.md}
191
+
192
+ </details>
193
+ ```
194
+
195
+ - Read `spec.md` and `plan.md` from disk and paste their **full contents** into
196
+ the matching `<details>` block. Do not summarize or trim them here — the
197
+ Summary above is the skimmable version; these blocks are the complete record.
198
+ - **If a file is missing, omit its entire `<details>` block and its checklist
199
+ bullet above** — do not embed an empty or placeholder block. Instead, add a
200
+ single plain-text line stating what's missing (e.g. "Spec not found —
201
+ ticket worked without `/jira-spec`."). If neither spec.md nor plan.md
202
+ exists, drop the AI Development Evidence section entirely and rely on the
203
+ "content sources used" note from Step 4.
204
+ - Leave every `- [ ]` evidence box unchecked — reviewers tick them.
205
+
206
+ ### 6. Show the proposed PR for review
207
+
208
+ Before any push, present in chat:
209
+
210
+ ```markdown
211
+ # Draft PR preview
212
+
213
+ **Repo:** <owner>/<repo>
214
+ **Base:** <default-branch>
215
+ **Head:** <current-branch>
216
+ **Title:** <title>
217
+ **Draft:** yes
218
+
219
+ ---
220
+ <full body, exactly as it will appear>
221
+ ---
222
+
223
+ Content sources used: <list>
224
+ ```
225
+
226
+ Ask:
227
+ > *"Looks good? Reply `confirm` to push and open the draft PR, `edit`
228
+ > to revise, or `cancel` to stop."*
229
+
230
+ ### 7. Push, then create the PR (only on `confirm`)
231
+
232
+ 1. **Push:**
233
+ - `git push -u origin <current-branch>` (fast-forward only).
234
+ - If rejected as non-fast-forward, **stop**. Do not force-push:
235
+ > *"Push rejected — remote has commits not in local history.
236
+ > Resolve manually (`git push --force-with-lease` if sure), then
237
+ > re-run `/draft-pr`."*
238
+ - Show push output on success.
239
+
240
+ 2. **Create:**
241
+ - `gh pr create --draft --title "<title>" --body-file <tmpfile> --base <default>`
242
+ - Capture the URL.
243
+
244
+ If `update` path: `gh pr edit <number> --body-file <tmpfile>`.
245
+
246
+ ### 8. Stop
247
+
248
+ Print:
249
+ > *"Draft PR ready at `<url>`. I have not marked it ready, assigned
250
+ > reviewers, or opened follow-up issues."*
251
+
252
+ Do **not**:
253
+ - `gh pr ready`
254
+ - Add labels, assignees, reviewers, milestones
255
+ - Comment on the PR
256
+ - Run CI manually
257
+ - Create related issues
258
+ - Start the next ticket
259
+
260
+ ## Hard rules
261
+
262
+ - **Always `--draft`.** Never `gh pr ready`.
263
+ - **Never push or create without explicit `confirm`.**
264
+ - **Never assign reviewers, labels, or milestones.**
265
+ - **Never check a `- [ ]` box.** Reviewers tick boxes.
266
+ - **Never overwrite existing PR description without asking.**
267
+ - **Never force-push.** Stop and surface if non-fast-forward.
268
+ - **Never invent acceptance criteria or test results.**
269
+ - **PR title must match Conventional Commits format** for CI validation.
270
+ - **Commit messages must include `({KEY})` suffix.**
271
+
272
+ ## Common mistakes
273
+
274
+ - Pushing before showing PR preview.
275
+ - Checking template boxes because "tests pass".
276
+ - Creating duplicate PR when one already exists.
277
+ - Marking PR ready even after user says "looks great".
278
+ - Putting the full spec/plan in the visible Summary instead of the collapsed
279
+ `<details>` blocks at the end (the Summary stays skimmable; the full
280
+ artifacts go in the details).
281
+ - PR title missing scope or ticket key → CI rejects.
282
+ - Forgetting the AI Evidence section when spec/plan exist.
283
+ - Embedding an empty or placeholder `<details>` block instead of omitting it
284
+ when an `.ai/` artifact is missing.
285
+ - Assuming `.github/pull_request_template.md` exists or has the exact
286
+ `# Summary` / `## Testing Notes` / `## Related Ticket` / `## PR Quality
287
+ Checklist` shape — a missing or differently-structured template must be
288
+ handled best-effort, never treated as a failure.
289
+ - Force-pushing to resolve conflicts.
290
+ - Retrying a rejected push with `--force-with-lease` because "it's
291
+ probably fine". Force-push is the user's call, not the skill's.