| name | create-pr |
|---|---|
| description | Create GitHub Pull Requests with auto-generated descriptions. Use when user says create PR, make pull request, generate PR, push PR, or auto create PR. Analyzes git diff, extracts ticket from branch name, generates comprehensive PR body. |
Automatically create GitHub Pull Requests using the GitHub CLI with descriptions generated from git diff analysis.
- "create pr" / "create pull request"
- "make pr" / "make pull request"
- "generate pr" / "generate pull request"
- "auto create pr"
- "push pr"
# Check if we're on a branch (not main)
git branch --show-current
# Check if there are uncommitted changes
git status --porcelain
# Check if branch exists on remote
git ls-remote --heads origin $(git branch --show-current)Requirements:
- Must be on a feature branch (not main/master)
- No uncommitted changes (everything should be committed)
- Branch must exist on remote (already pushed)
Parse branch name with regex:
^(?<prefix>feature|feat|fix|bugfix|hotfix|chore|patch|release|refactor|build|ci|test|docs|perf)-(?<ticket>(web|vavo|favo|pay|pro|proapp|markets|rt|user|fe|bug|core|regtech|earn|pr|rwds|qa|pt|defi)-[0-9]*)?-?(?<title>.*)$
Map branch prefix to conventional commit prefix:
feature|feat→feat:fix|bugfix|hotfix→fix:chore→chore:refactor→refactor:docs→docs:test→test:perf→perf:
gh pr list --head $(git branch --show-current) --base main --json numberIf PR exists, offer options: update description, create with different base, or cancel.
Run git fetch origin main && git diff main...HEAD to analyze changes.
Output format (raw markdown only, no explanations):
### Ticket:
[TICKET-123](https://app.clickup.com/t/2566449/TICKET-123)
### Types of changes
- [x] :sparkles: New feature
- [ ] :bug: Bug fix
- [ ] :boom: Breaking change
### Summary
[3-line summary of main changes]
### Detailed Changes
- 3–5 concise bullets max covering the most important behavioral or architectural changes
- Focus on *what changed and why*, not on listing files or components
- Only mention specific files if they are critical to understanding the change (e.g., new modules, deleted files, config changes)
- Skip trivial renames, import adjustments, test-only additions, and minor refactorsOnly add if present:
- Package Updates (added/updated/removed)
- New Storybook Stories
- Feature Flags & Experiments
- Workflow Changes
- Documentation Needs Update
gh pr create \
--title "feat: [TICKET-123] Descriptive Title" \
--body "$(generated_description)" \
--base main \
--head $(git branch --show-current)- Display PR URL and number
- Show next steps (request reviewers, add labels)
Send a notification to Slack with the PR URL and a very brief summary of the changes (1 sentence max, no ticket IDs).
curl -s -X POST \
"https://hooks.slack.com/triggers/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" \
-H "Content-Type: application/json" \
-d '{
"description": "<SUMMARY>",
"pr_url": "<PR_URL>"
}'Replace these placeholders before executing:
<SUMMARY>→ a very short summary of what the PR does (1 sentence, no ticket IDs). Example: "Add SkeletonCell core-ui component for loading states"<PR_URL>→ the full GitHub PR URL returned bygh pr create
This step runs automatically after PR creation — no confirmation needed.
CRITICAL: Before executing this step, you MUST ask the user for explicit confirmation. Show them the ticket ID, the PR URL, and the comment you intend to post, then wait for approval.
This step only runs when:
- A ticket ID was extracted from the branch name (step 2)
- The env var
CLICKUP_AUTH_KEYis available
How to get the API key:
echo "$CLICKUP_AUTH_KEY"If the variable is empty or unset, skip this step and inform the user that the ClickUp update was skipped because CLICKUP_AUTH_KEY is not configured.
Post a comment on the ticket with the PR link:
curl -s -X POST \
"https://api.clickup.com/api/v2/task/TICKET-123/comment?custom_task_ids=true&team_id=2566449" \
-H "Content-Type: application/json" \
-H "Authorization: $CLICKUP_AUTH_KEY" \
-d '{
"comment_text": "🔗 Pull Request created: <PR_URL>\n\n<SHORT_DESCRIPTION>",
"notify_all": false
}'Replace these placeholders before executing:
TICKET-123→ the uppercase ticket ID extracted from the branch (e.g.,DEFI-84)<PR_URL>→ the full GitHub PR URL returned bygh pr create<SHORT_DESCRIPTION>→ a 1–2 sentence summary of the PR changes (reuse the Summary section from the generated PR description)
Example of the confirmation message to show the user:
I'm about to add a comment to ClickUp ticket DEFI-84:
🔗 Pull Request created: https://github.com/org/repo/pull/456
Add empty state to wallet screen when no assets are present.
Proceed? (yes/no)
Only execute the curl commands after the user confirms.
If any API call returns an error, display the response body and inform the user — do not retry automatically.
Move the ticket status to "in review":
After the comment is posted successfully, update the ticket status in the same confirmation scope (no need to ask again).
First, fetch the task to find the status name for "in review" in its space:
curl -s -X GET \
"https://api.clickup.com/api/v2/task/TICKET-123?custom_task_ids=true&team_id=2566449" \
-H "Authorization: $CLICKUP_AUTH_KEY"From the response, read status.status to confirm the current status, and note the task uses custom statuses from its list/space.
Then update the status:
curl -s -X PUT \
"https://api.clickup.com/api/v2/task/TICKET-123?custom_task_ids=true&team_id=2566449" \
-H "Content-Type: application/json" \
-H "Authorization: $CLICKUP_AUTH_KEY" \
-d '{
"status": "in review"
}'Replace TICKET-123 with the same uppercase ticket ID used in the comment step.
If the status update fails (e.g., "in review" is not a valid status in that space), display the error and inform the user — the comment was still posted successfully. Do not retry.
Updated example of the confirmation message:
I'm about to update ClickUp ticket DEFI-84:
1. Add comment:
🔗 Pull Request created: https://github.com/org/repo/pull/456
Add empty state to wallet screen when no assets are present.
2. Move status to "in review"
Proceed? (yes/no)
- Not authenticated:
gh auth login - No GitHub CLI: Install from https://cli.github.com/
- Branch not pushed:
git push -u origin <branch> - On main branch: Switch to feature branch first