Token导航 LogoToken导航TokenDH.com
前端设计执行命令github未标认证来源可访问许可证需确认审计通过

graphitegraphite 命令行

Agent Skill

graphite 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

6,962

周安装

293

GitHub Stars

4

下载量

2,438
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:graphite(graphite 命令行)
来源仓库:https://github.com/withgraphite/agent-skills
仓库路径:skills/graphite
安装命令:
npx skills add https://github.com/withgraphite/agent-skills --skill graphite
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/withgraphite/agent-skills --skill graphite

简介

graphite 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。

  • 它支持查询仓库基本信息、Issue 状态、PR 合并情况及代码审查流程。
  • 通过 npx skills add 命令从指定 GitHub 仓库安装,具体用法请参考原始 README。
  • 安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。
  • graphite 属于前端设计类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Graphite Skill

Work with Graphite (gt) for creating, navigating, and managing stacked pull requests.

Quick Reference

I want to...Command
Create a new branch/PRgt create branch-name -m "message"
Amend current branchgt modify -m "message"
Navigate up the stackgt up
Navigate down the stackgt down
Jump to top of stackgt top
Jump to bottom of stackgt bottom
View stack structuregt ls
Submit stack for reviewgt submit --no-interactive
Rebase stack on trunkgt restack
Change branch parentgt track --parent <branch>
Rename current branchgt rename <new-name>
Move branch in stackgt move

What Makes a Good PR?

In roughly descending order of importance:

  • Atomic/hermetic - independent of other changes; will pass CI and be safe to deploy on its own
  • Narrow semantic scope - changes only to module X, or the same change across modules X, Y, Z
  • Small diff - (heuristic) small total diff line count

Do NOT worry about creating TOO MANY pull requests. It is always preferable to create more pull requests than fewer.

NO CHANGE IS TOO SMALL: tiny PRs allow for the medium/larger-sized PRs to have more clarity.

Always argue in favor of creating more PRs, as long as they independently pass build.


Branch Naming Conventions

When naming PRs in a stack, follow this syntax:

terse-stack-feature-name/terse-description-of-change

For example, a 4 PR stack:

auth-bugfix/reorder-args
auth-bugfix/improve-logging
auth-bugfix/improve-documentation
auth-bugfix/handle-401-status-codes

Creating a Stack

Basic Workflow

  1. Make changes to files
  2. Stage changes: git add <files>
  3. Create branch: gt create branch-name -m "commit message"
  4. Repeat for each PR in the stack
  5. Submit: gt submit --no-interactive

Handle Untracked Branches (common with worktrees)

Before creating branches, check if the current branch is tracked:

gt branch info

If you see "ERROR: Cannot perform this operation on untracked branch":

Option A (Recommended): Track temporarily, then re-parent

  1. Track current branch: gt track -p main
  2. Create your stack normally with gt create
  3. After creating ALL branches, re-parent your first new branch onto main: gt checkout <first-branch-of-your-stack> gt track -p main gt restack

Option B: Stash changes and start from main

  1. git stash
  2. git checkout main && git pull
  3. Create new branch and unstash: git checkout -b temp-working && git stash pop
  4. Proceed with gt track -p main and gt create

Navigating a Stack

# Move up one branch (toward top of stack)
gt up

# Move down one branch (toward trunk)
gt down

# Jump to top of stack
gt top

# Jump to bottom of stack (first branch above trunk)
gt bottom

# View the full stack structure
gt ls

Modifying a Stack

Amend Current Branch

git add <files>
gt modify -m "updated commit message"

Reorder Branches

Use gt move to reorder branches in the stack. This is simpler than trying to use gt create --insert.

Re-parent a Stack

If you created a stack on top of a feature branch but want it based on main:

# Go to first branch of your stack
gt checkout <first-branch>

# Change its parent to main
gt track --parent main

# Rebase the entire stack
gt restack

Rename a Branch

gt rename new-branch-name

Resetting Commits to Unstaged Changes

If changes are already committed but you want to re-stack them differently:

# Reset the last commit, keeping changes unstaged
git reset HEAD^

# Reset multiple commits (e.g., last 2 commits)
git reset HEAD~2

# View the diff to understand what you're working with
git diff HEAD

Before Submitting

Verify Stack is Rooted on Main

Before running gt submit, verify the first PR is parented on main:

gt ls

