Skip to content

Commit 6ba720d

Browse files
committed
feat(prompts): add release preparation prompt and refine gh command patterns
Introduce a new prompt for managing GitHub releases and update existing automation templates to prioritize non-interactive CLI usage without pagers.
1 parent 1e3c051 commit 6ba720d

File tree

5 files changed

+197
-24
lines changed

5 files changed

+197
-24
lines changed

.github/prompts/create-issue-from-branch.prompt.md

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,25 @@ Create or update a GitHub issue from the changes in the current branch compared
1414
- If milestone is not provided, use the latest open milestone.
1515
5. The issue description must be well-formatted Markdown.
1616
6. Use this Markdown structure exactly (omit empty sections):
17+
1718
- ## Summary
19+
1820
- ## Goal
21+
1922
- ## Success Criteria
23+
2024
- ## References
25+
2126
7. Keep language concise, goal-oriented, and user-facing.
27+
8. Prefer plain non-interactive `gh` commands.
28+
- Do not prefix commands with `GH_PAGER=cat` by default.
29+
- Only disable the pager when command output would otherwise not be captured reliably.
2230

2331
## Operational Steps
2432

33+
Use standard `gh` commands by default.
34+
Only disable the pager when needed to make command output reliably readable in the execution environment.
35+
2536
1. Ensure branch comparison is up to date:
2637

2738
```bash
@@ -30,11 +41,11 @@ git log --oneline --no-merges origin/main..HEAD
3041
git diff --name-status origin/main..HEAD
3142
```
3243

33-
2. Ask:
44+
1. Ask:
3445
- Label? (default: improvement)
3546
- Milestone? (default: latest open milestone)
3647

37-
3. Resolve defaults:
48+
2. Resolve defaults:
3849

3950
```bash
4051
LABEL="${LABEL:-improvement}"
@@ -44,7 +55,7 @@ if [ -z "$MILESTONE" ]; then
4455
fi
4556
```
4657

47-
4. Build a well-formatted Markdown body in a temp file:
58+
1. Build a well-formatted Markdown body in a temp file:
4859

4960
```bash
5061
cat > /tmp/issue-body.md <<'EOF'
@@ -63,11 +74,10 @@ cat > /tmp/issue-body.md <<'EOF'
6374
EOF
6475
```
6576

66-
5. Suggest a title in this style:
67-
- [IMPROVEMENT]: <goal-focused title>
77+
1. Suggest a title in this style:
6878
- Adapt prefix to selected label where appropriate (for example: [FEATURE]: ...).
6979

70-
6. Create or update issue:
80+
2. Create or update issue:
7181

7282
Create:
7383

