agentleFS
jamal-gmljamal-gml/anthropica/skills/plan-codebase-analysis/SKILL.md

plan-codebase-analysis

Skill0 starsChanged 11 days agoMITView on GitHub

Orient in an unfamiliar repository and trace a behaviour end to end (entry points, call paths, data flow, git history, tests as spec, conventions) with confidence-labelled findings. Use before broad or cross-module changes, when asked how X works or where Y is handled, or when a bug spans several files. Not for designing new systems (use `plan-architecture`).

  • Reads credentials

The file

We split this skill into the rules it gives an agent

8 rules. About 0 are common, 4 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Locate the anchor: Search in this order and stop at the first solid hit:

    line 18
  2. Very specific:

    Read references/search-recipes.md when the stack is unfamiliar or the first two searches miss.

    line 23
  3. Distinctive:

    Read the smallest slice that answers the question: search, then targeted line ranges.

    line 33
  4. Distinctive:

    When several implementations match (interfaces, plugins, per-tenant variants, old and new copies in a monorepo), find which one the entry …

    line 42
  5. Very specific:

    Prefer a cheap, side-effect-free check (run one narrow test, a --help, a dry-run) over reasoning about behaviour.

    line 43
  6. Distinctive:

    Read-only. Do not edit, format, install dependencies, run migrations, or start anything that writes to shared resources without asking.

    line 49
  7. Very specific:

    Do not print secrets found in .env, config or history.

    line 50
  8. Very specific:

    Do not check out branches or stash the user's changes to look around.

    line 51

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 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

Codebase Analysis

Build a verified, minimal map of the code that matters for the task, read-only, before anyone edits.

Procedure

  1. Frame the question. Restate the target as something observable: a route, command, job, UI action, error message or data field. Note what a full answer must explain (entry, decision points, side effects, outputs).
  2. Orient in under 10 tool calls.
    • git status, git branch --show-current, git log --oneline -15 (state and recent intent).
    • Instruction files: CLAUDE.md, AGENTS.md, .claude/rules/, CONTRIBUTING.md, docs/adr/.
    • Manifests give stack and scripts: package.json, pyproject.toml, go.mod, pom.xml/build.gradle, *.csproj, Cargo.toml, Gemfile, composer.json. Workspace files (pnpm-workspace.yaml, go.work, nx.json, turbo.json, Cargo [workspace]) mean a monorepo: find the owning package first.
    • Entry points and wiring: main/index/app/server files, route registration, DI container, Dockerfile CMD/ENTRYPOINT, CI build/test steps, Procfile, deployment manifests.
    • Tree to depth 2, excluding node_modules, vendor, dist, build, .venv, target and generated code.
  3. Locate the anchor. Search in this order and stop at the first solid hit:
    1. Exact user-visible strings (error text, log message, UI label, i18n key) - most unique.
    2. Route path or CLI command name.
    3. Symbol name, then its definition and references (LSP or ctags if available, else word-boundary search \bname\b).
    4. Config key, env var, DB table or column name. Read references/search-recipes.md when the stack is unfamiliar or the first two searches miss.
  4. Trace the call path. From the anchor follow callers up to the entry point and callees down to side effects (DB, queue, HTTP, file, cache, email). Record each hop as file:line - function - what it decides or changes. Stop a branch when it leaves the question's scope or enters a third-party library.
  5. Trace the data. For the key entity find where it is defined (schema/model), validated, transformed, persisted, read back and serialised. Note every place the shape or units change.
  6. Read the tests as spec. Find tests that exercise the path (search for the function, route or fixture). They show intended behaviour, edge cases and how to run that slice. Missing tests are a finding.
  7. Use history for "why". git log -S'<string>' --oneline (when a string appeared or vanished), git log -L :<func>:<file> (one function's history), git blame -w -C -L a,b <file> then git show <sha> for the message and linked issue. Do this before calling odd code a bug.
  8. Extract conventions the change must follow: layering, naming, error handling, DI, logging, validation library, test style and location, file placement. Cite one exemplar file for each.
  9. Check what changes the path at runtime: env vars, feature flags, per-environment config, build tags, tenant settings.
  10. Report with the Output template. Stop there unless implementation was requested.

Rules

  • Read the smallest slice that answers the question: search, then targeted line ranges. Never read lockfiles, minified bundles, snapshots or generated code unless they are the subject.
  • Folder names are hypotheses. Confirm architecture from imports, registration code and runtime config.
  • Label every claim:
    LabelMeaning
    VerifiedRead the code or ran it; cite file:line
    InferredFollows from verified facts plus a convention; say which
    UnverifiedPlausible, not checked; say what would confirm it
  • Dynamic dispatch hides callers (DI, reflection, decorators, event buses, string-keyed handlers, ORM hooks, middleware, signals). Search for the registration key or event name, not only the symbol.
  • When several implementations match (interfaces, plugins, per-tenant variants, old and new copies in a monorepo), find which one the entry point actually wires for the case in question.
  • Prefer a cheap, side-effect-free check (run one narrow test, a --help, a dry-run) over reasoning about behaviour.
  • Delegate wide fan-out searches (many naming variants or packages) to a search subagent when available; keep the conclusions, not file dumps.
  • Note dead code, TODO/FIXME/HACK near the path and skipped tests: they are risks for the change.
  • Time-box: if the anchor is not found after ~6 searches, report what was tried and ask for a hint (URL, screenshot, log line) instead of reading more files.

Safety gates

  • Read-only. Do not edit, format, install dependencies, run migrations, or start anything that writes to shared resources without asking.
  • Do not print secrets found in .env, config or history; reference the file and key name only.
  • Do not check out branches or stash the user's changes to look around; use git show <ref>:<path> instead.

Output

## Question
<one line>

## Answer (short)
<2-4 lines>

## Map
Entry: <file:line> <route/command/job>
Path:
1. <file:line> <function> - <what it does or decides>
2. ...
Side effects: <tables / queues / external calls / files>
Data shape changes: <where and how>
Runtime switches: <flags, env vars, config>

## Conventions to follow
- <convention> - exemplar <file>

## Tests
- Covering: <test files, command to run them>
- Gaps: <untested branches>

## Risks and unknowns
- [Inferred|Unverified] <item> - <how to confirm>

## Recommended next step
<smallest change, or the question that blocks it>

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.