/ceh-codebase-explanation:explain-codebasefrom ceh-codebase-explanation
Load this skill when a whole repo or knowledge base must be understood and the understanding written to .agents_workspace/CODEBASE_EXPLAINED.md, component by component. Trigger on "explain this codebase", "walk me through this project", "I inherited this repo".
Ships in ceh-codebase-explanation. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
One pass over the repository produces one file — .agents_workspace/CODEBASE_EXPLAINED.md — that
explains what every component does and how they connect. The reader is a developer or agent who has
never seen the repo and will change it tomorrow, so the file must be readable top to bottom, not
just greppable.
The hard requirement is accounting: every file in the repo belongs to an explained component, to an explicit group rule, or to a named exclusion. A file that belongs to none of the three is a gap you report, not an omission you make quietly.
The repo need not hold code. A knowledge base — Markdown, text, or other prose files on one or more subjects — gets the same pass, read as documents instead of programs. See Code or knowledge base.
Build the inventory from version control, not from a manual walk:
git ls-files # tracked files
git ls-files --others --exclude-standard # untracked, not ignored
Outside a git repo, fall back to find . -type f with the usual noise pruned (node_modules/,
.venv/, __pycache__/, dist/, build/, .next/).
Excluded by default — and each exclusion is named in the doc, never silent:
.agents_workspace/, session artifacts under .claude/Everything else belongs to a component. Repetitive sets inside a component are collapsed to a group rule rather than enumerated, in both modes:
migrations/— 42 sequential Alembic revisions,001_init…042_add_audit; each adds tables or columns and is applied in filename order.
Decide from the inventory which kind of repo this is, and say which in the doc's header line.
Mostly source files and manifests is a code repo. Mostly prose files (.md, .txt, .rst,
.org, notes exported from a notes app) with little or no code is a knowledge base. A repo with
both, such as a docs site with a build config, explains each part in its own terms.
In a knowledge base, a component is a topic area: a directory or a cohesive set of documents on one subject. Everything else in this skill holds, with these readings:
| Code repo | Knowledge base |
|---|---|
| Entry points, manifests | Index, README, table-of-contents, or map-of-content files, and any site config (mkdocs.yml, a vault config) |
| Core domain, then supporting code | Core subjects, then reference material (glossaries, sources, templates), then drafts and archives |
| What calls it, what it calls | What links to it and what it links to; which documents build on which |
| Key flows: a request, a build, a CLI run | Reading paths: the order a newcomer reads to learn a subject, or the documents one question passes through |
| A constraint the code imposes | A link target other documents depend on, a naming or front-matter convention, a generated index, two documents that cover the same ground |
Explain what each document says, not just what it is called: the claim, the definition, the procedure it carries. Summarize, never quote more than a sentence, and do not judge whether the content is correct. Contradictions between documents go into Gaps and oddities as facts.
Default: component level. A component is a directory or a cohesive set of files with one
responsibility — src/api/, store/, the CI workflows, the packaging config. Individual files are
named inside a component's explanation only when they carry weight: entry points, the file holding
the core logic, a file whose role contradicts its name.
Per-file only on an explicit ask — "per file", "file by file", "every file", "explain each file". Then every non-excluded file gets its own entry under its component. Do not volunteer this mode: on a large repo it multiplies both the reading and the document length, and the result is a worse orientation doc than the component view.
If the ask is per-file for one area only ("explain every file in src/api/"), do it there and stay
at component level everywhere else. Say which mode you used in the doc's header line.
Every component gets these four, in this order:
A description that restates the name is a failure. utils.py — utilities says nothing; say which
utilities and who imports them. Write what the reader cannot guess.
Path: .agents_workspace/CODEBASE_EXPLAINED.md. Create the directory if missing. Honor any
path the user names instead.
Git-ignored, never tracked. The doc is a regenerable local artifact, not repo content:
git check-ignore -q .agents_workspace/CODEBASE_EXPLAINED.md \
|| echo '.agents_workspace/CODEBASE_EXPLAINED.md' >> .git/info/exclude
.git/info/exclude is the right home — it ignores the file without modifying a tracked
.gitignore, so no teammate inherits the rule and no repo file changes. Use the repo .gitignore
instead only when the user asks for a shared rule. If a previous run left the file tracked
(git ls-files --error-unmatch <path> succeeds), report that it is tracked, with
git rm --cached <path> as the command that untracks it, and leave the untracking to the user.
Overwrite an existing one — it is generated, never hand-maintained.
The output file is the only write. This skill reads the repo; it changes nothing else in it.
Fill assets/codebase-explained.template.md: its frontmatter, then its sections in that
order, per references/codebase-explained-schema.md, whose worked example shows the four-part
component shape and a key flow.
| Want | Use |
|---|---|
| Diagrams of the system's shape + decision log | ceh-codebase-explanation:document-architecture |
| Docs for people who use or operate the product | ceh-documentation:write-guides-and-runbooks for the tasks, ceh-documentation:write-project-docs for a whole docs set |
| Explain one subsystem to someone who is in the session and can say "still blurry" | ceh-codebase-explanation:explain-until-understood |
| Explain what is in the repo and how it works, component by component | this skill |
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub cheneeheng/ceh-claude-code-library --plugin ceh-codebase-explanation5 skills in this plugin
/document-architectureLoad this skill when creating or updating ARCHITECTURE.yaml (Mermaid diagrams plus a Key Decisions log), or when a change to the system's shape must be brought back into it. Trigger on "write the architecture doc", "diagram the system", "record this decision", "high-level overview"./explain-until-understoodLoad this skill when someone in the session must understand a subsystem, design, diff, or tool: explain from zero until they can answer unaided. Trigger on "explain this to me", "I don't understand this diff". Not for a repo-wide file (use ceh-codebase-explanation:explain-codebase)./maintain-glossaryLoad this skill when a project's words need pinning down: a term with two senses, two words for one thing, or a new concept to name, settled in a committed GLOSSARY.md. Trigger on "what do we call X", "define our terms", "add this to the glossary", "these two words mean the same thing"./trace-code-rationaleLoad this skill when the question is why code is the way it is, not what it does: trace it through git log, blame, PRs, and issues, citing each claim. Trigger on "why is it like this", "why was this added", "is this safe to remove".