agentleFS
arjunprabhulalarjunprabhulal/agent-skills/skills/review/code-analysis/SKILL.md

code-analysis

Skill4 starsChanged 4 months agoMITView on GitHub

Builds an understanding of a whole codebase or subsystem — what it does, how it is structured, where the risk and complexity concentrate, and reports it as a map someone can act on. Use this whenever the user is new to a repo, inherits unfamiliar code, asks how something works end to end, wants an architecture overview or health assessment, or is deciding whether to refactor, extend, or replace. For reviewing a specific change, use code-review.

3 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before opening source files, read what the project says about itself and what it demonstrably does: README, entry points, public API or …

    line 18
  2. Distinctive:

    Every codebase has a small number of paths that carry most of the value.

    line 28
  3. Distinctive:

    Follow it end to end before branching.

    line 31
  4. Very specific:

    Use path/to/file.py:120 references throughout.

    line 95

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

Code analysis

The output is a map: what exists, how it fits together, and where the danger is. A map is judged by whether someone can navigate with it, not by how much of the territory it mentions.

Analysis fails by exhaustiveness — describing every module at equal depth produces a document with the same information density as the source, and no reason to read it. Depth must be unequal, concentrated where the risk and the change is.

1. Read the outside before the inside

Before opening source files, read what the project says about itself and what it demonstrably does: README, entry points, public API or route definitions, configuration, CI pipeline, dependency manifest, and the shape of the test suite.

This gives you the intended architecture. The gap between it and the real one is a finding.

Done when: you can state what the system does, who calls it, and what it calls.

2. Find the spine

Every codebase has a small number of paths that carry most of the value. Trace one all the way through — a request from entry to response, a job from trigger to side effect.

Follow it end to end before branching. The spine teaches you the project's real conventions, its layering, and where its abstractions leak, far faster than reading modules in isolation.

Done when: you can narrate one complete path through the system, naming each hop.

3. Let the repository tell you where the risk is

History is evidence and costs almost nothing to gather. Where change concentrates, risk concentrates.

git log --format=%H --since="1 year ago" | wc -l
git log --name-only --format= --since="1 year ago" | sort | uniq -c | sort -rn | head -20

Cross-reference the churn list against size and test coverage. The intersection — large, frequently changed, poorly tested — is where incidents come from, and it is the most valuable paragraph in your report.

Also worth a look: files changed by many different authors (shared, so conventions drift), and files changed by exactly one author who has left.

Done when: you have a ranked list of hotspots grounded in history, not impression.

4. Assess structure honestly

  • Layering: is there one, is it enforced, and where is it violated? A single import that crosses layers is a defect; a hundred means the layering is aspirational and should be described as such.
  • Coupling: what would you have to touch to change one behaviour? Concepts defined in more than one place are where bugs get half-fixed.
  • Boundaries: where does the system talk to the outside? Those are the places that fail, and the places that constrain change.
  • Dead code: unreferenced modules, unreachable branches, flags permanently on. Note it; deleting it is the cheapest available improvement.
  • Tests: what do they actually cover? Look at what they assert, not the coverage number. A suite that exercises everything and asserts nothing is worse than none, because it is trusted.

Done when: each dimension has a stated finding, including "fine, no action".

5. Report as a map with a recommendation

# <System> — analysis

**What it does:** one paragraph, no jargon
**Shape:** the 4–6 components that matter and how they connect

## The spine
The main path, hop by hop, with file references.

## Hotspots
| Area | Churn | Size | Tests | Why it matters |

## Structural findings
Ranked. Each: what it is, what it costs today, what it will cost later.

## If you change one thing
The single highest-value change, and why it beats the alternatives.

## Not covered
What was out of scope, and what remains unknown.

Use path/to/file.py:120 references throughout. A map without coordinates is an essay.

The "not covered" section is mandatory. An analysis that does not state its own limits gets read as complete, and its silence gets read as approval.

Rules

  • Depth follows risk. The hot, untested, load-bearing module deserves ten times the words of a stable utility. Equal depth is a failure of analysis, not a sign of thoroughness.
  • Separate observation from judgment. "Auth logic appears in three modules" is observation. "This should be consolidated" is judgment, and the reader is entitled to weigh them apart.
  • Report what you did not read. Nobody reads a large codebase completely. Which parts you skipped changes how much the reader should trust the conclusions.
  • Do not recommend a rewrite casually. It is almost always the wrong answer, and proposing it costs you credibility on the recommendations that would actually help.

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.