github
callstackincubator/agent-skills
GitHub patterns using gh CLI for pull requests, stacked PRs, code review, and repository automation.
What is github?
This skill provides GitHub workflow patterns and automation using the gh CLI tool. Use it when managing pull requests, implementing stacked PR workflows, handling merging strategies, or automating repository tasks.
- Create and manage pull requests via gh CLI
- Merge stacked PRs with squash-merge strategy while maintaining clean commit history
- Rebase branches onto main and update PR bases during multi-PR workflows
- View PR status and check CI/CD check results
- Automate repository operations using gh CLI commands
How to install github
npx skills add https://github.com/callstackincubator/agent-skills --skill github- gh CLI installed and authenticated with GitHub
- Git configured locally
- Access to the GitHub repository
How to use github
- 1.Install the skill using the provided npx command
- 2.Use `gh pr create` to create pull requests from your current branch
- 3.For stacked PRs, merge the first PR with `gh pr merge <PR_NUMBER> --squash`
- 4.For subsequent PRs in the stack, rebase onto main using `git rebase --onto origin/main <old-base-branch> <next-branch>`
- 5.Update the PR base to main with `gh pr edit <N> --base main`
- 6.Merge each subsequent PR with `gh pr merge <N> --squash`
- 7.Check PR status anytime with `gh pr status` or `gh pr checks <PR_NUMBER>`
Use cases
- Merging a chain of stacked PRs (each targeting the previous branch) into main as individual squash commits
- Creating pull requests from feature branches with titles and descriptions
- Checking PR status and CI/CD pipeline results before merging
- Rebasing dependent PRs when their base branch is merged
- Automating repetitive GitHub operations in agent workflows
- Developers managing multiple dependent pull requests
- Teams using stacked PR workflows for code review
- Engineers automating GitHub repository operations
- Code reviewers checking PR status and CI checks
github FAQ
A stacked PR workflow is when you have multiple pull requests in a chain, where each PR targets the previous branch instead of main. This allows parallel code review of dependent changes. The skill provides automation to merge them cleanly into main as individual squash commits.
The gh CLI is preferred for lower context usage in agent workflows and enables automation of complex operations like rebasing and merging stacked PRs programmatically.
The skill will stop and ask the user to resolve conflicts manually before continuing with the merge process.
Use `gh pr checks <PR_NUMBER>` to view the status of all CI/CD checks for a specific pull request.
Yes, the skill supports standard GitHub operations like creating PRs, merging, and checking status. The stacked PR workflow is just one specialized use case.
Full instructions (SKILL.md)
Source of truth, from callstackincubator/agent-skills.
name: github description: GitHub 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. license: MIT metadata: author: Callstack tags: github, gh-cli, pull-request, stacked-pr, squash, rebase
GitHub Patterns
Tools
Use gh CLI for all GitHub operations. Prefer CLI over GitHub MCP servers for lower context usage.
Quick Commands
# Create a PR from the current branch
gh pr create --title "feat: add feature" --body "Description"
# Squash-merge a PR
gh pr merge <PR_NUMBER> --squash --title "feat: add feature (#<PR_NUMBER>)"
# View PR status and checks
gh pr status
gh pr checks <PR_NUMBER>
Stacked PR Workflow Summary
When merging a chain of stacked PRs (each targeting the previous branch):
- Merge the first PR into main via squash merge
- For each subsequent PR: rebase onto main, update base to main, then squash merge
- On conflicts: stop and ask the user to resolve manually
# Rebase next PR's branch onto main, excluding already-merged commits
git rebase --onto origin/main <old-base-branch> <next-branch>
git push --force-with-lease origin <next-branch>
gh pr edit <N> --base main
gh pr merge <N> --squash --title "<PR title> (#N)"
See stacked-pr-workflow.md for full step-by-step details.
Quick Reference
| File | Description |
|---|---|
| stacked-pr-workflow.md | Merge stacked PRs into main as individual squash commits |
Problem -> Skill Mapping
| Problem | Start With |
|---|---|
| Merge stacked PRs cleanly | stacked-pr-workflow.md |
Related skills
More from callstackincubator/agent-skills and the wider catalog.

github-actions
Reusable GitHub Actions patterns for React Native iOS simulator and Android emulator cloud builds with downloadable artifacts.

react-native-best-practices
React Native performance optimization guidelines for FPS, bundle size, memory, and animations.

react-native-brownfield-migration
Incremental brownfield migration from native iOS/Android to React Native or Expo using @callstack/react-native-brownfield.

react-native-tv-best-practices
Reviews React Native TV apps for focus, D-pad navigation, 10-foot UI, playback/DRM, and TV performance.

react-navigation
React Navigation UI patterns for stacks, tabs, drawers, and sheets in React Native apps.

upgrading-react-native
Upgrade React Native apps to newer versions with template diffs, dependency updates, and native config migration.