@@ -89,13 +99,14 @@ gh issue edit <ISSUE_NUMBER> \
8999
--body-file /tmp/issue-body.md
90100
```
91101

92-
7. Verify and report final state:
102+
1. Verify and report final state:
93103

94104
```bash
95105
gh issue view <ISSUE_NUMBER> --json number,title,url,labels,milestone,body
96106
```
97107

98108
Report:
109+
99110
- Issue number and URL
100111
- Final title
101112
- Final label(s)

.github/prompts/create-pr-from-branch.prompt.md

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,21 @@ Create or update a GitHub pull request from the current branch into the fork's m
1212
6. Keep language concise, outcome-focused, and reviewer-friendly.
1313
7. Do not include irrelevant implementation noise; summarize what matters for review.
1414
8. Whenever new commits are pushed that change scope, update the PR description so it stays in sync with current branch changes.
15+
9. Prefer plain non-interactive `gh` commands.
16+
17+
- Do not prefix commands with `GH_PAGER=cat` by default.
18+
- Only disable the pager when command output would otherwise not be captured reliably.
1519

1620
## PR Markdown Template
1721

1822
Use this structure (omit empty sections):
23+
1924
- ## Summary
25+
2026
- ## Why
27+
2128
- ## Validation
29+
2230
- ## Issue
2331

2432
Example:
@@ -41,6 +49,9 @@ Resolves #<issue-number>
4149

4250
## Operational Steps
4351

52+
Use standard `gh` commands by default.
53+
Only disable the pager when needed to make command output reliably readable in the execution environment.
54+
4455
1. Ensure branch comparison is current:
4556

4657
```bash
@@ -49,18 +60,19 @@ git log --oneline --no-merges origin/main..HEAD
4960
git diff --name-status origin/main..HEAD
5061
```
5162

52-
2. Determine branch and existing PR state:
63+
1. Determine branch and existing PR state:
5364

5465
```bash
5566
BRANCH="$(git rev-parse --abbrev-ref HEAD)"
56-
GH_PAGER=cat GH_FORCE_TTY=0 gh pr list --head "$BRANCH" --json number,title,url,state
67+
GH_FORCE_TTY=0 gh pr list --head "$BRANCH" --json number,title,url,state
5768
```
5869

59-
3. Ask for required metadata if missing:
70+
1. Ask for required metadata if missing:
71+
6072
- Target issue number to resolve
6173
- PR title override (optional)
6274

63-
4. Build or refresh PR body in a temp file:
75+
1. Build or refresh PR body in a temp file:
6476

6577
```bash
6678
cat > /tmp/pr-body.md <<'EOF'
@@ -80,28 +92,28 @@ Resolves #<issue-number>
8092
EOF
8193
```
8294

83-
5. Create PR if none exists:
95+
1. Create PR if none exists:
8496

8597
```bash
86-
GH_PAGER=cat GH_FORCE_TTY=0 gh pr create \
98+
GH_FORCE_TTY=0 gh pr create \
8799
--base main \
88100
--head "$BRANCH" \
89101
--title "<PR title>" \
90102
--body-file /tmp/pr-body.md
91103
```
92104

93-
6. Update PR if one already exists, or after new commits change scope:
105+
1. Update PR if one already exists, or after new commits change scope:
94106

95107
```bash
96-
GH_PAGER=cat GH_FORCE_TTY=0 gh pr edit <PR_NUMBER> \
108+
GH_FORCE_TTY=0 gh pr edit <PR_NUMBER> \
97109
--title "<PR title>" \
98110
--body-file /tmp/pr-body.md
99111
```
100112

101-
7. Verify final PR state:
113+
1. Verify final PR state:
102114

103115
```bash
104-
GH_PAGER=cat GH_FORCE_TTY=0 gh pr view <PR_NUMBER> --json number,title,url,body
116+
GH_FORCE_TTY=0 gh pr view <PR_NUMBER> --json number,title,url,body
105117
```
106118

107119
## Completion Checklist

.github/prompts/prepare-release-milestone.prompt.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,15 @@ Prepare release tracking on GitHub without creating a release.
2525
- None of its labels are in the allowed list.
2626
5. Report any invalid items clearly and stop before any release creation step.
2727
6. Keep the response concise and operational.
28+
7. Prefer plain non-interactive `gh` commands.
29+
- Do not prefix commands with `GH_PAGER=cat` by default.
30+
- Only disable the pager when command output would otherwise not be captured reliably.
2831

2932
## Operational Steps
3033

34+
Use standard `gh` commands by default.
35+
Only disable the pager when needed to make command output reliably readable in the execution environment.
36+
3137
1. Ask:
3238
- Source milestone?
3339
- Destination milestone?
@@ -48,21 +54,21 @@ gh api repos/{owner}/{repo}/milestones --paginate --jq '.[] | [.number,.title,.s
4854
gh api repos/{owner}/{repo}/milestones -X POST -f title='<DESTINATION_MILESTONE>'
4955
```
5056

51-
4. Collect closed items from the source milestone:
57+
1. Collect closed items from the source milestone:
5258

5359
```bash
5460
gh issue list --repo {owner}/{repo} --milestone '<SOURCE_MILESTONE>' --state closed --limit 200 --json number,title,labels
5561
gh pr list --repo {owner}/{repo} --state closed --search 'milestone:"<SOURCE_MILESTONE>"' --limit 200 --json number,title,labels,state
5662
```
5763

58-
5. Move closed issues and closed pull requests to the destination milestone:
64+
1. Move closed issues and closed pull requests to the destination milestone:
5965

