/code-exploration:explore-codebasefrom code-exploration
Guided code exploration for an unfamiliar codebase, pull request or feature. Builds a throwaway local web app with a step-through flow, an interactive architecture diagram you can click, and live source snippets read from the checkout, then offers to hand off to the nvim-debug-setup skill so the same path can be stepped through in a debugger. Use when the user wants to understand, review or onboard onto code, asks how a request or feature flows through a system, wants an architecture overview they can explore, or wants to learn a codebase with a debugger. Not for polished documentation diagrams, use refine-mermaid-svg for those.
Ships in code-exploration. 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.
Reading a large change top to bottom does not build understanding. A map does. This workflow reads the code first, then turns what it found into a local page the user can click through: scenarios that step along the real code path, an architecture diagram with animated flows, and the actual source next to every claim. The user stays in control and the code under study is never edited.
Scope it. Find out what the user wants to understand, who will read the result, and the entry points. A pull request, a service, one feature and a whole repository need different depth. If the scope is unclear, propose one and go.
Read before drawing. Trace the real paths from the entry points to the end, not the file tree. Collect:
Keep a list of what was traced and what was inferred. The page should not present a guess as a fact.
Set up the workspace. Pick an untracked scratch folder, for example
.scratch/code-tour, or the repo's existing scratch convention. Add it to
.git/info/exclude so it can never be committed, and copy the contents of
assets/webapp/ into it. The server needs python3 and nothing else. Read
the repo's own tooling rules before running anything that installs software.
Author the data. Read references/data-schema.md completely, and look at assets/example/ for a working pair.
flow.json first. Start with the main path, then add one scenario
for each distinct way out: each error status, each early return, startup,
background refresh. Every step names the node it happens in and carries a
code anchor. The text explains why the step matters.arch.json: the frame, the packages, the outside systems, the
flows, and an info entry for every clickable box. If the archify skill is
installed it can draw the architecture instead, with automatic layout and
validation. See Using archify.Check it mechanically.
python3 <skill-dir>/scripts/check_anchors.py <scratch>/code-tour
Fix every error. Read every warning: an anchor that matches several lines
needs nth or a more specific substring.
Serve it and look. Start the server in the background and keep the process id so it can be stopped later.
cd <scratch>/code-tour && python3 server.py 8765
Then take screenshots of the flow page at a few steps, with
#<scenario-id>:<step> in the URL, and of the architecture page with each
flow selected, and read them:
python3 <skill-dir>/scripts/screenshot.py "http://127.0.0.1:8765/architecture#<flow-id>" out.png
Fix overlapping text, labels on top of boxes and arrows through boxes. The layout rules in the schema reference list the usual causes. If no browser is available, say that the visual check was skipped.
Hand it over. Give the URL, say which pages exist and what to click, and say how to stop the server. Mention that the folder is excluded from git, and list any archify files that were made, with their paths. Do not paste the whole diagram into the chat.
Offer the debugger. If the user wants to step through the code, export a tour and hand off.
python3 <skill-dir>/scripts/export_tour.py <scratch>/code-tour --scenario <id> --ext .go
Pass --ext with the language being debugged. Scenarios often include
configuration or infrastructure files that a debugger can never stop in.
That writes tour.json with one stop per code anchor of the scenario, in
step order:
{ "title": "...", "stops": [ { "file": "...", "find": "...", "nth": 1, "note": "3. ..." } ] }
Then invoke the nvim-debug-setup skill with the path of tour.json, the
command that starts the program locally, and any arguments or environment it
needs. Ask the user for those if they are not obvious from the repo. Do not
set up a debugger unless the user asked for one.
Once a debug session runs, the tour page can show it live and ask for a continue or a breakpoint at a tour step. See references/live-debugging.md, including its security model, before enabling it for someone.
Clean up. When the user is done, stop the server. Keep or delete the scratch folder as the user prefers. Never commit it.
Archify is a separate, third party skill
that generates validated diagrams as standalone HTML: architecture, workflow,
sequence, data flow, lifecycle, ERD, class, tree, timeline and waterfall. It
lays out and routes the diagram itself and checks the result. The hand placed
coordinates in arch.json are the part of this workflow that goes wrong most
often, so archify is the better tool for the architecture diagram, and for any
sequence or lifecycle diagram, when it is available. These notes follow its
documented workflow as of version 3.2.0.
Detect it, do not install it. It is present when the archify skill appears in
the available skills, or archify/SKILL.md exists under ~/.agents/skills or
~/.claude/skills, and node --version reports 18 or newer. When it is not
installed, use arch.json, and mention archify only if the user asks how to get
better diagrams. Never install or update it without being asked.
Split the work this way:
.archify/<type>-<slug>-<timestamp>/ and ends with a
validated HTML file. Ask for repository evidence, so claims carry source
locations.tour.json have no archify
counterpart. Keep writing flow.json, and export the tour as before.arch.json
and delete the Architecture link from the <nav> in index.html, so the page
has no dead tab.Things to pass on or watch for:
.archify/ to .git/info/exclude. The output belongs in the scratch
folder's reach, never in a commit.ARCHIFY_UPDATE_CHECK_DISABLED=1 when the environment should make no
outbound requests. If a receipt mentions an update, pass the notice on as
information and leave the version alone..env are refused. Tracked files are served as they are, so do
not run it on a checkout that contains secrets in tracked files, and do not put
secrets into the data files.| Path | What it is |
|---|---|
assets/webapp/ | The server, the two pages, the renderer, the stylesheet and starter data files to copy. |
assets/example/ | A complete example pair of flow.json and arch.json. It explains the tool's own server, so every anchor resolves in this repository. |
references/data-schema.md | Every field of both data files, and the layout rules. |
scripts/check_anchors.py | Validates both data files and resolves every code anchor. |
scripts/export_tour.py | Turns one scenario into tour.json for a debugger. |
scripts/screenshot.py | Headless Chrome screenshot, to check the rendering. |
scripts/selftest_server.py | Tests the server, including the live debugger bridge and its security checks. |
references/live-debugging.md | The live debugger view: protocol, security model, limits. |
assets/example/arch.json (opens in a new tab)assets/example/flow.json (opens in a new tab)assets/webapp/arch.html (opens in a new tab)assets/webapp/arch.js (opens in a new tab)assets/webapp/arch.json (opens in a new tab)assets/webapp/flow.json (opens in a new tab)assets/webapp/index.html (opens in a new tab)assets/webapp/server.py (opens in a new tab)assets/webapp/style.css (opens in a new tab)references/data-schema.md (opens in a new tab)references/live-debugging.md (opens in a new tab)scripts/check_anchors.py (opens in a new tab)scripts/export_tour.py (opens in a new tab)scripts/screenshot.py (opens in a new tab)scripts/selftest_server.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
2 skills in this plugin
Other plugins' skills for the same job
npx claudepluginhub cedi/agent-plugins --plugin code-exploration