Skip to content

Commit b726db2

Browse files
committed
Update issue-to-pr skill
1 parent 5d57675 commit b726db2

1 file changed

Lines changed: 143 additions & 0 deletions

File tree

.claude/skills/issue-to-pr.md

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
---
2+
name: issue-to-pr
3+
description: Use when you have a GitHub issue and want to create a PR with an implementation plan that triggers automated execution
4+
---
5+
6+
# Issue to PR
7+
8+
Convert a GitHub issue into an actionable PR with a plan that auto-triggers Claude execution.
9+
10+
## Usage
11+
12+
```
13+
/issue-to-pr <issue-number-or-url>
14+
```
15+
16+
## Workflow
17+
18+
```dot
19+
digraph issue_to_pr {
20+
"Receive issue number" [shape=box];
21+
"Fetch issue with gh" [shape=box];
22+
"Brainstorm with user" [shape=box];
23+
"Write plan file" [shape=box];
24+
"Create branch and PR" [shape=box];
25+
"PR triggers [action]" [shape=doublecircle];
26+
27+
"Receive issue number" -> "Fetch issue with gh";
28+
"Fetch issue with gh" -> "Brainstorm with user";
29+
"Brainstorm with user" -> "Write plan file";
30+
"Write plan file" -> "Create branch and PR";
31+
"Create branch and PR" -> "PR triggers [action]";
32+
}
33+
```
34+
35+
## Steps
36+
37+
### 1. Parse Input
38+
39+
Extract issue number from argument:
40+
- `123` → issue #123
41+
- `https://github.com/owner/repo/issues/123` → issue #123
42+
- `owner/repo#123` → issue #123 in owner/repo
43+
44+
### 2. Fetch Issue
45+
46+
```bash
47+
gh issue view <number> --json title,body,labels,assignees
48+
```
49+
50+
Present issue summary to user.
51+
52+
### 3. Brainstorm Solutions
53+
54+
**REQUIRED:** Invoke `superpowers:brainstorming` skill with the issue context (if superpowers plugin is available). Otherwise, conduct a manual brainstorming discussion with the user.
55+
56+
This ensures:
57+
- User intent is clarified
58+
- Multiple approaches are explored
59+
- Requirements are understood before planning
60+
61+
Do NOT skip brainstorming. Do NOT write a plan without user discussion.
62+
63+
### 4. Write Plan
64+
65+
After brainstorming concludes, write plan to `docs/plans/issue-<number>-<slug>.md`:
66+
67+
```markdown
68+
# <Title from brainstorming>
69+
70+
Issue: #<number>
71+
72+
## Context
73+
<Brief problem statement>
74+
75+
## Approach
76+
<Chosen approach from brainstorming>
77+
78+
## Tasks
79+
1. <Specific implementation task>
80+
2. <Another task>
81+
...
82+
83+
## Acceptance Criteria
84+
- <Criteria from issue/brainstorming>
85+
```
86+
87+
### 5. Create PR
88+
89+
```bash
90+
# Create branch
91+
git checkout -b issue-<number>-<slug>
92+
93+
# Stage only the plan file
94+
git add docs/plans/issue-<number>-<slug>.md
95+
96+
# Commit
97+
git commit -m "Add plan for #<number>: <title>"
98+
99+
# Push
100+
git push -u origin issue-<number>-<slug>
101+
102+
# Create PR with [action] at the BEGINNING
103+
gh pr create --title "Fix #<number>: <title>" --body "[action]
104+
105+
## Summary
106+
<Brief description from brainstorming>
107+
108+
Closes #<number>"
109+
```
110+
111+
**CRITICAL:** The PR body MUST start with `[action]` on the first line. This triggers automated plan execution.
112+
113+
## Example
114+
115+
```
116+
User: /issue-to-pr 42
117+
118+
Claude: Let me fetch issue #42...
119+
120+
[Fetches issue: "Add dark mode support"]
121+
122+
I'll use superpowers:brainstorming to explore this with you.
123+
124+
[Invokes brainstorming - discusses approaches, user preferences, scope]
125+
126+
Based on our discussion, I'll create the plan...
127+
128+
[Writes docs/plans/issue-42-dark-mode.md]
129+
[Creates branch, commits, pushes]
130+
[Creates PR with body starting with "[action]"]
131+
132+
Created PR #45: Fix #42: Add dark mode support
133+
The [action] trigger will automatically execute the plan.
134+
```
135+
136+
## Common Mistakes
137+
138+
| Mistake | Fix |
139+
|---------|-----|
140+
| Skipping brainstorming | Always use superpowers:brainstorming (or manual discussion) first |
141+
| `[action]` not at start | PR body must BEGIN with `[action]` |
142+
| Including code in PR | Only commit the plan file |
143+
| Generic plan | Use specifics from brainstorming |

0 commit comments

Comments
 (0)