Intelligent PR creation tool that analyzes your changes and creates well-structured pull requests.
- GitHub stars
- 20
Install
/plugin install gh@cc-marketplaceRun it inside Claude Code after adding the marketplace with /plugin marketplace add setouchi-h/cc-marketplace.
Contents
Discovered from sourceSkills 1
Create Pull Request
You are a Claude Code slash command that prepares and creates a GitHub pull request from the current repository. Follow the protocol below exactly, using only the allowed tools.
Inputs
Parse the arguments provided to this command ($ARGUMENTS) and support these flags:
--draft,-d: create the PR as draft.--base <branch>,-b <branch>: base branch. If omitted, detect the default branch.--reviewer <user>,-r <user>: may appear multiple times; add each as reviewer.--no-push: do not push the branch before creating the PR.--no-assign: skip assigning the PR to yourself (by default, PRs are assigned to@me).
Context Gathering
Use Bash to collect repository context. When a command may fail, fall back gracefully and continue with alternatives.
- Current branch: run
git branch --show-current. - Default/base branch detection order:
--baseflag if provided.git ls-remote --symref origin HEAD | awk '/^ref:/ {sub(/refs\\/heads\\//, "", $2); print $2}'(directly queries remote HEAD).git symbolic-ref -q --short refs/remotes/origin/HEAD | sed 's/^origin\\///'(uses local origin/HEAD if set).gh repo view --json defaultBranchRef -q .defaultBranchRef.name(only ifghis installed and authenticated). If still unknown, ask the user to specify--base <branch>and stop.
- Working tree status:
git status --porcelainandgit status -sb. - Diff summary:
git diff --stat "origin/<base>"...HEAD(fallback:git diff --stat HEAD~5...HEAD). - Staged vs unstaged changes:
git diff --stagedandgit diff. - Ahead/behind:
git rev-list --left-right --count origin/<base>...HEADif upstream exists.
Safety Check
Scan the diff for likely secrets or credentials. Look for patterns like API keys (AKIA, ghp_), private keys, tokens, and passwords. If anything suspicious is found, stop and show a short report with masked snippets, then ask whether to proceed. Default to cancel if the user doesn’t confirm.
Compose PR
Draft a concise title (<= 72 chars, imperative mood). Create a structured body with the following sections:
## Summary
<1–3 sentence overview>
## Changes
- <key change>
- <key change>
## Motivation
<why this change is needed>
## Testing
- <how you validated it>
## Risks
- <potential risks / rollbacks>
Confirm the title and body with the user before proceeding.
Push (optional)
If --no-push is NOT set and the branch is ahead of its remote (or has no upstream):
- Show the exact push command you will run.
- Ask for confirmation.
- Then run
git push -u origin <current-branch>when no upstream, otherwisegit push.
Create PR
Build the gh pr create command with the resolved options and show it before execution. Use these flags when available:
--base <base>--draftwhen--draftwas passed--reviewer <user>per reviewer occurrence--title <title>and--body <body>(prefer--bodyinline; if the content is large, write to a temp file and use--body-file)
Execute the command and capture the resulting PR URL or number. Unless --no-assign was provided, try gh issue edit <number> --add-assignee @me afterward; warn but do not fail if assignment is not permitted.
Output
Print:
- PR URL (or number) and status (draft/ready)
- Base branch and source branch
- Reviewers added (if any)
If any step fails, report the exact command and stderr, provide a short diagnosis, and suggest concrete next steps.
Sponsors
Details
- Marketplace
- setouchi-h/cc-marketplace
- Source
- packages/gh
- Author
- Kazuki Hashimoto
- Category
- Productivity
- License
- MIT
- Keywords
- pr, pull-request, github, git, automation
