Skip to content
Development
Command

/draft-pr

Draft PR content and write to 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/draft-pr

Context preview

What this command does when you run it.

Draft PR content and write to PR.md file

Command definition

draft-pr.md
allowed-tools: Bash(git:*), Bash(gh pr list:*), Bash(gh pr view:*), Bash(gh repo view:*), Read(.github/PULL_REQUEST_TEMPLATE.md), Write(PR.md), Edit(PR.md)
denied-tools: Bash(gh pr create:*), Bash(gh pr edit:*)
argument-hint: [additional instructions]
description: Draft PR content and write to PR.md file

Draft PR content with the following additional instructions: $ARGUMENTS

Context

  • Current branch: `!git branch --show-current`
  • Remote tracking: `!git status -sb`
  • Recent commits on this branch: `!git log origin/main..HEAD --oneline`
  • Repository info: `!gh repo view --json owner,name`

Your task

Create a PR draft in `PR.md` file based on the current branch changes.

Steps

1. **Verify branch status**:

  • Ensure current branch is not main/master
  • Check if there are commits to create PR for
  • If no commits or on main branch, inform user and exit

2. **Check for existing PR**:

  • Check if PR already exists: `gh pr list --head $(git branch --show-current)`
  • If PR exists, get current PR details for comparison

3. **Analyze repository PR style**:

  • Search for past PRs: `gh pr list --state merged --limit 10`
  • Analyze recent PRs for:
  • Title format and language
  • Description structure
  • Common patterns

4. **Load PR template**:

  • Read `.github/PULL_REQUEST_TEMPLATE.md` if it exists
  • Use template structure as base

5. **Analyze changes**:

  • Get all commit messages: `git log origin/main..HEAD --pretty=format:"%s"`
  • Get detailed diff if needed: `git diff origin/main..HEAD --stat`
  • Understand the overall purpose of changes

6. **Create PR.md file**:

  • Follow the template structure (Summary, Why, Changes with AS-IS/TO-BE)
  • Write clear title (first line)
  • Write comprehensive description (rest of file)
  • Match the repository's PR language and style
  • Include all relevant context

7. **Show draft to user**:

  • Display the created `PR.md` content
  • Inform user they can edit `PR.md` before creating the PR
  • Suggest using `/create-pr` command next

Important Notes

  • **DO NOT create the actual PR** - only draft the content in PR.md
  • Follow the repository's existing PR style and language
  • Ensure PR.md follows the template format (Summary/Why/Changes)
  • Make the description comprehensive but concise
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