GitHub CLI Skill
Prerequisite
- •Local Path: Ensure
ghis in your PATH. - •Usage: Run
ghcommands directly (e.g.,gh issue list). - •Auth: Ensure you are authenticated. Run
gh auth status. If not, rungh auth login.
Pull Requests
- •
Create PR:
bashgh pr create --title "type(scope): description" --body "Detailed description"
- •
View PR:
gh pr view [number|url] --web - •
Check Status:
gh pr status - •
Checkout PR:
gh pr checkout [number] - •
List PRs:
gh pr list
Issues
- •List Issues:
gh issue list - •Create Issue:
gh issue create --title "..." --body "..."
Actions
- •List Runs:
gh run list - •Watch Run:
gh run watch [run-id]
Milestones
- •
CRITICAL: There is NO
gh milestonecommand. You MUST use the API. - •
List Milestones:
bashgh api repos/{owner}/{repo}/milestones -q ".[] | \"\(.number): \(.title)\"" - •
Assign Issue to Milestone:
bash# Use the TITLE, not the number! gh issue edit [issue-number] --milestone "Milestone Title"
- •
NEVER use
gh issue edit --milestone 3. The CLI expects the title string, not the milestone ID.
Best Practices
- •Non-Interactive: Use flags (
--title,--body,--yes) to avoid interactive prompts when running from scripts/agent. - •Web Flag: Use
--webwhen asking the user to review something in the browser. - •JSON Output for
gh issue/pr: Use--json [fields]to get machine-readable output. - •JSON Output for
gh api: Use-q(jq filter), NOT--json. The--jsonflag does not exist forgh api. - •Draft PRs: GitHub cannot merge Draft PRs. Always run
gh pr ready [id]beforegh pr merge.
Common Mistakes to Avoid
- •
gh milestone list- Does NOT exist. Usegh api repos/.../milestones. - •
gh api ... --json- INVALID. Use-qfor filtering. - •
gh issue edit --milestone 3- WRONG. Use the milestone title, not its ID. - •
gh pr mergeon Draft - FAILS. Rungh pr readyfirst.