{"data":{"slug":"discovered-853ebeca47c147395471d3891974fd68d562a527ce1d5b0d","title":"Pr Create - Prepare and Push Feature Branch Commits for PR","summary":"Prepare clean, atomic commits for the current feature branch, push to remote, and create or update a PR to main. Requires a feature branch, not main, and a plan doc in `docs\/plans\/completed\/`.","url":"https:\/\/skillshunter.net\/skills\/discovered-853ebeca47c147395471d3891974fd68d562a527ce1d5b0d","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/discovered-853ebeca47c147395471d3891974fd68d562a527ce1d5b0d","markdown_url":"https:\/\/skillshunter.net\/skills\/discovered-853ebeca47c147395471d3891974fd68d562a527ce1d5b0d.md","download_url":"https:\/\/skillshunter.net\/skills\/discovered-853ebeca47c147395471d3891974fd68d562a527ce1d5b0d\/download","category":{"slug":"software-development","name":"Software & Development"},"editor_note":"Ensure the current branch is not `main` and that there are commits ahead of `main` or uncommitted changes. Locate the latest completed plan doc in `docs\/plans\/completed\/` to guide commit messages and PR description.","instructions":"---\nname: pr-create\ndescription: Prepare commits for the current feature branch, push, and create or update a PR to main.\nallowed-tools: Bash(git status:*), Bash(git log:*), Bash(git diff:*), Bash(git reset --soft:*), Bash(python ~\/.claude\/skills\/shared\/commit.py:*), Bash(python3 ~\/.claude\/skills\/shared\/commit.py:*), Bash(git push:*), Bash(git rev-parse:*), Bash(git branch:*), Bash(git fetch:*), Bash(git checkout:*), Bash(git merge:*), Bash(git rebase:*), Bash(gh pr create:*), Bash(gh pr view:*), Bash(gh pr edit:*), Bash(ls:*), Bash(python ~\/.claude\/skills\/shared\/gate_pushed_tree.py:*), Bash(python3 ~\/.claude\/skills\/shared\/gate_pushed_tree.py:*), Bash(python ~\/.claude\/scripts\/review_scope.py status), Bash(python3 ~\/.claude\/scripts\/review_scope.py status), Bash(python ~\/.claude\/scripts\/review_scope.py forecast), Bash(python3 ~\/.claude\/scripts\/review_scope.py forecast), Read, Glob, Grep\n---\n\n# Create PR for Plan-Based Changes\n\nPrepare commits on the current feature branch, push, and create or update a PR to main.\n\nRead `~\/.claude\/skills\/shared\/bash-rules.md` for bash command constraints.\n\n## Context\n- Repo root: !`git rev-parse --show-toplevel 2>\/dev\/null || pwd`\n- Current branch: !`git rev-parse --abbrev-ref HEAD`\n- Working tree status: !`git status --short`\n- Commits ahead of main: !`git log main..HEAD --oneline`\n\n## Working directory\n\n`docs\/plans\/` and any other file paths in this skill are relative to **Repo root** from Context. The cwd may be a subdirectory \u2014 prefix Repo root when calling Read\/Glob\/Grep\/ls. Bare paths are cwd-relative and will silently miss plans at the actual root.\n\n## Workflow\n\n### Step 1: Gather context\n\n1. Use **Current branch** from context. If on `main`, abort \u2014 the user must check out the feature branch first.\n\n2. Use **Working tree status** and **Commits ahead of main** from context. Abort if there are no commits ahead of main and no uncommitted changes.\n\n3. Find the latest completed plan doc \u2014 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.\n\n4. Read the plan to understand the scope and intent of the changes.\n\n### Step 2: Prepare commits\n\nReset commits back to the working tree and re-commit them as clean, atomic commits:\n\n1. Run `\/reset` \u2014 let the user choose which commits to reset.\n\n2. Group the change set as `~\/.claude\/skills\/shared\/commit-grouping.md` describes, drawing on the plan doc for the messages, and show the plan for the user's approval. Then commit each group with `python ~\/.claude\/skills\/shared\/commit.py -F <message-file> <paths\u2026>` (`python3` on macOS), which stages exactly those paths, checks the message, scans what they add and signs the commit.\n\n### Step 3: Rebase onto main\n\nEnsure commits are based on the latest main so pr-merge can fast-forward:\n```\ngit fetch origin main\ngit rebase main\n```\nIf the rebase produces conflicts, stop and ask the user to resolve them.\n\n### Step 4: Push and create\/update PR\n\n1. Push the branch. Gate the published state first, then use `--force-with-lease` if the remote branch already exists (commits were reset and recommitted), with the review bookmark's forecast before the push and its status after, as `~\/.claude\/skills\/shared\/review-bookmark-status.md` describes:\n   ```\n   python ~\/.claude\/skills\/shared\/gate_pushed_tree.py --caller pr-create\n   python ~\/.claude\/scripts\/review_scope.py forecast\n   git push -u origin <branch-name> --force-with-lease\n   python ~\/.claude\/scripts\/review_scope.py status\n   ```\n   Use `python3` on macOS. For a new remote branch, a regular push works too \u2014 `--force-with-lease` is safe either way.\n\n   A non-zero exit stops the push. The branch's commits were written here and never measured against the repo's own gate, and a reviewer reading the PR cannot see that: the gate runs on a working tree, so a branch that fails it looks the same on GitHub as one that passes.\n\n2. Draft the PR description. The PR body should be **more detailed than the commit message** \u2014 it is the primary review artifact. Build it from the plan doc and diff:\n\n   - **Overview**: 2-3 sentences on what this PR accomplishes and why (from the plan's Overview section)\n   - **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 \u2014 if the implementation added things not in the original plan, include them here.\n   - **Design decisions**: key trade-offs and rationale (from plan's Design Notes). Highlight anything a reviewer should pay attention to.\n   - **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.\n   - **Plan reference**: link to the plan document filename\n   - **Test coverage**: summary of test files and what they cover\n\n3. Check if a PR already exists for this branch: `gh pr view --json number,title,url`. If the command fails, no PR exists.\n\n   **If no PR exists** \u2014 create one:\n   ```\n   gh pr create --base main --title \"<title>\" --body \"<PR description>\"\n   ```\n\n   **If a PR already exists** \u2014 update it with the new description:\n   ```\n   gh pr edit --title \"<title>\" --body \"<PR description>\"\n   ```\n\n4. Report the PR URL to the user, then close the report as `~\/.claude\/skills\/shared\/review-bookmark-status.md` describes.\n","use_cases":["Prepare and push feature branch commits for a PR","Update an existing PR with new commits","Ensure commits are based on the latest main branch","Create a PR with a detailed description from a plan doc"],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/AnotherSava\/claude-code-common\/blob\/1a7f9f9cce53f6946ae1e3a9cc0733f2524a4b93\/claude\/skills\/pr-create\/SKILL.md","source_commit":"1a7f9f9cce53f6946ae1e3a9cc0733f2524a4b93","license":null,"version":null,"listing_approved_at":"2026-12-01","created_at":"2026-11-30T08:08:19.000000Z","updated_at":"2026-12-01T12:48:20.000000Z","seo_title":"Pr Create - Prepare and Push Feature Branch Commits for PR","seo_description":"Automate the preparation of clean, atomic commits for a feature branch, push to remote, and create or update a PR to main. Requires a feature branch and a plan doc for PR","seo_keywords":["pr create","git commit","feature branch","push to remote","create pr","update pr","plan doc","commit grouping"]}}