Tooluck logoTooluck
SKILL.md

code-explanation

Agent skill fromLeanmcp/gateway-skills

Generate a complete, beginner-friendly explanation of an entire code repository as a set of markdown files. Maps the repo structure with `treecap` (installing it if missing), studies the actual source, then writes a `CODE_EXPLANATION/` folder containing an `OVERVIEW.md` plus numbered deep-dive files (01_architecture.md, 02_models.md, ...) that explain how the code is built, what it does, and how the pieces fit together — illustrated with real code excerpts. Use this skill whenever the user wants to understand, document, onboard onto, or get a walkthrough of a codebase: phrases like "explain this repo", "explain the code", "code explanation", "walk me through this codebase", "help me understand how this is built", "document the architecture", or "what does this project do" — even if they don't say the word "skill". Prefer this over ad-hoc summaries whenever the goal is a durable, written explanation of a whole repo.

How to install code-explanation

install code-explanation
# install the gateway-skills pack with the skills CLI
npx skills add Leanmcp/gateway-skills

# or add only this skill to Claude Code: copy the folder

skills/code-explanation/

# into

~/.claude/skills/code-explanation/ (all projects)

.claude/skills/code-explanation/ (one project)

skills/code-explanation/SKILL.md

MITFull file
1# Code Explanation
2
3Produce a thorough written explanation of an entire repository so someone new
4can understand **what it does, how it is built, and how the pieces fit
5together**. The output is a `CODE_EXPLANATION/` folder of markdown files: one
6`OVERVIEW.md` and a series of numbered deep-dive documents.
7
8The goal is genuine understanding, not a file inventory. A good explanation
9reads like a knowledgeable engineer walking a new teammate through the codebase:
10it names the important abstractions, shows real code, and explains *why* things
11are shaped the way they are.
12
13## Workflow
14
15### 1. Establish the structural map with `treecap`
16
17Before reading any code, get a bird's-eye view of the repo layout. Use
18`treecap`, a tree viewer that caps how many entries it shows per folder so large
19repos stay readable.
20
21Resolve the tool in this order:
22
231. **`treecap`** — preferred. Check with `which treecap`.
242. If it is missing, **install it**: `pip install treecap` (it is a PyPI
25 package: https://pypi.org/project/treecap/). If `pip` isn't available, try
26 `pip3 install treecap` or `python -m pip install treecap`.
273. If installation fails or is declined, **fall back to `tree`**
28 (`which tree`).
294. If neither exists, fall back to a manual listing (e.g. `find . -type f`
30 filtered sensibly), but prefer the real tools.
31
32Run it on the target repo. Sensible defaults:
33
34```bash
35treecap -W 0 -L 3 # full width (all entries), 3 levels deep
36```
37…

Excerpt shown under the repository's MIT license.

More skills in gateway-skills

Keep exploring

Similar skill repositories

Newsletter

Join the Community

Subscribe to our newsletter for the latest news and updates