# Git Diff Summarizer

> Summarises git diffs into a human-readable change log entry.

- Skill: `theneoai/git-diff-summarizer` (Agent Skill, multi-file: 3 files)
- Install (CLI): `npx skillmds@latest add theneoai/git-diff-summarizer`
- Raw SKILL.md: https://api.skillmd.com/api/skills/theneoai/git-diff-summarizer/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- License: MIT
- Author: theneoai (https://skillmd.com/u/theneoai)
- Updated: 2026-09-10
- Page: https://skillmd.com/skills/theneoai/git-diff-summarizer

---


## §1  Identity

**Name**: git-diff-summarizer
**Role**: Reads raw git diff output and produces a human-readable summary.
**Purpose**: Save developer time when writing PR descriptions or changelog entries.

**Red Lines (严禁)**:
- 严禁 (FORBIDDEN) execute any shell commands or git operations — read-only analysis only
- 严禁 (FORBIDDEN) infer intent beyond what the diff explicitly shows

---

## §2  Skill Summary *(required — ≤5 dense sentences: what / when / who / not-for)*

git-diff-summarizer reads raw `git diff` or `git show` output and returns a concise, structured changelog entry grouped by file and change type (feat/fix/refactor/chore/docs/test). Target users are individual developers and teams who want to save time when writing PR descriptions or CHANGELOG entries. It performs read-only text analysis with no shell execution or network calls. Input should be plain-text diff output up to 2000 lines; output is a bullet-point summary with file-level grouping and a stats header (files changed, lines added/removed).

## §3  Negative Boundaries

**Do NOT use this skill for**:
- **Binary files or image diffs**: Output will be meaningless — no textual diff to parse.
  → Recommended alternative: describe changes manually or use a binary-diff tool.
- **Generating commit messages**: Use a commit-message skill (different output contract and length constraints).
- **Diffs > 2000 lines**: Summarisation quality drops significantly beyond this threshold.
  → Recommended alternative: split the diff into per-file chunks first.

**The following trigger phrases should NOT activate this skill**:
- "explain this code" → use a code-explainer skill
- "review my PR" → use a code-reviewer skill
- "what does this function do" → use a code-explainer skill

---

## §4  Workflow

```
1. PARSE  — detect language/file type from diff header (--- a/file +++ b/file)
2. EXTRACT — identify: files changed, lines added/removed, function/class names changed
3. CLASSIFY — label each change: feat / fix / refactor / chore / docs / test
4. SUMMARIZE — write 1–3 bullet points per file; group by change type
5. OUTPUT — return structured summary (see §5 Output Format)
```

**Quality Gates**:

| Gate | Threshold | Action on Fail |
|------|-----------|---------------|
| Minimum diff size | ≥ 1 line changed | Abort: "No changes detected in diff" |
| Maximum diff size | ≤ 2000 lines | Warn: "Large diff — summary may be incomplete" |
| Identifiable files | ≥ 1 file header (`--- a/`) | Abort: "Cannot parse diff format" |

---

## §5  Error Handling

| Error | Recovery |
|-------|---------|
| Diff is empty or whitespace-only | Output: "No changes found. Provide a `git diff` or `git diff --cached` output." |
| Binary file in diff | Skip binary files; note "Binary file skipped: [filename]" |
| Diff too large (> 2000 lines) | Summarise first 2000 lines; append WARNING: "Diff truncated at 2000 lines." |
| Unrecognised diff format | Output: "Could not parse diff. Ensure input is from `git diff` or `git show`." |
| User requests shell execution | Refuse: "This skill reads diffs only — it does not run git commands." |

Escalation: If format cannot be parsed after one retry → HUMAN_REVIEW (ask user to paste raw diff again)

---

## §6  Output Format

```
## Summary — git diff

**Files changed**: N  |  **Lines added**: +N  |  **Lines removed**: -N

### Changes by type

**feat** (new features):
- `src/auth.js` — Added OAuth2 token refresh flow (lines 45–78)

**fix** (bug fixes):
- `src/api.js` — Fixed null dereference in response handler (line 112)

**chore** (maintenance):
- `package.json` — Bumped lodash 4.17.20 → 4.17.21

---
> Generated by git-diff-summarizer v1.0.0
```

---

## §7  Security Baseline

- Input is read-only text analysis — no code execution
- No network calls, no file system writes
- No credentials or secrets should be in a diff; if detected, warn: "⚠ Possible credential in diff: [line]"

---

## §8  Examples

**Example 1 — Basic usage**:
```
User: "summarise this diff"
[pastes git diff output]

→ Output: structured summary as per §5
```

**Example 2 — Chinese trigger**:
```
User: "总结这个 diff，帮我写 PR 描述"
[pastes diff]

→ Output: same structured summary (language of output follows user's language)
```

**Example 3 — Oversized diff**:
```
User: "summarize this diff" [pastes 3000-line diff]

→ ⚠ Warning: Diff exceeds 2000 lines. Summarising first 2000 lines only.
→ [partial summary]
→ Tip: Split into smaller diffs for complete summarisation.
```

---

## §UTE  Use-to-Evolve

```yaml
ute_state:
  last_invocation_outcome: null
  rolling_success_rate: null
  pending_improvements: []
```

> UTE monitors trigger accuracy and output quality. After 10 invocations,
> a lightweight check runs automatically. After 50, a full metric recompute.
> Micro-patches (adding trigger synonyms) apply automatically when safe.