6066
```bash
6167
gh issue edit <ISSUE_NUMBER> --repo {owner}/{repo} --milestone '<DESTINATION_MILESTONE>'
6268
gh pr edit <PR_NUMBER> --repo {owner}/{repo} --milestone '<DESTINATION_MILESTONE>'
6369
```
6470

65-
6. Verify labels against this allowlist:
71+
1. Verify labels against this allowlist:
6672

6773
```text
6874
breaking change
@@ -75,22 +81,24 @@ build
7581
```
7682

7783
Validation rules:
84+
7885
- Each moved item must have at least one label.
7986
- At least one assigned label must match the allowlist exactly.
8087
- If any moved item fails validation, report the item number, title, and labels.
8188

82-
7. Verify final milestone state and report:
89+
1. Verify final milestone state and report:
8390

8491
```bash
8592
gh issue list --repo {owner}/{repo} --milestone '<DESTINATION_MILESTONE>' --state closed --limit 200 --json number,title,labels
8693
gh pr list --repo {owner}/{repo} --state closed --search 'milestone:"<DESTINATION_MILESTONE>"' --limit 200 --json number,title,labels,state
8794
```
8895

8996
Report:
97+
9098
- Source milestone
9199
- Destination milestone
92100
- Whether the destination milestone was created or already existed
93101
- Count of moved closed issues
94102
- Count of moved closed pull requests
95103
- Any moved items missing allowed labels
96-
- Confirmation that no GitHub release was created
104+
- Confirmation that no GitHub release was created
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
# Prepare Release
2+
3+
Prepare a GitHub release after confirming the target version and release type.
4+
5+
## Requirements
6+
7+
1. Describe the release workflow before taking action:
8+
- Confirm whether the release should be published as a prerelease or a release.
9+
- After the release type is confirmed, check for an open milestone that is a concrete version and not a spec milestone such as `4.x` or `4.5.x`.
10+
- If a valid open milestone exists, ask the user to confirm that version with a yes/no question.
11+
- If no valid open milestone exists, require the user to provide the release version.
12+
- Verify whether the tag already exists.
13+
- Verify whether a GitHub release already exists for the version.
14+
- Create or update the GitHub release with the title set to the version.
15+
2. Ask the user for both:
16+
- Release type: prerelease or release
17+
- Release version (or milestone confirmation yes/no when a valid milestone exists)
18+
3. Use the release version as both:
19+
- Tag name
20+
- Release title
21+
4. If the user selects prerelease:
22+
- Create the release with the prerelease flag enabled.
23+
5. If the user selects release:
24+
- Create the release without the prerelease flag.
25+
- Ensure the release is linked to the repository announcement discussion for that version.
26+
6. Treat milestone titles such as `v4.x` or `v4.5.x` as spec milestones and do not suggest them as the release version.
27+
7. If a release already exists for the selected tag:
28+
- Do not fail or stop at `gh release create`.
29+
- Inspect the existing release and update it instead.
30+
- If the requested type is release and the existing release is a prerelease, convert it to a full release.
31+
- If the requested type is release and there is no linked discussion, link or create the announcement discussion during the update.
32+
8. Keep the response concise and operational.
33+
9. Prefer plain non-interactive `gh` commands.
34+
- Do not prefix commands with `GH_PAGER=cat` by default.
35+
- Only disable the pager when command output would otherwise not be captured reliably.
36+
37+
## Operational Steps
38+
39+
1. Ask:
40+
- Is this a prerelease or a release?
41+
42+
Ask for the release type first.
43+
44+
After release type is selected, check open milestones before asking for a version.
45+
46+
Use standard `gh` commands by default.
47+
Only disable the pager when needed to make command output reliably readable in the execution environment.
48+
49+
1. Summarize the plan:
50+
- Confirm whether this should be a prerelease or a release.
51+
- Inspect open milestones and find the latest concrete version milestone.
52+
- If found, ask the user to confirm that version with yes/no.
53+
- If not found, ask the user to provide a release version.
54+
- Verify whether the tag already exists.
55+
- Verify whether a GitHub release already exists for that tag.
56+
- Create or update the GitHub release using the version as the tag and title.
57+
- Apply the prerelease flag only when requested.
58+
- When publishing a full release, ensure the `Announcements` discussion is linked.
59+
60+
2. After the release type is selected, inspect open milestones and find the latest non-spec milestone:
61+
62+
```bash
63+
gh api repos/{owner}/{repo}/milestones --paginate --jq '.[] | select(.state == "open") | .title'
64+
```
65+
66+
Suggestion rules:
67+
68+
- Exclude milestone titles that match spec patterns such as `v4.x` or `v4.5.x`.
69+
- Prefer the latest milestone that looks like a concrete release version such as `v4.5.0`.
70+
- If a valid milestone exists, ask: `Use <MILESTONE_VERSION> as the release version? (yes/no)`.
71+
- If the answer is yes, use that version.
72+
- If the answer is no, ask the user to provide the release version explicitly.
73+
- If no valid milestone exists, ask the user to provide the release version explicitly.
74+
75+
1. Confirm release version:
76+
77+
- Ensure a final release version is confirmed from either:
78+
- Milestone confirmation (yes), or
79+
- User-provided version.
80+
81+
1. Check whether the tag already exists:
82+
83+
```bash
84+
gh api repos/{owner}/{repo}/git/ref/tags/<RELEASE_VERSION>
85+
```
86+
87+
If the tag already exists, proceed only if that is intentional for the repository workflow.
88+
89+
1. Check whether a GitHub release already exists for the selected version:
90+
91+
```bash
92+
gh api repos/{owner}/{repo}/releases/tags/<RELEASE_VERSION>
93+
```
94+
95+
Decision rules:
96+
97+
- If the release does not exist, create it.
98+
- If the release exists, inspect whether it is draft, prerelease, or already a full release.
99+
- If the user selected `prerelease`, update the existing release to keep or set `prerelease=true` as needed.
100+
- If the user selected `release`, update the existing release to set `prerelease=false`.
101+
- Do not attempt `gh release create` again when a release already exists for the tag.
102+
103+
1. When the user selected `release`, ensure the announcement discussion is linked:
104+
105+
- Prefer the repository discussion category named `Announcements`.
106+
- If needed, inspect repository discussion categories before updating the release.
107+
- When creating a release, use `discussion_category_name` with `Announcements`.
108+
- When updating an existing release, use the release update API with `discussion_category_name=Announcements`.
109+
- If a discussion is already linked, preserve it.
110+
111+
1. Create the release:
112+
113+
Prerelease:
114+
115+
```bash
116+
gh release create <RELEASE_VERSION> --repo {owner}/{repo} --title '<RELEASE_VERSION>' --prerelease
117+
```
118+
119+
Release:
120+
121+
```bash
122+
gh api repos/{owner}/{repo}/releases -X POST -f tag_name='<RELEASE_VERSION>' -f name='<RELEASE_VERSION>' -F prerelease=false -f discussion_category_name='Announcements'
123+
```
124+
125+
Update existing release to full release and link announcement discussion:
126+
127+
```bash
128+
gh api repos/{owner}/{repo}/releases/<RELEASE_ID> -X PATCH -F prerelease=false -F make_latest=true -f discussion_category_name='Announcements'
129+
```
130+
131+
1. Report:
132+
133+
- Release version
134+
- Release type
135+
- Whether a valid milestone version was found
136+
- Whether the milestone version was confirmed (yes/no)
137+
- Whether the version was milestone-confirmed or user-provided
138+
- Whether the tag already existed
139+
- Whether a GitHub release already existed for the version
140+
- Whether the GitHub release was created or updated successfully
141+
- Whether the release ended as prerelease or full release
142+
- Whether the announcement discussion was linked

.github/skills/git-commit/SKILL.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ determine appropriate type, scope, and message.
1414

1515
## Conventional Commit Format
1616

17-
```
17+
```bash
1818
<type>[optional scope]: <description>
1919

2020
[optional body]
@@ -40,7 +40,7 @@ determine appropriate type, scope, and message.
4040

4141
## Breaking Changes
4242

43-
```
43+
```bash
4444
# Exclamation mark after type/scope
4545
feat!: remove deprecated endpoint
4646

0 commit comments

Comments
 (0)