agentleFS
camilo-acevedocamilo-acevedo/claude-skills/diff-summary/SKILL.md

diff-summary

Skill0 starsChanged 7 months agoMITView on GitHub

Produce a categorized summary of a git diff (stats, top files by lines changed, file categories, sample hunks) instead of streaming the full diff. Default range is HEAD vs the upstream branch (or main). Use for PR review, big refactors, or any change >200 lines you need an overview of before deciding what to read in detail.

  • Reads credentials

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Do NOT invoke when:

    line 25
  2. Very specific:

    If ins == "-" or del == "-", the file is binary — record but exclude from the LOC-sum sort.

    line 63
  3. Very specific:

    If a sample exceeds 30 lines, truncate and append … (hunk truncated).

    line 90
  4. Very specific:

    If the diff is empty (no files changed), print one line: diff-summary: no changes between <RANGE> and stop.

    line 138

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

diff-summary

A Markdown-only skill — no Python, no scripts. You (Claude) run git diff --numstat and git diff --stat in parallel, categorize the files by path, pick a few representative hunks, and render the report.

When to invoke

Invoke diff-summary when ANY of these apply:

  • The user asks "what changed in this branch / PR?" or "summarize the diff".
  • You need to understand a large changeset (>200 lines) before commenting on it.
  • You're about to run git diff on something likely to be huge.

Do NOT invoke when:

  • The diff is small (<100 lines) — just run git diff directly.
  • The user asked about a specific file's changes (use git diff <path>).
  • You need every line of the diff (use git diff and read it).

Choosing the diff ref

Pick the first that resolves (verify each with git rev-parse --verify --quiet <ref>):

  1. The user's explicit against=<ref> argument.
  2. Tracked upstream: git rev-parse --abbrev-ref --symbolic-full-name '@{upstream}'.
  3. origin/main.
  4. origin/master.
  5. HEAD~10.

Or, if the user passed staged=true, skip ref selection and use --cached in the commands below (comparison is staged-vs-HEAD).

How to run

Step 1 — gather numbers in parallel

Single Bash batch, all read-only:

CommandYields
git diff --shortstat <RANGE>The N files changed, X insertions(+), Y deletions(-) line.
git diff --numstat <RANGE>Per-file <ins>\t<del>\t<path>.
git rev-parse --abbrev-ref HEADCurrent branch (for the title).

Where <RANGE> is <ref>...HEAD for ref comparisons, or --cached for the staged form.

Step 2 — parse + categorize

For each numstat row:

  • If ins == "-" or del == "-", the file is binary — record but exclude from the LOC-sum sort.
  • Compute total = ins + del.
  • Assign a category by path glob, first match wins:
Glob (case-insensitive)Category
*.lock, package-lock.json, poetry.lock, pnpm-lock.yaml, yarn.lock, Cargo.lock, go.sumgenerated
dist/**, build/**, out/**, __pycache__/**, node_modules/**generated
tests/**, test/**, *test.go, *_test.py, *.test.ts, *.test.tsx, *.spec.ts, *.spec.jstests
*.md, docs/**, README*, CHANGELOG*, LICENSE*docs
*.json, *.yaml, *.yml, *.toml, *.ini, *.cfg, Dockerfile*, *.env*, .github/**, .gitlab*config
anything elsesrc

Sum ins and del per category.

Step 3 — pick sample hunks

Pick the top 3 files by total LOC changed excluding generated. For each, run:

git diff <RANGE> -- <path>

From each output, take the first hunk only (the first block starting with @@, up to the next @@ or end of file). Cap each sample at ~30 lines. If a sample exceeds 30 lines, truncate and append … (hunk truncated).

Skip the sample step if samples=0.

Step 4 — render

# diff-summary — <branch> vs <ref>   (or "staged changes")

## Stats
- <shortstat output, verbatim>
- Net: +<insertions − deletions> lines

## Categories
- src:       <files> files  (+<ins> / -<del>)
- tests:     <files> files  (+<ins> / -<del>)
- config:    <files> files  (+<ins> / -<del>)
- docs:      <files> files  (+<ins> / -<del>)
- generated: <files> files  (+<ins> / -<del>)

(Omit any category with zero files.)

## Top files (by total LOC changed, generated excluded)
| File | + | - |
|------|---|---|
| <path> | <ins> | <del> |
| ... up to `top` rows (default 10) ... |

(If there are more files than the cap, append `… (+N more)` as a final row.)

## Sample hunks

### <path1> @@ <hunk header>

<first hunk, ≤30 lines>


### <path2> @@ <hunk header>
<first hunk> ```

(Up to samples blocks; default 3.)

Path to full diff

git diff <RANGE>


If the diff is empty (no files changed), print one line:
`diff-summary: no changes between <RANGE>` and stop.

## Supported arguments

| Argument | Default | Purpose |
|----------|---------|---------|
| `root=<path>` | cwd / repo root | Repo to inspect. |
| `against=<ref>` | upstream / origin/main / origin/master / HEAD~10 | Ref to diff against. |
| `staged=true` | off | Use `--cached` (staged-vs-HEAD) instead of a ref comparison. |
| `samples=N` | `3` | Number of sample hunks to include. |
| `top=N` | `10` | Files listed in the top-LOC table. |

## Notes

- "category" is a heuristic from the file path. Use it as a hint, not gospel.
- For >1000 changed files, render only the top table and skip sample hunks;
  point at `git diff <RANGE>` for the rest.
- The full diff command is always shown at the bottom — run it directly if
  the user wants more.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.