Files
everything-claude-code/commands/prp-pr.md
Matt Mo c02d6e9f94 feat: add PRP workflow commands adapted from PRPs-agentic-eng (#848)
* feat: add PRP workflow commands adapted from PRPs-agentic-eng

Add 5 new PRP workflow commands and extend 2 existing commands:

New commands:
- prp-prd.md: Interactive PRD generator with 8 phases
- prp-plan.md: Deep implementation planning with codebase analysis
- prp-implement.md: Plan executor with rigorous validation loops
- prp-commit.md: Quick commit with natural language file targeting
- prp-pr.md: GitHub PR creation from current branch

Extended commands:
- code-review.md: Added GitHub PR review mode alongside local review
- plan.md: Added cross-reference to /prp-plan for deeper planning

Adapted from PRPs-agentic-eng by Wirasm. Sub-agents remapped to
inline Claude instructions. ECC conventions applied throughout
(YAML frontmatter, Phase headings, tables, no XML tags).

Artifacts stored in .claude/PRPs/{prds,plans,reports,reviews}/.

* fix: address PR #848 review feedback

- Remove external URLs from all 6 command files (keep attribution text)
- Quote $ARGUMENTS in prp-implement.md to handle paths with spaces
- Fix empty git add expansion in prp-commit.md (use xargs -r)
- Rewrite sub-agent language in prp-prd.md as direct instructions
- Fix code-review.md: add full-file fetch for PR reviews, replace
  || fallback chains with project-type detection, use proper GitHub
  API for inline review comments
- Fix nested backticks in prp-plan.md Plan Template (use 4-backtick fence)
- Clarify $ARGUMENTS parsing in prp-pr.md for base branch + flags
- Fix fragile integration test pattern in prp-implement.md (proper
  PID tracking, wait-for-ready loop, clean shutdown)

* fix: address second-pass review feedback on PR #848

- Add required 'side' field to GitHub review comments API call (code-review.md)
- Replace GNU-only xargs -r with portable alternative (prp-commit.md)
- Add failure check after server readiness timeout (prp-implement.md)
- Fix unsafe word-splitting in file-fetch loop using read -r (code-review.md)
- Make git reset pathspec tolerant of zero matches (prp-commit.md)
- Quote PRD file path in cat command (prp-plan.md)
- Fix plan filename placeholder inconsistency (prp-plan.md)
- Add PR template directory scan before fixed-path fallbacks (prp-pr.md)
2026-03-31 14:12:23 -07:00

4.6 KiB

description: Create a GitHub PR from current branch with unpushed commits — discovers templates, analyzes changes, pushes argument-hint: [base-branch] (default: main)

Create Pull Request

Adapted from PRPs-agentic-eng by Wirasm. Part of the PRP workflow series.

Input: $ARGUMENTS — optional, may contain a base branch name and/or flags (e.g., --draft).

Parse $ARGUMENTS:

  • Extract any recognized flags (--draft)
  • Treat remaining non-flag text as the base branch name
  • Default base branch to main if none specified

Phase 1 — VALIDATE

Check preconditions:

git branch --show-current
git status --short
git log origin/<base>..HEAD --oneline
Check Condition Action if Failed
Not on base branch Current branch ≠ base Stop: "Switch to a feature branch first."
Clean working directory No uncommitted changes Warn: "You have uncommitted changes. Commit or stash first. Use /prp-commit to commit."
Has commits ahead git log origin/<base>..HEAD not empty Stop: "No commits ahead of <base>. Nothing to PR."
No existing PR gh pr list --head <branch> --json number is empty Stop: "PR already exists: #. Use gh pr view <number> --web to open it."

If all checks pass, proceed.


Phase 2 — DISCOVER

PR Template

Search for PR template in order:

  1. .github/PULL_REQUEST_TEMPLATE/ directory — if exists, list files and let user choose (or use default.md)
  2. .github/PULL_REQUEST_TEMPLATE.md
  3. .github/pull_request_template.md
  4. docs/pull_request_template.md

If found, read it and use its structure for the PR body.

Commit Analysis

git log origin/<base>..HEAD --format="%h %s" --reverse

Analyze commits to determine:

  • PR title: Use conventional commit format with type prefix — feat: ..., fix: ..., etc.
    • If multiple types, use the dominant one
    • If single commit, use its message as-is
  • Change summary: Group commits by type/area

File Analysis

git diff origin/<base>..HEAD --stat
git diff origin/<base>..HEAD --name-only

Categorize changed files: source, tests, docs, config, migrations.

PRP Artifacts

Check for related PRP artifacts:

  • .claude/PRPs/reports/ — Implementation reports
  • .claude/PRPs/plans/ — Plans that were executed
  • .claude/PRPs/prds/ — Related PRDs

Reference these in the PR body if they exist.


Phase 3 — PUSH

git push -u origin HEAD

If push fails due to divergence:

git fetch origin
git rebase origin/<base>
git push -u origin HEAD

If rebase conflicts occur, stop and inform the user.


Phase 4 — CREATE

With Template

If a PR template was found in Phase 2, fill in each section using the commit and file analysis. Preserve all template sections — leave sections as "N/A" if not applicable rather than removing them.

Without Template

Use this default format:

## Summary

<1-2 sentence description of what this PR does and why>

## Changes

<bulleted list of changes grouped by area>

## Files Changed

<table or list of changed files with change type: Added/Modified/Deleted>

## Testing

<description of how changes were tested, or "Needs testing">

## Related Issues

<linked issues with Closes/Fixes/Relates to #N, or "None">

Create the PR

gh pr create \
  --title "<PR title>" \
  --base <base-branch> \
  --body "<PR body>"
  # Add --draft if the --draft flag was parsed from $ARGUMENTS

Phase 5 — VERIFY

gh pr view --json number,url,title,state,baseRefName,headRefName,additions,deletions,changedFiles
gh pr checks --json name,status,conclusion 2>/dev/null || true

Phase 6 — OUTPUT

Report to user:

PR #<number>: <title>
URL: <url>
Branch: <head> → <base>
Changes: +<additions> -<deletions> across <changedFiles> files

CI Checks: <status summary or "pending" or "none configured">

Artifacts referenced:
  - <any PRP reports/plans linked in PR body>

Next steps:
  - gh pr view <number> --web   → open in browser
  - /code-review <number>       → review the PR
  - gh pr merge <number>        → merge when ready

Edge Cases

  • No gh CLI: Stop with: "GitHub CLI (gh) is required. Install: https://cli.github.com/"
  • Not authenticated: Stop with: "Run gh auth login first."
  • Force push needed: If remote has diverged and rebase was done, use git push --force-with-lease (never --force).
  • Multiple PR templates: If .github/PULL_REQUEST_TEMPLATE/ has multiple files, list them and ask user to choose.
  • Large PR (>20 files): Warn about PR size. Suggest splitting if changes are logically separable.