If the first branch has a parent other than main:

gt checkout <first-branch>
gt track -p main
gt restack

Run Validation

After creating each PR, run appropriate linting, building, and testing:

  1. Refer to the project's CLAUDE.md for specific commands
  2. If validation fails, fix the issue, stage changes, and use gt modify

Submitting and Updating PRs

Submit the Stack

gt submit --no-interactive

Update PR Descriptions

After submitting, use gh pr edit to set proper titles and descriptions.

IMPORTANT: Never use Bash heredocs for PR descriptions - shell escaping breaks markdown tables, code blocks, etc. Instead:

  1. Use the Write tool to create /tmp/pr-body.md with the full markdown content
  2. Use gh pr edit with --body-file:
gh pr edit <PR_NUMBER> --title "stack-name: description" --body-file /tmp/pr-body.md

PR descriptions must include:

  • Stack Context: What is the bigger goal of this stack?
  • What? (optional for small changes): Super terse, focus on what not why
  • Why?: What prompted the change? Why this solution? How does it fit into the stack?

Example (for a PR in a 3-PR stack adding a warning feature):

## Stack Context

This stack adds a warning on the merge button when users are bypassing GitHub rulesets.

## Why?

Users who can bypass rulesets (via org admin or team membership) currently see no indication
they're circumventing branch protection. This PR threads the bypass data from the server to
enable the frontend warning (PR 2) to display it.

Troubleshooting

ProblemSolution
"Cannot perform this operation on untracked branch"Run gt track -p main first
Stack parented on wrong branchUse gt track -p main then gt restack
Need to reorder PRsUse gt move
Conflicts during restackResolve conflicts, then git rebase --continue
Want to split a PRReset commits (git reset HEAD^), re-stage selectively, create new branches
Need to delete a branch (non-interactive)gt delete <branch> -f -q
gt restack hitting unrelated conflictsUse targeted git rebase <target> instead (see below)
Rebase interrupted mid-conflictCheck if files are resolved but unstaged, then git add + git rebase --continue

Advanced: Surgical Rebasing in Complex Stacks

In deeply nested stacks with many sibling branches, gt restack can be problematic:

  • It restacks ALL branches that need it, not just your stack
  • Can hit conflicts in completely unrelated branches
  • Is all-or-nothing - hard to be surgical

When to Use git rebase Instead of gt restack

Use direct git rebase when:

  • You only want to update specific branches in your stack
  • gt restack is hitting conflicts in unrelated branches
  • You need to skip obsolete commits during the rebase

Targeted Rebase Workflow

# 1. Checkout the branch you want to rebase
git checkout my-feature-branch

# 2. Rebase onto the target (e.g., updated parent branch)
git rebase target-branch

# 3. If you hit conflicts:
#    - Resolve the conflict in the file
#    - Stage it: git add <file>
#    - Continue: git rebase --continue

# 4. If a commit is obsolete and should be skipped:
git rebase --skip

# 5. After rebase, use gt modify to sync graphite's tracking
gt modify --no-edit

Recovering from Interrupted Rebase (Context Reset)

If a rebase was interrupted (e.g., Claude session ran out of context):

  1. Check status: git status # Look for "interactive rebase in progress" and "Unmerged paths"
  2. Read the "unmerged" files - they may already be resolved (no conflict markers)
  3. If already resolved, just stage and continue: git add <resolved-files> git rebase --continue
  4. If still has conflict markers, resolve them first, then stage and continue

Deleting Branches from a Stack

# Delete a branch (non-interactive, even if not merged)
gt delete branch-to-delete -f -q

# Also delete all children (upstack)
gt delete branch-to-delete -f -q --upstack

# Also delete all ancestors (downstack)
gt delete branch-to-delete -f -q --downstack

Flags:

  • -f / --force: Delete even if not merged or closed
  • -q / --quiet: Implies --no-interactive, minimizes output

After deleting intermediate branches, children are automatically restacked onto the parent. If you need to manually update tracking:

gt checkout child-branch
gt track --parent new-parent-branch

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

36.66%
按下载量换算894

Claude

31.35%
按下载量换算764

Cursor

19.42%
按下载量换算473

Gemini CLI

9.02%
按下载量换算220

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

执行命令

安装流程涉及命令执行,可能通过 npx skills add https://github.com/withgraphite/agent-skills --skill graphite 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills