Commit with Graphite

VerifiedCaution

Commits staged changes using Graphite, automatically creating a new branch if on trunk and handling branch stacking. Generates conventional commit messages from the diff, updates PR metadata, and runs pre-commit checks. Best for developers using Graphite who want an automated commit workflow.

Sby Skills Guide Bot
DevelopmentIntermediate
6/2/2026
Claude Code
#commit#graphite#git#conventional-commits#automation

Recommended for

Automated summary

Automates committing staged changes with Graphite, including branch creation, pre-commit checks, and PR metadata updates.

Strengths

  • Handles branch management automatically
  • Generates conventional commit messages
  • Runs pre-commit hooks
  • Updates PR title and summary

Limitations

  • Requires Graphite (gt) and pnpm setup
  • May not work without those tools
  • Assumes specific workflow with staging parent branch
When to use it

Use when working in a feature-branch workflow with Graphite stacking and conventional commits.

When not to use it

Avoid if using a simple git workflow without Graphite or if you need manual commit control.

Security analysis

Caution
Quality score85/100

The skill operates with powerful tools (Graphite, GitHub CLI, pnpm) that can modify local and remote repository state. While no malicious payloads are included, the unrestricted pnpm usage and autonomous nature increase risk if invoked on a malicious project.

Findings
  • •Uses pnpm:* which can execute arbitrary scripts defined in package.json, potentially dangerous in untrusted repositories.
  • •Autonomous execution without user confirmation could lead to unintended commits or PR updates.
  • •gh:* allows full GitHub CLI access, including modifying PR titles/bodies, which could be misused in a compromised context.
How this analysis is made

Examples

Auto-generate commit message
/commit
Custom commit message
/commit fix: resolve auth redirect loop
Force new branch with custom message
/commit --new-branch feat: add user avatar upload

name: commit description: Commit staged changes using Graphite. Checks if on trunk and creates a new branch if needed. Updates PR title and summary after each commit. allowed-tools: Bash(gt:), Bash(git:status), Bash(git:diff), Bash(git:branch), Bash(gh:), Bash(pnpm:*), Read

Commit Skill

Commits changes using Graphite, ensuring proper branch management and PR metadata.

Usage

Invoke with /commit or /commit <message>.

  • /commit — auto-generates a conventional commit message from the diff
  • /commit fix: resolve auth redirect loop — uses the provided message
  • /commit --new-branch — forces creation of a new branch even if already on a feature branch
  • /commit --new-branch fix: resolve auth redirect loop — combines both

Autonomous Execution

This skill runs fully autonomously without user interaction. When invoked:

  • Do NOT ask for user confirmation at any step
  • Do NOT pause between tasks or wait for approval
  • Proceed directly through all workflow steps
  • Only stop if a critical error occurs

Workflow

Step 1: Check Current Branch

Determine the current branch:

git branch --show-current

If the --new-branch flag was passed, always create a new branch regardless of the current branch. Proceed to Step 2a.

If the current branch is main or staging (a trunk branch), you are on trunk and must create a new branch before committing. Proceed to Step 2a.

If already on a feature branch (and --new-branch was not passed), skip to Step 3.

Step 2a: Create a New Branch

Create a new feature branch. First, examine the staged and unstaged changes to determine an appropriate branch name:

git diff --stat
git diff --staged --stat

Generate a descriptive kebab-case branch name based on the changes (e.g., fix/auth-redirect-loop, feat/add-user-avatar, chore/update-dependencies).

Create the branch with Graphite:

gt create <branch-name>

gt create automatically stacks the new branch on top of the current branch. This means:

  • If on trunk (main/staging), the new branch's parent is trunk
  • If on a feature branch (e.g., via --new-branch), the new branch stacks on top of that feature branch

Step 2b: Track Parent (only when creating from trunk)

If the new branch was created from main or staging (i.e., NOT via --new-branch from a feature branch), ensure it targets staging:

gt track --parent staging

Skip this step when --new-branch was used from a feature branch — the branch is already correctly stacked on the current branch by gt create.

Step 3: Stage Changes

Check for unstaged changes:

git status

If there are unstaged changes, stage all of them:

