@groupby/ai-dev 0.5.3 → 0.5.5
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.
- package/package.json +1 -1
- package/teams/fhr-core/github/pull_request_template.md +19 -0
- package/teams/fhr-core/resources/spec-template.md +22 -0
- package/teams/fhr-core/skills/address-pr/SKILL.md +129 -0
- package/teams/fhr-core/skills/jira-ticket/SKILL.md +47 -0
- package/teams/fhr-core/skills/plan-spec/SKILL.md +58 -0
- package/teams/fhr-core/skills/ready-pr/SKILL.md +74 -0
- package/teams/fhr-core/skills/refine-spec/SKILL.md +48 -0
- package/teams/fhr-core/skills/review-pr/SKILL.md +122 -0
- package/teams/fhr-core/skills/tdd-green/SKILL.md +62 -0
- package/teams/fhr-core/skills/tdd-red/SKILL.md +51 -0
- package/teams/fhr-core/skills/tdd-workflow/SKILL.md +52 -0
- package/teams/fhr-core/skills/write-pr/SKILL.md +49 -0
package/package.json
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
PR TITLE must follow: FHR-<number>: <description>
|
|
3
|
+
Example: FHR-7113: Add AI-first development workflow for FAS
|
|
4
|
+
The pull-request.yml CI check will fail if the format is wrong.
|
|
5
|
+
-->
|
|
6
|
+
|
|
7
|
+
## Jira ticket
|
|
8
|
+
|
|
9
|
+
[FHR-XXXX](https://attraqt.atlassian.net/browse/FHR-XXXX)
|
|
10
|
+
|
|
11
|
+
## AI Development Checklist
|
|
12
|
+
|
|
13
|
+
- [ ] Specification file present
|
|
14
|
+
- [ ] Unit tests present and passing
|
|
15
|
+
- [ ] Documentation file present
|
|
16
|
+
- [ ] AI tool used: _Claude Code / Copilot / Agent / Other_
|
|
17
|
+
- [ ] Tests generated/refined with AI (failing tests written before implementation)
|
|
18
|
+
- [ ] AI review pass completed (visible in PR comments)
|
|
19
|
+
- [ ] Repo context files (`CLAUDE.md`, `AGENTS.md`, `architecture.md`, `coding-guidelines.md`, `glossary.md`) still accurate
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# FHR-XXXX TITLE
|
|
2
|
+
|
|
3
|
+
> Task description, including background context, user stories, and so on.
|
|
4
|
+
|
|
5
|
+
## Acceptance Criteria
|
|
6
|
+
|
|
7
|
+
**Functional requirements**
|
|
8
|
+
> - criteria 1
|
|
9
|
+
> - criteria 2
|
|
10
|
+
> - ...
|
|
11
|
+
|
|
12
|
+
**Non-Functional requirements**
|
|
13
|
+
> - criteria 1
|
|
14
|
+
> - criteria 2
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## Design and Implementation Plan
|
|
18
|
+
|
|
19
|
+
> Fill with the design and implementation plan.
|
|
20
|
+
> List of user acceptance tests
|
|
21
|
+
> List of unit tests
|
|
22
|
+
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: address-pr
|
|
3
|
+
description: Work through unresolved GitHub PR review threads on the current branch — fix valid findings in code and reply to invalid ones with an explanation. Use when the user wants to address review comments, respond to PR feedback, or run "/address-pr".
|
|
4
|
+
arguments: pr-number (optional)
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Address PR
|
|
8
|
+
|
|
9
|
+
Work through unresolved GitHub PR review threads: fix the valid ones in code, and reply to the invalid ones with a clear explanation.
|
|
10
|
+
|
|
11
|
+
Argument: `$ARGUMENTS` — optional. Pass the PR number to target a specific PR; omit it to auto-detect from the current branch.
|
|
12
|
+
|
|
13
|
+
## Quick start
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
/address-pr
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Step 1: Find the PR
|
|
20
|
+
|
|
21
|
+
If a PR number was passed in `$ARGUMENTS`, substitute it for `<PR_NUMBER>` in the commands below; otherwise omit `<PR_NUMBER>` entirely and `gh` auto-detects the PR from the current branch:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
gh pr view <PR_NUMBER> --json number,url,title,headRefName
|
|
25
|
+
gh repo view --json owner,name --jq '.owner.login, .name' # first line = <OWNER>, second = <REPO>
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Extract the PR number and `headRefName`. If no open PR exists, stop and report.
|
|
29
|
+
|
|
30
|
+
Make sure the working tree is on the PR's branch before changing any code — fixes must land on the right branch:
|
|
31
|
+
```bash
|
|
32
|
+
git checkout <headRefName>
|
|
33
|
+
git pull
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Step 2: Fetch unresolved review threads
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
gh api graphql -f query='
|
|
40
|
+
query($owner: String!, $repo: String!, $number: Int!) {
|
|
41
|
+
repository(owner: $owner, name: $repo) {
|
|
42
|
+
pullRequest(number: $number) {
|
|
43
|
+
reviewThreads(first: 100) {
|
|
44
|
+
nodes {
|
|
45
|
+
id
|
|
46
|
+
isResolved
|
|
47
|
+
isOutdated
|
|
48
|
+
comments(first: 10) {
|
|
49
|
+
nodes { id databaseId body path line author { login } createdAt }
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
' -f owner=<OWNER> -f repo=<REPO> -F number=<PR_NUMBER>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Keep threads where `isResolved` is `false`. Skip threads where `isOutdated` is `true` — they reference lines that have since changed and no longer block review.
|
|
60
|
+
|
|
61
|
+
If there are no unresolved threads, report "No open review threads" and stop.
|
|
62
|
+
|
|
63
|
+
## Step 3: Evaluate each unresolved thread
|
|
64
|
+
|
|
65
|
+
Read the full comment text and load the referenced file at the path/line for context. Decide for each thread:
|
|
66
|
+
- **Valid** — a real problem or improvement that is technically correct and appropriate for this codebase.
|
|
67
|
+
- **Invalid** — based on a misunderstanding, would be incorrect, or does not apply.
|
|
68
|
+
|
|
69
|
+
## Step 4: Apply fixes for valid findings
|
|
70
|
+
|
|
71
|
+
Apply each fix in the most specific module that owns the code (respect the `architecture.md` module boundaries). Collect all code changes, then run the tests for each affected module. Skip the build for docs/config-only changes (e.g. `suggest-docs`, `*.adoc`, `*.md`) — there is nothing to test:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
# Unit tests for an affected module (with upstream deps built):
|
|
75
|
+
mvn -pl <module> -am test
|
|
76
|
+
|
|
77
|
+
# Acceptance tests — run if an acceptance test module exists in the repository (e.g. suggest-tests):
|
|
78
|
+
mvn -pl suggest-tests verify
|
|
79
|
+
|
|
80
|
+
# Full build / static analysis before merge:
|
|
81
|
+
mvn -P verify-project verify
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
If tests fail, fix the failure before proceeding.
|
|
85
|
+
|
|
86
|
+
## Step 5: Commit and push (only if code changed)
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
git add <changed files>
|
|
90
|
+
git commit -m "FHR-<number>: address review feedback"
|
|
91
|
+
git push
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Confirm with the user before pushing.
|
|
95
|
+
|
|
96
|
+
## Step 6: Reply to all threads
|
|
97
|
+
|
|
98
|
+
`<MODEL_NAME>` is the model powering this session (e.g., "Sonnet 4.6", "Opus 4.8") and `<MODEL_SLUG>` is its URL slug (e.g., "sonnet", "opus", "haiku") — substitute from your system context.
|
|
99
|
+
|
|
100
|
+
For each **valid** thread that was fixed:
|
|
101
|
+
```bash
|
|
102
|
+
gh api repos/<OWNER>/<REPO>/pulls/<PR_NUMBER>/comments \
|
|
103
|
+
--method POST \
|
|
104
|
+
--field body="Fixed — <one-sentence summary of the change made>.
|
|
105
|
+
|
|
106
|
+
🤖 Addressed by [Claude <MODEL_NAME>](https://www.anthropic.com/claude/<MODEL_SLUG>)" \
|
|
107
|
+
--field in_reply_to=<FIRST_COMMENT_DATABASE_ID>
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
For each **invalid** thread:
|
|
111
|
+
```bash
|
|
112
|
+
gh api repos/<OWNER>/<REPO>/pulls/<PR_NUMBER>/comments \
|
|
113
|
+
--method POST \
|
|
114
|
+
--field body="<Clear, professional explanation of why no change is needed.>
|
|
115
|
+
|
|
116
|
+
🤖 Addressed by [Claude <MODEL_NAME>](https://www.anthropic.com/claude/<MODEL_SLUG>)" \
|
|
117
|
+
--field in_reply_to=<FIRST_COMMENT_DATABASE_ID>
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Use the `databaseId` of the first comment in each thread as `in_reply_to`.
|
|
121
|
+
|
|
122
|
+
## Step 7: Report
|
|
123
|
+
|
|
124
|
+
Summarise how many threads were fixed (with code changes), how many received a reply (no change), any that need manual attention, and the commit SHA if code was pushed.
|
|
125
|
+
|
|
126
|
+
## Constraints
|
|
127
|
+
|
|
128
|
+
- Never push without explicit user confirmation.
|
|
129
|
+
- Fix failing tests before moving on — do not push a broken build.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: jira-ticket
|
|
3
|
+
description: Fetch a Jira ticket by number using the Atlassian MCP and report a summary. Use when the user says "jira", "ticket", or provides a ticket number like FHR-1234 or FAS-5678.
|
|
4
|
+
tools: mcp__atlassian__getJiraIssue, mcp__atlassian__getAccessibleAtlassianResources
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Jira Ticket Summary
|
|
8
|
+
|
|
9
|
+
Fetch a Jira ticket via the Atlassian MCP and return a structured summary.
|
|
10
|
+
|
|
11
|
+
## Prerequisites
|
|
12
|
+
|
|
13
|
+
The `atlassian` MCP server must be connected and authenticated. If the MCP tools are unavailable, tell the user:
|
|
14
|
+
> The Atlassian MCP isn't connected. Run `/mcp` to connect and authenticate, then try again.
|
|
15
|
+
|
|
16
|
+
## Steps
|
|
17
|
+
|
|
18
|
+
1. **Validate input**: the ticket number comes from `$ARGUMENTS` (e.g. `FHR-6921`). If empty, ask the user for one.
|
|
19
|
+
|
|
20
|
+
2. **Fetch the ticket** with the `mcp__atlassian__getJiraIssue` tool:
|
|
21
|
+
- `cloudId`: `attraqt.atlassian.net`
|
|
22
|
+
- `issueIdOrKey`: the ticket number from `$ARGUMENTS`
|
|
23
|
+
- `responseContentFormat`: `markdown` (so the description comes back as plain text, not ADF JSON)
|
|
24
|
+
- `fields`: `["summary", "status", "assignee", "reporter", "description", "labels", "components", "issuetype", "priority", "issuelinks", "fixVersions"]`
|
|
25
|
+
|
|
26
|
+
If the call fails with a cloudId/site error, call `mcp__atlassian__getAccessibleAtlassianResources` to find the correct cloudId, then retry with that value.
|
|
27
|
+
|
|
28
|
+
3. **Check for errors**: if the tool returns an error (e.g. issue not found, no access), report it clearly and stop.
|
|
29
|
+
|
|
30
|
+
4. **Report** a structured summary using these fields from the response:
|
|
31
|
+
|
|
32
|
+
- **Ticket**: `key` — `fields.summary`
|
|
33
|
+
- **Type / Priority**: `fields.issuetype.name` / `fields.priority.name`
|
|
34
|
+
- **Status**: `fields.status.name`
|
|
35
|
+
- **Assignee**: `fields.assignee.displayName` (or "Unassigned")
|
|
36
|
+
- **Reporter**: `fields.reporter.displayName`
|
|
37
|
+
- **Labels**: `fields.labels[]` joined, or "none"
|
|
38
|
+
- **Components**: `fields.components[].name` joined, or "none"
|
|
39
|
+
- **Fix Version**: `fields.fixVersions[].name`, or "none"
|
|
40
|
+
- **Description**: synthesise `fields.description` into 3–6 readable sentences
|
|
41
|
+
- **Linked tickets**: for each entry in `fields.issuelinks[]`, show the link type and the linked issue key + summary
|
|
42
|
+
|
|
43
|
+
## Notes
|
|
44
|
+
|
|
45
|
+
- Authentication is handled by the MCP's OAuth session — no API tokens or `CONFLUENCE_USER`/`CONFLUENCE_PASS` env vars are needed.
|
|
46
|
+
- Never print the raw JSON. Synthesise a clean human-readable summary from the parsed fields.
|
|
47
|
+
- If the description is empty or null, say "No description provided."
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: plan-spec
|
|
3
|
+
description: Read a spec file and produce a detailed design and implementation plan — with BDD acceptance tests and TDD test cases per task — written into the spec's "Design and Implementation Plan" section, then committed. Use when user references a spec file and wants a plan, implementation design, or test specifications derived from requirements.
|
|
4
|
+
arguments: spec-file
|
|
5
|
+
model: claude-opus-4-8
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Plan Spec
|
|
9
|
+
|
|
10
|
+
Turns a refined spec into a concrete design and implementation plan with tests, committed to git.
|
|
11
|
+
|
|
12
|
+
## Quick start
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
/plan-spec suggest-docs/src/main/docs/plans/FHR-XXXX-feature-name.md
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Workflow
|
|
19
|
+
|
|
20
|
+
1. **Enter Plan mode** — call `EnterPlanMode` immediately; stay in it while producing the plan
|
|
21
|
+
|
|
22
|
+
2. **Load context**
|
|
23
|
+
- Read the spec file passed as argument
|
|
24
|
+
- Read `glossary.md` from the project root for ubiquitous language
|
|
25
|
+
- Read `architecture.md` from the project root for architecture guidelines
|
|
26
|
+
|
|
27
|
+
3. **Produce the plan**
|
|
28
|
+
- Break the feature into discrete implementation tasks
|
|
29
|
+
- For each task, use this format:
|
|
30
|
+
```
|
|
31
|
+
### Task: <name>
|
|
32
|
+
- [ ] Acceptance tests
|
|
33
|
+
- [ ] Unit tests
|
|
34
|
+
- [ ] Production code
|
|
35
|
+
|
|
36
|
+
**Acceptance tests (BDD)**
|
|
37
|
+
- Given ... When ... Then ...
|
|
38
|
+
|
|
39
|
+
**Unit tests (TDD)**
|
|
40
|
+
- should ... when ...
|
|
41
|
+
```
|
|
42
|
+
- Respect module boundaries and patterns from `architecture.md`
|
|
43
|
+
- Use only domain terms from `glossary.md`
|
|
44
|
+
|
|
45
|
+
4. **Exit Plan mode and write into spec** — call `ExitPlanMode`, then update the spec file
|
|
46
|
+
- Write the full plan under the `## Design and Implementation Plan` section
|
|
47
|
+
- Create the section if it does not already exist
|
|
48
|
+
|
|
49
|
+
5. **Commit**
|
|
50
|
+
- Stage the spec file
|
|
51
|
+
- Commit with message (replace XXXX with the actual ticket number from the spec file): `FHR-XXXX: add design and implementation plan`
|
|
52
|
+
|
|
53
|
+
## Constraints
|
|
54
|
+
|
|
55
|
+
- Do NOT touch any source code
|
|
56
|
+
- Do NOT implement anything — plan only
|
|
57
|
+
- Use only ubiquitous language from the glossary
|
|
58
|
+
- Follow architecture patterns (module boundaries, event bus, DI, interfaces) from `architecture.md`
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ready-pr
|
|
3
|
+
description: Check that all GitHub PR review threads are resolved, then promote the PR from draft to ready for review. Stops with a clear message if any unresolved threads remain. Use when the user wants to mark a PR ready, promote a draft, or run "/ready-pr".
|
|
4
|
+
arguments: pr-number (optional)
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Ready PR
|
|
8
|
+
|
|
9
|
+
Check the PR's review threads. If all are resolved, mark the PR ready for review. If any are still open, stop and say what to do.
|
|
10
|
+
|
|
11
|
+
Argument: `$ARGUMENTS` — optional. Pass the PR number to target a specific PR; omit it to auto-detect from the current branch.
|
|
12
|
+
|
|
13
|
+
## Quick start
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
/ready-pr
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Step 1: Find the PR
|
|
20
|
+
|
|
21
|
+
If a PR number was passed in `$ARGUMENTS`, substitute it for `<PR_NUMBER>` in the commands below; otherwise omit `<PR_NUMBER>` entirely and `gh` auto-detects the PR from the current branch:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
gh pr view <PR_NUMBER> --json number,url,title,isDraft,state
|
|
25
|
+
gh repo view --json owner,name --jq '.owner.login, .name' # first line = <OWNER>, second = <REPO>
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Stop and report if any of these hold — do not continue:
|
|
29
|
+
- No PR is found.
|
|
30
|
+
- `state` is not `OPEN` (the PR is merged or closed — there is nothing to promote).
|
|
31
|
+
- `isDraft` is `false` (the PR is already marked ready for review).
|
|
32
|
+
|
|
33
|
+
## Step 2: Check for unresolved review threads
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
gh api graphql -f query='
|
|
37
|
+
query($owner: String!, $repo: String!, $number: Int!) {
|
|
38
|
+
repository(owner: $owner, name: $repo) {
|
|
39
|
+
pullRequest(number: $number) {
|
|
40
|
+
reviewThreads(first: 100) {
|
|
41
|
+
nodes {
|
|
42
|
+
isResolved
|
|
43
|
+
isOutdated
|
|
44
|
+
comments(first: 1) {
|
|
45
|
+
nodes { body path line author { login } }
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
' -f owner=<OWNER> -f repo=<REPO> -F number=<PR_NUMBER>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Keep threads where `isResolved` is `false` AND `isOutdated` is `false`. Outdated threads do not block readiness.
|
|
56
|
+
|
|
57
|
+
## Step 3: If unresolved threads exist — STOP
|
|
58
|
+
|
|
59
|
+
Report and do nothing further:
|
|
60
|
+
|
|
61
|
+
> **Not ready:** N unresolved review thread(s) remain:
|
|
62
|
+
>
|
|
63
|
+
> - `path:line` — "comment text" (by @reviewer)
|
|
64
|
+
> - …
|
|
65
|
+
>
|
|
66
|
+
> Run `/address-pr` to fix or reply to each thread, or resolve them manually on GitHub, then run `/ready-pr` again.
|
|
67
|
+
|
|
68
|
+
## Step 4: If all threads are resolved — mark ready
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
gh pr ready <PR_NUMBER>
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Report the PR URL and confirm it is now ready for review.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: refine-spec
|
|
3
|
+
description: Conduct a structured requirements-refinement interview against a spec file, using the project's ubiquitous language from glossary.md, until scope and acceptance criteria are clear, then update the spec file in place. Use when user references a spec file and wants to clarify requirements, define scope, or sharpen acceptance criteria — but not write code or tests.
|
|
4
|
+
arguments: spec-file
|
|
5
|
+
model: claude-opus-4-8
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Refine Spec
|
|
9
|
+
|
|
10
|
+
Requirements-refinement session: interview the user until scope and acceptance criteria are clear, then rewrite the spec in place.
|
|
11
|
+
|
|
12
|
+
## Quick start
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
/refine-spec suggest-docs/src/main/docs/plans/FHR-XXXX-feature-name.md
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Workflow
|
|
19
|
+
|
|
20
|
+
1. **Enter Plan mode** — call `EnterPlanMode` immediately; stay in it through the entire interview
|
|
21
|
+
|
|
22
|
+
2. **Load context**
|
|
23
|
+
- Read the spec file passed as argument
|
|
24
|
+
- Read `glossary.md` from the project root for ubiquitous language
|
|
25
|
+
|
|
26
|
+
3. **Assess current state**
|
|
27
|
+
- Identify what is clear, what is vague, and what is missing
|
|
28
|
+
- Flag any terminology that drifts from the glossary
|
|
29
|
+
|
|
30
|
+
4. **Interview loop**
|
|
31
|
+
- Ask focused, one-topic-at-a-time questions (scope, edge cases, acceptance criteria)
|
|
32
|
+
- Use only domain terms from the glossary — never invent synonyms
|
|
33
|
+
- Continue until scope is unambiguous, acceptance criteria are testable, no open questions remain
|
|
34
|
+
|
|
35
|
+
5. **Exit Plan mode and update spec** — call `ExitPlanMode`, then rewrite the spec file in place
|
|
36
|
+
- Preserve original structure; add/update sections as needed
|
|
37
|
+
- Use only ubiquitous language from the glossary
|
|
38
|
+
|
|
39
|
+
6. **Commit**
|
|
40
|
+
- Stage the spec file
|
|
41
|
+
- Commit with message (replace XXXX with the actual ticket number from the spec file): `FHR-XXXX: refine the requirements`
|
|
42
|
+
|
|
43
|
+
## Constraints
|
|
44
|
+
|
|
45
|
+
- Do NOT touch any source code
|
|
46
|
+
- Do NOT discuss unit tests or implementation details
|
|
47
|
+
- Do NOT propose solutions — only clarify requirements
|
|
48
|
+
- Stop interviewing once all sections are clear
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: review-pr
|
|
3
|
+
description: Review the current branch's GitHub PR — fetch its description and diff, compare against the spec/plan if present, and submit a GitHub PR review with inline comments for every finding. Use when the user wants to review a PR, run an AI review pass, or run "/review-pr".
|
|
4
|
+
arguments: pr-number (optional)
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Review PR
|
|
8
|
+
|
|
9
|
+
Review the open GitHub PR for this branch by acting as a code reviewer. The output is a **submitted GitHub PR review with inline comments** — not a local file.
|
|
10
|
+
|
|
11
|
+
Argument: `$ARGUMENTS` — optional. Pass the PR number to review a specific PR; omit it to auto-detect from the current branch.
|
|
12
|
+
|
|
13
|
+
## Quick start
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
/review-pr
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Step 1: Find the PR
|
|
20
|
+
|
|
21
|
+
If a PR number was passed in `$ARGUMENTS`, substitute it for `<PR_NUMBER>` in the commands below; otherwise omit `<PR_NUMBER>` entirely and `gh` auto-detects the PR from the current branch:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
gh pr view <PR_NUMBER> --json number,url,title,state,body,headRefName,baseRefName
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Extract the PR number, title, description, and base branch. If no PR is found, stop and ask the user to run `/write-pr` first.
|
|
28
|
+
|
|
29
|
+
Get the latest commit SHA (required to anchor inline comments):
|
|
30
|
+
```bash
|
|
31
|
+
gh pr view <PR_NUMBER> --json commits --jq '.commits[-1].oid'
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Step 2: Fetch the diff
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
gh pr diff <PR_NUMBER>
|
|
38
|
+
gh pr view <PR_NUMBER> --json files --jq '[.files[].path]'
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Step 3: Load spec/plan and project standards (if available)
|
|
42
|
+
|
|
43
|
+
Detect the ticket number from the branch name (pattern `FHR-\d+`).
|
|
44
|
+
|
|
45
|
+
Read if present (the spec may be in any of these locations):
|
|
46
|
+
- `.claude/resources/FHR-<number>-*.md`
|
|
47
|
+
- `suggest-docs/src/main/docs/specs/FHR-<number>-*.md`
|
|
48
|
+
- `documentation/releases/*/FHR-<number>-*.md`
|
|
49
|
+
|
|
50
|
+
The plan is embedded in the spec's `## Design and Implementation Plan` section — there is no separate plan file.
|
|
51
|
+
|
|
52
|
+
Also read:
|
|
53
|
+
- `coding-guidelines.md`, `architecture.md`, `glossary.md` (project root) — the standards to review against.
|
|
54
|
+
|
|
55
|
+
If the spec is missing, proceed and review code quality only.
|
|
56
|
+
|
|
57
|
+
## Step 4: Review the PR
|
|
58
|
+
|
|
59
|
+
Review the diff and PR description against `coding-guidelines.md` and `architecture.md`.
|
|
60
|
+
|
|
61
|
+
**What to check:**
|
|
62
|
+
|
|
63
|
+
1. **PR description accuracy** — does the body describe what actually changed? Are diagrams present and correct for complex changes?
|
|
64
|
+
2. **Spec compliance** (if a spec was found) — does the implementation satisfy each acceptance criterion? Are there missing tests for any plan task?
|
|
65
|
+
3. **Code quality:**
|
|
66
|
+
- Correctness and edge cases (nulls, boundary values, empty inputs)
|
|
67
|
+
- Error handling and resilience (no swallowed exceptions)
|
|
68
|
+
- Security and input validation (no injection, no hardcoded secrets)
|
|
69
|
+
- Test coverage (every new/changed conditional branch has a dedicated test)
|
|
70
|
+
- Readability, naming, complexity, duplication
|
|
71
|
+
- Architecture and module boundaries (refer to `architecture.md` for module structure and dependency rules; no circular dependencies)
|
|
72
|
+
- Domain language matches `glossary.md`
|
|
73
|
+
- Logging and observability (no secrets or PII in logs)
|
|
74
|
+
|
|
75
|
+
**For each finding, record:**
|
|
76
|
+
- `path` — relative file path in the repo
|
|
77
|
+
- `line` — absolute line number in the new version of the file
|
|
78
|
+
- `side` — always `"RIGHT"` for added or unchanged lines
|
|
79
|
+
- `severity` — `BLOCKER` | `MAJOR` | `MINOR` | `NIT`
|
|
80
|
+
- `body` — comment text prefixed with the severity tag, e.g. `BLOCKER: Missing null check. Add a guard before line 42.`
|
|
81
|
+
|
|
82
|
+
Only raise a finding if the evidence is clear from the diff. Do not speculate about code you cannot see.
|
|
83
|
+
|
|
84
|
+
**Inline comments can only anchor to lines that are part of the PR's diff hunks** (added or directly-adjacent context lines). The GitHub reviews API rejects the whole submission (HTTP 422) if any comment targets a line outside the diff. If a finding concerns an unchanged line, put it in the review `body` instead of inline.
|
|
85
|
+
|
|
86
|
+
## Step 5: Submit the GitHub PR review
|
|
87
|
+
|
|
88
|
+
Get the owner and repo (printed on separate lines — the first is `<OWNER>`, the second is `<REPO>`):
|
|
89
|
+
```bash
|
|
90
|
+
gh repo view --json owner,name --jq '.owner.login, .name'
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Choose the review `event` from the highest finding severity:
|
|
94
|
+
- `REQUEST_CHANGES` — at least one `BLOCKER` or `MAJOR` finding (these block the PR).
|
|
95
|
+
- `COMMENT` — only `MINOR`/`NIT` findings (non-blocking, so the severity tags carry weight).
|
|
96
|
+
|
|
97
|
+
Submit the full review in a single API call:
|
|
98
|
+
```bash
|
|
99
|
+
gh api repos/<OWNER>/<REPO>/pulls/<PR_NUMBER>/reviews \
|
|
100
|
+
--method POST \
|
|
101
|
+
--field commit_id=<LATEST_COMMIT_SHA> \
|
|
102
|
+
--field body="Review: <N> finding(s) — <X> blocker(s), <Y> major, <Z> minor, <W> nit(s)." \
|
|
103
|
+
--field event="<REQUEST_CHANGES or COMMENT>" \
|
|
104
|
+
--raw-field comments='[
|
|
105
|
+
{"path":"suggest-api/src/main/java/Foo.java","line":42,"side":"RIGHT","body":"BLOCKER: …"},
|
|
106
|
+
{"path":"suggest-lucene/src/main/java/Bar.java","line":17,"side":"RIGHT","body":"MINOR: …"}
|
|
107
|
+
]'
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
If a finding cannot be anchored to a specific file line (e.g. a description-level issue), include it in the review `body` instead of as an inline comment.
|
|
111
|
+
|
|
112
|
+
If there are **no findings**, approve:
|
|
113
|
+
```bash
|
|
114
|
+
gh api repos/<OWNER>/<REPO>/pulls/<PR_NUMBER>/reviews \
|
|
115
|
+
--method POST \
|
|
116
|
+
--field body="LGTM — all quality gates pass." \
|
|
117
|
+
--field event="APPROVE"
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Step 6: Report
|
|
121
|
+
|
|
122
|
+
Output the PR URL, the review decision (`REQUEST_CHANGES` or `APPROVE`), finding counts by severity, and any findings placed in the review body rather than inline.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tdd-green
|
|
3
|
+
description: Implement production code (green phase) for the next incomplete task in a spec file's Design and Implementation Plan, writing only enough code to make the failing tests pass, then refactor while keeping tests green, mark the Production code sub-task done, and commit the green and refactor work separately. Use when user references a spec file and wants to implement a feature, or says "green phase", "make tests pass", "tdd green", or "green and refactor".
|
|
4
|
+
arguments: spec-file
|
|
5
|
+
model: claude-haiku-4-5-20251001
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# TDD Green
|
|
9
|
+
|
|
10
|
+
Implements the production code to make the failing tests pass. Run after `/tdd-red`.
|
|
11
|
+
|
|
12
|
+
## Quick start
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
/tdd-green suggest-docs/src/main/docs/plans/FHR-XXXX-feature-name.md
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Workflow
|
|
19
|
+
|
|
20
|
+
1. **Load context**
|
|
21
|
+
- Read the spec file passed as argument
|
|
22
|
+
- Read `glossary.md` from the project root for ubiquitous language
|
|
23
|
+
- Read `coding-guidelines.md` from the project root for coding conventions
|
|
24
|
+
- Read `architecture.md` from the project root for module boundaries and patterns
|
|
25
|
+
|
|
26
|
+
2. **Find the next incomplete task**
|
|
27
|
+
- Scan the `## Design and Implementation Plan` section for the first task whose `- [ ] Production code` checkbox is unchecked
|
|
28
|
+
- Work on that task only — do not advance to subsequent tasks
|
|
29
|
+
|
|
30
|
+
3. **Implement production code**
|
|
31
|
+
- Write only enough production code to make the failing tests pass
|
|
32
|
+
- Follow all conventions in `coding-guidelines.md`
|
|
33
|
+
- Respect module boundaries from `architecture.md`
|
|
34
|
+
- Use only domain terms from `glossary.md`
|
|
35
|
+
- This is the **green phase**: no refactoring, no gold-plating — just passing tests
|
|
36
|
+
|
|
37
|
+
4. **Run the tests**
|
|
38
|
+
- Unit tests
|
|
39
|
+
- Acceptance tests (JGiven)
|
|
40
|
+
- All tests must pass before proceeding
|
|
41
|
+
|
|
42
|
+
5. **Commit (green)**
|
|
43
|
+
- Stage all changed production files
|
|
44
|
+
- Commit with message (replace XXXX with the actual ticket number from the spec file): `FHR-XXXX: implement <task name> (green)`
|
|
45
|
+
|
|
46
|
+
6. **Refactor**
|
|
47
|
+
- Remove duplication, clarify intent, simplify structure
|
|
48
|
+
- Do NOT change behaviour; no new logic, no new tests
|
|
49
|
+
- Do NOT modify test code
|
|
50
|
+
- Run all tests; they must remain green. In case of any failure, stop immediately and ask the user what to do next (rollback; make the test pass; ...)
|
|
51
|
+
|
|
52
|
+
7. **Mark task done**
|
|
53
|
+
- In the spec file, check off `- [x] Production code` for the completed task
|
|
54
|
+
|
|
55
|
+
8. **Commit (refactor)**
|
|
56
|
+
- Stage all changed production files and the updated spec file
|
|
57
|
+
- Commit with message (replace XXXX with the actual ticket number from the spec file): `FHR-XXXX: refactor <task name> (refactor)`
|
|
58
|
+
## Constraints
|
|
59
|
+
|
|
60
|
+
- Do NOT modify test code
|
|
61
|
+
- Do NOT advance past the first incomplete task
|
|
62
|
+
- Write the minimum code needed to make tests pass
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tdd-red
|
|
3
|
+
description: Write failing tests (red phase) for the next incomplete task in a spec file's Design and Implementation Plan — acceptance tests (JGiven BDD) and unit tests (JUnit Jupiter) — then mark the Acceptance tests and Unit tests sub-tasks done and commit. Use when user references a spec file and wants to write the failing tests before implementing a feature, or says "red phase", "write tests", or "tdd red".
|
|
4
|
+
arguments: spec-file
|
|
5
|
+
model: claude-haiku-4-5-20251001
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# TDD Red
|
|
9
|
+
|
|
10
|
+
Writes the failing tests for the next incomplete task in the plan. Run after `/plan-spec`.
|
|
11
|
+
|
|
12
|
+
## Quick start
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
/tdd-red suggest-docs/src/main/docs/plans/FHR-XXXX-feature-name.md
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Workflow
|
|
19
|
+
|
|
20
|
+
1. **Load context**
|
|
21
|
+
- Read the spec file passed as argument
|
|
22
|
+
- Read `glossary.md` from the project root for ubiquitous language
|
|
23
|
+
- Read `coding-guidelines.md` from the project root for test conventions
|
|
24
|
+
|
|
25
|
+
2. **Find the next incomplete task**
|
|
26
|
+
- Scan the `## Design and Implementation Plan` section for the first task whose `- [ ] Acceptance tests` or `- [ ] Unit tests` checkbox is unchecked
|
|
27
|
+
- Work on that task only — do not advance to subsequent tasks
|
|
28
|
+
|
|
29
|
+
3. **Write the tests**
|
|
30
|
+
- Write acceptance tests (JGiven BDD style) and unit tests (JUnit Jupiter) as described for that task in the plan
|
|
31
|
+
- Follow all conventions in `coding-guidelines.md`: EasyMock for mocking, stage classes named `Given*`/`When*`/`Then*`, test methods named as scenario descriptions
|
|
32
|
+
- Use only domain terms from `glossary.md`
|
|
33
|
+
- This is the **red phase**: write only tests, no production code
|
|
34
|
+
|
|
35
|
+
4. **Run the tests**
|
|
36
|
+
- Run unit tests
|
|
37
|
+
- Run acceptance tests (JGiven)
|
|
38
|
+
- Confirm the suite is red (fails) before proceeding
|
|
39
|
+
|
|
40
|
+
5. **Mark task done**
|
|
41
|
+
- In the spec file, check off `- [x] Acceptance tests` and `- [x] Unit tests` for the completed task
|
|
42
|
+
|
|
43
|
+
6. **Commit**
|
|
44
|
+
- Stage all new test files and the updated spec file
|
|
45
|
+
- Commit with message (replace XXXX with the actual ticket number from the spec file): `FHR-XXXX: add failing tests for <task name> (red)`
|
|
46
|
+
|
|
47
|
+
## Constraints
|
|
48
|
+
|
|
49
|
+
- Do NOT write any production code
|
|
50
|
+
- Do NOT advance past the first incomplete task
|
|
51
|
+
- Use only ubiquitous language from the glossary
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tdd-workflow
|
|
3
|
+
description: Drive the full red-green-refactor TDD cycle across every task in a spec file's Design and Implementation Plan — picking the next incomplete task, then running the red, green, and refactor phases for it, then looping to the next task until the plan is complete. Use when user references a spec file and wants to implement the whole plan end to end, or says "run the tdd workflow", "implement the plan", or "tdd workflow".
|
|
4
|
+
arguments: spec-file
|
|
5
|
+
model: claude-haiku-4-5-20251001
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# TDD Workflow
|
|
9
|
+
|
|
10
|
+
Automates the per-task red → green → refactor cycle for an entire plan by orchestrating the
|
|
11
|
+
`tdd-red` and `tdd-green` skills. Run after `/plan-spec`.
|
|
12
|
+
|
|
13
|
+
## Quick start
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
/tdd-workflow suggest-docs/src/main/docs/plans/FHR-XXXX-feature-name.md
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Workflow
|
|
20
|
+
|
|
21
|
+
1. **Load context**
|
|
22
|
+
- Read the spec file passed as argument
|
|
23
|
+
- Locate the `## Design and Implementation Plan` section and its list of `### Task:` blocks
|
|
24
|
+
|
|
25
|
+
2. **Pick the next task**
|
|
26
|
+
- Find the first `### Task:` whose checkboxes are not all checked
|
|
27
|
+
(`- [ ] Acceptance tests`, `- [ ] Unit tests`, `- [ ] Production code`)
|
|
28
|
+
- This task is the current task. If every task is fully checked, stop; the plan is complete
|
|
29
|
+
|
|
30
|
+
3. **Red phase (if needed)**
|
|
31
|
+
- If `Acceptance tests` or `Unit tests` is unchecked for the current task, invoke `tdd-red` with the spec file
|
|
32
|
+
- Wait for it to finish before continuing
|
|
33
|
+
|
|
34
|
+
4. **Green/Refactor phase (if needed)**
|
|
35
|
+
- If `Production code` is unchecked for the current task, invoke `tdd-green` with the spec file
|
|
36
|
+
- Wait for it to finish before continuing
|
|
37
|
+
|
|
38
|
+
5. **Loop to the next task**
|
|
39
|
+
- Re-read the spec file and return to step 2
|
|
40
|
+
- Continue until no incomplete task remains
|
|
41
|
+
|
|
42
|
+
6. **Report**
|
|
43
|
+
- Summarise which tasks were implemented and confirm the plan is fully checked off
|
|
44
|
+
|
|
45
|
+
## Constraints
|
|
46
|
+
|
|
47
|
+
- Always run the phases in order (red before green/refactor) for a given task
|
|
48
|
+
- Do NOT start the next task until the current one is fully complete
|
|
49
|
+
- If a phase’s checkbox is already checked for the current task, treat that phase as already complete (do not re-run it)
|
|
50
|
+
- Let each sub-skill enforce its own rules (tests-only in red, minimal code + refactor in green); this skill only sequences them
|
|
51
|
+
- Each invoked sub-skill commits its own work; do not add extra commits between skill invocations
|
|
52
|
+
- Stop and surface the problem if any phase fails (e.g. tests will not pass) rather than advancing
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: write-pr
|
|
3
|
+
description: Render the repo PR template from the current branch's diff, and create (or update) a draft GitHub PR. Use when the user wants to open a PR, write a PR description, or run "/write-pr" on a branch.
|
|
4
|
+
arguments: extra-context (optional)
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Write PR
|
|
8
|
+
|
|
9
|
+
Render the `.github/pull_request_template.md` from the current branch's changes and open a **draft** GitHub PR. PRs are always created as drafts — use `/ready-pr` to promote them once review is complete.
|
|
10
|
+
|
|
11
|
+
Argument: `$ARGUMENTS` — optional free text treated as extra context for the description.
|
|
12
|
+
|
|
13
|
+
## Quick start
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
/write-pr
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Workflow
|
|
20
|
+
|
|
21
|
+
1. **Detect the ticket and diff**
|
|
22
|
+
- Read the ticket number from the branch name (pattern `FHR-\d+`). If the branch name has no ticket, ask the user for the ticket number before continuing.
|
|
23
|
+
- Make sure the branch is committed — `git diff origin/master...HEAD` only shows committed work, not uncommitted or untracked files. Get the diff vs `master`:
|
|
24
|
+
```bash
|
|
25
|
+
git diff origin/master...HEAD --stat
|
|
26
|
+
git diff origin/master...HEAD
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
2. **Render the template** — fill in `.github/pull_request_template.md`:
|
|
30
|
+
- Set the Jira link to `https://attraqt.atlassian.net/browse/FHR-<number>`.
|
|
31
|
+
- Tick the AI Development Checklist items that genuinely apply (spec present, tests present, docs present, AI review pass, etc.). Leave unticked anything not yet true.
|
|
32
|
+
- Prepend a `## Summary of changes` section (the template has no such section) describing what changed and why.
|
|
33
|
+
|
|
34
|
+
4. **Approve before publishing** — present the title and rendered body and wait for explicit approval. Support correction cycles.
|
|
35
|
+
|
|
36
|
+
5. **Publish** — write the approved body to a temp file (e.g. `pr-body.md`), then with confirmation push the branch and create or update the draft PR:
|
|
37
|
+
```bash
|
|
38
|
+
gh pr create --draft --title "FHR-<number>: <Title>" --body-file pr-body.md
|
|
39
|
+
# or, if a PR already exists for this branch (omit the number — gh auto-detects it):
|
|
40
|
+
gh pr edit --title "FHR-<number>: <Title>" --body-file pr-body.md
|
|
41
|
+
```
|
|
42
|
+
Delete the temp file afterwards and report the PR URL.
|
|
43
|
+
|
|
44
|
+
## Constraints
|
|
45
|
+
|
|
46
|
+
- Always create the PR as a **draft**.
|
|
47
|
+
- Never push without explicit user confirmation.
|
|
48
|
+
- The title MUST match `FHR-<number>: <description>` — the `pull-request.yml` CI check fails otherwise.
|
|
49
|
+
- Only tick checklist items that are actually true.
|