Skip to content
Development
Command

/create-pr

Create or update PR from PR.md file

From plugin
ccexp
2713 skills3 commands

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/create-pr

Context preview

What this command does when you run it.

Create or update PR from PR.md file

Command definition

create-pr.md
allowed-tools: Bash(git status:*), Bash(git branch:*), Bash(gh pr list:*), Bash(gh pr view:*), Read(PR.md)
argument-hint: [additional instructions]
description: Create or update PR from PR.md file

Create or update PR with the following additional instructions: $ARGUMENTS

Context

  • Current branch: `!git branch --show-current`
  • Remote tracking: `!git status -sb`
  • PR draft file exists: `!test -f PR.md && echo "Yes" || echo "No"`

Your task

Create or update a GitHub pull request based on the content in `PR.md` file.

Steps

1. **Verify prerequisites**:

  • Ensure `PR.md` file exists
  • If not, suggest running `/draft-pr` first
  • Check current branch is not main/master

2. **Verify branch is pushed**:

  • Check if current branch is pushed to remote
  • If not pushed: `git push -u origin $(git branch --show-current)`

3. **Check for existing PR**:

  • Check if PR already exists: `gh pr list --head $(git branch --show-current)`
  • Store PR number if exists

4. **Read PR.md content**:

  • Read the `PR.md` file
  • First line is the title
  • Remaining lines are the body

5. **Show PR content to user**:

  • Display the title and body from PR.md
  • If updating existing PR, show what will change
  • Ask for explicit user approval:
  • For new PR: "Would you like to create this PR? (You can edit PR.md first if needed)"
  • For update: "Would you like to update PR #XXX with this content? (You can edit PR.md first if needed)"

6. **Wait for user approval**:

  • MUST get explicit "yes" or confirmation from user
  • If user wants to edit, wait for them to finish

7. **Create or update PR** (only after approval):

  • If creating new PR:
     gh pr create --title "$(head -n1 PR.md)" --body "$(tail -n+2 PR.md)"
  • If updating existing PR:
     gh pr edit [PR_NUMBER] --title "$(head -n1 PR.md)" --body "$(tail -n+2 PR.md)"

8. **Show result**:

  • Display the PR URL
  • Confirm success

Important Notes

  • **NEVER create/update PR without explicit user approval**
  • Always show what will be created/updated before proceeding
  • Remind user they can edit PR.md before approval
  • If PR.md doesn't exist, guide user to run `/draft-pr` first
  • Ensure branch is pushed before creating PR
Read more
Ships withccexp

Interactive CLI tool for exploring and managing Claude Code settings and slash commands

Get the whole plugin
Stats
271
Stars
9
Forks
Active
Maintenance
TypeScript
Language
MIT
License
2d ago
Last commit
1y ago
Created

Repo: nyatinte/ccexp