Skip to content

Commit b6f992e

Browse files
committed
chore: add .claude/skills/pr/SKILL.md
1 parent 5e15eda commit b6f992e

1 file changed

Lines changed: 106 additions & 0 deletions

File tree

.claude/skills/pr/SKILL.md

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
---
2+
name: pr
3+
description: Push branch and create a GitHub PR with concise, issue-linked description
4+
user-invocable: true
5+
argument-hint: "[#issue]"
6+
disable-model-invocation: true
7+
allowed-tools: Bash, Read, Grep, Glob
8+
---
9+
10+
# Create Pull Request
11+
12+
Push branch and create a PR with a concise, issue-linked description.
13+
14+
## Current Branch Context
15+
- Branch: !`git branch --show-current`
16+
- Commits: !`git log main..HEAD --oneline 2>/dev/null`
17+
- Changed files: !`git diff main..HEAD --stat 2>/dev/null`
18+
19+
## Arguments
20+
- `$ARGUMENTS` - Issue reference (optional, e.g., `#42` or `42`). If provided, the PR will be linked to this issue.
21+
22+
## Instructions
23+
24+
1. **Review the branch context above** — the commits and changed files are already loaded.
25+
26+
2. **Check CHANGELOG.md** — if it wasn't updated for these changes, update it now and commit:
27+
```bash
28+
git add CHANGELOG.md && git commit -m "docs: update changelog"
29+
```
30+
31+
3. **Push branch**:
32+
```bash
33+
git push -u origin HEAD
34+
```
35+
- The `pre-push` git hook automatically runs the full test suite (BE & FE in parallel).
36+
- If the hook fails, read the output, fix the issue, commit the fix, and retry the push. Do NOT use `--no-verify` to bypass.
37+
38+
4. **Generate PR title**:
39+
- If `$ARGUMENTS` contains an issue number, fetch the issue title:
40+
```bash
41+
gh issue view <number> --json title -q '.title'
42+
```
43+
- PR title format: `<type>(<scope>): <short description>` (conventional commit style, under 70 chars)
44+
- Derive the type from the branch prefix (`feat/` → feat, `fix/` → fix, `docs/` → docs)
45+
46+
5. **Create PR** using the template from `.github/PULL_REQUEST_TEMPLATE.md`:
47+
```bash
48+
gh pr create --title "<title>" --assignee @me --label "<label>" --body "$(cat <<'EOF'
49+
## 🤔 Background
50+
51+
Related #<issue-number>
52+
53+
<1-2 sentences: motivation and context for the changes>
54+
55+
## 💡 Changes
56+
57+
- <bullet 1: what changed and why>
58+
- <bullet 2>
59+
- <bullet 3> (optional)
60+
- <bullet 4> (optional)
61+
EOF
62+
)"
63+
```
64+
65+
**MANDATORY:** Always follow the PR template structure (`## 🤔 Background` + `## 💡 Changes`). Never use a different format.
66+
67+
**Assignee:** Always assign to `@me` (the PR creator).
68+
69+
**Labels:** Add the single most relevant label based on the branch prefix and change context:
70+
- `bug` — branch starts with `fix/` and addresses a defect
71+
- `enhancement` — branch starts with `feat/` or adds new functionality
72+
- `documentation` — branch starts with `docs/` or only changes docs
73+
- `refactor` — code restructuring with no behavior change
74+
- `ui` — visual/frontend-only changes
75+
- `investigation` — spikes, research, or exploratory work
76+
77+
**Body guidelines:**
78+
- **Background**: Link the issue with `Related #<number>`, then 1-2 sentences of context. **NEVER use `Closes` or `Fixes`.**
79+
- **Changes**: 2-4 short bullet points. Focus on *what* and *why*, not implementation details.
80+
- **No file lists, no class names, no code snippets** in the body.
81+
- Keep the entire body under 15 lines.
82+
83+
6. **Move issue to "In Review"** in GitHub Project (if issue number provided):
84+
```bash
85+
# Read project config from .claude/github-project.json
86+
ITEM_ID=$(gh project item-list PROJECT_NUMBER --owner OWNER --format json \
87+
| jq -r '.items[] | select(.content.number == ISSUE_NUMBER) | .id')
88+
89+
gh project item-edit \
90+
--id "$ITEM_ID" \
91+
--project-id "PROJECT_ID" \
92+
--field-id "STATUS_FIELD_ID" \
93+
--single-select-option-id "IN_REVIEW_OPTION_ID"
94+
```
95+
96+
**Note:** Requires `project` scope. Run `gh auth refresh -s project` if needed.
97+
98+
7. **Report the PR URL** to the user.
99+
100+
## Example Usage
101+
102+
```
103+
/pr
104+
/pr #42
105+
/pr 15
106+
```

0 commit comments

Comments
 (0)