codebase-explainer
Skill5 starsChanged 14 days agoMITView on GitHub
Produces an onboarding guide for an unfamiliar repository from its real import graph. A bundled script parses Python, JS/TS and Go imports to find entry points, hub files that many others depend on, import cycles, orphans and external packages, then emits a Mermaid architecture diagram and a self-contained interactive HTML dependency graph. The guide covers the architecture overview, how a request or data flows from the API to the database, key modules and the files to handle with care, each backed by numbers. Use when the user asks to explain a codebase, onboard to a new or just-cloned repo, map the codebase or its modules, draw an architecture or dependency diagram, see what imports what, or asks "where do I start?".
3 other projects use a version of this.
Adopted by
Most recently taken up by
- bhaveyx/codebase-explainertheir own version, first seen Oct 25, 2026
- dennisrongo/claude-skillstheir own version, first seen Aug 16, 2026
- TheophilusChinomona/idevtheir own version, first seen Jun 12, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- dennisrongo/claude-skills★ 1same name
- bhaveyx/codebase-explainer★ 0same name
- TheophilusChinomona/idev★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository56 other files it gives its agents.
- docs/llms.txtllms.txt
- a11y-fixerSkill
- ad-copy-generatorSkill
- agent-guardrailsSkill
- agent-memory-keeperSkill
- ai-slop-detectorSkill
- api-to-sdkSkill
- app-store-optimizerSkill
- architecture-doctorSkill
- brand-voice-guideSkill
- bug-detectiveSkill
- changelog-from-gitSkill
- codebase-time-machineSkill
- commit-craftSkill
- competitor-spySkill
- content-repurposerSkill
- cost-cutterSkill
- demo-recorderSkill
- dependency-doctorSkill
- dockerize-anythingSkill
- durable-agent-workflowsSkill
- e2e-flow-testerSkill
- email-campaign-writerSkill
- env-secrets-guardSkill
- gh-actions-auditorSkill
- hook-generatorSkill
- incident-commanderSkill
- influencer-outreachSkill
- instagram-growth-managerSkill
- landing-page-roasterSkill
- launch-post-writerSkill
- meeting-notes-to-ticketsSkill
- merge-conflict-resolverSkill
- migration-wizardSkill
- plan-grillerSkill
- prompt-injection-scannerSkill
- pr-reviewer-proSkill
- readme-glow-upSkill
- roast-my-githubSkill
- screenshot-to-componentSkill
- seo-blog-writerSkill
- skill-creator-proSkill
- skill-finderSkill
- skills-doctorSkill
- social-analytics-reporterSkill
- social-media-calendarSkill
- social-media-managerSkill
- sql-optimizerSkill
- startup-idea-validatorSkill
- tdd-loopSkill
- terse-modeSkill
- test-gap-hunterSkill
- tiktok-viral-creatorSkill
- ui-tasteSkill
- youtube-script-writerSkill
- youtube-seo-optimizerSkill
The file
We split this skill into the rules it gives an agent
2 rules. 0 are common, 2 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 86
Every claim points to real paths, and every number comes from the script's output.
- Distinctive: line 90
Don't write files into the user's repo without asking.
“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Codebase Explainer
Turn "I just cloned this and I'm lost" into "I know where everything lives". The diagrams come from the imports in the code, not from guessing at folder names.
1. Map the imports
python3 scripts/code_map.py . # modules, entry points, hubs, cycles, orphans, packages
python3 scripts/code_map.py . --format mermaid # module diagram, heaviest edges only
python3 scripts/code_map.py . --format mermaid --focus src/api # file-level diagram of one folder
python3 scripts/code_map.py . --format html --out /tmp/code-map.html # interactive graph, one offline file
python3 scripts/code_map.py . --format json # the full model, for your own queriesOptions: --depth N (folder levels per module, picked automatically by default), --exclude 'GLOB' (repeatable, for fixtures, generated code and vendored copies), --skip-tests, --max-nodes and --max-edges for the diagram. Exit codes: 0 ok · 2 nothing to analyse.
It resolves Python imports (relative, src/ layouts, importlib.import_module("literal")), JS/TS (import, export … from, require, import(), index files, tsconfig/jsconfig paths, workspace package names) and Go (through go.mod). Other languages get file and line counts but no edges.
| Section | What it means |
| Entry points | __main__ guards, Go package main, package.json bin/main/scripts, pyproject scripts. "file name" alone is a guess |
| Hubs | files imported by 3 or more non-test files. A change here reaches all of them |
| Cycles | import-time cycles can break on load or change with import order. lazy only ones go through function-level, type-only or dynamic imports |
| Orphans | nothing imports them and they aren't entry points: dead code, or loaded in a way the parse can't see |
| Unresolved | local imports that point nowhere: stale paths or an alias it couldn't read |
Limits: a static parse can't see imports built from strings at runtime, DI containers, reflection, plugin registries, framework conventions (file-based routes, decorators) or calls between services over HTTP and queues. Say this in the guide. Don't present the graph as complete, and check the heaviest edges in the code before explaining them.
2. Read around the facts
Skim the README, manifests, CI workflows, Dockerfiles and env examples. Then open each real entry point and follow one request or command down through the hubs it reaches, and find the data layer (ORM models, migrations, API clients). For churn, run git log --since=1.year --name-only --pretty=format: | sort | uniq -c | sort -rn | head -20. A hub that also churns a lot is the riskiest file in the repo.
3. Write ARCHITECTURE.md (or show it inline if the user prefers)
# Architecture of <project>
## TL;DR
3 sentences: what it does, main tech, how it's deployed.
## Map
| Path | Responsibility | Files | LOC |
## Components
```mermaid
flowchart LR
%% from code_map.py --format mermaid; rename labels if you like, never add edges it didn't find
```
## How a request flows
```mermaid
sequenceDiagram
Client->>API: POST /orders
API->>Service: createOrder()
Service->>DB: insert
```
## Key concepts & glossary
## Handle with care
| File | Why | Evidence |
e.g. `core/state.py` | everything reads it | imported by 23 files, in an import-time cycle with `core/events.py`, 41 commits this year
## Getting started
Run, test, debug commands (verified from the repo).
## Where to make common changes
"Add an API endpoint → ...", "Add a screen → ...", "Add a DB column → ..."
## What this map can't see
Which of the limits above apply here.The sequence diagram comes from reading code, not from the script. If you draw a link the parse didn't find (an HTTP call, a queue), make it dashed and say where you saw it.
4. Offer the interactive map
Ask where to write code-map.html (outside the repo or a gitignored path, unless they want it committed). It's one file with no network requests: click a node to light up what it imports and what imports it, search by path, switch between modules and files, cycle edges in red. Repos over 800 files get the module view only (--html-max-files raises that).
Rules
- Every claim points to real paths, and every number comes from the script's output.
- Diagrams must be valid Mermaid and stay small (about 25 nodes or fewer). Use several focused diagrams rather than one huge one.
- Explain why things are structured this way when the code or commit history shows it.
- List open questions you couldn't answer instead of making things up.
- Don't write files into the user's repo without asking.
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
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.

