Path Resolution
<skill-root> means the directory containing this SKILL.md.
- Resolve
scripts/... and references/... relative to <skill-root>, not the caller's current working directory.
- When executing local helpers, use explicit paths such as
<skill-root>/scripts/....
Create Pull Request on GitHub from Committed Changes
Context
Git Information
- Current branch:
git branch --show-current
- Remote branches:
git branch -r
- Default branch:
git symbolic-ref --short refs/remotes/origin/HEAD | sed 's@^origin/@@'
- Repository root:
git rev-parse --show-toplevel
- Unpushed commits:
git log origin/$(git branch --show-current)..HEAD --oneline 2>/dev/null || echo "Branch not pushed yet"
- Push status:
git status -sb | head -1
Committed Changes Only
Note: Replace origin/HEAD with origin/<base-branch> if --base=<branch> is specified
- Commits different from base branch:
git log origin/HEAD..HEAD --oneline
- Number of commits ahead:
git rev-list --count origin/HEAD..HEAD
- Files changed in commits:
git diff --name-status origin/HEAD..HEAD
- Lines added/removed:
git diff --shortstat origin/HEAD..HEAD
- Full diff:
git diff origin/HEAD..HEAD
Detailed Commit History
Note: Replace origin/HEAD with origin/<base-branch> if --base=<branch> is specified
- Commit messages with body:
git log origin/HEAD..HEAD --format="### %s%n%n%b%n"
- Commit authors:
git log origin/HEAD..HEAD --format="%an <%ae>" | sort | uniq
PR Templates
- GitHub template:
cat .github/pull_request_template.md 2>/dev/null || echo "No GitHub template"
- Alternative template:
cat .github/PULL_REQUEST_TEMPLATE.md 2>/dev/null || echo ""
Project Information
- README:
cat README.md 2>/dev/null | head -50 || echo "No README"
Language Support
Default: English
--japanese: Creates PR in Japanese
Base Branch Support
Default: Repository's default branch (usually main or master)
--base=: Specify target branch for the pull request
- Use
--base=<branch> to create PR against a specific branch
- Default behavior: Uses repository default branch from
git symbolic-ref --short refs/remotes/origin/HEAD
- Examples:
/create-pr → Creates PR to default branch
/create-pr --base=develop → Creates PR to develop branch
/create-pr --base=release/v2.0 → Creates PR to release branch
/create-pr --japanese --base=develop → Japanese PR to develop branch
Update PR Support
--update: Updates an existing pull request instead of creating a new one
- Use when you've added commits to a branch that already has an open PR
- Finds the existing PR for the current branch
- Updates PR title and description based on all commits
- Useful after addressing review comments or adding more changes
- Examples:
/create-pr --update → Updates existing PR for current branch
/create-pr --update --japanese → Updates PR with Japanese description
- Note: Only works if an open PR exists for the current branch
- If no PR is found, will notify the user (does not create a new PR)
Your Task
Based on the above context (focusing ONLY on committed changes), create and submit a pull request on GitHub:
1. Analyze Committed Changes
- Review all commits between current branch and base branch
- Understand the intent from commit messages and diff
- Identify what changed, why it changed, and how it was verified
- Check for breaking changes, known limitations, and review-order hints
- Notice if the branch mixes unrelated work; if it does, recommend splitting instead of hiding complexity in the PR body
2. Use PR Template If Exists
- Follow template format strictly
- Fill sections based on committed changes only
- Delete empty sections
- Maintain checklist format (- [ ])
3. PR Title and Body Format
- Title: short, specific, standalone summary of what the PR does.
- Prefer imperative wording in English: "Add ...", "Remove ...", "Fix ...".
- Avoid vague titles such as "Fix bug", "Update code", "Phase 1", or "Refactor".
- Body: explain only what reviewers and future readers cannot get cheaply from the diff.
- Always cover: what changed, why it changed, and verification performed.
- Include context, trade-offs, limitations, rollout, follow-ups, or review-order hints only when relevant.
- Do not duplicate changed-file lists, commit classifications, checklist boilerplate, or obvious implementation details.
- If a PR template exists (
.github/pull_request_template.md), follow it strictly but delete empty/non-applicable optional sections when the template allows it.
- Otherwise, use the concise standard format from pr-templates.md.
- For
--japanese, use the Japanese format from the same file.
4. Writing Guidelines
English:
- Use clear, concise English
- Keep code references and file paths as-is
- Be direct and professional
- Prefer short paragraphs and bullets over long prose
- Wrap @ symbols in code/paths with backticks to prevent mentions:
@import, path/@file
Japanese:
- Use appropriate technical Japanese
- Keep English proper nouns (libraries, functions) as-is
- Use clear Japanese without honorifics
- Use ですます調 for paragraph-style sentences
- For bullet points, use だ・である調 or noun-ending style (体言止め)
- Omit final punctuation in bullet points (no
。)
Escaping Rules (Important):
- For GitHub MCP tools (
mcp__github__create_pull_request, mcp__github__update_pull_request):
- Pass
body as raw Markdown text
- Do NOT escape backticks in Markdown (use
`code`, never \code``)
- If generated text contains
\ before backticks, normalize it to plain backticks before tool call
- For
gh CLI commands:
- Prefer
--body-file to avoid shell-escaping issues
- If inline body is unavoidable, use a single-quoted heredoc (
<<'EOF') so backticks are preserved as-is
5. Execution Steps
Standard Flow (Create New PR)
Determine base branch:
- If
--base=<branch> specified: Use the specified branch
- Otherwise: Use repository default branch (
git symbolic-ref --short refs/remotes/origin/HEAD | sed 's@^origin/@@')
Ensure changes are pushed:
git push -u origin [current branch name]
Prepare PR content:
- Generate appropriate title summarizing commits
- Create PR body following template or standard format
- Analyze commits against the determined base branch
- Apply escaping rules based on execution method (MCP vs
gh)
Create pull request:
mcp__github__create_pull_request:
- title: [Generated title in selected language]
- body: [Raw Markdown body in selected language; do NOT escape backticks]
- head: [Current branch]
- base: [Determined base branch from step 0]
After creation:
- Provide PR URL
- Confirm success
- Explain any errors clearly
Update Flow (--update flag)
Get current branch:
git branch --show-current
Find existing PR for current branch:
mcp__github__list_pull_requests:
- state: open
- head: [repository owner]:[current branch]
Verify PR exists:
- If no PR found: Notify user and exit (do NOT create new PR)
- If PR found: Extract PR number and current base branch
Ensure latest changes are pushed:
git push origin [current branch name]
Prepare updated PR content:
- Generate new title summarizing all commits
- Create new PR body following template or standard format
- Analyze all commits against the PR's base branch
- Apply escaping rules based on execution method (MCP vs
gh)
Update pull request:
mcp__github__update_pull_request:
- pull_number: [PR number from step 2]
- title: [Generated title in selected language]
- body: [Raw Markdown body in selected language; do NOT escape backticks]
After update:
- Provide PR URL
- Confirm successful update
- Explain any errors clearly
Important Notes
- ONLY analyze committed changes (ignore uncommitted work)
- Notify if no commits exist between branches
- Focus on what was committed, not work in progress
- Be concise; remove sections that add no reviewer value
- Make the title/body useful as permanent history: specific enough to find later, but not a diff transcript
- Without --update: CREATE new PR using mcp__github__create_pull_request
- With --update: UPDATE existing PR using mcp__github__update_pull_request
- With --update: If no PR exists, notify user and DO NOT create new PR
- Use AskUserQuestionTool when you need clarification on:
- Whether certain commits should be included in the PR
- How to categorize or describe ambiguous changes
- Which base branch to use if not specified and multiple options exist
- If AskUserQuestionTool is unavailable and multiple independent clarifications are needed, ask in a single message using QID labels (
Q1, Q2, ...); require QID: <answer> responses and allow QID: OTHER(<concise detail>) when no option fits
1---2name: create-pr3description: Reviews committed changes and creates a pull request on GitHub. Use when the user wants to create a PR, push changes for review, or open a pull request. Requires a GitHub repository. Supports --japanese flag for Japanese descriptions, --base flag to specify target branch, and --update flag to update an existing PR.4---56## Path Resolution78- `<skill-root>` means the directory containing this `SKILL.md`.9- Resolve `scripts/...` and `references/...` relative to `<skill-root>`, not the caller's current working directory.10- When executing local helpers, use explicit paths such as `<skill-root>/scripts/...`.1112# Create Pull Request on GitHub from Committed Changes1314## Context1516### Git Information17- Current branch: `git branch --show-current`18- Remote branches: `git branch -r`19- Default branch: `git symbolic-ref --short refs/remotes/origin/HEAD | sed 's@^origin/@@'`20- Repository root: `git rev-parse --show-toplevel`21- Unpushed commits: `git log origin/$(git branch --show-current)..HEAD --oneline 2>/dev/null || echo "Branch not pushed yet"`22- Push status: `git status -sb | head -1`2324### Committed Changes Only25**Note**: Replace `origin/HEAD` with `origin/<base-branch>` if `--base=<branch>` is specified2627- Commits different from base branch: `git log origin/HEAD..HEAD --oneline`28- Number of commits ahead: `git rev-list --count origin/HEAD..HEAD`29- Files changed in commits: `git diff --name-status origin/HEAD..HEAD`30- Lines added/removed: `git diff --shortstat origin/HEAD..HEAD`31- Full diff: `git diff origin/HEAD..HEAD`3233### Detailed Commit History34**Note**: Replace `origin/HEAD` with `origin/<base-branch>` if `--base=<branch>` is specified3536- Commit messages with body: `git log origin/HEAD..HEAD --format="### %s%n%n%b%n"`37- Commit authors: `git log origin/HEAD..HEAD --format="%an <%ae>" | sort | uniq`3839### PR Templates40- GitHub template: `cat .github/pull_request_template.md 2>/dev/null || echo "No GitHub template"`41- Alternative template: `cat .github/PULL_REQUEST_TEMPLATE.md 2>/dev/null || echo ""`4243### Project Information44- README: `cat README.md 2>/dev/null | head -50 || echo "No README"`4546## Language Support4748**Default**: English49**--japanese**: Creates PR in Japanese5051## Base Branch Support5253**Default**: Repository's default branch (usually `main` or `master`)54**--base=<branch>**: Specify target branch for the pull request5556- Use `--base=<branch>` to create PR against a specific branch57- Default behavior: Uses repository default branch from `git symbolic-ref --short refs/remotes/origin/HEAD`58- Examples:59 - `/create-pr` → Creates PR to default branch60 - `/create-pr --base=develop` → Creates PR to develop branch61 - `/create-pr --base=release/v2.0` → Creates PR to release branch62 - `/create-pr --japanese --base=develop` → Japanese PR to develop branch6364## Update PR Support6566**--update**: Updates an existing pull request instead of creating a new one6768- Use when you've added commits to a branch that already has an open PR69- Finds the existing PR for the current branch70- Updates PR title and description based on all commits71- Useful after addressing review comments or adding more changes72- Examples:73 - `/create-pr --update` → Updates existing PR for current branch74 - `/create-pr --update --japanese` → Updates PR with Japanese description75- **Note**: Only works if an open PR exists for the current branch76- If no PR is found, will notify the user (does not create a new PR)7778## Your Task7980Based on the above context (focusing ONLY on committed changes), create and submit a pull request on GitHub:8182### 1. Analyze Committed Changes83- Review all commits between current branch and base branch84- Understand the intent from commit messages and diff85- Identify what changed, why it changed, and how it was verified86- Check for breaking changes, known limitations, and review-order hints87- Notice if the branch mixes unrelated work; if it does, recommend splitting instead of hiding complexity in the PR body8889### 2. Use PR Template If Exists90- Follow template format strictly91- Fill sections based on committed changes only92- Delete empty sections93- Maintain checklist format (- [ ])9495### 3. PR Title and Body Format9697- Title: short, specific, standalone summary of what the PR does.98 - Prefer imperative wording in English: "Add ...", "Remove ...", "Fix ...".99 - Avoid vague titles such as "Fix bug", "Update code", "Phase 1", or "Refactor".100- Body: explain only what reviewers and future readers cannot get cheaply from the diff.101 - Always cover: what changed, why it changed, and verification performed.102 - Include context, trade-offs, limitations, rollout, follow-ups, or review-order hints only when relevant.103 - Do not duplicate changed-file lists, commit classifications, checklist boilerplate, or obvious implementation details.104- If a PR template exists (`.github/pull_request_template.md`), follow it strictly but delete empty/non-applicable optional sections when the template allows it.105- Otherwise, use the concise standard format from [pr-templates.md](references/pr-templates.md).106- For `--japanese`, use the Japanese format from the same file.107108### 4. Writing Guidelines109110**English:**111- Use clear, concise English112- Keep code references and file paths as-is113- Be direct and professional114- Prefer short paragraphs and bullets over long prose115- Wrap @ symbols in code/paths with backticks to prevent mentions: `@import`, `path/@file`116117**Japanese:**118- Use appropriate technical Japanese119- Keep English proper nouns (libraries, functions) as-is120- Use clear Japanese without honorifics121- Use ですます調 for paragraph-style sentences122- For bullet points, use だ・である調 or noun-ending style (体言止め)123- Omit final punctuation in bullet points (no `。`)124125**Escaping Rules (Important):**126- For GitHub MCP tools (`mcp__github__create_pull_request`, `mcp__github__update_pull_request`):127 - Pass `body` as raw Markdown text128 - Do NOT escape backticks in Markdown (use `` `code` ``, never `\`code\``)129 - If generated text contains `\` before backticks, normalize it to plain backticks before tool call130- For `gh` CLI commands:131 - Prefer `--body-file` to avoid shell-escaping issues132 - If inline body is unavoidable, use a single-quoted heredoc (`<<'EOF'`) so backticks are preserved as-is133134### 5. Execution Steps135136#### Standard Flow (Create New PR)1371380. **Determine base branch**:139 - If `--base=<branch>` specified: Use the specified branch140 - Otherwise: Use repository default branch (`git symbolic-ref --short refs/remotes/origin/HEAD | sed 's@^origin/@@'`)1411421. **Ensure changes are pushed**:143 ```bash144 git push -u origin [current branch name]145 ```1461472. **Prepare PR content**:148 - Generate appropriate title summarizing commits149 - Create PR body following template or standard format150 - Analyze commits against the determined base branch151 - Apply escaping rules based on execution method (MCP vs `gh`)1521533. **Create pull request**:154 ```155 mcp__github__create_pull_request:156 - title: [Generated title in selected language]157 - body: [Raw Markdown body in selected language; do NOT escape backticks]158 - head: [Current branch]159 - base: [Determined base branch from step 0]160 ```1611624. **After creation**:163 - Provide PR URL164 - Confirm success165 - Explain any errors clearly166167#### Update Flow (--update flag)1681690. **Get current branch**:170 ```bash171 git branch --show-current172 ```1731741. **Find existing PR for current branch**:175 ```176 mcp__github__list_pull_requests:177 - state: open178 - head: [repository owner]:[current branch]179 ```1801812. **Verify PR exists**:182 - If no PR found: Notify user and exit (do NOT create new PR)183 - If PR found: Extract PR number and current base branch1841853. **Ensure latest changes are pushed**:186 ```bash187 git push origin [current branch name]188 ```1891904. **Prepare updated PR content**:191 - Generate new title summarizing all commits192 - Create new PR body following template or standard format193 - Analyze all commits against the PR's base branch194 - Apply escaping rules based on execution method (MCP vs `gh`)1951965. **Update pull request**:197 ```198 mcp__github__update_pull_request:199 - pull_number: [PR number from step 2]200 - title: [Generated title in selected language]201 - body: [Raw Markdown body in selected language; do NOT escape backticks]202 ```2032046. **After update**:205 - Provide PR URL206 - Confirm successful update207 - Explain any errors clearly208209## Important Notes210- ONLY analyze committed changes (ignore uncommitted work)211- Notify if no commits exist between branches212- Focus on what was committed, not work in progress213- Be concise; remove sections that add no reviewer value214- Make the title/body useful as permanent history: specific enough to find later, but not a diff transcript215- **Without --update**: CREATE new PR using mcp__github__create_pull_request216- **With --update**: UPDATE existing PR using mcp__github__update_pull_request217- **With --update**: If no PR exists, notify user and DO NOT create new PR218- **Use AskUserQuestionTool** when you need clarification on:219 - Whether certain commits should be included in the PR220 - How to categorize or describe ambiguous changes221 - Which base branch to use if not specified and multiple options exist222 - If AskUserQuestionTool is unavailable and multiple independent clarifications are needed, ask in a single message using QID labels (`Q1`, `Q2`, ...); require `QID: <answer>` responses and allow `QID: OTHER(<concise detail>)` when no option fits