github
GitHub
Base directory for this skill: ~.agents\skills\github
Interact with GitHub repositories through the Model Context Protocol (MCP) server for GitHub.
When to Use
- Managing repository files (create, update, get contents)
- Working with issues (create, update, list, comment)
- Managing pull requests (create, review, merge, get status)
- Searching GitHub (repositories, code, issues, users)
- Creating and managing branches
- Forking repositories
Prerequisites
-
设置环境变量:需要
GITHUB_TOKEN环境变量进行 GitHub API 认证export GITHUB_TOKEN="your_github_token_here" -
切换到技能目录:必须在技能目录下运行命令,或使用完整路径
cd ~/.agents/skills/github
Quick Start
Run the CLI script with bun from this skill directory:
cd ~/.agents/skills/github && bun ./scripts/github.ts <command> [options]
Note on path formats:
- The
~(tilde) expands to your home directory in most shells (bash, zsh, PowerShell, Git Bash) - On Windows with cmd.exe, use:
cd %USERPROFILE%\.agents\skills\github - On Windows with PowerShell, use:
cd ~/.agents/skills/githuborcd $env:USERPROFILE/.agents/skills/github - In bash on Windows (e.g., Git Bash), use forward slashes:
cd C:/Users/username/.agents/skills/github
Available Commands
Repository Operations
| Command | Description |
|---|---|
create-repository |
Create a new GitHub repository |
fork-repository |
Fork a repository to your account |
search-repositories |
Search for repositories |
File Operations
| Command | Description |
|---|---|
get-file-contents |
Get file or directory contents |
create-or-update-file |
Create or update a single file |
push-files |
Push multiple files in a single commit |
Branch Operations
| Command | Description |
|---|---|
create-branch |
Create a new branch |
list-commits |
List commits in a repository |
Issue Operations
| Command | Description |
|---|---|
create-issue |
Create a new issue |
get-issue |
Get issue details |
list-issues |
List repository issues |
update-issue |
Update an existing issue |
add-issue-comment |
Add a comment to an issue |
Pull Request Operations
| Command | Description |
|---|---|
create-pull-request |
Create a new PR |
get-pull-request |
Get PR details |
list-pull-requests |
List repository PRs |
get-pull-request-files |
Get files changed in PR |
get-pull-request-status |
Get PR status checks |
get-pull-request-comments |
Get PR review comments |
get-pull-request-reviews |
Get PR reviews |
create-pull-request-review |
Create a PR review |
merge-pull-request |
Merge a PR |
update-pull-request-branch |
Update PR branch from base |
Search Operations
| Command | Description |
|---|---|
search-repositories |
Search repositories |
search-code |
Search code across GitHub |
search-issues |
Search issues and PRs |
search-users |
Search GitHub users |
Global Options
-t, --timeout <ms>: Call timeout (default: 30000)-o, --output <format>: Output format:text|markdown|json|raw
Common Examples
# Get file contents (first cd to skill directory)
cd ~/.agents/skills/github && bun ./scripts/github.ts get-file-contents \
--owner facebook --repo react --path README.md
# Create an issue
cd ~/.agents/skills/github && bun ./scripts/github.ts create-issue \
--owner myorg --repo myrepo --title "Bug report" --body "Description here"
# List open PRs
cd ~/.agents/skills/github && bun ./scripts/github.ts list-pull-requests \
--owner facebook --repo react --state open
# Search code
cd ~/.agents/skills/github && bun ./scripts/github.ts search-code \
--q "useState filename:*.tsx"
# Create a PR review
cd ~/.agents/skills/github && bun ./scripts/github.ts create-pull-request-review \
--owner myorg --repo myrepo --pull-number 123 \
--body "LGTM!" --event APPROVE
Or save the path for easier use:
# Set alias in your shell config (e.g., ~/.bashrc or ~/.zshrc)
alias github-cli='cd ~/.agents/skills/github && bun ./scripts/github.ts'
# Then use:
github-cli get-file-contents --owner facebook --repo react --path README.md
Requirements
- Bun runtime
mcporterpackage (embedded in script)GITHUB_TOKENenvironment variable for authentication
Troubleshooting
Error: Module not found "./scripts/github.ts"
原因:当前工作目录不是 ~/.agents/skills/github
解决方法:
cd ~/.agents/skills/github
bun ./scripts/github.ts <command> [options]
或者使用完整路径(需要根据实际情况调整):
bun ~/.agents/skills/github/scripts/github.ts <command> [options]
Windows 用户特别提示:
- 如果在 bash/Git Bash 中使用 Windows 路径(如
C:\Users\...),反斜杠会被当作转义字符 - 解决方案:使用正斜杠
C:/Users/...或双反斜杠C:\\Users\\... - 更简单的方法:使用
~/.agents/skills/github格式(在 Git Bash 中可用)
示例(Git Bash on Windows):
# 正确 ✓
cd ~/.agents/skills/github && bun ./scripts/github.ts <command>
cd C:/Users/username/.agents/skills/github && bun ./scripts/github.ts <command>
# 错误 ✗(反斜杠被转义)
cd C:\Users\username\.agents\skills\github && bun ./scripts/github.ts <command>
Error: MCP error -32603 Not Found
可能原因:
- 路径不存在:请求的文件或目录在仓库中不存在
- 认证失败:
GITHUB_TOKEN未设置或无效 - 仓库不存在:指定的 owner/repo 不存在或没有访问权限
解决方法:
-
验证路径存在:先搜索确认路径
cd ~/.agents/skills/github && bun ./scripts/github.ts search-code \ --q "filename:your-file.txt repo:owner/repo" -
检查 GITHUB_TOKEN:
echo $GITHUB_TOKEN # Linux/Mac echo %GITHUB_TOKEN% # Windows -
验证仓库访问权限:
cd ~/.agents/skills/github && bun ./scripts/github.ts get-file-contents \ --owner owner --repo repo --path .
Error: 401/403 Unauthorized
原因:GitHub Token 无效或权限不足
解决方法:
- 在 GitHub 生成新的 Personal Access Token
- 确保 Token 具有所需的权限(如
repo用于私有仓库) - 设置环境变量:
export GITHUB_TOKEN="your_token"
Resources
scripts/github.ts- Main CLI tool wrapping GitHub MCP serverreferences/api_reference.md- Detailed parameter documentation for all commands
More from l-yifan/skills
scientific-figure-pro
Generate publication-ready scientific figures in Python/matplotlib with a consistent figures4papers house style. Use when creating or refining academic bar/trend/heatmap/scatter/multi-panel figures, enforcing visual consistency, or exporting paper-ready PNG/PDF/SVG outputs.
32figures4papers-playbook
Locate and adapt real plotting examples from the figures4papers repository. Use when users ask for a figure in the style of specific papers/projects, want the closest existing script template, or need fast script selection by chart type/domain before customization.
30deep-wiki
Access AI-generated documentation and insights for GitHub repositories via DeepWiki. This skill should be used when exploring unfamiliar codebases, understanding repository architecture, finding implementation patterns, or asking questions about how a GitHub project works. Supports any public GitHub repository.
25gkg
Global Knowledge Graph for codebase analysis. This skill should be used when searching for code definitions (functions, classes, methods), finding references to symbols, understanding code structure, analyzing import usage, generating repository maps, or performing impact analysis before refactoring. Supports TypeScript, JavaScript, Python, Java, and more.
21gh-grep
Search real-world code examples across millions of GitHub repositories using grep.app. This skill should be used when looking for implementation patterns, API usage examples, library integration patterns, or production code references. Supports literal code search, regex patterns, and filtering by language/repo/path.
18context7
Fetch up-to-date documentation and code examples for any library or framework. Use when needing API references, code examples, library documentation, or framework guides. Supports React, Next.js, MongoDB, Supabase, and thousands of other libraries.
13