Netron-style interactive graph of a code path, architecture or data flow, as one self-contained HTML file with typed nodes, key = value attributes, labelled edges and a click-for-details side panel. Use when the user wants a 链路图 / architecture / flow they can explore visually instead of reading text, asks for something like Netron, or wants an existing graph brought up to date after the code changed.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Netron Graph?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/oliver0719-netron-graph)
---
name: netron-graph
description: Netron-style interactive graph of a code path, architecture or data flow, as one self-contained HTML file with typed nodes, key = value attributes, labelled edges and a click-for-details side panel. Use when the user wants a 链路图 / architecture / flow they can explore visually instead of reading text, asks for something like Netron, or wants an existing graph brought up to date after the code changed.
---
# Netron graph
Make a graph the user **explores** instead of reads, laid out like Netron. The structure lives on the canvas, and prose lives only in the side panel, one click away. You write one graph JSON file. `scripts/build.py` validates it, checks every edge against the source tree, and renders it into the fixed viewer in `assets/viewer.html`. Nothing about a particular graph lives in the viewer.
Every edge is a claim about the code. A wrong edge misleads the user until they catch it, so each edge cites the line that makes it true, and the build checks that line on every rebuild.
**Work in a fresh context.** A long session carries facts forward from earlier revisions and earlier graphs. When this conversation is long, or the graph replaces an older one, run the steps in a fresh subagent with thinking on. Hand it the entry point, the source root and the question. An older graph may go along as a layout to reuse; the current source is the only evidence.
## Steps
1. **Gather evidence by tracing.** Start at the entry point and follow the calls. Each function you reach is a candidate node. Each call, read or write between two of them is an edge, and the line where it happens is that edge's `ref`. A function you found only by searching joins the graph once you can name its caller. Grade each node:
- `obs`: seen running (a log, a test run, a trace)
- `inf`: read from source
- `unk`: nobody has checked
Done when every planned node has refs or an honest `unk`, and every planned edge has its ref line.
2. **Model the graph** using the reference under *Modelling* below. Done when you can say what flows across every edge.
3. **Write `<name>.graph.json`** next to where the HTML will live. The JSON is the source of truth and the HTML is a build artefact. Fields are in [SCHEMA.md](SCHEMA.md). Start from an example:
- `examples/minimal.json`: small, uses every layout mechanism, and checks against `examples/minimal_src`
- `examples/vllm_serve.json`: a real open-source code path (vLLM v0.34.0, `lang: zh`) across three lanes, with an issue, a `scan`, a proposed view and a sibling branch; checks against a v0.34.0 checkout
4. **Build against the source** with `python <this skill>/scripts/build.py X.graph.json X.html --src <repo root>`. Fix every `ERROR`, and either fix each `warn` or accept it deliberately.
- The source check fails on a ref whose line no longer makes its hop, and on a `scan` hit that no edge shows (SCHEMA.md › *Source check*).
- The other warns catch breaches of the *Modelling* rules: a proposed view identical to the current one, mostly-`"n"` nodes that aren't `nextOnly`, edges that skip a lane or run up or left, nodes with no incoming edge below r 0, `"w"` rows with no issue or leak, and Traditional characters under `zh`.
- For a graph of something other than code, leave out `--src`; the badge then tells the reader nothing was checked.
Done when it prints `ok:` and its `source:` line lists as unchecked only edges that no source line can show (readiness seen in a log, say), each named in your reply.
5. **Look at it** in a browser. The built-in pane runs JS only for files inside the project folder; for anything else, build to a path inside the project first.
- Set a desktop viewport of about 1440×900, fit, and take a screenshot.
- Check that the console has no errors, no edge runs behind a node, no group box covers a node that isn't in the group, and the labels are readable.
- Click one node in each lane and every header toggle once, then check the mobile preset.
- To fix a defect, move `c`/`r` in the JSON, rebuild and look again.
Done when a fresh screenshot shows none of those defects.
6. **Send** the HTML (rendered). Keep the reply to a few lines: how to read it and what the toggles do. The overview panel carries the rest.
## Updating a graph after the code changes
1. Rebuild with `--src <repo root> --fix-refs`. It rewrites refs that only moved and prints each rewrite with the line it landed on; read them and confirm each is still the same call.
2. Each stale-ref `ERROR` is a hop that is gone or renamed. Trace it again from its caller, then redraw, move or delete that edge, and delete its node when nothing reaches it any more. Each `scan` `ERROR` is a new touch point: draw it as an edge, or skip it with a why.
3. Look at it and send it (steps 5–6). Edges that still check need no rework.
Done when the build prints `ok:` and checks at least as many edges as the previous build did.
## Modelling
- **Node = Module**, at the granularity the reader reasons at: one function, class, config object or process. If two boxes always appear together and nothing worth labelling flows between them, merge them. Draw only nodes the change touches or connects to; name the rest in `refs`.
- **Header:** `t` is the real name as written in the code, so the reader can grep it, and cards, group labels and edge labels use that same string. `ty` is a short category label. `k` picks the header colour; the same kind gets the same colour throughout.
- **Rows** are Netron attributes: 2–5 `key = value` facts the reader needs at this hop. Use them for types, defaults and the one parameter that matters. A sentence belongs in the panel, not in a row.
- `"w"` marks a defect, and nothing else.
- `"n"` marks a row that differs from the current state, and nothing else.
- **Edge label = what flows**, as a type or a value (`resolved : dict`, `HTTP GET`, `AsyncEngineArgs`). An unlabelled edge is a missing fact.
- **Edge ref** is the line that makes the edge true: the call, the read or the write. An endpoint's own definition goes in that node's `refs`. Give the edge a `has` when the name it would look for is generic (`get`, `run`).
- A row that says a node reads, fills or points to X has the matching edge.
- A node with no incoming edge is an input.
- **Scan** an input or shared state whose every touch point matters: an env, a config file, a global, a cache's writers. The build then fails until each matching line is an edge or a skip with a reason. A claim of "only" or "唯一" in a label or verdict stands on a scan.
- **Lanes** are lifecycles or execution contexts: startup vs per-request, parent vs child process, client vs server. A module or package boundary is a group, not a lane.
- Each node sits in the lane where it runs: work done at startup sits in the startup lane even when its result is used per request.
- A test sits beside the node it exercises, joined by a `test` edge, and is never a step in a runtime chain.
- Edges between lanes are the coupling, so keep them few and between adjacent lanes; reorder the lanes or move the node when one would skip a lane.
- **Layout** is a grid of (lane, `c`, `r`), and rows pack separately in each lane.
- The main chain enters at c0 r0 and runs down column 0, each caller above its callee, with no edge going up or left.
- Inputs sit at r 0 in later columns; side inputs such as config go in later columns beside the row they feed.
- A node with a cross-lane edge sits in the column facing that lane, with nothing between it and the gap.
- A group's members form a rectangle, and no node outside the group sits inside it.
- An edge never jumps over a node in the same column or row; move one of them.
- **Issues** (when reviewing code): define `issues` with a severity, flag the problem rows `"w"`, and draw reads that bypass an interface as `leak` edges. A known defect this round leaves unfixed stays a `leak` edge and an issue, outside `fixedNext`.
- **Proposed view**, only when you are proposing changes. The current state is the baseline and each change is a delta on it: `rowsNext`, `removedNext` (drawn as a struck-through ghost), `nextOnly` nodes, `next` edges and `fixedNext`. A node whose rows would mostly be `"n"` is new, so it is `nextOnly`. A `nextOnly` node and a `next` edge have no code yet, so they stay unchecked until the change lands.
- **Panel text:** `verdict` is the one-sentence judgement, `fix` is the change, `iface` is what a caller must know, and `refs` is where the evidence is. Each fact lives in one place. Keep them short; the user chose this format so they wouldn't have to read.
- **Language:** `lang` sets the viewer chrome (`zh` is the default; `en` is the other option). Write the content, and your replies about the graph, in the user's language and script (Simplified or Traditional).