Create Draft Pull Request

VerifiedSafe

Push committed changes to GitHub and create a draft pull request for early feedback or documentation. Uses git and GitHub CLI commands.

Sby Skills Guide Bot
DevelopmentIntermediate
8/15/2026
Claude CodeCursorCodex
#git#github#pull-request#cli#workflow

Recommended for

Automated summary

Pushes staged changes, creates a conventional commit, and opens a draft pull request on GitHub through the gh CLI.

Strengths

  • Covers the whole chain end to end — status check, commit, push, draft PR creation — with copy-pasteable commands.
  • Enforces a conventional commit message format of type(scope): description.
  • Warns against literal \n escapes in the PR body and recommends a body file with verification via gh pr view --json body.
  • Deliberately avoids hardcoding label lists: it reads the repo's live labels with descriptions and favours precision over coverage.

Limitations

  • Assumes gh is installed and authenticated and that a remote branch exists; it does not handle failures of those preconditions.
  • Does not cover branch creation, merge conflicts, reviewer assignment, or CI failures.
  • The file appears truncated at step 7: the gh pr edit --add-label command is cut off.
When to use it

Use it when changes are already staged or committed and you want to open a draft PR quickly for early feedback or to kick off CI.

When not to use it

Avoid it when the repo requires a PR template, mandatory reviewers, or process labels that the assistant cannot determine reliably.

Security analysis

Safe
Quality score88/100

The skill only uses standard git and GitHub CLI commands for legitimate version control and PR creation. There are no destructive, exfiltrating, or obfuscated actions. Commands like 'git add .' and 'git push' are routine and within expected developer workflow. No secrets are transmitted or unsafe patterns present.

No concerns found

How this analysis is made

Examples

Open a draft PR for a fix
I've staged the CLI version mismatch fix on branch fix/cli-version. Commit it with a conventional message, push the branch, and open a draft PR describing the change.
Draft PR with repo-appropriate labels
Create a draft PR for my staged registry changes, then look up the repo's actual labels and add only the ones that genuinely match this diff.
Fix a mangled PR body
My draft PR body shows literal \n characters instead of line breaks. Recreate the body from a markdown file and verify the stored body with gh pr view.

name: pr description: Push committed changes and create a draft PR on GitHub. Use when you have staged changes ready to push and want to open a draft PR for early feedback or documentation.

PR

Quickly push changes and open a draft pull request on GitHub.

When to Use

  • You have staged changes ready to push and want to create a draft PR
  • Early feedback needed on work-in-progress
  • Want to document and track changes before final review
  • Need to open a PR for discussion or CI validation

Instructions

Step 1: Verify Staged Changes

Check what will be committed:

git status

Ensure all changes you want are staged with:

git add <files>

Or add everything:

git add .

Step 2: Create Commit Message

Write a clear, conventional commit message. Use the format:

<type>(<scope>): <description>

<optional body with details>

Types: feat, fix, chore, refactor, docs, test, etc.

Examples:

  • feat(registry): add new skill category
  • fix(cli): resolve version mismatch
  • chore: regenerate artifacts

Step 3: Commit Changes

git commit -m "your commit message here"

Step 5: Push to Remote

git push -u origin <branch-name>

If you're on main or pushing to an existing branch:

git push

Step 6: Create Draft PR

gh pr create --draft

This will prompt you for:

  • Title — auto-filled from commit, edit as needed
  • Body — add context, description, or leave blank
  • Assignees — optional
  • Labels — apply by judgement; see Step 7

For multiline descriptions, use a body file with real newlines. Do not pass literal \\n sequences or rely on shell $'...' quoting; malformed quoting can make GitHub display \\n (and sometimes a stray $).

cat > /tmp/pr-body.md <<'EOF'
## Summary

Describe the change here.
EOF
gh pr create --draft --title "Your PR Title" --body-file /tmp/pr-body.md

After creating or editing the PR, verify the stored body:

gh pr view <number> --json body --jq .body

Or specify details inline for a one-line body:

gh pr create --draft --title "Your PR Title" --body "Description here"

Step 7: Apply Labels by Judgement

