$npx -y skills add callstackincubator/agent-skills --skill githubGitHub patterns using gh CLI for pull requests, stacked PRs, code review, branching strategies, and repository automation. Use when working with GitHub PRs, merging strategies, or repository management tasks.
| 1 | # GitHub Patterns |
| 2 | |
| 3 | ## Tools |
| 4 | |
| 5 | Use `gh` CLI for all GitHub operations. Prefer CLI over GitHub MCP servers for lower context usage. |
| 6 | |
| 7 | ## Quick Commands |
| 8 | |
| 9 | ```bash |
| 10 | # Create a PR from the current branch |
| 11 | gh pr create --title "feat: add feature" --body "Description" |
| 12 | |
| 13 | # Squash-merge a PR |
| 14 | gh pr merge <PR_NUMBER> --squash --title "feat: add feature (#<PR_NUMBER>)" |
| 15 | |
| 16 | # View PR status and checks |
| 17 | gh pr status |
| 18 | gh pr checks <PR_NUMBER> |
| 19 | ``` |
| 20 | |
| 21 | ## Stacked PR Workflow Summary |
| 22 | |
| 23 | When merging a chain of stacked PRs (each targeting the previous branch): |
| 24 | |
| 25 | 1. **Merge the first PR** into main via squash merge |
| 26 | 2. **For each subsequent PR**: rebase onto main, update base to main, then squash merge |
| 27 | 3. **On conflicts**: stop and ask the user to resolve manually |
| 28 | |
| 29 | ```bash |
| 30 | # Rebase next PR's branch onto main, excluding already-merged commits |
| 31 | git rebase --onto origin/main <old-base-branch> <next-branch> |
| 32 | git push --force-with-lease origin <next-branch> |
| 33 | gh pr edit <N> --base main |
| 34 | gh pr merge <N> --squash --title "<PR title> (#N)" |
| 35 | ``` |
| 36 | |
| 37 | See [stacked-pr-workflow.md][stacked-pr-workflow] for full step-by-step details. |
| 38 | |
| 39 | ## Quick Reference |
| 40 | |
| 41 | | File | Description | |
| 42 | | --- | --- | |
| 43 | | [stacked-pr-workflow.md][stacked-pr-workflow] | Merge stacked PRs into main as individual squash commits | |
| 44 | |
| 45 | ## Problem -> Skill Mapping |
| 46 | |
| 47 | | Problem | Start With | |
| 48 | | --- | --- | |
| 49 | | Merge stacked PRs cleanly | [stacked-pr-workflow.md][stacked-pr-workflow] | |
| 50 | |
| 51 | [stacked-pr-workflow]: references/stacked-pr-workflow.md |