agentleFS
camilo-acevedocamilo-acevedo/claude-skills/git-digest/SKILL.md

git-digest

Skill0 starsChanged 7 months agoMITView on GitHub

Bundle several git commands (status, log, diff --stat, branch -vv, stash list) into a single Markdown digest. Invoke instead of running 4–5 separate git commands when you need to understand the working-tree state, recent commits, and how the branch relates to its upstream.

The file

We split this skill into the rules it gives an agent

7 rules. About 0 are common, 5 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Do NOT invoke when:

    line 24
  2. Distinctive:

    Run the commands below from the repo root.

    line 32
  3. Distinctive:

    Run all of these in parallel (one Bash call per command):

    line 37
  4. Very specific:

    Verify the chosen ref exists before diffing: git rev-parse --verify --quiet <ref>.

    line 64
  5. Distinctive:

    If it fails, fall back to the next option.

    line 65
  6. Distinctive:

    If the working tree is clean AND the branch has an upstream AND ahead = behind = 0, emit only this one-liner and stop:

    line 69
  7. Very specific:

    If git is not on PATH or the cwd is not inside a git repo, report that in one line and stop.

    line 125

≈ “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

git-digest

A Markdown-only skill — no Python, no external scripts. You (Claude) run the git commands listed below in parallel via the Bash tool, then format the results into the digest layout at the bottom of this file.

When to invoke

Invoke git-digest when ANY of these apply:

  • You're starting work on an unfamiliar branch and need a quick orientation.
  • The user asks "what's going on in this repo?" / "what's left on this branch?" / "what changed lately?".
  • You're about to run more than two of: git status, git log, git diff --stat, git branch -vv, git stash list.

Do NOT invoke when:

  • You only need ONE specific piece of git state (just run that one command).
  • You're inside a non-git directory.
  • The user is asking about a specific commit or file history (use git log <path> directly).

How to run it

Run the commands below from the repo root. They are all read-only and independent, so issue them as parallel Bash tool calls in a single message.

Required commands

Run all of these in parallel (one Bash call per command):

#CommandPurpose
1git rev-parse --show-toplevelConfirm we are inside a git repo + get the repo name (last path segment).
2git symbolic-ref --quiet --short HEADCurrent branch name. Empty + non-zero exit ⇒ detached HEAD.
3git rev-parse --abbrev-ref --symbolic-full-name '@{upstream}'Tracked upstream (empty / error if none).
4git rev-list --left-right --count '@{upstream}'...HEADTwo numbers: <behind> <ahead> vs upstream. Skip if step 3 was empty.
5git symbolic-ref --quiet --short refs/remotes/origin/HEADDefault branch (e.g. origin/main). Strip the origin/ prefix.
6git status --porcelain=v1 --untracked-files=normalWorking-tree state.
7git log -5 --pretty=format:'- %h (%ar) %s — %an'Last 5 commits (adjust -5 if user asks for more).
8git diff --shortstat <ref>...HEADDiff stats vs <ref> (see "Choosing the diff ref" below).
9git diff --numstat <ref>...HEADPer-file insertions/deletions vs the same ref. Sort by (insertions + deletions) desc, take top 10.
10git stash listStash entries (empty output ⇒ no stashes).

Steps 8 and 9 depend on knowing <ref> (which comes from step 3 or step 5), so run them in a second batch after the first parallel batch returns.

Choosing the diff ref

Pick the first that resolves:

  1. The user's explicit --against <ref> argument, if any.
  2. The upstream from step 3 (e.g. origin/feature/foo).
  3. origin/<default-branch> from step 5 (e.g. origin/main).
  4. HEAD~10 as last resort.

Verify the chosen ref exists before diffing: git rev-parse --verify --quiet <ref>. If it fails, fall back to the next option.

Short-circuit: pristine repo

If the working tree is clean AND the branch has an upstream AND ahead = behind = 0, emit only this one-liner and stop:

# git-digest — <repo-name>

clean working tree on `<branch>`, up to date with `<upstream>`.

Output format

Print exactly one Markdown document to the user (do not include the commands you ran). Use the following sections, in this order, and omit sections whose data collection failed.

# git-digest — <repo-name>

## Branch
- Current: <branch>            # or "(detached <short-sha>)" if detached
- Tracking: <upstream> (<rel>) # rel = "ahead N", "behind N", "ahead N, behind N", or "in sync"
                               # if no upstream: "- Tracking: (no upstream)"
- Default: <default-branch>    # omit if same as current, or unknown

## Working tree (<S> staged, <M> modified, <U> untracked[, <C> conflicted])

<porcelain output, one line per entry>


## Recent commits (last N)
<lines from `git log` step 7, already formatted as "- <sha> (<ago>) <subject> — <author>">

## Diff vs <ref>
- <shortstat output, e.g. "4 files changed, 87 insertions(+), 12 deletions(-)">
- Top files:
  - <path>  +<ins> / -<del>
  - …
  - … (<extra> more)   # only if more than 10 files

## Stash
<one line "(empty)" OR "- " + each stash entry>

Counting staged / modified / untracked / conflicted from porcelain

For each line of git status --porcelain=v1:

  • ?? ⇒ untracked.
  • Two non-space chars from {A, D, U} (e.g. AA, DU, UU) ⇒ conflicted.
  • Otherwise: first char non-space ⇒ staged; second char non-space ⇒ modified.

A single file can count as both staged AND modified (e.g. MM). Show the porcelain lines verbatim inside a fenced block.

Notes

  • If git is not on PATH or the cwd is not inside a git repo, report that in one line and stop.
  • Detached HEAD: skip the upstream / ahead-behind line.
  • Submodules and other worktrees are not inspected.
  • Output is always plain Markdown — safe to keep in context as-is.

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.