Labels are how humans and automation triage the PR queue, so choose them deliberately — but never hardcode a fixed label list. Repos define their own labels and rename or retire them over time; a memorized set rots and won't transfer across repos. Instead, read the live set and reason about fit each time.

  1. Read the repo's actual labels (names and descriptions — the description tells you the intended use):

    gh label list --limit 200 --json name,description --jq '.[] | "\(.name) — \(.description)"'
    
  2. Pick the smallest set that is actually true of this PR. Match the diff's substance against label descriptions:

    • What kind of change is it? (bug fix, enhancement, refactor, docs, dependency bump …)
    • What area does it touch? (frontend, backend, CLI, schema, CI …)
    • Does a cross-cutting label genuinely apply? (performance, security, tech-debt …) — only if the PR materially does that, not aspirationally.
    • Is there a state/process label the repo uses for triage or gating? (needs-review, awaiting-assets, blocked …) Apply one only if it reflects reality.
  3. Prefer precision over coverage. Two labels that are exactly right beat five that are loosely related. If nothing fits, apply nothing — a wrong label misroutes triage worse than a missing one.

  4. Skip labels you can't justify. Roadmap/sprint/phase tags, auto-merge eligibility, ownership cosign labels, etc. usually require context the PR author must supply — don't guess them. If a required-by-process label is missing (e.g. the repo gates on a scope or migration-notes label) and you can't satisfy it, say so rather than applying it falsely.

  5. Apply, then confirm:

    gh pr edit <number> --add-label "<label-1>" --add-label "<label-2>"
    gh pr view <number> --json labels --jq '.labels[].name'
    

State briefly why each label was chosen (and note any you deliberately skipped) so the reasoning is auditable.

Tips

  • Accidental staging leakage: if a PR contains unrelated staging changes, do not force-push blindly. Start a clean branch from current origin/main, apply only the intended files, verify git diff --stat origin/main...HEAD, then push and create a replacement draft PR. Close the contaminated PR and cross-reference the replacement in a comment.
  • Draft PRs show as "Draft" and won't trigger auto-merge workflows
  • Rebase before final PR — git rebase -i origin/main to clean up commits
  • Ready to review? — Use gh pr ready to convert from draft to ready-for-review
  • Add more commits — Just push again with git push, the PR updates automatically

Troubleshooting

"fatal: The current branch has no upstream branch"

  • Use git push -u origin <branch-name> on first push

"Permission denied" when pushing

  • Check your git credentials: gh auth status
  • Re-authenticate if needed: gh auth login

PR creation fails

  • Ensure you're in a git repository: git rev-parse --show-toplevel
  • Check GitHub CLI is installed: gh version

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/create-draft-pull-request-mstwizeg/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/create-draft-pull-request-mstwizeg' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/create-draft-pull-request-mstwizeg/download' --output '.skill-downloads/create-draft-pull-request-mstwizeg/SKILL.md.part' && mv '.skill-downloads/create-draft-pull-request-mstwizeg/SKILL.md.part' '.skill-downloads/create-draft-pull-request-mstwizeg/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/create-draft-pull-request-mstwizeg/SKILL.md' && test -s '.skill-downloads/create-draft-pull-request-mstwizeg/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/pr' && cp -R '.skill-downloads/create-draft-pull-request-mstwizeg' '.claude/skills/pr'

Cursor
test -f '.skill-downloads/create-draft-pull-request-mstwizeg/SKILL.md' && test -s '.skill-downloads/create-draft-pull-request-mstwizeg/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/pr' && cp -R '.skill-downloads/create-draft-pull-request-mstwizeg' '.cursor/skills/pr'

Codex
test -f '.skill-downloads/create-draft-pull-request-mstwizeg/SKILL.md' && test -s '.skill-downloads/create-draft-pull-request-mstwizeg/SKILL.md' && mkdir -p '.agents/skills' && test ! -e '.agents/skills/pr' && cp -R '.skill-downloads/create-draft-pull-request-mstwizeg' '.agents/skills/pr'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/create-draft-pull-request-mstwizeg'

openskills read 'create-draft-pull-request-mstwizeg'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/create-draft-pull-request-mstwizeg/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills