/code-tour:code-tourfrom code-tour
Analyse an existing repository with CodeGraph and generate a self-contained HTML code-reading tour — code presented in execution order, feature by feature, with explanations, clickable jumps to called functions and classes defined in other modules, and an always-visible overview showing where you are. Use when asked to understand, explore, onboard onto, explain, or produce reading material for an unfamiliar codebase, or when the user says コードツアー / コードリーディング / code tour.
Ships in code-tour. 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; scripts run unread.
Turn an unfamiliar repository into a guided reading experience: one HTML file where each feature's code is laid out in execution order, every call and cross-module type is a clickable jump, and two overview maps always show where the reader is.
Division of labour. The scripts extract facts and draw; you supply meaning. Never hand-write the structural data, and never make the scripts guess at intent.
| Layer | Owner | What |
|---|---|---|
| Symbols, call order, source, layout | scripts/*.py | Deterministic, from the CodeGraph DB |
| Feature selection, naming, prose | You | Judgement a static analyser cannot make |
| HTML | scripts/render.py | Pure function of tour.json |
tour.json is the durable artifact. The HTML is disposable — re-render any time
in under a second. A tour with no explanations still renders, so get the
structure out early and enrich it.
command -v codegraph || npm i -g @colbymchenry/codegraph
[ -d "<repo>/.codegraph" ] && codegraph sync "<repo>" || codegraph init "<repo>"
If codegraph cannot be installed, stop and tell the user — there is no
fallback path. Everything downstream reads <repo>/.codegraph/codegraph.db.
Set a working directory outside the target repo so you never dirty it:
WORK=<out>/.code-tour-work && mkdir -p "$WORK"
uv run --script scripts/discover.py <repo> -o "$WORK/features.json"
Ranked entry points, language-agnostically: framework route nodes, module
top-level bodies, and functions nothing (outside of tests) calls, weighted by
how much code they reach.
Now use judgement. Read features.json and choose 3–8 features that
together explain what this repository does. Then:
handleSubmit.reach_count.is_test: true candidates are deprioritised but still listed. Pick one only
if a test is genuinely the clearest specification of a behaviour.Write your picks to $WORK/plan.json:
{"features": [
{"slug": "user-signup", "title": "ユーザー登録の流れ",
"entry": "<id from features.json>",
"summary": "フォーム送信から DB 保存までを追う。"}
]}
Prefer the opaque id over a name — names are ambiguous across files.
uv run --script scripts/trace.py <repo> --entry "<id>" \
--title "ユーザー登録の流れ" -o "$WORK/trace-user-signup.json" \
--max-depth 4 --max-steps 25
Depth-first along call edges sorted by source position — the order the code actually runs. Classes referenced from elsewhere are appended as reference steps so they are reachable by jump.
Check the printed outline. If it is thin, raise --max-depth; if it sprawls
into logging/util noise, lower --max-steps or pick a more specific entry.
Read each trace (the source is embedded, so you do not need to open files) and
add three keys to each step. Batch one feature at a time and write
tour.json after each, so a long run stays resumable.
| Key | Content |
|---|---|
explanation | 2–4 sentences: what this code does and why it exists. |
why_next | One sentence motivating the jump to the next step. |
highlights | [{"line": <absolute line no.>, "note": "…"}] for the 1–3 lines that matter. |
line numbers are absolute file line numbers, matching start_line..end_line.
Write in the user's language. Say what the reader cannot get from the code
itself: the intent, the trade-off, the surprise. Never narrate syntax —
「for ループで回します」 is wasted space; 「N+1 クエリを避けるため一括取得している」 is not.
Assemble $WORK/tour.json:
{"title": "<repo> コードツアー", "repo": "/abs/path",
"features": [{"id":"user-signup","title":"…","summary":"…","steps":[/* annotated */]}]}
uv run --script scripts/render.py "$WORK/tour.json" -o <out>/index.html
Report the path. Offer to open it (open <out>/index.html) and to publish it
as an Artifact — the page is fully self-contained, so it publishes as-is.
Remove $WORK unless the user asked to keep it; mention that keeping
tour.json lets them revise prose and re-render instantly.
J/K or ←/→ step through · click any underlined identifier to jump to
its definition · Backspace returns to where you jumped from · both overview
maps are clickable · ◐ toggles the theme.
uv run --script handles dependencies.
Pygments is the only one.references/tour-schema.md for the full contract and
references/troubleshooting.md when something looks wrong.references/tour-schema.md (opens in a new tab)references/troubleshooting.md (opens in a new tab)scripts/assets/app.js (opens in a new tab)scripts/assets/style.css (opens in a new tab)scripts/cg_db.py (opens in a new tab)scripts/discover.py (opens in a new tab)scripts/render.py (opens in a new tab)scripts/trace.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub atsushi-green/code-tour --plugin code-tour