skills/github-pr-publish/SKILL.md
Agent-neutral workflow for safely publishing GitHub pull requests with gh CLI, local git, and constrained GitHub REST fallback. Use when asked to create, open, publish, draft, or preflight a GitHub PR from a local branch; push a branch for PR creation; create a PR in a public or private repo; diagnose PR creation auth, SSO, permission, or not-found failures; or avoid unsafe gh pr create prompting, fork creation, or accidental pushes.
npx skillsauth add 17-sss/agent-skills github-pr-publishInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Publish GitHub pull requests through general tools rather than agent-specific connectors. Prefer gh, local git, and GitHub REST APIs. Browser flows are explicit-only fallbacks.
This workflow supports public and private repositories. Private repositories require an authenticated GitHub CLI account with repository access, any required organization SSO authorization, and enough token or OAuth permissions to create pull requests.
gh auth login OAuth.gh pr create. Actual creation requires complete prompt-free inputs.--head value to gh pr create.--push --remote <name> --yes.HEAD:<branch> to the exact named remote after branch and remote checks pass.For read-only preflight, git and gh should be available. For private repos and actual creation, gh must be authenticated.
Useful commands:
gh auth status --hostname github.com
gh api user --jq .login
If auth fails, guide the user to gh auth login. Do not ask for token values.
Use the bundled read-only helper:
skills/github-pr-publish/scripts/collect_publish_context.sh --repo OWNER/REPO
It captures sanitized account status, repo metadata, remotes, branch state, default/base candidates, upstream/ahead-behind details, and existing PR hints under /tmp/github-pr-publish-*.
Prepare a final title and body before creating the PR. Include:
Prompt-free content is required for actual creation:
--title plus --body or --body-file, or--fill, --fill-first, or --fill-verbose when commit-derived content is intended--template alone is not enough because a title source is still required. Use it only with --title or a verified fill/title source.
Preview is the default:
skills/github-pr-publish/scripts/create_pr.sh \
--repo OWNER/REPO \
--base main \
--head OWNER:feature-branch \
--title "Add feature" \
--body-file /tmp/pr-body.md
The preview prints the intended state machine:
preview -> validate -> optional guarded push -> create -> verify
No remote mutation occurs without --yes.
When the branch already exists on the target remote:
skills/github-pr-publish/scripts/create_pr.sh \
--repo OWNER/REPO \
--base main \
--head OWNER:feature-branch \
--title "Add feature" \
--body-file /tmp/pr-body.md \
--yes
The helper verifies the remote head, creates the PR with explicit --head, then verifies the created PR with gh pr view.
For a first push, be explicit:
skills/github-pr-publish/scripts/create_pr.sh \
--repo OWNER/REPO \
--base main \
--title "Add feature" \
--body-file /tmp/pr-body.md \
--push --remote origin \
--yes
The helper derives an explicit head from OWNER and the current branch, checks the branch is safe, checks the remote maps to the target repository, pushes exactly HEAD:<branch>, and then creates the PR.
Use REST only when the remote head already exists and the CLI create path is blocked:
skills/github-pr-publish/scripts/create_pr.sh \
--repo OWNER/REPO \
--base main \
--head OWNER:feature-branch \
--title "Add feature" \
--body-file /tmp/pr-body.md \
--use-rest \
--yes
REST creation requires head, base, and title unless converting an issue. Success must return HTTP 201 and a PR URL.
--web is explicit-only. Without --yes, it is preview-only. With --yes, the helper still runs account, repo, head, branch, and content validation before opening GitHub's browser-based flow.
Classify failures without overclaiming:
gh auth login.scripts/collect_publish_context.shRead-only context collector. Writes sanitized files to /tmp/github-pr-publish-* and never stores tokens.
scripts/create_pr.shCommand renderer and explicit executor. Supports preview, guarded push, CLI create, REST fallback, and fake CLI tests.
Read these only when maintaining or adapting behavior:
references/github-cli-pr-create.md for CLI constraintsreferences/github-rest-create-pr.md for REST fallback constraintsreferences/agent-adapters.md for agent installation notestools
Inspect explicit repo-local commit rules, recent history, and staged changes to draft commit messages in the right style family. Use when the user asks for a commit message, asks to commit staged changes, or wants help choosing between conventional, gitmoji, plain imperative, or repo-custom commit formats.
tools
Agent-neutral workflow for reviewing GitHub pull requests with gh CLI, local git, tests, and GitHub REST or GraphQL APIs, then posting summary or inline review comments as the user's authenticated GitHub account. Use when asked to set up PR review authentication, review a PR URL, review owner/repo#123, review the current branch PR, post PR review comments, review public or private repo PRs, use gh to inspect a PR diff, or leave feedback from the user's GitHub account.
testing
Create, refresh, validate, and resume shared HANDOFF and memory documents for a repository, a workspace-wide cross-repo context, or a workstream inside a larger workspace. Use when asked to write a handoff, checkpoint progress, resume prior work, or standardize project-state notes in Git-trackable files such as `docs/HANDOFF.md`, `_memory/HANDOFF.md`, or `_memory/workstreams/checkout-flow/HANDOFF.md`.
tools
Use when work should span one or more detached tasks but still behave like one job with a single owner context. TaskFlow is the durable flow substrate under authoring layers like Lobster, ACPX, plugins, or plain code. Keep conditional logic in the caller; use TaskFlow for flow identity, child-task linkage, waiting state, revision-checked mutations, and user-facing emergence.