| name | gh |
| description | GitHub operations using gh CLI for any repository. Use when the user asks to "create pr", "create pull request", "view pr", "check ci", "pr status", "list prs", "create issue", "view issue", "search code", or any other GitHub-related operations. Handles PR creation with proper base branch detection, template support, and project conventions. |
| user-invocable | true |
| model | haiku |
| trigger | ["pull request","create pr","create pull request","make pull request","make a pr","open pull request","open a pr","github pr","check ci","pr status","view pr","list prs","show prs","my prs","pr checks","create issue","github issue","view issue","list issues","search code","search repo","repository search"] |
GitHub Operations
Manage GitHub workflows using the gh CLI.
When to Use This Skill
Use this skill when the user asks to:
- Create a pull request
- View PR details or status
- Check CI/CD pipeline status
- Manage issues
- Review PR comments
- Search repository code or issues
Commands
Create Pull Request
When creating a PR:
-
Verify current branch and changes:
git branch --show-current
git status
-
Check if branch is pushed:
git log @{u}.. 2>/dev/null || echo "Branch not pushed"
-
Push if needed:
git push -u origin $(git branch --show-current)
-
Detect parent branch (if base not specified):
Find the parent branch from which the current branch was created:
PARENT_BRANCH=$(git show-branch -a 2>/dev/null | grep '\*' | grep -v "$(git rev-parse --abbrev-ref HEAD)" | head -n1 | sed 's/.*\[\(.*\)\].*/\1/' | sed 's/[\^~].*//' | sed 's/remotes\/origin\///')
if [ -z "$PARENT_BRANCH" ]; then
for branch in development develop main master; do
if git show-ref --verify --quiet refs/remotes/origin/$branch; then
PARENT_BRANCH=$branch
break
fi
done
fi
-
Create PR:
Check if a PR template exists and use it, otherwise open in browser:
if [ -f .github/PULL_REQUEST_TEMPLATE.md ]; then
gh pr create --title "Brief title (under 70 chars)" --base "$PARENT_BRANCH" --template .github/PULL_REQUEST_TEMPLATE.md
else
gh pr create --title "Brief title (under 70 chars)" --base "$PARENT_BRANCH" --web
fi
Base branch logic:
- Auto-detect: Use the parent branch from which current branch was created
- Fallback: Use common default branches if detection fails
- Override: Use explicitly specified base branch if provided by user
Template handling:
- If
.github/PULL_REQUEST_TEMPLATE.md exists: Use --template flag to fill it via CLI
- If no template: Use
--web flag to open browser for manual description
- Display PR URL to user
View Pull Request
gh pr view 123
gh pr view 123 --web
gh pr list
gh pr list --author @me
Check PR Status
gh pr checks 123
gh pr status
PR Comments
gh pr view 123 --comments
gh pr comment 123 --body "Your comment here"
Issue Management
gh issue create --title "Issue title" --body "Issue description"
gh issue view 456
gh issue list
gh issue list --search "keyword"
Code Search
gh search code "search term"
gh search code --repo owner/repo "search term"
View Commits
git log --oneline -10
gh pr view <commit-sha>
PR Best Practices
Title Format
- Keep under 70 characters
- Use imperative mood: "Add feature" not "Added feature"
- Be specific but concise
Examples:
- ✅ "Optimize CLAUDE.md by removing general knowledge"
- ✅ "Fix memory leak in ChatController disposal"
- ✅ "Add snapshot tests for CallVisualizer UI"
- ❌ "Update files" (too vague)
- ❌ "This PR adds a new feature to handle user authentication and also fixes some bugs" (too long)
Description Format
- If the repository has a PR template at
.github/PULL_REQUEST_TEMPLATE.md, use the --template flag
- If no template exists, use the
--web flag to open browser for manual description
- Never create custom descriptions with
--body - always use template or browser
Base Branch Selection
- Auto-detect: Automatically use the parent branch from which the current branch was created
- Fallback: Use common default branches (
development, develop, main, or master) if parent branch detection fails
- Override: Use explicitly specified base branch if the user requests it (e.g., "create PR against master")
Error Handling
If gh is not authenticated:
Run: gh auth login
Follow browser-based OAuth flow
If gh is not installed:
macOS: brew install gh
Or download from: https://cli.github.com/
Important Notes
- Check for PR template first: Use
--template if .github/PULL_REQUEST_TEMPLATE.md exists, otherwise use --web
- Never use
--body parameter: Always use template or browser for PR descriptions
- Always verify branch is pushed before creating PR
- Check CI status before requesting review