Skip to content

Commit 3d5befb

Browse files
committed
docs(prompts): add reusable issue-from-branch prompt template
1 parent 4eb5321 commit 3d5befb

1 file changed

Lines changed: 103 additions & 0 deletions

File tree

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# Create Issue From Branch Changes
2+
3+
Create or update a GitHub issue from the changes in the current branch compared to main.
4+
5+
## Requirements
6+
7+
1. Compare changes from origin/main..HEAD and infer the user-facing goal.
8+
2. Do not include implementation details (no file lists, refactor notes, internal mechanics).
9+
3. Ask before editing the issue:
10+
- Which label should be used?
11+
- Which milestone should be used?
12+
4. Defaults:
13+
- If label is not provided, use improvement.
14+
- If milestone is not provided, use the latest open milestone.
15+
5. The issue description must be well-formatted Markdown.
16+
6. Use this Markdown structure exactly (omit empty sections):
17+
- ## Summary
18+
- ## Goal
19+
- ## Success Criteria
20+
- ## References
21+
7. Keep language concise, goal-oriented, and user-facing.
22+
23+
## Operational Steps
24+
25+
1. Ensure branch comparison is up to date:
26+
27+
```bash
28+
git fetch origin main --quiet
29+
git log --oneline --no-merges origin/main..HEAD
30+
git diff --name-status origin/main..HEAD
31+
```
32+
33+
2. Ask:
34+
- Label? (default: improvement)
35+
- Milestone? (default: latest open milestone)
36+
37+
3. Resolve defaults:
38+
39+
```bash
40+
LABEL="${LABEL:-improvement}"
41+
42+
if [ -z "$MILESTONE" ]; then
43+
MILESTONE="$(gh api repos/{owner}/{repo}/milestones --paginate -f state=open --jq 'sort_by(.number) | last | .title')"
44+
fi
45+
```
46+
47+
4. Build a well-formatted Markdown body in a temp file:
48+
49+
```bash
50+
cat > /tmp/issue-body.md <<'EOF'
51+
## Summary
52+
<goal-focused summary>
53+
54+
## Goal
55+
<what outcome we want>
56+
57+
## Success Criteria
58+
- <criterion 1>
59+
- <criterion 2>
60+
61+
## References
62+
- <optional links>
63+
EOF
64+
```
65+
66+
5. Suggest a title in this style:
67+
- [IMPROVEMENT]: <goal-focused title>
68+
- Adapt prefix to selected label where appropriate (for example: [FEATURE]: ...).
69+
70+
6. Create or update issue:
71+
72+
Create:
73+
74+
```bash
75+
gh issue create \
76+
--title "<TITLE>" \
77+
--label "$LABEL" \
78+
--milestone "$MILESTONE" \
79+
--body-file /tmp/issue-body.md
80+
```
81+
82+
Update existing:
83+
84+
```bash
85+
gh issue edit <ISSUE_NUMBER> \
86+
--title "<TITLE>" \
87+
--add-label "$LABEL" \
88+
--milestone "$MILESTONE" \
89+
--body-file /tmp/issue-body.md
90+
```
91+
92+
7. Verify and report final state:
93+
94+
```bash
95+
gh issue view <ISSUE_NUMBER> --json number,title,url,labels,milestone,body
96+
```
97+
98+
Report:
99+
- Issue number and URL
100+
- Final title
101+
- Final label(s)
102+
- Final milestone
103+
- Confirmation that body is well-formatted Markdown and goal-focused

0 commit comments

Comments
 (0)