aip
Google API Improvement Proposals (AIP) reference. Use BEFORE designing or reviewing APIs, protobuf definitions, or any work…
Analyze a git repo's history to surface high-churn files, ownership risks, bug hotspots, momentum trends, and firefighting patterns. Use this skill whenever the user wants to understand a codebase, assess repo health, or orient themselves before reading code — even if they don't
$ npx -y skills add fredrikaverpil/dotfiles --skill codebase-audit --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/codebase-auditContext preview
The summary Claude sees to decide when to auto-load this skill.
Analyze a git repo's history to surface high-churn files, ownership risks, bug hotspots, momentum trends, and firefighting patterns. Use this skill whenever the user wants to understand a codebase, assess repo health, or orient themselves before reading code — even if they don't
name: codebase-audit # Source: https://piechowski.io/post/git-commands-before-reading-code/ description: > Analyze a git repo's history to surface high-churn files, ownership risks, bug hotspots, momentum trends, and firefighting patterns. Use this skill whenever the user wants to understand a codebase, assess repo health, or orient themselves before reading code — even if they don't explicitly say "audit". Examples: "audit this repo", "analyze this repo's history", "what's the state of this codebase?", "bus factor", "churn analysis", "tell me about this repo", "who owns this code?", "is this repo healthy?". allowed-tools: - Bash context: fork
Analyze the current git repository's history to produce a structured health report covering churn, ownership, bugs, momentum, and firefighting patterns.
Produce a structured markdown report with one section per dimension, including raw data (top files/contributors) and observations. The report should help the reader orient themselves in an unfamiliar codebase and identify risk areas before reading code.
Steps 1a-1e are independent — run them in parallel, then synthesize in step 2.
Before starting the analysis, check whether the repo is GitHub-hosted and `gh` is authenticated:
gh repo view --json nameWithOwner 2>/dev/null
If this succeeds, set a mental flag that GitHub enrichments are available. If it fails (not a GitHub repo, or `gh` not authenticated), skip all `gh`-prefixed sub-steps below and rely on git-only analysis. Do not warn or apologize — just use what's available.
git log --format=format: --name-only --since="1 year ago" | grep . | sort | uniq -c | sort -nr | head -20
Report the top 20 most-modified files in the past year. Flag any file that appears disproportionately often -- this is the clearest signal of codebase drag.
Lockfiles, generated output and vendored trees dominate raw churn without telling you anything about the code. If 5 or more of the top 10 are noise of this kind, run a filtered second pass:
NOISE='(^|/)([^/]*-lock\.(json|yaml)|[^/]*\.lock|package\.json|go\.sum|CHANGELOG\.md|[^/]*\.snap)$|(^|/)(__snapshots__|dist|build|coverage|generated|vendor|node_modules|\.terraform)/' git log --format=format: --name-only --since="1 year ago" | grep . | grep -vE "$NOISE" | sort | uniq -c | sort -nr | head -20
Extend `$NOISE` with repo-specific paths when the filtered pass is still dominated by bulk content (`docs/`, `locales/`, `i18n/`). Label that as a repo-specific pass, separate from the generic de-noising above.
Report both passes and name what was excluded — a lockfile churning 80 times is itself a finding about dependency pressure, it just isn't a finding about the code.
Keep the blank-line strip as its own `grep .` rather than folding `^$` into `$NOISE`. BSD grep (macOS) drops the `^$` branch when the alternation contains a leading `.*`, silently leaving every blank line in the count.
When file-level hotspots are too noisy to read — large repos, monorepos:
git log --format=format: --name-only --since="1 year ago" | grep . | cut -d/ -f1-2 | sort | uniq -c | sort -nr | head -20
Commit count alone is a poor proxy for ownership. Someone reformatting config files 100 times looks more "important" than someone who architected a core subsystem in 5 commits. Gather multiple signals to build a nuanced picture.
git shortlog -sn --no-merges
git shortlog -sn --no-merges --since="6 months ago"
Under a squash-merge workflow these counts reflect who *merged*, not who wrote the code — which can invert the ranking entirely. Check before trusting it:
gh pr list --state merged --limit 20 --json mergeCommit,author
If GitHub is unavailable, a history of single-commit merges with no branch topology is the tell.
For the top 5 contributors by commit count, measure insertions and deletions:
git log --author="<name>" --numstat --no-merges --format='' | awk '{ add += $1; del += $2 } END { print "+" add, "-" del }'This distinguishes high-volume contributors from high-frequency ones.
Identify the top-level directories in the repo, then for each one show the top 3 contributors:
git shortlog -sn --no-merges -- <directory>
This reveals domain expertise — one person may own 80% of `infra/` while another owns `src/auth/`. Concentrated subsystem ownership is a bus-factor risk even when overall commit counts look balanced.
For each of the top 3 contributors, sample their 5 most recent commits:
git log --author="<name>" --no-merges --oneline -5
Use the commit messages to characterize the nature of their work: features, bug fixes, refactoring, formatting, dependency updates, etc. This adds qualitative context that numbers alone cannot provide.
Only if GitHub is available. Query merged PRs to understand who reviews whose code:
gh pr list --state merged --limit 100 --json author,reviews
Look for review silos — if only one person reviews a particular author's PRs, that's a knowledge concentration risk. Also note if anyone is a "review bottleneck" (appears as reviewer on most PRs).
Only if GitHub is available. GitHub's own contributor statistics include weekly additions/deletions per author, which is more efficient than looping `git log --numstat` per author:
gh api repos/{owner}/{repo}/stats/contributorsUse this to cross-validate the git-based lines-changed data from 1b-ii. If available, prefer this data as it's pre-aggregate
Personal dotfiles, managed in three layers: Nix (nix/): system configuration and packages, pinned by flake.lock and applied with a rebuild. Fully reproducible. Stow (stow/): dotfiles symlinked into $HOME with GNU Stow (not Nix).
Google API Improvement Proposals (AIP) reference. Use BEFORE designing or reviewing APIs, protobuf definitions, or any work…
GitHub CLI (gh) conventions and the inline PR review recipe. Use when working with GitHub repositories, PRs, issues, actions, `gh…
This skill should be used when creating a GitHub pull request via `gh pr create`. Covers the gh CLI mechanics; PR title and body…
This skill should be used BEFORE running any git commit command. Triggers when about to run `git commit`. Ensures commit messages…
Where this author deviates from, or tightens, idiomatic Go defaults.
Interact with the user's running Neovim instance via RPC. Use this skill when you need to execute Lua or Vimscript inside Neovim,…