一键导入
ghx
// Guidance for safe, reliable GitHub CLI workflows across issues, pull requests, and reviews.
// Guidance for safe, reliable GitHub CLI workflows across issues, pull requests, and reviews.
Review a GitHub pull request by collecting PR context, analyzing risks, and publishing one structured review.
Solve a GitHub issue by collecting context, implementing a fix, and opening or updating a pull request.
Fix a GitHub pull request by addressing feedback or CI failures, pushing changes, and publishing replies.
| name | ghx |
| description | Guidance for safe, reliable GitHub CLI workflows across issues, pull requests, and reviews. |
Use this skill as shared guidance for raw gh and gh api usage in GitHub issue, pull request, and review workflows.
It focuses on safe command patterns, payload handling, and common collection/publish recipes.
This skill is guidance-only. It does not provide scripts, wrappers, or executable entrypoints.
ghgithub-review, github-pr-fix, or github-issue-solvegh CLI authentication is required.GITHUB_TOKEN or GH_TOKEN must have the scopes required by the target repository operations.jq is recommended when you need structured filtering or JSON post-processing.gh issue create --body-file <file>gh issue comment --body-file <file>gh pr create --body-file <file>gh pr edit --body-file <file>--body-file - only when stdin is clearly available and intentional.Good:
cat > /tmp/comment.md <<'EOF'
## Summary
Detailed markdown with quotes, backticks, and newlines.
EOF
gh issue comment 123 --repo owner/repo --body-file /tmp/comment.md
Bad:
gh issue comment 123 --repo owner/repo --body "## Summary
Detailed markdown with quotes, backticks, and newlines."
gh api --input <file> for complex request bodies.-f key=value flags over hand-built shell strings.gh issue view 123 --repo owner/repo --json number,title,body,state,url,author,createdAt,updatedAt,labels
gh api repos/owner/repo/issues/123/comments --paginate
gh pr view 123 --repo owner/repo --json number,title,body,state,url,baseRefName,headRefName,headRefOid,author,createdAt,updatedAt,mergeable,reviews,changedFiles,additions,deletions
gh pr view 123 --repo owner/repo --json files
gh pr diff 123 --repo owner/repo
gh api graphql -f query='
query($owner:String!, $repo:String!, $number:Int!) {
repository(owner:$owner, name:$repo) {
pullRequest(number:$number) {
reviewThreads(first:100) {
nodes {
isResolved
comments(first:100) {
nodes { id body path line author { login } }
}
}
}
}
}
}' -F owner=<owner> -F repo=<repo> -F number=<pr_number>
gh pr create --repo owner/repo --title "Title" --body-file /tmp/pr-body.md --head feature/x --base main
gh pr edit 123 --repo owner/repo --title "Updated title" --body-file /tmp/pr-body.md
gh api repos/owner/repo/issues/123/comments -X POST --input /tmp/comment.json
Example payload:
{
"body": "Comment body"
}
gh api repos/owner/repo/pulls/123/comments -X POST \
-F in_reply_to=456789 \
-f body='Thanks, fixed in the latest commit.'
Use gh api with a JSON payload file so body text and inline comments stay structured and reproducible.
--repo owner/repo in automation.--json output when subsequent steps need structured data.--paginate for REST endpoints.