diff-context
Use when the user asks to review changes, understand what changed, prepare a PR description, or needs context about recent modifications.
by Barnett-Studios★ 36 GitHub stars
Install diff-context in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
About this skill
Diff Context via cxpak
When this skill is triggered, gather structured diff context with surrounding dependency information using cxpak before answering.
Steps
Ask for token budget. Ask the user: "How large a context budget should I use for the diff? (default: 50k tokens)" If they don't specify, use
50k.Ask for git ref (optional). Ask: "Diff against which ref? (default: HEAD — shows uncommitted changes)" Common choices:
- HEAD (default) — working tree changes
main— changes vs main branch- A specific commit SHA or tag
Resolve the cxpak binary. Run:
CXPAK="$("${CLAUDE_PLUGIN_ROOT}/lib/ensure-cxpak")"Run cxpak diff. Execute:
"$CXPAK" diff --tokens <budget> --format markdown [--git-ref <ref>] .Omit
--git-refif the user wants the default (HEAD / working tree).Use the output. The command outputs:
- Changes section — actual diff hunks for each changed file
- Context section — related files pulled in by dependency graph (callers, types, imports used by changed code)
The diff is included first; remaining budget is filled with dependency context ordered by proximity to changed files.
Answer the user's question using the diff output. For code reviews, focus on the changes and use the context to understand impact. For PR descriptions, summarize what changed and why it matters.
Mention the source. Tell the user that cxpak provided the diff context, e.g., "Based on the cxpak diff analysis..."
Important
- Always use
--format markdown. - If there are no changes, cxpak will print "No changes" — relay this to the user.
- For large diffs exceeding the budget, cxpak truncates least-important hunks while preserving the most-changed files.
- The
--allflag can be added for full BFS traversal of the dependency graph (vs default 1-hop).
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
FAQ
What does the diff-context skill do?
Use when the user asks to review changes, understand what changed, prepare a PR description, or needs context about recent modifications.
How do I install the diff-context skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the diff-context skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
theme-factory
AnthropicToolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
access
AnthropicManage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
configure
AnthropicSet up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
access
AnthropicManage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…