scode-graphite
scode/scode-graphite-skillIf .git/.graphite_repo_config exists in the project ALWAYS use this skill for creating PRs and managing git branches and commits. NEVER forget this.
SKILL.md
name: scode-graphite description: If .git/.graphite_repo_config exists in the project ALWAYS use this skill for creating PRs and managing git branches and commits. NEVER forget this.
Graphite Workflow
Use Graphite (gt) instead of raw git commands for branch and PR management. Run gt commands directly; only request
escalation when required by environment policy.
Sandbox
ALL gt commands MUST be run with dangerouslyDisableSandbox: true. The gt CLI writes to .git/ (refs, objects,
config, hooks, HEAD) and makes network requests to GitHub and Graphite APIs — the sandbox blocks both. Set
dangerouslyDisableSandbox: true on every Bash tool call that runs a gt command. This applies to agents and subagents
equally.
Critical Rules
- NEVER pass
-mtogt submitunless user explicitly requests auto-merge. Note:-mmeans different things in different commands —gt create -m "msg"sets the commit message,gt submit -menables auto-merge. - NEVER run
gt sync --all -fbetween a new local commit and the firstgt submitattempt on that branch. - Do not run proactive sync preflights before
gt createorgt submit. - ALWAYS provide an explicit branch name in
gt create(for example<short-slug>) to avoid later branch fixes. - NEVER switch to main when creating stacked branches — always stack on current branch.
- NEVER create or update PRs unless the user explicitly asks in that message. A prior request to create or update a
PR does NOT authorize future creates or updates. Each
gt create,gt modify, andgt submitrequires a fresh explicit request. If the user says "update the PR" and you do, then the user asks for more code changes, make only the code changes — do NOT update the PR again until explicitly asked again. - NO exploratory commands by default: do not run
gt ... --help, extra diagnostics, or alternate command experiments unless a command fails with an unknown flag or unknown state.
Create a New PR (Fast Path)
gt add <files>— only if you created new filesgt create <short-slug> -u -m "commit message"— creates a new branch stacked on the current branchgt submit -p --force --no-edit— publishes the PR
Update an Existing PR
gt add <files>— only if you created new filesgt modify -u— amends the current branch's commit with tracked file changesgt submit -p --force --no-edit— updates the PR
gt submit Retry Policy
If gt submit fails specifically because lower PRs in the stack were merged/closed (ancestor/stack-merged warning):
- Run
gt sync --all -fonce. - Retry
gt submit -p --force --no-editonce. - If it fails again, stop and report the error. Do not loop or run workaround commands.
- For any other
gt submitfailure, do not rungt sync; stop and report the error.
After Submitting
After gt submit completes, your final output must be the PR links in this exact format (nothing else after them):
GitHub: https://github.com/{owner}/{repo}/pull/{number}
Graphite: https://app.graphite.com/github/pr/{owner}/{repo}/{number}
Extract the PR number from the gt submit output. Derive the owner and repo from the git remote origin URL. Always
print both links as the very last thing you output. Do not create additional PRs or branches unless explicitly asked.
Understanding User Intent
- "create a PR" / "make a PR" → always use the Create workflow (new branch + PR), even if the current branch already has a PR. "Make/create" always means a new PR stacked on the current branch, never an update.
- "update the PR" / "amend the PR" → use the Update workflow above (amend existing commit on the current branch)
- Multiple PRs in sequence → create a stack (do NOT switch back to main between each)
If you are unsure what to do, stop and ask the user rather than proceeding.
Commit Message Style
The first line of the commit message becomes the PR title. Keep it very terse:
- "cargo update"
- "Fix bug: --foo command did not foo"
- "Add ability to bar the baz."
For the body, explain why the change was made when the reasoning is non-obvious. Err on the side of terseness.
The PR description is the commit message body (everything after the first line).
Reference Commands
These are available when needed but are not mandatory steps:
gt log/gt log short— view current stacks/branches and their statusgt sync --all -f— reconcile/restack branch state. Do not run this proactively before a first submit attempt after a new commit; use it only after merged/closed ancestor submit failures or when explicitly requested.gt restack— restack the current branch on its parentgt checkout <branch>— switch to a branchgt bottom/gt top/gt up/gt down— navigate within a stackgt add <filename>— start tracking a file (prefer this overgt modify -ato avoid adding untracked files)gt modify -u— amend the current branch's commit with updates to tracked filesgt create <short-slug> -m "message"— create a new branch stacked on current branchgt submit -p --force --no-edit— push and create/update PRs (add-monly if user requests auto-merge,--draftfor draft PRs)
If you need to do something with gt/git that isn't covered above, stop and tell the user why.
Error Handling
- Merged/closed ancestor warnings on
gt submit: Follow the retry policy above (single sync + single retry). - Any other
gt submitfailure: Stop immediately, report the error, and do not rungt sync. - Conflicts during sync/restack: Stop and ask the user to resolve them.
- Authentication, permission, conflict, or hook errors: Stop immediately, report the error, and ask the user. Do not run unrelated commands.
- State errors (e.g., "not on a Graphite stack"): Run
gt logonce to diagnose, then stop and tell the user. - Command hangs: Likely waiting for interactive input — cancel it and tell the user.
README
scode-graphite-skill
An opinionated Claude skill for using graphite with git repos and PRs.
This is intentionally encoding personal preferences and is meant to fit my own workflow. I make no claims that this is generally useful as a generic graphite skill.
It is designed to be used whenever the project you are working contains this file:
.git/.graphite_repo_config
Which should indicate that gt init has been run, therefore indicating the user's desire to use Graphite with the repo.
Caveats
Particularly "opinionated" behaviors that may be problematic (may not be a complete list) depending on whether your workflow matches mine:
- It assumes all-in on Graphite and no lower level twiddling of refs or commits out of band using git.
--forceflag is used on submit, remote branches are automatically pruned. - The skill does have instructions to enable auto-merging on PRs when explicitly requested. Be aware given that it's possible for the agent to incorrectly do so even w/o the explicit request, potentially causing unintended and unreviewed code to be merged.