Create PR for Plan-Based Changes
Prepare commits on the current feature branch, push, and create or update a PR to main.
Read ~/.claude/skills/shared/bash-rules.md for bash command constraints.
Context
- Repo root: !
git rev-parse --show-toplevel 2>/dev/null || pwd
- Current branch: !
git rev-parse --abbrev-ref HEAD
- Working tree status: !
git status --short
- Commits ahead of main: !
git log main..HEAD --oneline
Working directory
docs/plans/, .ralphex/progress/, and any other file paths in this skill are relative to Repo root from Context. The cwd may be a subdirectory — prefix Repo root when calling Read/Glob/Grep/ls. Bare paths are cwd-relative and will silently miss plans and progress logs at the actual root.
Workflow
Step 1: Gather context
Use Current branch from context. If on main, abort — the user must check out the feature branch first.
Use Working tree status and Commits ahead of main from context. Abort if there are no commits ahead of main and no uncommitted changes.
Find the latest completed plan doc — look in docs/plans/completed/ for the most recently created file whose name relates to the current branch or the work described in the commits.
Find the matching progress log in .ralphex/progress/.
Read the plan and progress log to understand the scope and intent of the changes.
Step 2: Prepare commits
Reset commits back to the working tree and use /commit to create clean, atomic commits:
Run /reset — let the user choose which commits to reset.
Run /commit. It handles everything: diff analysis, atomic grouping, commit messages, import optimization, doc updates. Pass the plan doc and progress log context so it can write informed messages.
Step 3: Rebase onto main
Ensure commits are based on the latest main so pr-merge can fast-forward:
git fetch origin main
git rebase main
If the rebase produces conflicts, stop and ask the user to resolve them.
Step 4: Push and create/update PR
Push the branch. Use --force-with-lease if the remote branch already exists (commits were reset and recommitted):
git push -u origin <branch-name> --force-with-lease
For a new remote branch, a regular push works too — --force-with-lease is safe either way.
Draft the PR description. The PR body should be more detailed than the commit message — it is the primary review artifact. Build it from the plan doc, diff, and progress log:
- Overview: 2-3 sentences on what this PR accomplishes and why (from the plan's Overview section)
- What changed: bulleted list of concrete changes grouped by area (new modules, modified behavior, structural changes, test coverage). Derive from the diff, not just the plan — if the implementation added things not in the original plan, include them here.
- Design decisions: key trade-offs and rationale (from plan's Design Notes). Highlight anything a reviewer should pay attention to.
- Scope reconciliation: compare the plan against the actual diff. If the implementation diverged from the plan (added features, dropped features, changed approach), note the differences and why.
- Plan reference: link to the plan document filename
- Test coverage: summary of test files and what they cover
Check if a PR already exists for this branch: gh pr view --json number,title,url. If the command fails, no PR exists.
If no PR exists — create one:
gh pr create --base main --title "<title>" --body "<PR description>"
If a PR already exists — update it with the new description:
gh pr edit --title "<title>" --body "<PR description>"
Report the PR URL to the user.
1---2name: pr-create3description: Prepare commits for the current feature branch, push, and create or update a PR to main.4---56# Create PR for Plan-Based Changes78Prepare commits on the current feature branch, push, and create or update a PR to main.910Read `~/.claude/skills/shared/bash-rules.md` for bash command constraints.1112## Context13- Repo root: !`git rev-parse --show-toplevel 2>/dev/null || pwd`14- Current branch: !`git rev-parse --abbrev-ref HEAD`15- Working tree status: !`git status --short`16- Commits ahead of main: !`git log main..HEAD --oneline`1718## Working directory1920`docs/plans/`, `.ralphex/progress/`, and any other file paths in this skill are relative to **Repo root** from Context. The cwd may be a subdirectory — prefix Repo root when calling Read/Glob/Grep/ls. Bare paths are cwd-relative and will silently miss plans and progress logs at the actual root.2122## Workflow2324### Step 1: Gather context25261. Use **Current branch** from context. If on `main`, abort — the user must check out the feature branch first.27282. Use **Working tree status** and **Commits ahead of main** from context. Abort if there are no commits ahead of main and no uncommitted changes.29303. Find the latest completed plan doc — look in `docs/plans/completed/` for the most recently created file whose name relates to the current branch or the work described in the commits.31324. Find the matching progress log in `.ralphex/progress/`.33345. Read the plan and progress log to understand the scope and intent of the changes.3536### Step 2: Prepare commits3738Reset commits back to the working tree and use `/commit` to create clean, atomic commits:39401. Run `/reset` — let the user choose which commits to reset.41422. Run `/commit`. It handles everything: diff analysis, atomic grouping, commit messages, import optimization, doc updates. Pass the plan doc and progress log context so it can write informed messages.4344### Step 3: Rebase onto main4546Ensure commits are based on the latest main so pr-merge can fast-forward:47```48git fetch origin main49git rebase main50```51If the rebase produces conflicts, stop and ask the user to resolve them.5253### Step 4: Push and create/update PR54551. Push the branch. Use `--force-with-lease` if the remote branch already exists (commits were reset and recommitted):56 ```57 git push -u origin <branch-name> --force-with-lease58 ```59 For a new remote branch, a regular push works too — `--force-with-lease` is safe either way.60612. Draft the PR description. The PR body should be **more detailed than the commit message** — it is the primary review artifact. Build it from the plan doc, diff, and progress log:6263 - **Overview**: 2-3 sentences on what this PR accomplishes and why (from the plan's Overview section)64 - **What changed**: bulleted list of concrete changes grouped by area (new modules, modified behavior, structural changes, test coverage). Derive from the diff, not just the plan — if the implementation added things not in the original plan, include them here.65 - **Design decisions**: key trade-offs and rationale (from plan's Design Notes). Highlight anything a reviewer should pay attention to.66 - **Scope reconciliation**: compare the plan against the actual diff. If the implementation diverged from the plan (added features, dropped features, changed approach), note the differences and why.67 - **Plan reference**: link to the plan document filename68 - **Test coverage**: summary of test files and what they cover69703. Check if a PR already exists for this branch: `gh pr view --json number,title,url`. If the command fails, no PR exists.7172 **If no PR exists** — create one:73 ```74 gh pr create --base main --title "<title>" --body "<PR description>"75 ```7677 **If a PR already exists** — update it with the new description:78 ```79 gh pr edit --title "<title>" --body "<PR description>"80 ```81824. Report the PR URL to the user.