Skip to main content
command CX Codex

pr — Claude Code command: create pull requests

A Claude Code command that creates a pull request from the current branch to a target branch. Verifies local checks and CI workflows before submitting the PR to GitHub.

MIT ★ 907 updated 2025-11-12

Install into Claude Code · Manually: put the files in place All methods and platforms ↓
.claude/commands/pr.md
Open on GitHub

What pr does

This command automates pull request creation via GitHub CLI. It first confirms that local checks—/review and /security-scan—have passed, and verifies that the ci-commit-branch-guard and ci-quality-gate workflows succeeded for your current branch.

Once validated, it creates the PR with a conventional commit title, fills the body from .github/pull_request_template.md (or generates a summary with Context, Testing, and Security results), adds the status: in-review label, and outputs the PR link. Requires GitHub CLI (gh) installed and authenticated.

What it helps with

  • submit a pull request to the target branch from Claude Code
  • verify local checks and CI passed before creating a PR
  • populate PR description from a template automatically
  • add labels and share the link with reviewers

Example prompts for the agent

  • /pr main
  • /pr develop
  • /pr

How to install pr

Manually: put the files in place

.claude/commands/pr.md

Call it with /pr. For all projects use ~/.claude/commands/

Questions about pr

How do I install pr in Claude Code?

Place the command file at .claude/commands/pr.md in your project. It will then be available as /pr in Claude Code.

What does the pr command do?

It creates a pull request from your current branch. First, it checks that local verifications (/review, /security-scan) and GitHub CI workflows have passed, then creates the PR with a description from your template and adds a status label.

What argument should I pass to the command?

Specify the target branch, such as /pr main or /pr develop. If omitted, it defaults to main. The source branch is determined automatically from the current git branch.

Source text

pr.md · MIT
---
description: Create a pull request from the current branch.
argument-hint: [target-branch]
---

## Variables

TARGET_BRANCH: $1 (defaults to `main`)
SOURCE_BRANCH: current branch (`git branch --show-current`)

## Workflow

1. Ensure `/review` and `/security-scan` have passed locally.
2. Confirm `ci-commit-branch-guard` and `ci-quality-gate` workflows succeeded for `SOURCE_BRANCH`.
3. Create the PR using GitHub CLI:
   ```bash
   gh pr create \
     --base "$TARGET_BRANCH" \
     --head "$SOURCE_BRANCH" \
     --title "<Conventional PR title>" \
     --body-file .github/pull_request_template.md
   ```
   If no template exists, provide a summary referencing Context, Testing, and Security results.
4. Add labels (`gh pr edit --add-label "status: in-review"`).
5. Share the PR link with reviewers and ensure at least one human approval is obtained.

© alirezarezvani · MIT · alirezarezvani/claude-code-skill-factory

Similar slash commands

All slash commands for Code review and refactoring →

From the same set36

The whole set →

Project sponsors

Companies that keep this analytics open