$npx -y skills add SafeAI-Lab-X/ClawKeeper --skill githubGitHub operations via gh CLI: issues, PRs, CI runs, code review, API queries. Use when: (1) checking PR status or CI, (2) creating/commenting on issues, (3) listing/filtering PRs or issues, (4) viewing run logs. NOT for: complex web UI interactions requiring manual browser flow
| 1 | # GitHub Skill |
| 2 | |
| 3 | Use the `gh` CLI to interact with GitHub repositories, issues, PRs, and CI. |
| 4 | |
| 5 | ## When to Use |
| 6 | |
| 7 | ✅ **USE this skill when:** |
| 8 | |
| 9 | - Checking PR status, reviews, or merge readiness |
| 10 | - Viewing CI/workflow run status and logs |
| 11 | - Creating, closing, or commenting on issues |
| 12 | - Creating or merging pull requests |
| 13 | - Querying GitHub API for repository data |
| 14 | - Listing repos, releases, or collaborators |
| 15 | |
| 16 | ## When NOT to Use |
| 17 | |
| 18 | ❌ **DON'T use this skill when:** |
| 19 | |
| 20 | - Local git operations (commit, push, pull, branch) → use `git` directly |
| 21 | - Non-GitHub repos (GitLab, Bitbucket, self-hosted) → different CLIs |
| 22 | - Cloning repositories → use `git clone` |
| 23 | - Reviewing actual code changes → use `coding-agent` skill |
| 24 | - Complex multi-file diffs → use `coding-agent` or read files directly |
| 25 | |
| 26 | ## Setup |
| 27 | |
| 28 | ```bash |
| 29 | # Authenticate (one-time) |
| 30 | gh auth login |
| 31 | |
| 32 | # Verify |
| 33 | gh auth status |
| 34 | ``` |
| 35 | |
| 36 | ## Common Commands |
| 37 | |
| 38 | ### Pull Requests |
| 39 | |
| 40 | ```bash |
| 41 | # List PRs |
| 42 | gh pr list --repo owner/repo |
| 43 | |
| 44 | # Check CI status |
| 45 | gh pr checks 55 --repo owner/repo |
| 46 | |
| 47 | # View PR details |
| 48 | gh pr view 55 --repo owner/repo |
| 49 | |
| 50 | # Create PR |
| 51 | gh pr create --title "feat: add feature" --body "Description" |
| 52 | |
| 53 | # Merge PR |
| 54 | gh pr merge 55 --squash --repo owner/repo |
| 55 | ``` |
| 56 | |
| 57 | ### Issues |
| 58 | |
| 59 | ```bash |
| 60 | # List issues |
| 61 | gh issue list --repo owner/repo --state open |
| 62 | |
| 63 | # Create issue |
| 64 | gh issue create --title "Bug: something broken" --body "Details..." |
| 65 | |
| 66 | # Close issue |
| 67 | gh issue close 42 --repo owner/repo |
| 68 | ``` |
| 69 | |
| 70 | ### CI/Workflow Runs |
| 71 | |
| 72 | ```bash |
| 73 | # List recent runs |
| 74 | gh run list --repo owner/repo --limit 10 |
| 75 | |
| 76 | # View specific run |
| 77 | gh run view <run-id> --repo owner/repo |
| 78 | |
| 79 | # View failed step logs only |
| 80 | gh run view <run-id> --repo owner/repo --log-failed |
| 81 | |
| 82 | # Re-run failed jobs |
| 83 | gh run rerun <run-id> --failed --repo owner/repo |
| 84 | ``` |
| 85 | |
| 86 | ### API Queries |
| 87 | |
| 88 | ```bash |
| 89 | # Get PR with specific fields |
| 90 | gh api repos/owner/repo/pulls/55 --jq '.title, .state, .user.login' |
| 91 | |
| 92 | # List all labels |
| 93 | gh api repos/owner/repo/labels --jq '.[].name' |
| 94 | |
| 95 | # Get repo stats |
| 96 | gh api repos/owner/repo --jq '{stars: .stargazers_count, forks: .forks_count}' |
| 97 | ``` |
| 98 | |
| 99 | ## JSON Output |
| 100 | |
| 101 | Most commands support `--json` for structured output with `--jq` filtering: |
| 102 | |
| 103 | ```bash |
| 104 | gh issue list --repo owner/repo --json number,title --jq '.[] | "\(.number): \(.title)"' |
| 105 | gh pr list --json number,title,state,mergeable --jq '.[] | select(.mergeable == "MERGEABLE")' |
| 106 | ``` |
| 107 | |
| 108 | ## Templates |
| 109 | |
| 110 | ### PR Review Summary |
| 111 | |
| 112 | ```bash |
| 113 | # Get PR overview for review |
| 114 | PR=55 REPO=owner/repo |
| 115 | echo "## PR #$PR Summary" |
| 116 | gh pr view $PR --repo $REPO --json title,body,author,additions,deletions,changedFiles \ |
| 117 | --jq '"**\(.title)** by @\(.author.login)\n\n\(.body)\n\n📊 +\(.additions) -\(.deletions) across \(.changedFiles) files"' |
| 118 | gh pr checks $PR --repo $REPO |
| 119 | ``` |
| 120 | |
| 121 | ### Issue Triage |
| 122 | |
| 123 | ```bash |
| 124 | # Quick issue triage view |
| 125 | gh issue list --repo owner/repo --state open --json number,title,labels,createdAt \ |
| 126 | --jq '.[] | "[\(.number)] \(.title) - \([.labels[].name] | join(", ")) (\(.createdAt[:10]))"' |
| 127 | ``` |
| 128 | |
| 129 | ## Notes |
| 130 | |
| 131 | - Always specify `--repo owner/repo` when not in a git directory |
| 132 | - Use URLs directly: `gh pr view https://github.com/owner/repo/pull/55` |
| 133 | - Rate limits apply; use `gh api --cache 1h` for repeated queries |