| name | gh-helper |
| description | Complete GitHub operations via gh CLI - repos, issues, PRs, code search, actions, file management
When user mentions GitHub, repositories, issues, PRs, gh command, code search, commits, file contents
|
GitHub CLI Helper Agent
Overview
Complete GitHub operations via gh CLI and GitHub API. This skill replaces GitHub MCP server functionality, providing CLI/API equivalents for all operations.
MCP Tool Equivalents Reference
| MCP Tool | CLI/API Equivalent |
|---|
create_or_update_file | gh api -X PUT /repos/{owner}/{repo}/contents/{path} |
search_repositories | gh search repos <query> |
create_repository | gh repo create <name> |
get_file_contents | gh api /repos/{owner}/{repo}/contents/{path} |
push_files | git add && git commit && git push |
create_issue | gh issue create |
create_pull_request | gh pr create |
fork_repository | gh repo fork |
create_branch | gh api -X POST /repos/{owner}/{repo}/git/refs |
list_commits | gh api /repos/{owner}/{repo}/commits |
list_issues | gh issue list |
update_issue | gh issue edit |
add_issue_comment | gh issue comment |
search_code | gh search code <query> |
search_issues | gh search issues <query> |
search_users | gh api /search/users?q=<query> |
get_issue | gh issue view <number> |
get_pull_request | gh pr view <number> |
list_pull_requests | gh pr list |
create_pull_request_review | gh pr review |
merge_pull_request | gh pr merge |
get_pull_request_files | gh api /repos/{owner}/{repo}/pulls/{number}/files |
get_pull_request_status | gh pr checks |
update_pull_request_branch | gh api -X PUT /repos/{owner}/{repo}/pulls/{number}/update-branch |
get_pull_request_comments | gh api /repos/{owner}/{repo}/pulls/{number}/comments |
get_pull_request_reviews | gh api /repos/{owner}/{repo}/pulls/{number}/reviews |
Auto-Approved Commands
Safe read-only commands:
gh repo view, gh repo list
gh issue list, gh issue view
gh pr list, gh pr view, gh pr diff, gh pr checks
gh run list, gh run view, gh run watch
gh workflow list, gh workflow view
gh release list, gh release view
gh search repos, gh search code, gh search issues
gh status
Repository Operations
Search Repositories
gh search repos "kubernetes operator"
gh search repos "react" --language typescript --stars ">1000"
gh search repos "cli tool" --owner hashicorp
gh search repos "mcp server" --topic model-context-protocol
gh search repos "query" --json fullName,description,stargazersCount
Create Repository
gh repo create
gh repo create my-repo --public --description "My project"
gh repo create my-repo --private --clone
gh repo create my-repo --template owner/template-repo
gh repo create my-org/my-repo --public
Fork Repository
gh repo fork owner/repo
gh repo fork owner/repo --clone
gh repo fork owner/repo --org my-org
gh repo fork owner/repo --fork-name my-fork
Get File Contents
gh api /repos/{owner}/{repo}/contents/{path} | jq -r '.content' | base64 -d
gh api /repos/{owner}/{repo}/contents/{path}?ref=branch-name
gh api /repos/{owner}/{repo}/contents/{path}
gh api /repos/{owner}/{repo}/contents/{path} -H "Accept: application/vnd.github.raw"
Create or Update File
gh api -X PUT /repos/{owner}/{repo}/contents/{path} \
-f message="Add new file" \
-f content="$(echo 'file content' | base64)" \
-f branch="main"
SHA=$(gh api /repos/{owner}/{repo}/contents/{path} | jq -r '.sha')
gh api -X PUT /repos/{owner}/{repo}/contents/{path} \
-f message="Update file" \
-f content="$(echo 'new content' | base64)" \
-f sha="$SHA" \
-f branch="main"
Push Multiple Files
Use git commands for pushing multiple files:
git add file1.txt file2.txt
git commit -m "Add multiple files"
git push origin branch-name
git add .
git commit -m "Update files"
git push
Create Branch
git checkout -b new-branch
git push -u origin new-branch
SHA=$(gh api /repos/{owner}/{repo}/git/refs/heads/main | jq -r '.object.sha')
gh api -X POST /repos/{owner}/{repo}/git/refs \
-f ref="refs/heads/new-branch" \
-f sha="$SHA"
SHA=$(gh api /repos/{owner}/{repo}/git/refs/heads/source-branch | jq -r '.object.sha')
gh api -X POST /repos/{owner}/{repo}/git/refs \
-f ref="refs/heads/new-branch" \
-f sha="$SHA"
List Commits
git log --oneline -20
gh api /repos/{owner}/{repo}/commits
gh api "/repos/{owner}/{repo}/commits?sha=branch&per_page=10"
gh api "/repos/{owner}/{repo}/commits?author=username"
gh api "/repos/{owner}/{repo}/commits?since=2024-01-01T00:00:00Z"
gh api /repos/{owner}/{repo}/commits --jq '.[].commit.message'
Issue Operations
List Issues
gh issue list
gh issue list --state open
gh issue list --state closed
gh issue list --state all
gh issue list --assignee @me
gh issue list --assignee username
gh issue list --author @me
gh issue list --label bug
gh issue list --label "bug,priority:high"
gh issue list --milestone "v1.0"
gh issue list --search "is:open label:bug"
gh issue list --json number,title,state,labels
Get Issue Details
gh issue view 123
gh issue view 123 --web
gh issue view 123 --json number,title,body,state,labels,assignees,comments
gh issue view 123 --comments
Create Issue
gh issue create
gh issue create --title "Bug report" --body "Description"
gh issue create --title "Feature" --label enhancement --assignee @me
gh issue create --title "Bug" --milestone "v1.0" --project "Board"
gh issue create --title "Issue" --body-file issue-body.md
gh issue create --title "Issue" --editor
Update Issue
gh issue edit 123 --title "New title"
gh issue edit 123 --body "New description"
gh issue edit 123 --body-file updated.md
gh issue edit 123 --add-label "priority:high"
gh issue edit 123 --remove-label "needs-triage"
gh issue edit 123 --add-assignee username
gh issue edit 123 --remove-assignee username
gh issue edit 123 --milestone "v2.0"
gh issue close 123
gh issue reopen 123
Add Issue Comment
gh issue comment 123 --body "This is a comment"
gh issue comment 123 --body-file comment.md
gh issue comment 123 --editor
gh issue comment 123 --edit-last --body "Updated comment"
Search Issues
gh search issues "memory leak"
gh search issues "bug" --repo owner/repo
gh search issues "type:bug" --state open
gh search issues "label:critical" --assignee username
gh search issues "is:pr is:merged" --author username
gh search issues "query" --json number,title,repository,state
Pull Request Operations
List Pull Requests
gh pr list
gh pr list --state open
gh pr list --state closed
gh pr list --state merged
gh pr list --state all
gh pr list --author @me
gh pr list --assignee username
gh pr list --label "needs-review"
gh pr list --base main
gh pr list --head feature-branch
gh pr list --search "is:open review:required"
gh pr list --json number,title,state,author,labels
Get Pull Request Details
gh pr view 123
gh pr view 123 --web
gh pr view 123 --json number,title,body,state,author,labels,reviews,commits,files
gh pr view 123 --comments
Create Pull Request
gh pr create
gh pr create --title "Fix bug" --body "Description"
gh pr create --title "Feature" --base main --head feature-branch
gh pr create --fill
gh pr create --draft
gh pr create --title "PR" --reviewer user1,user2
gh pr create --title "PR" --reviewer team:my-team
gh pr create --title "PR" --label bug --assignee @me
gh pr create --web
Get Pull Request Files
gh pr diff 123
gh api /repos/{owner}/{repo}/pulls/123/files
gh api /repos/{owner}/{repo}/pulls/123/files --jq '.[] | {filename, status, additions, deletions}'
Get Pull Request Status/Checks
gh pr checks 123
gh pr checks 123 --watch
gh pr checks 123 --watch --fail-level all
gh pr checks 123 --json name,state,conclusion
Create Pull Request Review
gh pr review 123 --approve
gh pr review 123 --request-changes --body "Please fix the tests"
gh pr review 123 --comment --body "Looks good so far"
gh api -X POST /repos/{owner}/{repo}/pulls/123/reviews \
-f body="Review comment" \
-f event="COMMENT" \
-f comments='[{"path":"file.js","position":10,"body":"Consider refactoring"}]'
Get Pull Request Reviews
gh api /repos/{owner}/{repo}/pulls/123/reviews
gh api /repos/{owner}/{repo}/pulls/123/reviews --jq '.[] | {user: .user.login, state: .state, body: .body}'
Get Pull Request Comments
gh api /repos/{owner}/{repo}/pulls/123/comments
gh api /repos/{owner}/{repo}/issues/123/comments
gh api /repos/{owner}/{repo}/pulls/123/comments --jq '.[] | {user: .user.login, body: .body, path: .path}'
Merge Pull Request
gh pr merge 123
gh pr merge 123 --squash
gh pr merge 123 --rebase
gh pr merge 123 --delete-branch
gh pr merge 123 --auto --squash
gh pr merge 123 --squash --subject "feat: Add feature" --body "Detailed description"
Update Pull Request Branch
gh api -X PUT /repos/{owner}/{repo}/pulls/123/update-branch \
-f expected_head_sha="current-head-sha"
gh pr checkout 123
git merge main
git push
Code Search
Search Code
gh search code "function authenticate"
gh search code "TODO" --repo owner/repo
gh search code "interface User" --language typescript
gh search code "config" --filename "*.yaml"
gh search code "query" --json path,repository,textMatches
Search Users
gh api "/search/users?q=fullname:John+type:user"
gh api "/search/users?q=location:Seattle+followers:>100"
gh api "/search/users?q=email:@company.com"
GitHub Actions
List Workflows
gh workflow list
gh workflow list --all
View Workflow Runs
gh run list
gh run list --workflow "CI"
gh run list --branch main
gh run list --status failure
gh run view 12345
gh run view 12345 --log
gh run view 12345 --log-failed
gh run watch 12345
Trigger Workflow
gh workflow run "Deploy" --ref main
gh workflow run "Deploy" -f environment=production -f version=1.0.0
Cancel/Rerun Workflow
gh run cancel 12345
gh run rerun 12345
gh run rerun 12345 --failed
Releases
List Releases
gh release list
gh release list --limit 10
View Release
gh release view v1.0.0
gh release view latest
Create Release
gh release create v1.0.0
gh release create v1.0.0 --title "Version 1.0.0" --notes "Release notes"
gh release create v1.0.0 --generate-notes
gh release create v1.0.0 --draft
gh release create v1.0.0 --prerelease
gh release create v1.0.0 ./dist/*.tar.gz
Authentication & Configuration
Authentication
gh auth login
gh auth login --clipboard
gh auth status
gh auth switch
gh auth logout
Configuration
gh config set editor "code --wait"
gh config set editor vim
gh alias set prs 'pr list --author @me'
gh alias set co 'pr checkout'
gh alias set issues 'issue list --assignee @me'
gh alias list
Browse (Terminal to Web)
gh browse
gh browse 123
gh browse -- issues
gh browse -- settings
gh browse -- src/main.ts
Advanced API Usage
For any operation not covered by gh commands:
gh api /repos/{owner}/{repo}/issues
gh api -X POST /repos/{owner}/{repo}/issues \
-f title="New issue" \
-f body="Description"
gh api -X PUT /repos/{owner}/{repo}/issues/123 \
-f state="closed"
gh api -X DELETE /repos/{owner}/{repo}/issues/comments/456
gh api /repos/{owner}/{repo}/issues --paginate
gh api /repos/{owner}/{repo}/issues --jq '.[].title'
gh api graphql -f query='
query {
repository(owner: "owner", name: "repo") {
issues(first: 10) {
nodes { title number }
}
}
}
'
Common Workflows
Complete PR Workflow
git checkout -b feature/new-thing
git add . && git commit -m "Add new feature"
git push -u origin feature/new-thing
gh pr create --fill
gh pr checks --watch
gh pr merge --squash --delete-branch
Daily PR Review Routine
gh pr list --search "review-requested:@me"
gh pr list --author @me
gh pr checks --watch
Release Workflow
git tag v1.0.0
git push origin v1.0.0
gh release create v1.0.0 --generate-notes
gh release upload v1.0.0 ./dist/*.tar.gz
When to Ask for Help
Ask the user for clarification when:
- Repository owner/name is ambiguous
- Multiple PRs or issues match criteria
- Authentication or permissions issues arise
- Workflow involves destructive operations (force push, delete)
- Need to determine correct branch or ref