Loading...
Loading...
Context-efficient Git and Graphite workflows for Claude Code. Automatically delegates verbose git/Graphite CLI operations to isolated subagents, reducing context pollution by 225x. Use when working with git operations, Graphite stacked diffs, or any git workflow that produces verbose output. Prevents context window exhaustion by automatically applying delegation patterns via SessionStart hooks.
npx skill4agent add slamb2k/mad-skills graphite-skillYou: "Check my Graphite stack"
Claude: [Returns 15KB of JSON → 4,000+ tokens consumed]
Result: Context polluted, reasoning degraded, 2-3 operations maxgt stackgit log --graphgt pr infoYou: "Check my Graphite stack"
Claude: [Automatically delegates to Task subagent]
Subagent: [Processes 15KB in isolated context]
Claude: "✓ feature/auth | 3 PRs | Review #456"
Result: Clean context, 18 tokens used, 100+ operations possible⚠️ Graphite Skill Setup Required
Would you like to set up Graphite Skill in this project now?
If yes, run: bash ~/.claude/plugins/mad-skills/graphite-skill/install.sh --project# Navigate to your project
cd /path/to/your/project
# Run the installer
bash ~/.claude/plugins/mad-skills/graphite-skill/install.sh --project
# The installer will:
# - Copy hooks to .claude/plugins/graphite-skill/
# - Configure SessionStart hook
# - Set up agent templates
# - Make scripts executable# In your project
mkdir -p .claude/plugins/graphite-skill/hooks
# Copy files from the carbon skill directory
cp ~/.claude/plugins/mad-skills/graphite-skill/hooks/session-start.sh .claude/plugins/graphite-skill/hooks/
cp ~/.claude/plugins/mad-skills/graphite-skill/settings.json .claude/plugins/graphite-skill/
# Make hook executable
chmod +x .claude/plugins/graphite-skill/hooks/session-start.sh
# Optional: Copy agent template
mkdir -p .claude/agents
cp ~/.claude/plugins/mad-skills/graphite-skill/agents/graphite-ops-template.md .claude/agents/# Test hook execution
bash .claude/plugins/graphite-skill/hooks/session-start.sh
# Should output JSON with hookSpecificOutput
# Test in Claude Code
claude --debug hooks
# Look for:
# [SessionStart] Executing hook: session-start.sh
# [SessionStart] Hook completed successfully1. Session starts → SessionStart hook fires
2. Hook detects: git repo, project setup status, Graphite CLI, custom agent
3a. If not set up → Prompts user to run install.sh (auto-detection)
3b. If set up → Hook injects ~800 tokens of delegation patterns into context
4. Claude knows: Use Task delegation for verbose operations automatically
5. User benefits: Automatic context efficiency, zero manual effort.claude/plugins/graphite-skill/hooks/session-start.sh--json2>/dev/nullYou: "Check git status"
Claude: [Delegates automatically]
→ "3 modified, 2 staged, 1 untracked | Ready to commit"You: "Show me recent commits"
Claude: [Delegates automatically]
→ "Last 10: abc123 Feature, def456 Fix, ... | 3 authors, 2 days"You: "Show git diff"
Claude: [Delegates automatically]
→ "+47/-12 across 3 files | auth.ts, api.ts, tests/ | No conflicts"You: "Check my Graphite stack"
Claude: [Delegates automatically]
→ "✓ feature/auth | 3 PRs | #456 (needs review), #457 (approved), #458 (draft)"You: "Show PRs needing review"
Claude: [Delegates automatically]
→ "📋 2 PRs: #456 (Auth - awaiting review), #459 (Docs - changes requested)"You: "Submit my stack for review"
Claude: [Delegates automatically]
→ "✓ 3 PRs created | CI running on all | Ready for review"You: "Navigate to next branch in stack"
Claude: [Delegates automatically]
→ "Switched to feature/auth-ui (3/5 in stack)"git log --graphgit diffgit statusgit branchgt stackgt pr listgt pr infogt submitgt logYou: "Check my stack"
Claude: [Uses Task delegation automatically]
→ Concise summary# One-time setup in Claude Code
/agents create
Name: graphite-ops
Color: cyan
Scope: project
Prompt: Load from .claude/agents/graphite-ops-template.md
# Use with color
You: "graphite-ops check my stack"
graphite-ops [cyan]: ✓ feature/auth | 3 PRs | Review #456graphite-skill/agents/graphite-ops-template.md# One team member sets up
./install.sh --project
git add .claude/
git commit -m "Add Graphite Skill context-optimization for git/Graphite"
git push
# Other team members pull and get:
# ✓ Automatic context optimization
# ✓ Consistent behavior across team
# ✓ Zero per-developer setup.claude/plugins/graphite-skill/settings.json{
"contextTokens": 800,
"delegationThreshold": 100,
"autoDetectGraphite": true,
"autoDetectCustomAgent": true,
"enableTaskDelegation": true,
"enableCustomAgent": true
}contextTokensdelegationThresholdautoDetectGraphiteautoDetectCustomAgentenableTaskDelegationenableCustomAgent| Metric | Before (Raw CLI) | After (Graphite Skill) | Improvement |
|---|---|---|---|
| Tokens consumed | 4,108 | 18 | 225x |
| Context pollution | High | Minimal | 99.6% reduction |
| Response quality | Degraded | Optimal | Focused reasoning |
| User effort | Manual patterns | Zero | Automatic |
| Operations before exhaustion | 2-3 | 100+ | 50x |
# Check permissions
chmod +x .claude/plugins/graphite-skill/hooks/session-start.sh
# Check settings.json exists
ls -la .claude/settings.json
# Test manually
bash .claude/plugins/graphite-skill/hooks/session-start.sh | jq .# Verify hook returns correct JSON
bash .claude/plugins/graphite-skill/hooks/session-start.sh | \
jq '.hookSpecificOutput.hookEventName'
# Should output: "SessionStart"claude --debug hooks
# Check for:
# - Hook execution confirmation
# - Context injection success
# - Any error messagesclaude --debug hookssettings.jsongraphite-skill/
├── SKILL.md # This file - complete skill reference
├── install.sh # Automated installation script
├── settings.json # Configuration settings
├── hooks/
│ └── session-start.sh # SessionStart hook for pattern injection
├── agents/
│ └── graphite-ops-template.md # Custom agent template (optional)
├── examples/
│ └── team-configuration.md # Example team configurations
├── test/
│ └── verify-installation.sh # Installation verification script
├── QUICKSTART.md # Quick start guide
└── README.md # Detailed documentation
References (from root skill directory):
- QUICKSTART.md - 5-minute setup guide
- README.md - Complete documentation
- examples/team-configuration.md - Team setup examplesgraphite-skill/QUICKSTART.mdgraphite-skill/install.shgraphite-skill/examples/team-configuration.mdgraphite-skill/agents/graphite-ops-template.md