一键导入
scode-graphite
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.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
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.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| 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. |
Use Graphite (gt) instead of raw git commands for branch and PR management.
ALL gt commands and gt-fast.sh 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. This applies to agents and subagents equally.
-m to gt submit unless user explicitly requests auto-merge. Note: -m means different things in
different commands — gt create -m "msg" sets the commit message, gt submit -m enables auto-merge.gt sync --all -f between a new local commit and the first gt submit attempt on that branch.gt create or gt submit.gt create (for example <short-slug>) to avoid later branch fixes.gt ... --help, extra diagnostics, or alternate command
experiments unless a command fails with an unknown flag or unknown state.For new and update PR operations, use the gt-fast.sh script located in the same directory as this SKILL.md file. It
handles the happy path, detached HEAD worktrees, merged-parent recovery, and untracked-branch recovery deterministically
in a single invocation.
Run with dangerouslyDisableSandbox: true.
New PR:
/path/to/gt-fast.sh new <short-slug> "<commit message>" [files-to-add...]
Only pass files-to-add for newly created files. The commit message first line becomes the PR title.
Update PR:
/path/to/gt-fast.sh update [files-to-add...]
After a successful submit (whether via gt-fast.sh or manual commands), 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 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.
If you are unsure what to do, stop and ask the user rather than proceeding.
The first line of the commit message becomes the PR title. Keep it very terse:
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).
Use this section only when gt-fast.sh is unavailable or exits non-zero. Run gt commands one at a time with
dangerouslyDisableSandbox: true, following the procedures below.
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 PRgt 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 PRCodex automation worktrees often start detached at a commit that already exists on an integration branch. Use this deterministic flow so PR creation does not require trial-and-error:
git branch --show-current.git switch -c automation/<slug>-<yyyymmdd>.main by default and validate with: git rev-list --left-right --count main...HEAD. If the left count
is 0, keep parent main (both 0 0 and 0 N are valid).gt log short once, pick one obvious parent from the tracked stack, and validate
it with the same git rev-list check. If no obvious parent has left count 0, stop and ask the user.gt track -p <parent>.gt create ..., then gt submit ...).If gt create fails with "untracked branch":
gt log short once to see the tracked stack.git rev-list --left-right --count <parent>...HEAD:
0 0: placeholder branch at parent tip; safe to continue.0 N: branch is ahead of parent but not diverged; safe to continue.gt track -p <parent> on the existing branch.gt create <short-slug> -u -m "commit message".gt track -p <parent> again on the new
branch before gt submit. This reparents the PR branch directly onto the real parent so the empty placeholder branch
does not block submission.gt submit -p --force --no-edit.Do not use gt sync for this recovery. This is a branch-parenting problem, not a sync problem.
gt submit Retry PolicyIf gt submit fails specifically because lower PRs in the stack were merged/closed (ancestor/stack-merged warning):
gt sync --all -f once.gt submit -p --force --no-edit once.gt submit failure, do not run gt sync; stop and report the error.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 (only after merged/closed ancestor submit failures or when
explicitly requested)gt restack — restack the current branch on its parentgt track -p <parent> — attach the current branch to an existing parent branch, or reparent itgt 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 over gt modify -a to 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 -m only if user requests auto-merge, --draft
for draft PRs)If you need to do something with gt/git that isn't covered above, stop and tell the user why.
gt submit: Follow the retry policy above (single sync + single retry).gt submit says a lower branch introduces no changes / empty PR and nothing was submitted: this is usually an
intermediate placeholder branch. Reparent the current branch with gt track -p <parent> (same parent used during
gt create) and retry gt submit -p --force --no-edit once.gt submit failure: Stop immediately, report the error, and do not run gt sync.gt create says the current branch is untracked: Treat this as the untracked-branch case above.gt log once to diagnose, then stop and tell the user.