From agents-library
Explain how a codebase is shaped — the read-to-explain counterpart to review-pr. Orients on the project, then fans out read-only explorer sub-agents to map it across three lenses (layering & entry points incl. config/auth/error handling, data & persistence, conventions & build), consolidates their findings into one skimmable orientation brief with file:line references, and optionally writes that brief to a doc. Supports three scopes: whole repository (default), a path/glob for one subsystem, or a feature/flow trace that follows a single execution path end to end. Use this whenever the user wants to understand an unfamiliar codebase, "explain how this works", get oriented, onboard onto a repo or subsystem, map the architecture, write an ARCHITECTURE.md, or trace how a feature/endpoint flows — even if they don't say the word "skill". Read-only by default; never modifies code and writes a doc only on explicit confirmation. No `gh` or remote required.
How this skill is triggered — by the user, by Claude, or both
Slash command
/agents-library:describe-codebaseThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
You are the **orchestrator** of a read-to-explain survey of a codebase. The user
You are the orchestrator of a read-to-explain survey of a codebase. The user wants to understand how some code is shaped — the whole repository, one subsystem, or one feature's execution path. Your job is to orient on the project, fan out read-only explorer sub-agents, consolidate what they find into one orientation brief, and optionally persist it.
This is the inverse of review-pr: where that skill reads a diff to critique
it, you read a codebase to explain it. You produce orientation, not findings to
fix.
A single agent reading a whole codebase top-to-bottom blurs together questions that need different attention: "where does execution start and flow?", "how is data stored?", and "what are the conventions and commands?" are different mental modes. Focused explorers, each holding one lens over the same target, map more and map it more sharply. You then merge their findings into one brief so the user sees an orientation, not three separate reports.
The explorers only read — they never edit. The only thing you ever write is an optional doc the user explicitly opts into (Phase 3). Keeping the survey read-only is what makes it safe to point at any repo, including one you've never seen.
AGENTS.md, README, CLAUDE.md,
CONTRIBUTING, and architecture notes. Capture what's already documented so
the brief reflects and points at it rather than re-deriving it. If a rule is
declared (commit format, layering, style bars), note where it lives.src/payments/): map just that subtree.No main-branch detection and no gh are required — this works on any checkout,
including a fresh clone. If the target has no source files in scope, say there's
nothing to map and stop.
Dispatch all sub-agents in parallel — issue every Agent/Task call in a single
message so they run concurrently (the
superpowers:dispatching-parallel-agents pattern).
Each sub-agent's prompt is assembled from three parts:
lenses/ and
include it verbatim. That file is the sub-agent's entire instruction set.file:line reference on every finding, or an empty
list if you find nothing.Map scopes (whole-repo, path) — three lens explorers:
| Explorer | Emoji | File | Maps |
|---|---|---|---|
| Layering & entry points | 🧭 | lenses/layering.md | Boot, request/data flow, layer boundaries, plus config, auth, error handling, logging. |
| Data & persistence | 🗃️ | lenses/data.md | Schema, migrations, data-access layer, schema ownership. |
| Conventions & build | 📐 | lenses/conventions.md | Naming idioms, how to wire a new component, lint/format/test/build commands. |
Flow-trace scope — per-segment tracers:
Identify the entry point for the named feature/flow first (search for the route,
handler, command, or symbol). Then dispatch tracers along the path it touches —
entry/handler, business logic, data access, and any external call — each given
lenses/flow-trace.md verbatim plus its assigned segment and starting location.
If the segments aren't knowable up front, dispatch the entry tracer first, then
fan out the remaining segments from where it hands off.
If a sub-agent fails or returns nothing, note it and continue with the others — never block the whole brief on one lens or segment.
Merge the explorers' findings into one skimmable orientation brief, scaled to the
scope, shown in the conversation. Every line that makes a structural claim
carries its file:line so the reader can click through and verify.
For a map scope, render the brief in this shape:
## <repo/subsystem> — orientation
**Layering** entry → business → data; who-calls-who
**Shared infra** config: … auth: … errors: … logging: …
**Data** schema owner: … migrations: … access layer: …
**Conventions** naming idioms; how to wire a new component
**Commands** lint: … format: … test: … build: …
**Start here** 3–5 files a newcomer should read first, in order
Fill each line from the explorers' findings, each pointing at a file:line. The
Start here list is your synthesis — the handful of files that best orient a
newcomer, drawn from across the three lenses. If an explorer reported "not found"
for something (e.g. no central config, commands undiscoverable), say so plainly
rather than omitting the line.
For a flow trace, render an ordered, numbered walkthrough instead: each hop a
file:line reference, from the entry point through to the data/external boundary
and back, with the meaningful branch points called out.
Keep it skimmable — an orientation, not an essay.
Ask the user whether to write the brief to disk:
ARCHITECTURE.md at the repo root,AGENTS.md project-specific section, orOnly write on an explicit pick. If the chosen target already exists, show what would change (the file's proposed content, or the exact append) and confirm before writing — never overwrite a hand-written doc silently. You write no code under any path; the only artifact you ever create is this one doc.
Each explorer returns findings as records with these fields:
lens: layering | data | conventions | flow-<segment>
topic: short label (e.g. "config object", "auth guard", "test layout")
location: path:line — required; the claim's evidence
detail: one or two lines on what's there and why it matters
You compose these into the brief sections; you do not surface the raw records.
npx claudepluginhub cleanunicorn/agents-library --plugin agents-libraryProvides CDSS development patterns for drug interaction checking, dose validation, clinical scoring (NEWS2, qSOFA), and alert classification integrated into EMR workflows.