Get the FREE Ultimate OpenClaw Setup Guide →

gh-pr-create

npx machina-cli add skill dceoy/github-cli-agent-skills/gh-pr-create --openclaw
Files (1)
SKILL.md
1.4 KB

GitHub PR Create

When to use

  • The user asks to open a pull request.
  • You need to create a draft or request reviews.

Inputs to confirm

  • Base branch and head branch (if not current).
  • Title/body or whether to use --fill.
  • Draft status, reviewers, labels, assignees, milestone, project.
  • Target repo if not current (--repo OWNER/REPO).

Workflow

  1. Verify auth:
    gh --version
    gh auth status
    
  2. Create the PR:
    gh pr create --title "Fix auth" --body "Fixes #123" --base main
    gh pr create --fill --draft --reviewer "alice"
    
  3. Optional: web flow or template:
    gh pr create --web
    gh pr create --template "pull_request_template.md"
    

Examples

# Draft PR with auto-filled title/body
~ gh pr create --fill --draft

Notes

  • Mention Fixes #123 / Closes #123 in the PR body to auto-close issues on merge.
  • --head supports user:branch to target a fork.
  • Adding to projects may require gh auth refresh -s project.

References

Source

git clone https://github.com/dceoy/github-cli-agent-skills/blob/main/skills/gh-pr-create/SKILL.mdView on GitHub

Overview

gh-pr-create automates creating GitHub pull requests via the gh CLI, including draft status, reviewers, labels, assignees, milestones, and projects. It helps teams open PRs consistently and attach essential metadata to streamline collaboration.

How This Skill Works

The skill verifies gh is installed and authenticated, then builds a gh pr create command using the specified base/head, title/body (or --fill), and optional flags for draft (--draft), reviewer (--reviewer), label (--label), assignee (--assignee), milestone (--milestone), and project (--project). It also supports targeting a different repository with --repo and offers web or template flows as alternatives.

When to Use It

  • When the user asks to open a pull request from a feature branch.
  • When you need to create a draft PR or to request reviews from teammates.
  • When you want to attach metadata like labels, reviewers, assignees, milestones, or a project.
  • When targeting a different repo or a fork using --repo and --head.
  • When you prefer auto-filled title/body or want to use a PR template or web flow.

Quick Start

  1. Step 1: Verify gh is installed and authenticated (gh --version; gh auth status).
  2. Step 2: Create PR with base/head and title/body (or use --fill).
  3. Step 3: Attach optional metadata (--draft, --reviewer, --label, --assignee, --milestone, --project) or use --web / --template if desired.

Best Practices

  • Confirm base and head branches before running gh pr create.
  • Use --fill to auto-fill title/body when drafting, or provide explicit --title and --body.
  • Include reviewers, labels, assignees, milestone, and project to route PRs effectively.
  • Use --repo and --head for cross-repo PRs; ensure you have access to the target repo.
  • Mention Fixes #123 or Closes #123 in the body to auto-close related issues.

Example Use Cases

  • Draft PR with auto-filled title/body: gh pr create --fill --draft
  • PR with explicit title/body and base: gh pr create --title 'Fix login' --body 'Details here' --base main
  • PR with reviewer and label: gh pr create --reviewer alice --label needs-review
  • PR to a fork: gh pr create --head user:feature --repo owner/repo
  • PR using a template: gh pr create --template pull_request_template.md

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers