cli-gh by paulrberg/agent-skills
npx skills add https://github.com/paulrberg/agent-skills --skill cli-gh提供 GitHub CLI (gh) 操作和工作流程的专家指导。使用此技能进行命令行 GitHub 操作,包括拉取请求管理、问题跟踪、仓库操作、工作流自动化和代码空间管理。
核心功能:
关键:此技能绝不使用破坏性的 gh CLI 操作。
此技能仅专注于安全、只读或可逆的 GitHub 操作。以下命令被禁止,且绝不允许使用:
永久性破坏性命令:
gh repo delete - 仓库删除gh repo archive - 仓库归档gh release delete - 发布删除gh release delete-asset - 资产删除gh run delete - 工作流运行删除广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
gh cache delete - 缓存删除gh secret delete - 密钥删除gh variable delete - 变量删除gh label delete - 标签删除gh ssh-key delete - SSH 密钥删除(可能导致用户被锁定)gh gpg-key delete - GPG 密钥删除gh codespace delete - 代码空间删除gh extension remove - 扩展移除gh gist delete - Gist 删除xargs 结合任何破坏性命令进行批量删除操作rm -rf(临时文件清理除外)允许的操作:
git status、git log、git diff)# 登录 GitHub
gh auth login
# 检查认证状态
gh auth status
# 配置 git 使用 gh 作为凭证助手
gh auth setup-git
# 交互式创建 PR
gh pr create
# 使用标题和正文创建 PR
gh pr create --title "Add feature" --body "Description"
# 创建到特定分支的 PR
gh pr create --base main --head feature-branch
# 创建草稿 PR
gh pr create --draft
# 从当前分支创建 PR
gh pr create --fill # 使用提交信息
# 列出 PR
gh pr list
# 列出我的 PR
gh pr list --author @me
# 查看 PR 详情
gh pr view 123
# 在浏览器中查看 PR
gh pr view 123 --web
# 查看 PR 差异
gh pr diff 123
# 检查 PR 状态
gh pr status
# 在本地检出 PR
gh pr checkout 123
# 评审 PR
gh pr review 123 --approve
gh pr review 123 --comment --body "Looks good!"
gh pr review 123 --request-changes --body "Please fix X"
# 合并 PR
gh pr merge 123
gh pr merge 123 --squash
gh pr merge 123 --rebase
gh pr merge 123 --merge
# 关闭 PR
gh pr close 123
# 重新打开 PR
gh pr reopen 123
# 将草稿 PR 标记为就绪
gh pr ready 123
# 使用基础分支更新 PR 分支
gh pr update-branch 123
# 查看 PR 检查
gh pr checks 123
# 监视 PR 检查
gh pr checks 123 --watch
# 交互式创建问题
gh issue create
# 使用标题和正文创建问题
gh issue create --title "Bug report" --body "Description"
# 使用标签创建问题
gh issue create --title "Bug" --label bug,critical
# 分配问题
gh issue create --title "Task" --assignee @me
# 列出问题
gh issue list
# 列出我的问题
gh issue list --assignee @me
# 按标签列出
gh issue list --label bug
# 查看问题详情
gh issue view 456
# 在浏览器中查看
gh issue view 456 --web
# 关闭问题
gh issue close 456
# 重新打开问题
gh issue reopen 456
# 编辑问题
gh issue edit 456 --title "New title"
gh issue edit 456 --add-label bug
gh issue edit 456 --add-assignee @user
# 评论问题
gh issue comment 456 --body "Update"
# 创建分支来处理问题
gh issue develop 456 --checkout
# 查看仓库
gh repo view
# 在浏览器中查看
gh repo view --web
# 克隆仓库
gh repo clone owner/repo
# 复刻仓库
gh repo fork owner/repo
# 列出仓库
gh repo list owner
# 创建仓库
gh repo create my-repo --public
gh repo create my-repo --private
# 同步复刻
gh repo sync owner/repo
# 设置默认仓库
gh repo set-default
跨整个 GitHub 搜索仓库、问题和拉取请求。
# 搜索仓库
gh search repos "machine learning" --language=python
# 使用过滤器搜索
gh search repos --stars=">1000" --topic=kubernetes
# 跨 GitHub 搜索问题
gh search issues "bug" --label=critical --state=open
# 排除结果(注意使用 -- 以防止标志被解释)
gh search issues -- "memory leak -label:wontfix"
# 搜索 PR
gh search prs --author=@me --state=open
# 使用日期过滤器搜索
gh search prs "refactor" --created=">2024-01-01"
管理仓库标签,用于组织和分类问题与 PR。
# 列出仓库中的所有标签
gh label list
# 创建新标签
gh label create "priority: high" --color FF0000 --description "High priority items"
# 编辑现有标签
gh label edit "bug" --color FFAA00 --description "Something isn't working"
# 从另一个仓库克隆标签
gh label clone owner/source-repo
直接从终端管理 GitHub 代码空间。
# 列出代码空间
gh codespace list
# 创建新代码空间
gh codespace create --repo owner/repo
# SSH 进入代码空间
gh codespace ssh
# 在 VS Code 中打开
gh codespace code
# 在 JupyterLab 中打开
gh codespace jupyter
# 复制文件到/从代码空间
gh codespace cp local-file.txt remote:~/path/
gh codespace cp remote:~/path/file.txt ./local-dir/
# 查看日志
gh codespace logs
# 创建发布
gh release create v1.0.0
# 创建带说明的发布
gh release create v1.0.0 --notes "Release notes"
# 创建带文件的发布
gh release create v1.0.0 dist/*.tar.gz
# 创建草稿发布
gh release create v1.0.0 --draft
# 自动生成发布说明
gh release create v1.0.0 --generate-notes
# 列出发布
gh release list
# 查看发布
gh release view v1.0.0
# 下载发布资产
gh release download v1.0.0
# 创建 gist
gh gist create file.txt
# 从标准输入创建 gist
echo "content" | gh gist create -
# 列出 gists
gh gist list
# 查看 gist
gh gist view <gist-id>
# 编辑 gist
gh gist edit <gist-id>
# 设置默认编辑器
gh config set editor vim
# 设置默认 git 协议
gh config set git_protocol ssh
# 查看配置
gh config list
# 设置浏览器
gh config set browser firefox
常见 gh 操作一览:
| 操作 | 命令 | 常用标志 |
|---|---|---|
| 创建 PR | gh pr create | --draft, --fill, --base, --title |
| 列出 PR | gh pr list | --author @me, --label, --state |
| 查看 PR | gh pr view <number> | --web, --comments |
| 合并 PR | gh pr merge <number> | --squash, --rebase, --delete-branch |
| 创建问题 | gh issue create | --title, --body, --label |
| 列出问题 | gh issue list | --assignee @me, --label, --state |
| 查看问题 | gh issue view <number> | --web, --comments |
| 克隆仓库 | gh repo clone <repo> | -- (用于传递 git 标志) |
| 复刻仓库 | gh repo fork | --clone, --remote |
| 查看仓库 | gh repo view | --web |
| 创建发布 | gh release create <tag> | --title, --notes, --draft |
| 运行工作流 | gh workflow run <name> | --ref, --field |
| 监视运行 | gh run watch <id> | --exit-status |
| 搜索仓库 | gh search repos <query> | --language, --stars |
| 创建标签 | gh label create <name> | --color, --description |
| 创建代码空间 | gh codespace create | --repo, --branch |
| SSH 到代码空间 | gh codespace ssh | --codespace |
有关详细模式和高级用法,请参阅:
实用的自动化脚本(参见 examples/ 目录):
auto-pr-create.sh - 自动化 PR 创建工作流issue-triage.sh - 批量问题标签和分配workflow-monitor.sh - 监视并通知工作流完成情况release-automation.sh - 完整的发布工作流自动化使用 --json 标志获取结构化输出。始终使用 --help 验证字段名,因为它们与 GitHub API 名称不同。
# 检查任何命令可用的 JSON 字段
gh repo view --help | grep -A 50 "JSON FIELDS"
gh pr list --help | grep -A 50 "JSON FIELDS"
| 错误(API 风格) | 正确(gh CLI) |
|---|---|
stargazersCount | stargazerCount |
forksCount | forkCount |
watchersCount | watchers |
openIssuesCount | issues |
# gh repo view --json 的常用字段
gh repo view owner/repo --json name,description,stargazerCount,forkCount,updatedAt,url,readme
--web 标志在浏览器中打开项目以查看详细信息--author、--label、--state 应用过滤器以高效缩小列表范围--json 标志以启用可脚本化的输出,便于自动化--help 以获取有效的 JSON 字段名 - 它们与 GitHub API 不同gh repo create --template 从模板仓库搭建项目结构gh pr merge --auto 为通过检查的 PR 启用自动合并每周安装数
265
仓库
GitHub 星标数
41
首次出现
2026年2月9日
安全审计
安装于
codex247
claude-code103
opencode91
gemini-cli91
github-copilot91
amp91
Expert guidance for GitHub CLI (gh) operations and workflows. Use this skill for command-line GitHub operations including pull request management, issue tracking, repository operations, workflow automation, and codespace management.
Key capabilities:
CRITICAL: This skill NEVER uses destructive gh CLI operations.
This skill focuses exclusively on safe, read-only, or reversible GitHub operations. The following commands are PROHIBITED and must NEVER be used:
Permanently destructive commands:
gh repo delete - Repository deletiongh repo archive - Repository archivalgh release delete - Release deletiongh release delete-asset - Asset deletiongh run delete - Workflow run deletiongh cache delete - Cache deletiongh secret delete - Secret deletiongh variable delete - Variable deletiongh label delete - Label deletiongh ssh-key delete - SSH key deletion (can lock out users)gh gpg-key delete - GPG key deletiongh codespace delete - Codespace deletiongh extension remove - Extension removalgh gist delete - Gist deletionxargs with any destructive commandsrm -rf (except for temporary file cleanup)Allowed operations:
git status, git log, git diff)# Login to GitHub
gh auth login
# Check authentication status
gh auth status
# Configure git to use gh as credential helper
gh auth setup-git
# Create PR interactively
gh pr create
# Create PR with title and body
gh pr create --title "Add feature" --body "Description"
# Create PR to specific branch
gh pr create --base main --head feature-branch
# Create draft PR
gh pr create --draft
# Create PR from current branch
gh pr create --fill # Uses commit messages
# List PRs
gh pr list
# List my PRs
gh pr list --author @me
# View PR details
gh pr view 123
# View PR in browser
gh pr view 123 --web
# View PR diff
gh pr diff 123
# Check PR status
gh pr status
# Checkout PR locally
gh pr checkout 123
# Review PR
gh pr review 123 --approve
gh pr review 123 --comment --body "Looks good!"
gh pr review 123 --request-changes --body "Please fix X"
# Merge PR
gh pr merge 123
gh pr merge 123 --squash
gh pr merge 123 --rebase
gh pr merge 123 --merge
# Close PR
gh pr close 123
# Reopen PR
gh pr reopen 123
# Ready draft PR
gh pr ready 123
# Update PR branch with base branch
gh pr update-branch 123
# View PR checks
gh pr checks 123
# Watch PR checks
gh pr checks 123 --watch
# Create issue interactively
gh issue create
# Create issue with title and body
gh issue create --title "Bug report" --body "Description"
# Create issue with labels
gh issue create --title "Bug" --label bug,critical
# Assign issue
gh issue create --title "Task" --assignee @me
# List issues
gh issue list
# List my issues
gh issue list --assignee @me
# List by label
gh issue list --label bug
# View issue details
gh issue view 456
# View in browser
gh issue view 456 --web
# Close issue
gh issue close 456
# Reopen issue
gh issue reopen 456
# Edit issue
gh issue edit 456 --title "New title"
gh issue edit 456 --add-label bug
gh issue edit 456 --add-assignee @user
# Comment on issue
gh issue comment 456 --body "Update"
# Create branch to work on issue
gh issue develop 456 --checkout
# View repository
gh repo view
# View in browser
gh repo view --web
# Clone repository
gh repo clone owner/repo
# Fork repository
gh repo fork owner/repo
# List repositories
gh repo list owner
# Create repository
gh repo create my-repo --public
gh repo create my-repo --private
# Sync fork
gh repo sync owner/repo
# Set default repository
gh repo set-default
Search across all of GitHub for repositories, issues, and pull requests.
# Search for repositories
gh search repos "machine learning" --language=python
# Search with filters
gh search repos --stars=">1000" --topic=kubernetes
# Search issues across GitHub
gh search issues "bug" --label=critical --state=open
# Exclude results (note the -- to prevent flag interpretation)
gh search issues -- "memory leak -label:wontfix"
# Search PRs
gh search prs --author=@me --state=open
# Search with date filters
gh search prs "refactor" --created=">2024-01-01"
Manage repository labels for issue and PR organization.
# List all labels in repository
gh label list
# Create new label
gh label create "priority: high" --color FF0000 --description "High priority items"
# Edit existing label
gh label edit "bug" --color FFAA00 --description "Something isn't working"
# Clone labels from another repository
gh label clone owner/source-repo
Manage GitHub Codespaces directly from the terminal.
# List codespaces
gh codespace list
# Create new codespace
gh codespace create --repo owner/repo
# SSH into codespace
gh codespace ssh
# Open in VS Code
gh codespace code
# Open in JupyterLab
gh codespace jupyter
# Copy files to/from codespace
gh codespace cp local-file.txt remote:~/path/
gh codespace cp remote:~/path/file.txt ./local-dir/
# View logs
gh codespace logs
# Create release
gh release create v1.0.0
# Create release with notes
gh release create v1.0.0 --notes "Release notes"
# Create release with files
gh release create v1.0.0 dist/*.tar.gz
# Create draft release
gh release create v1.0.0 --draft
# Generate release notes automatically
gh release create v1.0.0 --generate-notes
# List releases
gh release list
# View release
gh release view v1.0.0
# Download release assets
gh release download v1.0.0
# Create gist
gh gist create file.txt
# Create gist from stdin
echo "content" | gh gist create -
# List gists
gh gist list
# View gist
gh gist view <gist-id>
# Edit gist
gh gist edit <gist-id>
# Set default editor
gh config set editor vim
# Set default git protocol
gh config set git_protocol ssh
# View configuration
gh config list
# Set browser
gh config set browser firefox
Common gh operations at a glance:
| Operation | Command | Common Flags |
|---|---|---|
| Create PR | gh pr create | --draft, --fill, --base, --title |
| List PRs | gh pr list | --author @me, --label, |
For detailed patterns and advanced usage, see:
Practical automation scripts (see examples/ directory):
auto-pr-create.sh - Automated PR creation workflowissue-triage.sh - Bulk issue labeling and assignmentworkflow-monitor.sh - Watch and notify on workflow completionrelease-automation.sh - Complete release workflow automationUse --json flag for structured output. Always verify field names with--help as they differ from GitHub API names.
# Check available JSON fields for any command
gh repo view --help | grep -A 50 "JSON FIELDS"
gh pr list --help | grep -A 50 "JSON FIELDS"
| Wrong (API-style) | Correct (gh CLI) |
|---|---|
stargazersCount | stargazerCount |
forksCount | forkCount |
watchersCount | watchers |
openIssuesCount | issues |
# Common fields for gh repo view --json
gh repo view owner/repo --json name,description,stargazerCount,forkCount,updatedAt,url,readme
--web flag to open items in browser for detailed view--author, --label, --state to narrow down lists efficiently--json flag to enable scriptable output for automation--help for valid JSON field names - they differ from GitHub APIgh repo create --template to scaffold from template repositoriesgh pr merge --auto for PRs that pass checksWeekly Installs
265
Repository
GitHub Stars
41
First Seen
Feb 9, 2026
Security Audits
Gen Agent Trust HubFailSocketPassSnykWarn
Installed on
codex247
claude-code103
opencode91
gemini-cli91
github-copilot91
amp91
Azure Data Explorer (Kusto) 查询技能:KQL数据分析、日志遥测与时间序列处理
102,600 周安装
Mole Mac 清理工具 - macOS 系统优化与磁盘空间管理 CLI 工具
263 周安装
React Three Fiber 后期处理教程:Bloom辉光、Vignette暗角等效果实现
263 周安装
React-PDF 使用指南:在 React 中生成 PDF 的完整教程与最佳实践
263 周安装
Legal Advisor - Claude AI 法律顾问技能,智能法律咨询与文档分析助手
263 周安装
飞书CLI工具箱:13个功能模块命令速查,高效管理电子表格、日历、任务、文件等
263 周安装
PARA第二大脑技能:AI助手帮你用PARA方法组织知识库和数字笔记
263 周安装
--state| View PR | gh pr view <number> | --web, --comments |
| Merge PR | gh pr merge <number> | --squash, --rebase, --delete-branch |
| Create issue | gh issue create | --title, --body, --label |
| List issues | gh issue list | --assignee @me, --label, --state |
| View issue | gh issue view <number> | --web, --comments |
| Clone repo | gh repo clone <repo> | -- (to pass git flags) |
| Fork repo | gh repo fork | --clone, --remote |
| View repo | gh repo view | --web |
| Create release | gh release create <tag> | --title, --notes, --draft |
| Run workflow | gh workflow run <name> | --ref, --field |
| Watch run | gh run watch <id> | --exit-status |
| Search repos | gh search repos <query> | --language, --stars |
| Create label | gh label create <name> | --color, --description |
| Create codespace | gh codespace create | --repo, --branch |
| SSH to codespace | gh codespace ssh | --codespace |