diff --git a/skill/github-cli/SKILL.md b/skill/github-cli/SKILL.md new file mode 100644 index 0000000..249c221 --- /dev/null +++ b/skill/github-cli/SKILL.md @@ -0,0 +1,81 @@ +--- +name: github-cli +description: > + Interact with GitHub using the gh CLI - PRs, issues, repos, releases, and actions. + Trigger terms: github, gh, pull request, PR, issue, release, actions, workflow, repo. +--- + +## When to Use +- Creating, viewing, or merging pull requests +- Managing issues (create, close, comment) +- Checking workflow/action status +- Creating releases +- Cloning or forking repos + +## When NOT to Use +- Local git operations (use `git` directly) +- Non-GitHub remotes (GitLab, Bitbucket) + +## Prerequisites +- `gh` CLI installed +- SSH key `~/.ssh/agent` configured for GitHub access +- Set `GIT_SSH_COMMAND` if needed: `export GIT_SSH_COMMAND="ssh -i ~/.ssh/agent"` + +## Quick Reference + +### Pull Requests +| Action | Command | +|--------|---------| +| List PRs | `gh pr list` | +| View PR | `gh pr view ` | +| Create PR | `gh pr create --title "..." --body "..."` | +| Checkout PR | `gh pr checkout ` | +| Merge PR | `gh pr merge ` | +| PR diff | `gh pr diff ` | +| PR checks | `gh pr checks ` | + +### Issues +| Action | Command | +|--------|---------| +| List issues | `gh issue list` | +| View issue | `gh issue view ` | +| Create issue | `gh issue create --title "..." --body "..."` | +| Close issue | `gh issue close ` | +| Comment | `gh issue comment --body "..."` | + +### Repos & Releases +| Action | Command | +|--------|---------| +| Clone | `gh repo clone /` | +| Fork | `gh repo fork /` | +| View repo | `gh repo view` | +| Create release | `gh release create --title "..." --notes "..."` | +| List releases | `gh release list` | + +### Actions & Workflows +| Action | Command | +|--------|---------| +| List runs | `gh run list` | +| View run | `gh run view ` | +| Watch run | `gh run watch ` | +| Rerun failed | `gh run rerun --failed` | +| List workflows | `gh workflow list` | + +### API Access +```bash +gh api repos///pulls +gh api graphql -f query='...' +``` + +## Procedure + +1. Ensure `gh auth status` shows authenticated +2. Use `gh pr list` or `gh issue list` to find items +3. Perform action with appropriate command +4. Verify with `gh pr checks` or `gh run list` + +## Checks & Guardrails +- Always check PR status before merging +- Use `--draft` for work-in-progress PRs +- Prefer `gh pr merge --squash` for clean history +- Check `gh run list` after pushing to verify CI