| name | github |
| description | Git and GitHub operations via gh CLI — branching, committing, creating PRs, managing issues, viewing CI status, and repository management. Provides ready-to-use gh commands for common workflows like creating feature branches, checking PR review status, listing open issues, viewing workflow run results, and managing labels. Use when doing git operations, creating or updating PRs, managing GitHub issues, checking CI/CD status, viewing PR comments, or working with GitHub releases. Triggers on 'git', 'github', 'PR', 'pull request', 'issue', 'branch', 'CI status', 'gh'. NOT for: Linear issue tracking (use linear), AI code reviews (use coderabbit), full PR lifecycle with review loops (use pr-loop). Use when this capability is needed. |
Skill: GitHub & Git Operations
Use gh CLI and git commands through this skill. No GitHub MCP required.
Prerequisites
gh CLI installed (brew install gh)
- Authenticated:
gh auth login
Quick Reference
Issues
gh issue create --title "Title" --body "Description" --label "bug"
gh issue list
gh issue list --assignee @me
gh issue list --label "enhancement"
gh issue view 123
gh issue close 123
Pull Requests
gh pr create --title "Title" --body "Description"
gh pr create --title "feat: add feature" --body "$(cat <<'EOF'
## Summary
- Change 1
- Change 2
## Test plan
- [ ] Test A
- [ ] Test B
EOF
)"
gh pr list
gh pr list --author @me
gh pr view 123
gh pr checkout 123
gh pr merge 123 --squash
Commits (Git)
git add file1.ts file2.ts
git commit -m "$(cat <<'EOF'
feat: description of change
More details here.
Co-Authored-By: Claude <noreply@anthropic.com>
EOF
)"
git status
git diff
git diff --staged
Branches
git checkout -b feat/new-feature
git push -u origin feat/new-feature
git branch -d feat/old-feature
Worktrees (Isolated Development)
Worktrees create isolated workspaces sharing the same repo — work on multiple branches simultaneously.
Directory selection (priority order):
- Check for existing
.worktrees/ or worktrees/ dir
- Check CLAUDE.md for preference
- Ask user:
.worktrees/ (project-local, hidden) or ~/.config/superpowers/worktrees/<project>/ (global)
Safety: For project-local dirs, verify they're gitignored first:
git check-ignore -q .worktrees 2>/dev/null
Create + setup:
git worktree add .worktrees/feature-name -b feat/feature-name
cd .worktrees/feature-name
[ -f package.json ] && npm install
[ -f Cargo.toml ] && cargo build
[ -f requirements.txt ] && pip install -r requirements.txt
npm test
git worktree list
git worktree remove .worktrees/feature-name
Common Workflows
Start New Feature
git checkout -b feat/feature-name
git add changed-files.ts
git commit -m "feat: add feature"
git push -u origin feat/feature-name
gh pr create --title "feat: add feature" --body "Description"
Fix a Bug from Issue
gh issue view 42
git checkout -b fix/issue-42
git add .
git commit -m "fix: resolve issue #42"
git push -u origin fix/issue-42
gh pr create --title "fix: resolve issue #42" --body "Closes #42"
Create Issue for Future Work
gh issue create \
--title "feat: future enhancement" \
--body "## Description
What needs to be done.
## Acceptance Criteria
- [ ] Criterion 1
- [ ] Criterion 2" \
--label "enhancement"
Safety Rules
- Never force push to main/master - Always create feature branches
- Stage specific files - Avoid
git add -A which can include secrets
- Check before commit - Run
git status and git diff --staged
- Don't commit secrets - Check for .env, credentials, API keys
- Ask before destructive operations - reset --hard, branch -D, etc.
Troubleshooting
Auth Issues - GITHUB_TOKEN Conflict (Common!)
Symptom: gh commands fail with "Bad credentials" even though gh auth status shows you're logged in.
Cause: An old/expired GITHUB_TOKEN in your shell config (.zshrc, .bashrc) overrides the valid keyring auth.
Diagnosis:
gh auth status
Fix:
grep -r "GITHUB_TOKEN" ~/.zshrc ~/.bashrc ~/.zprofile 2>/dev/null
unset GITHUB_TOKEN
gh auth status
Why this happens: Old GitHub workflows used personal access tokens exported as GITHUB_TOKEN. The gh CLI now uses OAuth via keyring, which is more secure and auto-refreshes. The old env var takes precedence and breaks things.
Re-authenticate
gh auth login
Push Rejected
git fetch origin
git rebase origin/main
git push
Converted and distributed by TomeVault — claim your Tome and manage your conversions.