better-github-skill
它能做什么
它为 AI 智能体提供三个现成的辅助工具,分别用于拉取请求状态、审查线程和失败的 CI 检查。适用于希望快速了解拉取请求情况的开发者。
适用场景
- ✓当你想获得拉取请求的完整状态报告,包括检查和审查情况时。
- ✓当你需要阅读审查讨论,包括尚未解决的评论时。
- ✓当 CI 构建失败,你想知道哪个步骤出错以及原因时。
技能链接
https://github.com/humanlayer/humanlayer/blob/main/.claude/skills/better-github-skill/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我的拉取请求为什么 CI 检查失败了?审查人员又提了什么意见?”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会运行小型脚本,一次性收集拉取请求详情、审查线程或失败的任务日志。其他情况则使用常规的 GitHub 命令行工具。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
better-github-skill
Use these scripts only for the three flows listed below. Otherwise use raw
gh. Scripts run TypeScript with Bun and have no dependencies.
Scripts
| script | use for |
|---|---|
bun run scripts/pr-snapshot.ts [pr] [-R o/r] |
full PR state in one call: meta, mergeability, checks, files, reviews, comments, thread counts. Use instead of hand-assembling pr view --json field sets or chaining view/checks/comments calls. |
bun run scripts/pr-threads.ts [pr] [-R o/r] [--all] [--author X] [--since ISO] |
the full review conversation: review bodies, issue comments, and unresolved inline threads (resolution state porcelain gh cannot get). Resolved/outdated threads are hidden by default, counted in the header; --all includes them. Read-only: never reply to or resolve threads unless explicitly told to. |
bun run scripts/ci-failures.ts [run-id] [--pr N] [--list] [-R o/r] |
failing checks → failing jobs/steps → log snippet each; full logs saved to files (paths printed); rg those instead of re-fetching. --list [--workflow W] [-L n] shows recent runs with conclusions; use it to find the failing run id instead of gh run list --json field sets. |
Rule of thumb: pr-snapshot answers "what's the state of this PR", pr-threads answers "what did reviewers write". Neither replaces the other.
All scripts: --json for structured output, --help for usage (includes the
--json shape). Omit the PR number to use the current branch's PR. Default
output is sized for context; pass --full only when a truncation marker
([…+N chars]) hides something you need. They exit 0 when the report
succeeds even if CI is red or threads are unresolved.
Gotchas (each one burned real sessions repeatedly)
- Never pipe gh into
head: SIGPIPE can kill gh mid-write (spurious nonzero exit, shell-dependent) or silently truncate large output. Redirect to a file and read that, or trim with--jq '.[0:20]'. gh pr diffhas no--statand no positive pathspec (--name-onlyand-e/--excludeglobs exist in gh ≥ 2.95). Per-file stats:gh api 'repos/{owner}/{repo}/pulls/N/files' --jq '.[]|[.filename,.additions,.deletions]|@tsv'Full diff:gh pr diff N > "$TMPDIR/pr.diff"once, then rg/sed the file.gh pr checksexits 1 = failing, 8 = pending by design; append|| true, read the table.- File at any ref, no base64 dance:
gh api 'repos/{owner}/{repo}/contents/PATH?ref=SHA' -H 'Accept: application/vnd.github.raw' gh apifills{owner}/{repo}from the cwd repo (GH_REPO=o/roverrides). Quote any api path containing?(zsh globs it), or use-X GET -F per_page=100(any-f/-Fsilently flips the request to POST without-X GET).--paginateon any list endpoint (/comments,/files,/reviews);--jqalready runs per page; don't add--slurp.- PR/comment bodies:
--body-file file.mdor a quoted heredoc. Never inline--body "..."containing backticks. - Field cheat-sheet: CI status on a PR =
statusCheckRollup(pr view); steps live undergh run view N --json jobs;gh search prsfields ≠gh pr viewfields. - gh has no
-C; pass-R owner/repoto every command, or cd first. - Branch rules live at
gh api 'repos/{owner}/{repo}/rulesets'on modern repos;/branches/main/protection404s unless classic protection is on AND you have admin ("Branch not protected" or plain "Not Found" both mean check rulesets; neither is a path error). - Branch drift:
gh api 'repos/{owner}/{repo}/compare/BASE...HEAD' --jq '{ahead_by,behind_by}' - jq beyond one line: write the program to a file and
jq -f prog.jq; inline zsh quoting breaks. - Don't sleep-poll runs or checks;
gh run watch IDandgh pr checks N --watch --fail-fastexist; let the harness background them.
常见问题
它需要特殊软件吗?
需要。脚本使用 JavaScript 运行时 Bun 运行,并与 GitHub 命令行工具配合使用。
它能回复或解决审查评论吗?
不能。审查线程脚本只读,除非你明确要求,否则智能体不会回复或解决线程。
它与普通的 GitHub 命令有什么不同?
它一次调用就能收集多种信息,并把完整的 CI 日志保存为文件,所以智能体不必连续执行许多命令。
详情
作者的原始描述
Use for 1) inspecting PR state, 2) reading review threads, or 3) debugging CI failures. Otherwise use the gh CLI.
repo: humanlayer/humanlayer
热度
- GitHub 星标
- 13k
- 排名
- #11381
- 许可证
- Apache-2.0
- 更新时间
- 2026/10/31
评论
- …
同一仓库的更多技能
asd-ste100
13k教你的智能体把难懂的英文改写成短句、每句只有一个意思,方便人和其他软件阅读。
calldiff
13k帮你的智能体比较代码库中两个 git 版本之间的函数调用链,让代码审查能看出行为发生了什么变化。
chrome-devtools-cli
13k帮你的智能体通过终端控制 Chrome,打开页面、点击、填写表单,并截取页面快照,用于浏览器自动化和测试。
effect-program-design
13k帮你的智能体设计并测试可用于生产环境的 Effect v4 程序,包括清晰的服务、类型化错误、层以及对资源的安全处理。