graphite — Claude Code skill: stacked PRs with gt
Teaches the agent to build and manage Graphite PR stacks: create branches, walk the stack, restack on main.
npx skills add withgraphite/agent-skills --skill graphite -a claude-codeWhat graphite does
The skill covers the Graphite CLI (gt) and whitelists the commands the agent may run: gt *, git add, git reset, git diff, git status, git stash, git checkout, git rebase, git branch and gh pr. Inside there is a quick-reference table, the basic stack workflow, navigation (gt up, gt down, gt top, gt bottom, gt ls), amending a branch with gt modify and submitting with gt submit --no-interactive.
A separate section handles branches Graphite does not track. When gt branch info returns the untracked-branch error, the skill gives two routes: track the branch temporarily with gt track -p main, build the stack, then re-parent the first branch onto main and run gt restack; or stash the work and start from main. There is also a recipe for resetting commits back to unstaged changes and advice to reorder branches with gt move rather than gt create --insert.
Before submitting, the skill tells the agent to confirm with gt ls that the first branch sits on main, then run lint, build and tests using the commands from the project's CLAUDE.md. PR descriptions should be written to /tmp/pr-body.md and applied with gh pr edit --body-file instead of a heredoc, because shell escaping breaks markdown. In deep stacks gt restack can touch branches outside your work and hit unrelated conflicts; the skill points to a targeted git rebase <target> for that case.
What it helps with
- build a stack of dependent pull requests
- jump to a specific branch in the stack
- re-parent a stack from a feature branch onto main
- split one large commit into separate PRs
- fix a branch Graphite is not tracking
Example prompts for the agent
- create a three-PR stack for this feature with gt
- show me the stack and move me up one branch
- re-parent the stack onto main and restack it
How to install graphite
1Skills CLI (Vercel)
npx skills add withgraphite/agent-skills --skill graphite -a claude-code2Manually: put the files in place
~/.claude/skills/graphite/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/graphite/
1Skills CLI (Vercel)
npx skills add withgraphite/agent-skills --skill graphite -a codex2Manually: put the files in place
.agents/skills/graphite/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add withgraphite/agent-skills --skill graphite -a cursor2Manually: put the files in place
.cursor/skills/graphite/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install withgraphite/agent-skills graphite2Manually: put the files in place
.github/skills/graphite/SKILL.md1Skills CLI (Vercel)
npx skills add withgraphite/agent-skills --skill graphite -a gemini-cli2Platform CLI
gemini skills install https://github.com/withgraphite/agent-skills --path skills/graphiteManually: put the files in place
.devin/skills/graphite/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add withgraphite/agent-skills --skill graphite -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about graphite
How do I install graphite in Claude?
Run npx skills add withgraphite/agent-skills --skill graphite -a claude-code. The skill file then lives at ~/.claude/skills/graphite/SKILL.md.
What does graphite do?
It tells the agent how to drive the Graphite CLI: creating branches and PRs, navigating the stack, rebasing onto trunk, submitting with gt submit and editing descriptions with gh pr edit.
Why can't the agent work with my branch?
The branch is probably untracked by Graphite. The skill says to run gt track -p main first, then build the stack with gt create.