{"data":{"slug":"discovered-861aee536d8758b93e564dfee540a28c40e40379e9809315","title":"Create and Manage GitHub Pull Requests with Codex Branching","summary":"Create or verify a GitHub pull request by inspecting the current work, creating a feature branch from `origin\/<base>`, and pushing changes with upstream tracking. The deliverable is a GitHub branch and pull request with a conventional commit message and verified changes.","url":"https:\/\/skillshunter.net\/skills\/discovered-861aee536d8758b93e564dfee540a28c40e40379e9809315","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/discovered-861aee536d8758b93e564dfee540a28c40e40379e9809315","markdown_url":"https:\/\/skillshunter.net\/skills\/discovered-861aee536d8758b93e564dfee540a28c40e40379e9809315.md","download_url":"https:\/\/skillshunter.net\/skills\/discovered-861aee536d8758b93e564dfee540a28c40e40379e9809315\/download","category":{"slug":"software-development","name":"Software & Development"},"editor_note":"Before creating a new PR, set `<base>` to the branch explicitly requested by the user or use `main` by default. Ensure that the selected base is used consistently throughout the workflow. Confirm that the current branch does not already have an open PR with `gh pr list --head <branch> --state all`.","instructions":"---\nname: pr\ndescription: >-\n  Write or revise a pull request body, or push a GitHub branch, open a GitHub\n  pull request, or verify its publication.\n---\n\n# Pull Request Workflow\n\n> Upstream attribution: Adapted from the original [`github-pr` skill](https:\/\/github.com\/damacus\/skills\/blob\/b97d545a1099c1096bbaf9e346f833526b849a56\/skills\/workflow\/github-pr\/SKILL.md) authored by Dan Webb in `damacus\/skills` commit `b97d545`.\n\nThis skill replaces `github-pr`. For PR body drafts and edits, use the format\nbelow. For GitHub branch pushes and PR publication, follow the applicable\nworkflow steps. Before preparing a new PR, set `<base>` to the branch the user\nexplicitly requests, or `main` by default. Use the selected base throughout.\n\nRun GitHub CLI commands with elevated network access. Check `gh auth status` before the first GitHub write and ask the user to run `gh auth login` if authentication fails.\n\n## Workflow\n\n### 1. Inspect the work and current publication state\n\n- Inspect `git status --short`, `git diff`, and `git diff --cached` before staging anything.\n- Identify the exact files that belong to the requested work. Preserve unrelated staged, unstaged, and untracked changes.\n- Check whether the current branch already has a PR with `gh pr list --head <branch> --state all`. If it has an open PR, verify and summarize that PR instead of creating a duplicate. If it is closed or merged, do not reuse the branch without explicit user direction.\n- Refresh `origin\/<base>` before creating a new feature branch. Do not silently rebase, reset, stash, or rewrite any worktree state.\n\n### 2. Create or verify the feature branch\n\n- Never commit the requested work directly on `main`.\n- If starting from the default branch or the selected base, create a feature branch from refreshed `origin\/<base>` with `git switch -c codex\/<type>-<short-slug> origin\/<base>`.\n- If the current branch is detached, create an appropriately named branch before committing. If it is an existing feature branch, confirm that it is the intended branch and does not already have a conflicting PR.\n- Prefer `codex\/` branch names, with an appropriate type such as `feat`, `fix`, `docs`, `chore`, or `refactor`.\n\n### 3. Verify the change\n\n- Identify the repository's normal validation commands from its documented project contract, CI configuration, or task runner.\n- Check that automated tests exercise the changed behaviours the PR claims to\n  verify. Add or update focused tests for new behaviour and regressions that CI\n  can exercise. For behaviours CI cannot exercise, run a targeted manual check\n  when the required environment is available.\n- Run the relevant checks before publishing. For documentation-only work, use focused validation such as repository-provided linting plus `git diff --check` when no runtime test applies.\n- Report the exact commands and outcomes. Do not claim tests passed when they were not run.\n- If required validation fails because of this change, fix it before publishing. If it is demonstrably pre-existing, report that evidence and ask whether to publish a draft PR.\n\n### 4. Summarize and stage only the selected changes\n\n- Summarize the selected diff in plain language before writing the commit message.\n- Produce a concise conventional commit subject that describes the user-visible intent. Keep it under 50 characters when practical.\n- Stage explicit paths only: `git add -- <selected-paths>`. Never use `git add .` or `git add -A` by default.\n- Inspect `git diff --cached --stat` and run `git diff --cached --check` before committing. If unrelated files are staged, stop and ask the user which changes belong in the PR.\n\n- Include the selected tests added or updated during verification. Compare the\n  staged paths with the files that were tested. If any selected file changes\n  after verification, rerun the affected checks and repeat explicit-path staging\n  and staged-diff checks before committing.\n\n### 5. Commit and push\n\n- Commit only after the staged diff and validation match the requested scope: `git commit -m \"<conventional subject>\"`.\n- Push the current branch with upstream tracking: `git push -u origin HEAD`.\n- After pushing, check again for an existing PR for the exact branch. Do not create a second PR if one already exists.\n\n### 6. Create and verify the PR\n\n- Create a ready PR only when the relevant validation passed. If validation is incomplete or failed for a reason the user accepts, ask whether to create a draft instead.\n- Use explicit, non-interactive GitHub CLI arguments:\n\n  ```fish\n  gh pr create --base <base> --head <branch> --title \"<conventional subject>\" --body \"<PR body>\"\n  ```\n\n- Write the PR body using the format below.\n- Verify the created or existing PR with `gh pr view <number> --json number,url,state,isDraft,baseRefName,headRefName,title`.\n- Report the PR URL, branch, commit, selected base, validation results, and any known follow-up.\n\n## PR body\n\nAdapted from [Matt Pocock\u2019s \/pr skill](https:\/\/www.aihero.dev\/skills-pr#the-template).\nUse Markdown H2 headings in this order. When the repository requires a PR\ntemplate, fill its corresponding sections and add any missing H2 sections the\ntemplate allows.\n\n- `## Summary` \u2014 Say what changes and why. Include an issue-closing reference\n  when applicable. Use a short diff, pseudocode, or diagram when it makes the\n  change easier to understand.\n- `## Verification` \u2014 Name the changed behaviours that automated tests cover\n  and what they assert. Link to specific tests where useful. Show a before and\n  after when available, such as a regression test failing on the base and\n  passing on the branch. Keep routine lint output, test totals, and CI status\n  in the task report. State any material gap in coverage.\n- `## Manual verification` \u2014 Include this section when relevant behaviour\n  requires an environment or capability unavailable in CI. Say why CI cannot\n  exercise it, what was checked, and what was observed. Name the environment\n  and any material limits. If a required check is pending, say so.\n- `## Merge Danger` \u2014 Include this section only for high-risk changes.\n  Explain what makes the change high risk, what could break, who would be\n  affected, and any effects that reverting the commit would leave behind.\n\n## Write Safety\n\n- Use ordinary Git for commit-only requests.\n- Follow the requested scope. A push request ends with the push. A PR draft,\n  status check, or body edit requires only the actions needed for that request.\n- Do not amend existing commits, force-push, rebase, reset, stash, close PRs, or alter unrelated files unless the user explicitly asks.\n- Do not create a duplicate PR. Existing PR status is a result to report, not an error to work around.\n- Do not add reviewers, labels, assignees, projects, or milestones unless the user requests them.\n- If GitHub authentication, repository access, branch push, or PR creation fails, report the precise blocker and leave the local commit intact.\n\n## Completion Criteria\n\nA publication request is complete only when the selected change is committed, pushed to its intended feature branch, represented by one verified PR against the selected base, and accompanied by an accurate validation summary.\n","use_cases":["Create a new feature branch from `origin\/<base>` and push changes to GitHub","Verify an existing pull request and summarize its state","Ensure that changes are staged only for the requested work and not unrelated files"],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/damacus\/skills\/blob\/5706f70c0058822adf29da9bd7620c7ea780b9d6\/skills\/workflow\/pr\/SKILL.md","source_commit":"5706f70c0058822adf29da9bd7620c7ea780b9d6","license":null,"version":null,"listing_approved_at":"2026-12-02","created_at":"2026-11-30T08:55:08.000000Z","updated_at":"2026-12-02T09:15:01.000000Z","seo_title":"Create GitHub Pull Requests with Codex Branching","seo_description":"Create or verify a GitHub pull request by inspecting the current work, creating a feature branch from `origin\/<base>`, and pushing changes with upstream tracking.","seo_keywords":["GitHub pull request","codex branching","feature branch","conventional commit","git workflow"]}}