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 agentmods add skills/chen3feng/agent-skills/github-pr-via-gh-clinpx 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.svg" alt="Measured on agentmods" 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 | $0.00024 | $0.01839 |
| Opus 5 | $0.00012 | $0.00920 |
| Sonnet 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 3d 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.
- 3d 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 3mo 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. 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-operations
GitHub CLI operations for issues, PRs, milestones, and Projects v2. Covers gh commands, REST API patterns, and automation scripts. Use when managing GitHub issues, PRs, milestones, or Projects with gh.
pr-triage
PR triage: audit open PRs, deep review selected ones, draft and post review comments. Args: "all" to review all, PR numbers to focus (e.g. "42 57"), "en"/"fr" for language, no arg = audit only in French.
github
Prepare GitHub issues, pull requests, reviews, and release notes for Zhin projects. Use when asked to write an issue, PR description, changelog entry, or review comment. Triggers: 写 issue, PR 描述, 提 PR, release notes, gh pr.
codeflow-maintainer
OpenClaw-only maintainer PR workflow modes and skills. For OpenCoven/coven PR creation, redirect to skills/pr-agent, the Coven PR Readiness Agent.
openclaw-dev
OpenClaw Dev Agent — OpenClaw-only docs-aware development assistant. For OpenCoven/coven PR creation, redirect to skills/pr-agent, the Coven PR Readiness Agent.