home / skills / lambda-curry / devagent / github-cli-operations
This skill helps you manage GitHub repositories with gh to view PRs, diffs, checks, and issues from the command line.
npx playbooks add skill lambda-curry/devagent --skill github-cli-operationsReview the files below or copy the command above to add this skill to your agents.
---
name: GitHub CLI Operations
description: >-
Use GitHub CLI (gh) to interact with GitHub repositories, pull requests,
issues, and workflows. Use when: (1) Reading PR details, diffs, or metadata,
(2) Listing or filtering PRs and issues, (3) Creating PR comments or linking to
issues, (4) Checking CI status or mergeability, (5) Extracting issue references
from PR descriptions, or (6) Any GitHub repository operation via command line.
Requires GitHub CLI installed and authenticated.
---
# GitHub CLI Operations
Use GitHub CLI (`gh`) to interact with GitHub repositories, pull requests, issues, and workflows.
## Prerequisites
- GitHub CLI installed: `brew install gh` (macOS) or see [cli.github.com](https://cli.github.com)
- Authenticated: `gh auth login` (one-time setup)
- Repository context: Run commands from within a git repository or specify `--repo owner/repo`
## Quick Start
**Get PR details:**
```bash
gh pr view <pr-number> --json title,body,author,state
```
**Get PR diff:**
```bash
gh pr diff <pr-number>
```
**Extract Linear issue references:**
```bash
gh pr view <pr-number> --json body --jq '.body' | grep -oE 'LIN-[0-9]+'
```
## Usage Patterns for PR Review
### Get PR Context
Get PR title, description, and metadata:
```bash
gh pr view <pr-number> --json title,body,author,state,baseRefName,headRefName
```
Get changed files:
```bash
gh pr view <pr-number> --json files --jq '.files[].path'
```
Get diff for specific file:
```bash
gh pr diff <pr-number> -- path/to/file
```
### Check PR Status
Check CI status:
```bash
gh pr checks <pr-number>
```
Check if PR is mergeable:
```bash
gh pr view <pr-number> --json mergeable,mergeStateStatus
```
### Link to Linear Issues
Extract issue references from PR body:
```bash
gh pr view <pr-number> --json body --jq '.body' | grep -oE 'LIN-[0-9]+'
```
## Integration with Linear
When reviewing PRs, extract Linear issue references from:
- PR title: Look for `LIN-123` or `[LIN-123]` patterns
- PR body: Search for Linear issue links or IDs
- PR comments: Check for issue mentions
Then use Linear MCP functions to fetch issue details and requirements.
## Reference Documentation
- **Command Reference**: See [commands.md](references/commands.md) for complete GitHub CLI command reference
- **GitHub CLI Manual**: [cli.github.com/manual](https://cli.github.com/manual)
This skill uses the GitHub CLI (gh) to perform repository operations, inspect pull requests, issues, and workflows from the command line. It is built for quick inspection of PR metadata, diffs, CI status, mergeability, and extracting referenced issue IDs. Requires gh installed and authenticated and can run in-repo or against a specified owner/repo.
The skill runs gh commands to fetch PR details, file lists, and diffs, and parses JSON output to extract fields like title, body, author, files, mergeable status, and checks. It can also run search and text filters (jq/grep) to pull issue references such as Linear IDs from PR titles, bodies, or comments. Results are returned as structured text suitable for review automation or further integration.
What do I need to use this skill?
Install GitHub CLI and run gh auth login. Run commands from a repository or add --repo owner/repo.
How do I reliably extract issue IDs like LIN-123?
Use gh pr view --json body --jq '.body' and filter with a regex such as grep -oE 'LIN-[0-9]+' to capture consistent ID patterns.