Agent skill

Opening PRs

by oaustegard in oaustegard/claude-skills

Open a GitHub PR via API as a flowing graph — branch + push + createpr + mergeable poll, with structural protection against pushing to main/master/etc.

MITAuto-check: notesDevelopment

Install Opening PRs

skills CLI
$ npx skills add oaustegard/claude-skills --skill opening-prs -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install oaustegard/claude-skills opening-prs --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/oaustegard/claude-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/opening-prs .claude/skills/opening-prs && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
opening-prs
GitHub stars
150
Token cost
~1.3k tokens
SKILL.md length
394 words
Files
4 (incl. scripts)
Skills in repo
67
Repo updated
First seen
Licence
MIT

At a glance

Open a GitHub PR via API as a flowing graph — branch + push + createpr + mergeable poll, with structural protection against pushing to main/master/etc.

  • Works in 6 steps: Determine the branch name → Get the base branch's HEAD SHA → Create the branch → …
  • Claude.ai container needs to land changes on GitHub via the API (no git CLI required) and the prose create branch
  • SKILL.md covers What this fixes, Auth, Result shape and Tuning the mergeable poll, plus 2 more sections
  • Runs Python scripts from its folder; calls gh and git; reaches github.com; needs GH_TOKEN and GITHUB_TOKEN

What it does

Opening PRs is an agent skill from oaustegard/claude-skills. Open a GitHub PR via API as a flowing graph — branch + push + createpr + mergeable poll, with structural protection against pushing to main/master/etc. Use when a Claude Code or Claude.ai container needs to land changes on GitHub via the API (no git CLI required) and the prose "create branch, push, open PR, wait for mergeable" workflow keeps drifting under context pressure.

Its SKILL.md is about 1.3k tokens, which your agent loads only when the skill is triggered. The skill folder holds 5 other files, including scripts (for example `CHANGELOG.md`, `scripts/opening_prs.py` and `tests/test_opening_prs.py`).

It sits in Development, covering Git workflow and Pull requests. It works with GitHub and Git. The repository describes itself as: My collection of Claude skills. The licence is MIT.

When your agent uses it

  • Claude.ai container needs to land changes on GitHub via the API (no git CLI required) and the prose create branch
  • Wait for mergeable workflow keeps drifting under context pressure

Example prompts

  • “create branch, push, open PR, wait for mergeable”
  • “/opening-prs”

Requirements

  • Python 3
  • A credential in GITHUB_TOKEN

Workflow steps

6 steps, taken from the first numbered list in SKILL.md.

  1. Determine the branch name
  2. Get the base branch's HEAD SHA
  3. Create the branch
  4. Push files to the branch
  5. Create the PR
  6. Poll mergeable_state until GitHub finishes computing it

What it can do on your machine

Read from SKILL.md and the folder at commit 90b0f1b. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 1 file in scripts/ (Python), which the agent can run.

    Shell commands in SKILL.md call:

    • gh
    • git

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • github.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names these keys or tokens, usually read from environment variables:

    • GH_TOKEN
    • GITHUB_TOKEN

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Opening PRs loads about 1.3k tokens when it runs. Until then it costs about 97 tokens; SKILL.md has 394 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~97
When it runs · the whole SKILL.md, loaded when a task matches
~1.3k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check: notes

The automated check noted patterns worth knowing about, such as sudo or a known installer.

  • NoteMentions a .env fileSKILL.md:91
    H_TOKEN"] = "ghp_..."   # or load from a .env file

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from oaustegard/claude-skills at commit 90b0f1b, republished under its MIT licence (© oaustegard). 394 words, ~1,254 tokens.