gt add .

If the user specified specific files, stage only those files instead.

Step 4: Review the Diff

Get the full diff of staged changes:

git diff --staged

Analyze the diff to understand:

  • What type of change this is (feat/fix/refactor/docs/chore/test/style)
  • What scope/area is affected
  • What the changes accomplish

Step 5: Run Pre-Commit Checks

Run formatting and tests on changed files:

pnpm pre-commit

If pre-commit fails:

  1. Review the failures
  2. Fix any formatting issues automatically
  3. Re-stage the fixed files with gt add .
  4. Re-run pnpm pre-commit
  5. If tests fail, report the failures and stop — do not commit broken code

Step 6: Create the Commit

Generate a conventional commit message if one was not provided. The message format:

type(scope): concise description

Optional body with more detail if the change is complex.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Type: feat, fix, refactor, docs, chore, test, style, perf Scope: The affected package or area (e.g., landing, web, mobile, orpc, ui)

Create the commit:

gt modify -c -m "$(cat <<'EOF'
type(scope): concise description

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
EOF
)"

Use a HEREDOC to preserve multi-line formatting.

Step 7: Submit PR

Create or update the PR with Graphite:

gt submit

This will create a new PR if one doesn't exist, or update the existing one.

Step 8: Update PR Title and Summary

After submitting, get the full commit history for this branch:

gh pr view --json number,title,body,headRefName,commits

And get the full diff against the base branch:

gh pr diff

Analyze ALL commits and the full diff to generate:

  1. PR Title — conventional commit format covering the overall change:

    • feat(scope): description for new features
    • fix(scope): description for bug fixes
    • refactor(scope): description for refactoring
    • docs(scope): description for documentation
    • chore(scope): description for maintenance
    • If the PR has mixed types, use the most significant one
  2. PR Summary — structured markdown body:

## Summary
<1-3 bullet points describing what this PR does>

## Changes
<Bulleted list of specific changes made>

## Test Plan
<How to verify the changes work>

---
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Update the PR:

gh pr edit --title "type(scope): description" --body "$(cat <<'EOF'
## Summary
...

## Changes
...

## Test Plan
...

---
🤖 Generated with [Claude Code](https://claude.com/claude-code)
EOF
)"

Step 9: Report Result

Output a summary to the user:

✓ Committed: type(scope): description
✓ PR #<number> updated: <title>
  <PR URL>

Edge Cases

  • No changes to commit: If git status shows no changes, report "Nothing to commit" and stop
  • Branch already exists: If gt create fails because the branch exists, use gt branch checkout <name> instead
  • PR submit fails: If gt submit fails, report the error — the commit was still made successfully
  • Pre-commit hook failure: Fix formatting issues and retry. If tests fail, stop and report

Important Rules

  • Always use gt commands for branch/commit operations (never raw git commit)
  • Always run pnpm pre-commit before committing
  • Always include Co-Authored-By trailer in commit messages
  • Always update PR title and summary after each commit using the full diff
  • Branch names use kebab-case with type prefix (e.g., feat/thing, fix/bug)
  • New branches target staging via gt track --parent staging

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/commit-with-graphite-mm5t89yl/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/commit-with-graphite-mm5t89yl' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/commit-with-graphite-mm5t89yl/download' --output '.skill-downloads/commit-with-graphite-mm5t89yl/SKILL.md.part' && mv '.skill-downloads/commit-with-graphite-mm5t89yl/SKILL.md.part' '.skill-downloads/commit-with-graphite-mm5t89yl/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

Tools declared by the author (check availability in your agent): Bash(gt:*), Bash(git:status), Bash(git:diff), Bash(git:branch), Bash(gh:*), Bash(pnpm:*), Read

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/commit-with-graphite-mm5t89yl/SKILL.md' && test -s '.skill-downloads/commit-with-graphite-mm5t89yl/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/commit' && cp -R '.skill-downloads/commit-with-graphite-mm5t89yl' '.claude/skills/commit'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/commit-with-graphite-mm5t89yl'

openskills read 'commit-with-graphite-mm5t89yl'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/commit-with-graphite-mm5t89yl/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills