Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add chen3feng/agent-skills --skill github-pr-via-gh-cligit clone --depth 1 https://github.com/chen3feng/agent-skillsWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/chen3feng/agent-skills/github-pr-via-gh-cli)<a href="https://agentmods.dev/skills/chen3feng/agent-skills/github-pr-via-gh-cli"><img src="https://agentmods.dev/badge/skills/chen3feng/agent-skills/github-pr-via-gh-cli/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/chen3feng/agent-skills/github-pr-via-gh-cli"><img src="https://agentmods.dev/badge/skills/chen3feng/agent-skills/github-pr-via-gh-cli.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00024 | $0.01839 |
| Opus 5.5 | $0.00010 | $0.00736 |
| Sonnet 5.5 | $0.00005 | $0.00368 |
| Haiku 4.5 | $0.00002 | $0.00184 |
Grade A, and why
github-pr-via-gh-cli scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 178 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Opening a GitHub PR via gh
When to use
The user says "open a PR" / "send a pull request" and gh is
available (which gh succeeds). Works equally for first-party repos
and forks.
Problem
Getting all of these right on the first try:
- Do I need to fork, or can I push a branch directly?
- What's the
basebranch (mainvsmaster)? - Body with multiple paragraphs, backticks, and lists — how to pass?
Solution
-
Determine push access and the fork question.
gh auth status # who am I? git -C <repo> remote -v # what does origin point to?- If
originis owned by the authenticated user → push directly to a branch, no fork needed. - Otherwise → fork first:
gh repo fork --remote=true.
- If
-
Create a descriptive branch, commit, push.
git -C <repo> checkout -b <slug> git -C <repo> add <paths> git -C <repo> commit -F .commit_msg.tmp # see related skill git -C <repo> push -u origin <slug> -
Check the default branch, don't assume
main:git -C <repo> symbolic-ref refs/remotes/origin/HEAD | sed 's@^.*/@@' -
Create the PR with a body file (see related skill):
gh pr create \ --repo <owner>/<repo> \ --base <default-branch> \ --head <slug> \ --title "<one-line title>" \ --body-file pr_body.mdghprints the PR URL on success. Capture it.
Example
gh pr create --repo chen3feng/cn-doc-style-guide \
--base master --head add-md-style-tools \
--title 'Add Python tools for checking and auto-fixing Chinese Markdown docs' \
--body-file pr_body.md
# → https://github.com/chen3feng/cn-doc-style-guide/pull/1
Pitfalls
-
Anti-pattern — never do this:
gh pr create --body "$(cat <<'EOF' … multi-line body with ``` fences, $(…), backslashes … EOF )"This triple-nests double quotes, command substitution, and a heredoc. In zsh (the default agent shell on macOS) any backtick fence or
$(…)inside the body will unbalance the parser and the command hangs atcmdand dquote>/cmdand quote>— the agent sees "command interrupted" and the PR is never filed. Always write the body to a file via the editor tool and pass--body-file <path>. See shell-heredoc-and-multiline-strings. -
--titlewith backticks or$through the shell is still fragile; prefer--body-fileand keep the title short enough to put in a single-quoted string. -
--body "…\n…"does NOT give you line breaks.ghtakes the value verbatim;\nstays as a two-character literal and the PR body on GitHub will show\nin the middle of sentences. Always use--body-file <path>for anything longer than one line (see shell-heredoc-and-multiline-strings). -
Very long
gh pr createinvocations get backgrounded by some agent shells — the command appears to "hang" and the PR URL never comes back. Keep the command short (use--body-fileinstead of a giant inline--body), and verify withgh pr list --repo <owner>/<repo> --state openafterwards. -
If you already created the PR and the body is malformed (e.g. literal
\nshowing up), fix it without a new PR:
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 1mo ago First seen · 178 lines · 24 tokens per session scan A e7c18dc8e9e6
github-pr-via-gh-cli is a skill published in the GitHub repository chen3feng/agent-skills (5 stars, last pushed 5mo ago), licensed Apache-2.0. It adds 24 tokens to every session and 1,839 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other skills, from other repositories
github-cli
Automate GitHub workflows using the gh CLI for pull requests, issues, releases, actions, and repository management. Use when interacting with GitHub beyond basic git operations.
github-pr-workflow
Prepare a GitHub pull request from a feature branch — branch hygiene, commit shape, title/body, verification notes, screenshots for UI work, and replies to review comments.
commit-staged
This skill should be used when user asks to "commit these changes", "write commit message", "stage and commit", "create a commit", "commit staged files", or explicitly invokes "commit-staged".
github-ops
GitHub repository operations — issues, PRs, code search, and config-as-code workflows. Use when creating a GitHub issue for a network finding, opening a pull request for a config change, searching repos for IP or VLAN references, or committing an audit report to a repository.
github
A writing guide for GitHub issues, pull requests, code reviews, and release notes in Zhin projects. GitHub is a service where teams track bugs, discuss changes, review code, and publish project updates.
github-cli
A command-line tool connection for GitHub tasks that built-in tools do not cover. It uses GitHub's command-line program to work with issues, pull requests, releases, workflows, searches, and the GitHub API.