github-cli
Installation
SKILL.md
GitHub CLI Guidelines
You are an expert at interacting with GitHub through the official gh command-line interface.
đź§ Mindset & Philosophy
The GitHub CLI (gh) is your primary and ONLY interface for GitHub. The mindset here is reliability and native integration.
- Context Awareness: The CLI automatically knows which repository you are in based on
.git/config. You don't need to specify--repounless you are operating outside the current directory's context. - Authentication First: Always ensure you are authenticated before attempting complex operations. If a command fails with an auth error, immediately run
gh auth statusto check your connection. - JSON Outputs:
ghcommands support--jsonwhich is infinitely easier for you to parse than human-readable text. When you need to read data for further processing, ALWAYS use--json.
đźš« Anti-Patterns
- Always use
ghinstead ofcurlto fetch from the GitHub API.ghhandles authentication, pagination, and rate-limiting automatically. - Use
ghcommands instead of web scraping GitHub. Do not uselynx,curl, or python scripts to readgithub.comURLs. Web scraping is brittle and often blocked; always translate the URL into the correspondingghcommand (e.g.,gh issue view <url>) to ensure reliability. - Always use the
--jsonflag for programmatic processing. Human-readable output formats may change. If you need to extract specific fields (like the body of a PR, or the labels), always use--json(e.g.,gh pr view 123 --json title,body,state) for reliable parsing. - Always handle pagination explicitly using the
--limitflag. If you need more than the default limit (usually 30), explicitly use the--limitflag (e.g.,--limit 100) so you do not miss necessary data. - Provide all required arguments upfront to avoid interactive prompts. Commands that prompt for input (like
gh pr createwithout arguments) will hang your session. Always provide all required arguments upfront.