Download SKILL.mdSave it as .claude/skills/opening-prs/SKILL.md (or your agent's skills folder). This skill also uses 3 other files; get the full folder from GitHub.
name
opening-prs
description
Open a GitHub PR via API as a flowing graph — branch + push + create_pr + mergeable poll, with structural protection against pushing to main/master/etc. Use when a Claude Code or Claude.ai container needs to land changes on GitHub via the API (no git CLI required) and the prose "create branch, push, open PR, wait for mergeable" workflow keeps drifting under context pressure.
metadata.version
0.1.0
metadata.requires
flowing

Opening PRs

A flowing graph that turns the imperative "create branch, push files, open a PR, poll mergeable_state" workflow into a structural DAG. The "NEVER push directly to main" rule is encoded as a validate= gate that physically can't be skipped.

python
from opening_prs import open_pr

result = open_pr(
    repo="owner/repo",
    branch_name="feat/cool-thing",
    title="Add cool thing",
    body="## Summary\n\n...",
    files=[
        ("src/cool.py", "<file content>"),
        ("docs/cool.md", "<file content>"),
    ],
    base="main",  # default; protected names are also rejected
)

print(result["pr_url"])             # https://github.com/.../pull/N
print(result["mergeable_state"])    # clean | dirty | unstable | behind | blocked

What this fixes

The gh pr create workflow (or hand-rolled API calls) has five steps in prose form:

  1. Determine the branch name
  2. Get the base branch's HEAD SHA
  3. Create the branch
  4. Push files to the branch
  5. Create the PR
  6. Poll mergeable_state until GitHub finishes computing it

Each step has known failure modes:

  • Step 1: Accidentally pushing to main — the diagnosed pattern that motivated github-procedures §6 in the first place.
  • Step 6: GitHub returns mergeable_state: null immediately after creation. Need to poll. "Wait a few seconds and check" is prose, not a procedure — so it gets skipped under context pressure.

This skill encodes both as flowing primitives:

determine_branch ──▶ guard ──▶ get_base_head ──▶ create_branch
                      │                              │
                      │                              ▼
                      │                        push_files
                      │                              │
                      │                              ▼
                      │                         create_pr
                      │                          /        \
                      │                         ▼          ▼
                      │                  wait_mergeable  present_pr [terminal]
                      │
                      └─ validate=must_not_be_base_branch
  • validate=must_not_be_base_branch rejects branch_name in {"main", "master", "trunk", "production", "prod"} — case-insensitive — and the configured base itself. The body of create_branch never fires for a protected name. No GitHub API call happens for an invalid branch name.

  • retry_until=lambda r: r["mergeable_state"] in SETTLED_STATES consumes the retry budget while GitHub computes the merge result. unknown and null keep polling; settled states (clean, dirty, unstable, behind, blocked) stop. Exhaustion is soft: the PR is still presented with the last observed state.

Show full SKILL.md (165 more words)Show less

Auth

Requires GH_TOKEN (or GITHUB_TOKEN) in the environment. Classic PAT or fine-grained PAT with repo scope.

python
import os
os.environ["GH_TOKEN"] = "ghp_..."   # or load from a .env file

The skill sends User-Agent: opening-prs on every API call. (GitHub returns 401 "Bad credentials" without a UA, regardless of token validity. Common trap.)

Result shape

python
{
    "pr_url": "https://github.com/owner/repo/pull/N",
    "pr_number": 42,
    "pr_state": "open",
    "branch": "feat/cool-thing",
    "base": "main",
    "head_sha": "abc123...",
    "mergeable_state": "clean",
    "files_pushed": ["src/cool.py", "docs/cool.md"],
    "detached_failures": [],
}

Raises RuntimeError only if the main DAG fails (validate, branch creation, file push, or PR creation). Mergeable polling exhaustion is a soft failure — the PR exists, the field just isn't computed yet.

Tuning the mergeable poll

python
open_pr(
    ...,
    mergeable_poll_retries=8,         # default 8
    mergeable_poll_base_ms=2000,      # default 2s
    mergeable_poll_max_ms=8000,       # default 8s (cap on exponential backoff)
)

When NOT to use

  • Pushing many large files (the GitHub Contents API is one-file-per-PUT with base64 encoding — slow above ~10 files). Use git push if you have the CLI.
  • Needing to amend commits or rewrite history. This skill creates one commit per file via the contents API.
  • Anything involving force-push, branch deletion, or PR review-state manipulation. Out of scope; use a different tool.

See also

  • flowing — the DAG runner this skill is built on
  • closing-issues — the symmetric "close + synthesize" flow
  • The accessing-github-repos skill for byte-layer GitHub access patterns

© oaustegard, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 3 other files (scripts) in opening-prs of oaustegard/claude-skills.

  • SKILL.md
  • CHANGELOG.md
  • scripts/opening_prs.py
  • tests/test_opening_prs.py

Open the folder on GitHubat commit 90b0f1b

Compare with similar skills

Opening PRs next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Opening PRs compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Opening PRs this skilloaustegard/claude-skills150—~1.3kAutomated safety check: NotesMIT
Contributor-First PR MergeHKUDS/OpenHarness16k1 repos~847Automated safety check: PassMIT
Create Pull Requestcline/cline70k1 repos~1.6kAutomated safety check: PassApache-2.0
Create Pull Request with Work Item IDmakeplane/plane61k—~824Automated safety check: PassAGPL-3.0
Creating Description For Gh PRredis/jedis12k—~838Automated safety check: PassMIT
Pascal Editor PR Openerpascalorg/editor25k—~619Automated safety check: PassMIT

Similar skills

  • Merges external GitHub pull requests while keeping the original author credited, and fixes conflicts after the merge instead of rewriting the contribution.

    16k GitHub starsUsed in 1 repo~847 tokens
    DevelopmentAuto-check passed
  • Opens a GitHub pull request from your current branch with the gh CLI, after reviewing the commits and diff and gathering the details the PR needs.

    70k GitHub starsUsed in 1 repo~1.6k tokens
    DevelopmentAuto-check passed
  • Opens a pull request for the current branch using the repo's template, a work item ID in the title and a description filled in from the actual diff.

    61k GitHub stars~824 tokensUpdated today
    DevelopmentAuto-check passed
  • Official

    Generate a clear, concise GitHub PR title and description from the diff between two local git branches, and save it to prDescription.md in the repo root.

    12k GitHub stars~838 tokensUpdated today
    DevelopmentAuto-check passed
  • Pascal Editor PR Opener

    pascalorg/editor

    Opens or refreshes a pull request on pascalorg/editor from the current branch, describing only what the branch's commits and diff actually contain.

    25k GitHub stars~619 tokensUpdated today
    DevelopmentAuto-check passed
  • React Router Pull Request Creator

    remix-run/react-router

    Packages finished React Router work into a draft pull request: branch, commit, push, a written PR body and the right GitHub labels.

    57k GitHub stars~2.5k tokensUpdated today
    DevelopmentAuto-check passed

More from oaustegard/claude-skills

All 67 skills in this repo
  • Vega-Lite Interactive Charts

    oaustegard/claude-skills

    Builds interactive Vega-Lite charts from uploaded data: analyzes the fields, picks five to ten fitting chart types, and produces a React artifact with the data embedded inline.

    150 GitHub stars~2.1k tokensUpdated today
    Auto-check passed
  • Single-File HTML Composer

    oaustegard/claude-skills

    Builds self-contained single-file HTML pages such as reports, decks, postmortems, flowcharts and prototypes from a small spec using a bundled Python composer and templates.

    150 GitHub stars~3.2k tokensUpdated today
    Auto-check passed
  • Deciding With Confidence

    oaustegard/claude-skills

    Routes, triages, flags and rates a piece of text with a probability for every option: which department or queue a ticket goes to, which intent a message expresses, whether a yes/no condition holds…

    150 GitHub stars~2.6k tokensUpdated today
    Auto-check passed
  • Declauding

    oaustegard/claude-skills

    Rewrites model-sounding prose into plain technical writing and checks that every claim survives, for PR text, docs, commit messages and similar drafts.

    150 GitHub stars~5.2k tokensUpdated today
    Auto-check passed
  • Preact Developer

    oaustegard/claude-skills

    Guides building standards-based Preact apps with native-first choices, HTM syntax, import maps and vendored ESM, from single-file demos to larger builds.

    150 GitHub stars~4.6k tokensUpdated today
    Auto-check passed
  • Bluesky Zeitgeist Sampler

    oaustegard/claude-skills

    Deprecated sampler that captures short windows of the Bluesky firehose, clusters trending terms and builds an HTML report; replaced by the browsing-bluesky skill.

    150 GitHub stars~1.4k tokensUpdated today
    Auto-check passed

Works with

Categories

Questions about Opening PRs

What does Opening PRs do?

Open a GitHub PR via API as a flowing graph — branch + push + createpr + mergeable poll, with structural protection against pushing to main/master/etc. Opening PRs is an agent skill from oaustegard/claude-skills. Open a GitHub PR via API as a flowing graph — branch + push + createpr + mergeable poll, with structural protection against pushing to main/master/etc.

When should I use Opening PRs?

Opening PRs fits situations like: Claude.ai container needs to land changes on GitHub via the API (no git CLI required) and the prose create branch; wait for mergeable workflow keeps drifting under context pressure.

How do I install Opening PRs in Claude Code?

Run `npx skills add oaustegard/claude-skills --skill opening-prs -a claude-code`. Or copy the skill folder (opening-prs in oaustegard/claude-skills) into .claude/skills/opening-prs in your project. Claude Code loads it when a task matches its description.

How do I install Opening PRs in Codex?

Run `npx skills add oaustegard/claude-skills --skill opening-prs -a codex`. Or copy the skill folder (opening-prs in oaustegard/claude-skills) into .agents/skills/opening-prs in your project. Codex loads it when a task matches its description.

Can I use Opening PRs in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add oaustegard/claude-skills --skill opening-prs -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/opening-prs, .gemini/skills/opening-prs, .github/skills/opening-prs and .opencode/skills/opening-prs in your project.

What does Opening PRs need to run?

Going by SKILL.md and its folder, Opening PRs needs Python for the scripts in its folder, the command-line tools its instructions call (gh and git) and credentials named GH_TOKEN and GITHUB_TOKEN. Our summary lists: Python 3; A credential in GITHUB_TOKEN.

Does Opening PRs access the network?

SKILL.md names 1 domain. In commands or code: github.com; the agent is likely to contact it when it follows the instructions. This is read from the text; nothing was executed.

Is Opening PRs safe to install?

Our automated static check of SKILL.md found notes only (mentions a .env file), nothing it rates as a warning. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Opening PRs use?

Opening PRs is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Opening PRs use?

About 1.3k tokens (SKILL.md is roughly 5k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Opening PRs?

Skills that share tags, products or a category with Opening PRs: Contributor-First PR Merge (HKUDS/OpenHarness, 16k stars), Create Pull Request (cline/cline, 70k stars), Create Pull Request with Work Item ID (makeplane/plane, 61k stars) and Creating Description For Gh PR (redis/jedis, 12k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Opening PRs?

oaustegard (a GitHub user) maintains it in oaustegard/claude-skills, which has 150 GitHub stars. The repository holds 67 skills in this directory. The repository was last updated on October 9, 2026.

Source: oaustegard/claude-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.