/pr - Pull Request Creation Skill
Create Pull Requests that pass CI before creation and target the correct branch.
Language Requirement
IMPORTANT: All Pull Requests MUST be written in English.
- PR title: English
- PR body: English
- Commit messages: English
Pre-flight Checks (MANDATORY)
Before creating a PR, ALL of the following checks MUST pass:
bash
1cargo fmt --all -- --check
If this fails, run cargo fmt --all to fix and commit the changes.
2. Clippy Check
bash
1cargo clippy --all-targets --all-features -- -D warnings
CRITICAL: Zero warnings required. Fix all issues before proceeding.
3. Test Suite
All tests must pass.
Steps
Step 1: Run Pre-flight Checks
Execute all three checks above. If any fail:
- Fix the issues
- Commit the fixes using
/commit skill
- Re-run the checks until all pass
Step 2: Verify Branch Status
bash
1# Check current branch
2git branch --show-current
3
4# Check if up to date with remote
5git status
Verify:
Step 3: Determine Base Branch
CRITICAL: This project uses develop as the integration branch.
| Branch Type | Base Branch |
|---|
| feature/* | develop |
| bugfix/* | develop |
| docs/* | develop |
| refactor/* | develop |
| hotfix/* | main |
| release/* | main |
Branch Creation Rule: Always create new branches from origin/develop:
bash
1git fetch origin
2git checkout -b feature/<issue>-<desc> origin/develop
Step 4: Review Changes
bash
1# See all commits that will be in the PR
2git log origin/develop..HEAD --oneline
3
4# See the diff
5git diff origin/develop...HEAD
Step 5: Push to Remote
bash
1git push -u origin $(git branch --show-current)
Step 6: Create Pull Request
Use the following template:
bash
1gh pr create --base develop --title "TITLE" --body "$(cat <<'EOF'
2## Summary
3[1-3 bullet points summarizing the changes]
4
5## Related Issue
6Closes #XX
7
8## Changes Made
9- [Change 1]
10- [Change 2]
11- [Change 3]
12
13## Test Plan
14- [ ] `cargo test --all` passes
15- [ ] `cargo clippy --all-targets --all-features -- -D warnings` passes
16- [ ] Manual testing performed (if applicable)
17
18## Screenshots (if applicable)
19[Add screenshots for UI changes]
20
21---
22Generated with [Claude Code](https://claude.com/claude-code)
23EOF
24)"
Step 7: Verify PR Creation
After creation:
- Output the PR URL
- Verify CI is running:
gh pr checks
- Report status to user
Error Handling
Pre-flight Check Failures
If any pre-flight check fails:
- Format failure: Run
cargo fmt --all, commit, retry
- Clippy failure: Fix warnings, commit, retry
- Test failure: Fix tests, commit, retry
NEVER create a PR if pre-flight checks fail.
Push Failures
If push fails:
- Check if branch exists on remote
- Check for conflicting changes
- Pull and resolve conflicts if needed
PR Creation Failures
If gh pr create fails:
- Check authentication:
gh auth status
- Check if PR already exists:
gh pr list
- Report error details to user
Example Usage
User: "PRを作成して"
Claude executes /pr skill:
- Runs
cargo fmt --all -- --check (passes)
- Runs
cargo clippy --all-targets --all-features -- -D warnings (passes)
- Runs
cargo test --all (passes)
- Verifies branch is
feature/84-agent-skills
- Determines base branch is
develop
- Pushes to remote
- Creates PR with English title and body (base: develop)
- Reports PR URL to user