@groupby/ai-dev 0.4.2 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,252 @@
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. Uses `.github/PULL_REQUEST_TEMPLATE.md` if present (creating one only with explicit user approval). Fills the description from the corresponding plan file (preferred) or commit history (fallback). Leaves all template checkboxes unchecked. Never marks the PR ready, never assigns reviewers, never opens follow-up tickets. 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
+
10
+ ## Prerequisite
11
+
12
+ - `gh` CLI installed and authenticated (`gh auth status` succeeds).
13
+ - The repo's remote points at GitHub (`git remote -v` shows github.com).
14
+ - The current branch is **not** the default branch and has commits ahead
15
+ of it.
16
+
17
+ If any of these 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
25
+ `origin/` prefix.
26
+ - Fallback: `git config init.defaultBranch`.
27
+ - Fallback: ask the user.
28
+ 2. Confirm the current branch is not the default. If it is, stop.
29
+ 3. Run `git status` — working tree must be clean. If not, ask the user
30
+ how to proceed (commit / stash / abort).
31
+ 4. Confirm the branch has commits ahead of the default
32
+ (`git rev-list --count {default}..HEAD > 0`). If zero, stop — nothing
33
+ to PR.
34
+ 5. Check whether a PR already exists for this branch:
35
+
36
+ ```bash
37
+ gh pr view --json url,state,isDraft,title --jq '.'
38
+ ```
39
+
40
+ - If a PR exists, **do not create a duplicate.** Show its URL and
41
+ ask:
42
+ > *"PR already exists at `<url>` (state: `<state>`, draft:
43
+ > `<isDraft>`). Update its description, or skip and exit?"*
44
+ - On `update`: jump to step 4 (gather content) and then use
45
+ `gh pr edit --body-file <tmpfile>` instead of `gh pr create`.
46
+ - On `skip`: stop.
47
+
48
+ ### 2. Resolve the PR template
49
+
50
+ Look for `.github/PULL_REQUEST_TEMPLATE.md` (also accept
51
+ `PULL_REQUEST_TEMPLATE.md` at the repo root, and
52
+ `.github/pull_request_template.md` lowercase).
53
+
54
+ Three cases:
55
+
56
+ **A. Template exists and uses a recognizable shape** (contains headings
57
+ like `## Summary`, `## Description`, `## Test plan`, or a list of
58
+ `- [ ]` checkboxes):
59
+
60
+ - Use it as-is.
61
+ - Identify the description / summary section and the checklist section.
62
+
63
+ **B. Template exists but is custom / unfamiliar** (no recognizable
64
+ section headings):
65
+
66
+ - Use it verbatim.
67
+ - Insert the generated content **at the very top** above the existing
68
+ template content, separated by `---`.
69
+ - Do not modify the template body.
70
+
71
+ **C. Template missing entirely:**
72
+
73
+ - Stop and ask the user:
74
+ > *"No `.github/PULL_REQUEST_TEMPLATE.md` found. Creating one is a
75
+ > repo-wide commit affecting all future PRs. Create a default
76
+ > template now, or proceed without one (description-only PR)?"*
77
+ - On `create`: write the default template (see below) and commit it
78
+ to the current branch with message `{KEY}: add PR template` (using
79
+ the ticket key derived in step 3 if available; otherwise prompt the
80
+ user for a message). Then continue.
81
+ - On `proceed without`: skip template handling and use a plain
82
+ description.
83
+
84
+ ### 3. Derive ticket key, title, and content sources
85
+
86
+ - **Ticket key:** parse from the most recent commit message
87
+ (`{KEY}: ...` prefix per repo convention). Fallback: parse from the
88
+ current branch name (`{KEY}-...`). If none found, prompt the user.
89
+ - **Title:** use the first line of the squashed/most-recent commit
90
+ message verbatim (typically `{KEY}: <headline>`).
91
+ - **Content sources, in priority order:**
92
+ 1. Plan file at `.claude/artifacts/{KEY}_*-plan.md`. If present, pull
93
+ `## Implementation Details` and `## Post-Mortem` sections. Also
94
+ pull `## Goal` and `## Out of scope` if present.
95
+ 2. Spec file at `.claude/artifacts/{KEY}_*-spec.md` for Acceptance
96
+ Criteria.
97
+ 3. Squashed commit body (`git log -1 --pretty=%B`).
98
+ 4. `git log {default}..HEAD --oneline` as a last resort.
99
+
100
+ Note which sources were used; mention them in your final report so the
101
+ user can audit.
102
+
103
+ ### 4. Compose the PR body
104
+
105
+ Fill the template (or build a description if no template). Map content
106
+ into sections that exist in the template:
107
+
108
+ - **Summary / Description** — Plan's "Goal" + "Implementation Details"
109
+ summary (2–4 sentences).
110
+ - **Acceptance Criteria** — Verbatim from spec, as unchecked `- [ ]` items.
111
+ - **Test plan / How to test** — High-level test surface from plan's "Test
112
+ strategy" + final verification command output.
113
+ - **Notes / Other** — Plan's "Post-Mortem" section if present.
114
+ - **Out of scope** — Plan's "Out of scope" section.
115
+
116
+ Rules for the body:
117
+
118
+ - **Every `- [ ]` from the template is preserved unchecked.** No
119
+ exceptions, even when the corresponding work is done.
120
+ - **No fabrication.** If the plan doesn't mention something, don't
121
+ invent it for the description.
122
+ - **No new acceptance criteria.** Acceptance criteria come from the
123
+ spec or already-present template lines, never from the agent.
124
+ - **No screenshots, no benchmark numbers** unless the user provided
125
+ them in the conversation.
126
+ - **Keep it skimmable** — a reviewer should grasp the change in 30
127
+ seconds.
128
+
129
+ ### 5. Show the proposed PR for review
130
+
131
+ Before any push or PR creation, present in chat:
132
+
133
+ ```markdown
134
+ # Draft PR preview
135
+
136
+ **Repo:** <owner>/<repo>
137
+ **Base:** <default-branch>
138
+ **Head:** <current-branch>
139
+ **Title:** <title>
140
+ **Draft:** yes
141
+
142
+ ---
143
+ <full body, exactly as it will appear>
144
+ ---
145
+
146
+ Content sources used: <list>
147
+ ```
148
+
149
+ Ask:
150
+ > *"Looks good? Reply `confirm` to push the branch and open the draft
151
+ > PR, `edit` to revise the body, or `cancel` to stop."*
152
+
153
+ ### 6. Push, then create the PR (only on `confirm`)
154
+
155
+ Two confirmations, sequentially:
156
+
157
+ 1. **Push:**
158
+ - `git push -u origin <current-branch>` (fast-forward only — no flags).
159
+ - If the push is rejected as non-fast-forward (the branch has a
160
+ remote with diverged history, typically because a squash rewrote
161
+ local history), **stop**. Do not retry with `--force` or
162
+ `--force-with-lease`. Print:
163
+ > *"Push rejected — remote `<branch>` has commits not in local
164
+ > history. This usually means the branch was previously pushed
165
+ > and then squashed locally. Force-push is a destructive operation
166
+ > and is not done by this skill. Resolve manually
167
+ > (`git push --force-with-lease` if you're sure, or rebase/merge
168
+ > the remote first), then re-run `/draft-pr`."*
169
+ - Show the push output on success.
170
+ 2. **Create:**
171
+ - `gh pr create --draft --title "<title>" --body-file <tmpfile> --base <default>`.
172
+ - Capture the URL.
173
+
174
+ If `update` path was taken in step 1, replace step 6.2 with
175
+ `gh pr edit <number> --body-file <tmpfile>`.
176
+
177
+ ### 7. Stop
178
+
179
+ Print exactly one closing line:
180
+
181
+ > *"Draft PR ready at `<url>`. I have not marked it ready, assigned
182
+ > reviewers, or opened follow-up issues — those are your call."*
183
+
184
+ Do **not**:
185
+
186
+ - Run `gh pr ready` to take the PR out of draft.
187
+ - Add labels, assignees, reviewers, or milestones.
188
+ - Comment on the PR.
189
+ - Run CI manually.
190
+ - Create related issues.
191
+ - Start the next ticket.
192
+
193
+ ## Default PR template (used only when user approves creating one)
194
+
195
+ ```markdown
196
+ ## Summary
197
+
198
+ <one-paragraph description of the change>
199
+
200
+ ## Acceptance criteria
201
+
202
+ - [ ] <criterion>
203
+ - [ ] <criterion>
204
+
205
+ ## Test plan
206
+
207
+ - [ ] <how to verify>
208
+ - [ ] <how to verify>
209
+
210
+ ## Notes
211
+
212
+ <anything reviewers should know — risks, follow-ups, context>
213
+ ```
214
+
215
+ ## Hard rules
216
+
217
+ - **Always `--draft`.** Never `gh pr ready`. Never `--no-draft`.
218
+ - **Never push or create without explicit `confirm`.** Two distinct
219
+ user-visible side effects; preview must come first.
220
+ - **Never assign reviewers, labels, or milestones.** `CODEOWNERS` and
221
+ policy automations handle those.
222
+ - **Never check a `- [ ]` box from the template.** Even if the work is
223
+ obviously done. Reviewers tick boxes.
224
+ - **Never overwrite an existing PR description without asking.** If a
225
+ PR exists for the branch, the `update` path requires explicit user
226
+ approval.
227
+ - **Never overwrite an existing custom PR template.** If the template
228
+ doesn't match a known shape, append/prepend; do not rewrite.
229
+ - **Never commit a new PR template silently.** Creating
230
+ `.github/PULL_REQUEST_TEMPLATE.md` is a repo-wide change and needs
231
+ explicit user approval.
232
+ - **Never invent acceptance criteria, test results, or screenshots.**
233
+ - **Never force-push.** Not with `--force`, not with
234
+ `--force-with-lease`. If a normal push fails as non-fast-forward,
235
+ stop and surface the situation — the user resolves it manually.
236
+
237
+ ## Common mistakes
238
+
239
+ - Pushing before showing the PR preview.
240
+ - Checking template boxes because "the tests do pass".
241
+ - Rewriting a custom PR template because it didn't match the expected
242
+ format. Custom is fine — append, don't rewrite.
243
+ - Creating a duplicate PR when one already exists for the branch.
244
+ - Marking the PR ready, even after the user says "looks great" — only
245
+ the user takes it out of draft.
246
+ - Assigning reviewers based on guess.
247
+ - Including the full plan or spec verbatim in the body. The body is a
248
+ summary; the plan is in the repo at `.claude/artifacts/`.
249
+ - Opening follow-up issues for post-mortem suggestions. Those are user
250
+ actions.
251
+ - Retrying a rejected push with `--force-with-lease` because "it's
252
+ probably fine". Force-push is the user's call, not the skill's.
@@ -0,0 +1,216 @@
1
+ ---
2
+ name: jira-spec
3
+ description: Fetch a Jira ticket and write a development spec to ./.claude/artifacts/ in the current repo (alongside other work artifacts — plans, notes, design docs). 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): tools named
15
+ `mcp__atlassian__getAccessibleAtlassianResources` and
16
+ `mcp__atlassian__getJiraIssue` are available in the current session.
17
+ - **go-jira CLI** is installed and authenticated: `jira issue view <KEY>`
18
+ returns the ticket.
19
+ - **`curl` + stored credentials**: `${JIRA_BASE_URL}` is set and a
20
+ credential (`JIRA_TOKEN` or `.netrc` entry) authorizes
21
+ `${JIRA_BASE_URL}/rest/api/3/issue/<KEY>`.
22
+
23
+ If none of these is in place, the skill will refuse to proceed.
24
+ **Never fabricate ticket content** — the value of the spec is the verbatim
25
+ audit record from Jira.
26
+
27
+ ## Overview
28
+
29
+ Given a Jira ticket reference (key like `S4R-1234` or a browse URL), fetch the
30
+ ticket from Jira and produce a markdown spec at
31
+ `./.claude/artifacts/{KEY}_{kebab-title}.md` in the current repo. The spec
32
+ preserves the original ticket verbatim (for audit) and adds AI-gathered repo
33
+ context so a future session can start implementation immediately.
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** to extract the ticket key (uppercase letters, hyphen,
50
+ digits — e.g. `S4R-1234`). Accept both bare keys and `…/browse/KEY` URLs.
51
+
52
+ 2. **Fetch the ticket from Jira (the most common failure point — see
53
+ Prerequisite above).** Try in this order:
54
+ - **Atlassian MCP** (preferred when available): call
55
+ `mcp__atlassian__getAccessibleAtlassianResources` to obtain a `cloudId`,
56
+ then `mcp__atlassian__getJiraIssue` with that `cloudId` and the ticket
57
+ key. Also fetch comments if the description references them.
58
+ - **CLI fallback**: `jira issue view KEY` (go-jira) or a `curl` against
59
+ `${JIRA_BASE_URL}/rest/api/3/issue/KEY` using stored credentials.
60
+ - **If none of these works, STOP.** Print which mechanism was tried, the
61
+ error, and what the user needs to configure (e.g. "install go-jira and
62
+ run `jira init`", or "enable the Atlassian MCP in this client"). Do
63
+ NOT proceed to the repo scan. Do NOT invent ticket content.
64
+
65
+ 3. **Investigate the repo (medium depth).** Based on the ticket
66
+ summary/description:
67
+ - Identify the most relevant files/modules (use Grep/Glob, check
68
+ `CLAUDE.md`, look at recent commits touching the area).
69
+ - Read the key files end-to-end where useful; skim larger ones.
70
+ - Note conventions, patterns, and any nearby code the change will touch.
71
+ - Keep this targeted — don't tour the whole codebase.
72
+
73
+ 4. **Determine the output path.**
74
+ - Directory: `./.claude/artifacts/` in the current working repo (create
75
+ if missing). Never write to `~/.claude/artifacts/`.
76
+ - Filename: `{KEY}_{short-slug}-spec.md`. The `-spec` suffix is
77
+ **mandatory** — it identifies the doc as this command's artifact and
78
+ keeps it distinct from sibling docs (`-plan`, `-design`, `-requirements`,
79
+ `-testing-results`, etc.). You — the agent — choose the `{short-slug}`
80
+ part. See "Slug Rules" below.
81
+ - If the file already exists, ask the user before overwriting.
82
+
83
+ 5. **Write the spec** using the template below.
84
+
85
+ 6. **Report** the absolute path of the file you wrote and a one-line summary.
86
+ Do not start implementation unless the user asks.
87
+
88
+ ## Spec Template
89
+
90
+ ```markdown
91
+ # {KEY}: {Summary}
92
+
93
+ - **Jira:** {browse URL}
94
+ - **Status:** {status} · **Type:** {issuetype} · **Priority:** {priority}
95
+ - **Assignee:** {assignee} · **Reporter:** {reporter}
96
+ - **Labels:** {labels} · **Components:** {components}
97
+ - **Parent / Epic:** {parent or epic link, if any}
98
+ - **Fetched:** {YYYY-MM-DD}
99
+
100
+ ## Original Description (verbatim, for audit)
101
+
102
+ > {Jira description, rendered to markdown. Preserve formatting, bullet lists,
103
+ > code blocks, and links. Do not edit or paraphrase.}
104
+
105
+ ### Acceptance Criteria (verbatim)
106
+
107
+ > {If present as a separate field or section, include verbatim. Omit the heading
108
+ > if there is none — do not invent acceptance criteria.}
109
+
110
+ ### Relevant Comments (verbatim, optional)
111
+
112
+ > {Include only comments that add load-bearing context — decisions, scope
113
+ > changes, clarifications from the reporter. Skip chatter. Quote verbatim with
114
+ > author and date. Omit the section entirely if nothing qualifies.}
115
+
116
+ ## Implementation Notes (AI-gathered)
117
+
118
+ > ⚠️ The items below are AI guesses from a medium-depth repo scan. Verify
119
+ > against the current code before relying on any specific file path, line
120
+ > range, or claim — they may be stale, incomplete, or wrong.
121
+
122
+ ### Touch points in this repo
123
+ - `path/to/file` — what lives here and why it matters for this ticket
124
+ - `path/to/other:120-180` — specific region of interest
125
+
126
+ ### Patterns and conventions to follow
127
+ - {e.g. "New search strategies extend SearchStrategy and register in SearchStrategyFactory"}
128
+ - {Link to CLAUDE.md sections when relevant}
129
+
130
+ ### Suggested approach (sketch, not a plan)
131
+ - {2–5 bullets outlining the most plausible shape of the change. Keep loose —
132
+ > the actual plan belongs in a separate planning step.}
133
+
134
+ ### Test surface
135
+ - {Which test classes / component tests will need updates or additions}
136
+
137
+ ## Open Questions
138
+
139
+ > Include this section **only** when at least one truly blocking question
140
+ > exists — i.e. its answer would change the implementation and cannot be
141
+ > resolved by reading the repo or the ticket. If there are no such questions,
142
+ > omit this entire section (heading included). Don't print a placeholder.
143
+
144
+ - [ ] {question, with the reason it blocks progress}
145
+ ```
146
+
147
+ ## Rules
148
+
149
+ - **Verbatim means verbatim.** Do not summarize, "clean up", or translate the
150
+ Jira description. Quote it as-is in a blockquote so an auditor can compare
151
+ to Jira.
152
+ - **One spec file per ticket.** Don't append to a different ticket's file.
153
+ - **No invented metadata.** If a field is missing in Jira, omit it from the
154
+ spec rather than guessing.
155
+ - **Minimize open questions.** Prefer to resolve uncertainty by reading the
156
+ code. Only escalate questions that are genuinely blocking.
157
+ - **Don't start coding.** This skill produces the spec only. Implementation
158
+ comes later, in a fresh session that reads this file.
159
+
160
+ ## Slug Rules
161
+
162
+ You — the agent — pick the slug. The goal: a short, recognizable handle, not a
163
+ literal transliteration of the Jira summary. Aim for **3–6 words, ≤ 50
164
+ characters**.
165
+
166
+ Mechanics:
167
+
168
+ - Lowercase. Replace any run of non-`[a-z0-9]` with a single `-`. Trim
169
+ leading/trailing `-`.
170
+ - Strip a leading `KEY:` if the summary repeats the key.
171
+ - Drop filler: `implement-the-`, `add-support-for-`, `feature-from-`,
172
+ `the-`, `a-`, `for-`, `from-`, `in-`, `of-`, etc.
173
+ - Drop redundant qualifiers already implied by the repo (e.g. you don't
174
+ need `-mongo-` in the slug if every nearby ticket lives in a Mongo repo).
175
+ - Keep the **distinctive core**: the noun/verb that names the change.
176
+ "Implement the does not affect feature from Mongo for Facet Exclusion"
177
+ → `does-not-affect` (not
178
+ `implement-the-does-not-affect-feature-from-mongo-for-facet-exclusion`).
179
+ - If the ticket already has sibling docs in `.claude/artifacts/` with a slug
180
+ convention, follow that convention.
181
+
182
+ Examples (the `-spec` suffix is appended after the slug, always):
183
+
184
+ - Summary: `Implement the "does not affect" feature from Mongo for Facet
185
+ Exclusion`
186
+ - Good: `S4R-10226_does-not-affect-spec.md`
187
+ - Bad: `S4R-10226_implement-the-does-not-affect-feature-from-mongo...md`
188
+ - Summary: `Add MongoDB command listener logging`
189
+ - Good: `S4R-10443_mongodb-command-listener-logging-spec.md`
190
+ - Bad: `S4R-10443_add-mongodb-command-listener-logging.md`
191
+ - Summary: `S4R-10491: add support for LIST_VALUE
192
+ (VariantRollupValuesConverter)`
193
+ - Good: `S4R-10491_list-value-rollup-converter-spec.md`
194
+ - Bad: `S4R-10491_add-support-for-list-value-...converter.md`
195
+ - Summary: `Fix: NPE in /search when filters empty`
196
+ - Good: `S4R-1234_npe-search-empty-filters-spec.md`
197
+ - Bad: `S4R-1234_fix-npe-in-search-when-filters-empty.md`
198
+ - Summary: `Investigate latency spike on browse endpoint`
199
+ - Good: `S4R-1234_browse-latency-spike-spec.md`
200
+ - Bad: `S4R-1234_investigate-latency-spike-on-browse-endpoint.md`
201
+
202
+ ## Common Mistakes
203
+
204
+ - Writing the spec without fetching Jira (hallucinating description).
205
+ **Never do this** — if Jira is unreachable, stop and report.
206
+ - Saving to `~/.claude/artifacts/` instead of the repo's
207
+ `./.claude/artifacts/`.
208
+ - Paraphrasing the description. The "Original Description" section must be
209
+ verbatim.
210
+ - Padding "Open Questions" with nice-to-knows. Omit the section unless a
211
+ question is truly blocking.
212
+ - Producing a long literal slug (e.g. `implement-the-X-feature-from-Y`).
213
+ Strip filler and aim for a 3–6 word distinctive handle.
214
+ - Presenting AI-gathered touch points as ground truth. They are guesses —
215
+ keep the verify-before-relying banner above that section.
216
+ - Doing deep design work here. This is a spec, not a plan — medium-depth repo investigation only.