/architecture:map-flow <entry point> [--depth N] [--out <dir>]from architecture
Traces a single C# entry point into a sequence diagram with citations on every hop. Handles interface, service-locator, and reflection hops. Stops at Publish/Send. Invoke with 'map flow', 'sequence diagram', or 'trace this request'.
Ships in architecture. 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.
The current repository is both the consumer, whose convention home declares where artifacts land, and the default subject, whose tracked C# contains the entry point.
Collect with an individual Bash call, one command per call: the project root,
git rev-parse --show-toplevel. Treat a failure (not a repository, git unavailable) as an unknown
value and carry on; ${CLAUDE_PROJECT_DIR} is the resolver's --root either way. The <entry point>
argument is required: a route (with an optional leading HTTP verb), Type.Method, or a method name,
not a second repository.
Answer "what happens when this entry point runs" from call sites in the tree. Every hop traces to a line in a tracked file. The scripts collect and render. Do not add a hop the script did not emit, and do not bind a call to a class that merely has a method of the same name.
Read ${CLAUDE_PLUGIN_ROOT}/reference/config.md first. This skill writes into architecture_dir
and reads no dialect key: the picture is always a mermaid sequenceDiagram.
Run bash "${CLAUDE_PLUGIN_ROOT}/lib/resolve-convention-home.sh" --root "${CLAUDE_PROJECT_DIR}"
and resolve architecture_dir per ${CLAUDE_PLUGIN_ROOT}/reference/config.md "Where the config lives" and
"Resolution order, per key"; never parse the root instruction file yourself.
This skill never writes the consumer's root instruction file or its topic doc;
/architecture:setup apply owns both.
"${CLAUDE_SKILL_DIR}/scripts/collect-flow.sh" \
--repo "<subject-repo>" --entry "<entry point>" --depth N \
--generated-on "<YYYY-MM-DD>" --out "<architecture_dir>/flow.json"
--depth defaults to 5. Keep the ${CLAUDE_SKILL_DIR} anchor;
${CLAUDE_PLUGIN_ROOT}/reference/config.md § Script paths
says why.
Exit 3 is a refusal whose message states the reason; nothing was written. Report the reason and stop. Do not draw a sequence from the files you can see.
The record is schema_version 1, one object per line. Each hop carries file and line of the call
site, resolution (statically-resolved, inferred, or unresolved), mechanism (why a hop is
unresolved), sync (synchronous or asynchronous), and handoff.
The shipped adapter reads tracked *.cs only. The entry is one of:
| Entry | Selects |
|---|---|
/orders/{id} | the handler whose [Route], [HttpGet]-family attribute, or MapGet-family call carries that exact string; a route entry contains /, so a template without one ([HttpGet("{id}")]) is reached through Type.Method |
GET /orders/{id} | the same route, where the handler takes that verb: GET, POST, PUT, DELETE or PATCH in any case, read from an Http* attribute beside the route or from the Map* name; a handler that names no verb takes any |
OrdersService.Handle | the method Handle declared in the class OrdersService (the last two names of a dotted entry) |
Handle | every declaration named Handle |
A Map* call is traced through the method it names as its handler, MapGet("/x", Handle) or
MapGet("/x", Type.Handle), declared in the class that holds the call, an enclosing class, or
Type. A lambda, or a name that is not exactly one declaration in the tree, is a refusal that
points at Type.Method.
More than one match is a refusal that names every site and lists these forms. Nothing else
narrows a match: overloads and same-named types in different namespaces stay ambiguous. A
[Route(...)] above a class is not composed with the routes of its methods (a limit): it names no
handler, so a route entry matches only a string written whole on one handler. An entry with no
block body (expression-bodied or abstract) is a refusal. A repository with no C# file is a
refusal. That is the result. Do not fill it from another language.
A call is followed only through its receiver's declared type, read from a parameter or local of the
enclosing method, then a field, property or primary-constructor parameter of the enclosing class,
then its in-tree base classes; a type name written at the call (Repository.Save) is its own
evidence. The script follows the call, and walks the callee, only when that type is a class in the
tree that declares the method. Never bind a call by method name alone. resolution records the
evidence:
statically-resolved: the type came from a declaration in the enclosing method or class, or is
written at the call. The callee may be in another file.inferred: the type came through a base class or a declaration in another file (a partial
class), or the method is declared on a base class.unresolved: anything else, never followed. mechanism says why:mechanism | Cause |
|---|---|
interface | the receiver's type is an interface: one the tree declares, or a name of I plus an uppercase letter that no class in the tree declares |
dependency-injection | the call is GetService or GetRequiredService |
reflection | the call is CreateInstance |
broker | Publish<T> or Send<T>, a hand-off |
dynamic-publish | Publish or Send with no type argument, a hand-off |
external-call | the receiver's type is outside the tree: a declared type no tracked file declares (Dictionary, Logger), or a type name written at the call (Console.WriteLine, string.IsNullOrWhiteSpace) |
receiver-type-unknown | no declaration of the receiver is in reach (a lambda parameter, a var initialized from a call), or the call is chained on a result (.ToList()) |
callee-not-in-tree | the receiver's type is a class in the tree, but neither it nor an in-tree base class declares the method (an external base class, an extension method, a delegate, a constructor the class does not declare) |
ambiguous-method | the type is declared more than once in the tree, or declares the method more than once (overloads) |
Publish and Send are hand-offs to a broker this skill does not read: handoff is yes and
sync is asynchronous whether or not the call is awaited. Every other hop takes sync from
await. Neither hand-off is dropped.
Hops are recorded in call order: a followed callee's hops come right after the call that leads to
it, before the caller's next call. An access modifier marks a declaration only as a whole word at
the start of the line, so _internalService.Run(x) and publicUrl = Build(x) are calls.
subject is the github.com origin repository name when that remote resolves, otherwise the
directory basename. The helper is inline in collect-flow.sh.
"${CLAUDE_SKILL_DIR}/scripts/render-flow.sh" \
--record "<architecture_dir>/flow.json" --out "<architecture_dir>"
Write flow.json first, then render from it. The script writes flow.md: a sequenceDiagram
whose participants are architectural roles (transport, application, domain, infrastructure, or the
directory name), not every class. Asynchronous hops use -->>, synchronous hops ->>. A handoff
names /architecture:map-events.
Consecutive hops that share a role pair, sync, resolution, mechanism, and handoff collapse to one arrow; the artifact says how many collapsed, and the table keeps every cited call.
The script prints one summary line on stdout. Keep it for the report:
flow: entry=<name> hops=<n> truncated=<yes|no> unresolved=<n> external=<n> di=<n> handoffs=<n>.
unresolved counts every unresolved hop. external counts the external-call,
receiver-type-unknown and callee-not-in-tree hops, di the interface and
dependency-injection hops; the rest are ambiguous-method, reflection and broker hops.
When truncated=yes, the artifact names the depth and says the sequence stopped. Do not describe
that picture as the whole path.
Exit 1 means the record is unreadable, not schema_version 1, or not one object per line; nothing was written. Report that message. Do not reformat the record by hand.
Parse flow.md before the report. Stdout is one JSON report with a status of ok or error per
block; exit 1 means a block failed to parse:
node "${CLAUDE_PLUGIN_ROOT}/lib/mermaid-gate.mjs" "<out>/flow.md"
Quote any failing block's line and error. A failing block is a defect in the render script:
report it and do not repair flow.md by hand. Without mmdc the parse is a structural check, so
say that an ok does not prove every syntax error is absent. When node is missing, say the
diagram was not checked.
End every run with this block, in this order, filled from the record and the script exits:
none written when the run stopped or refused.hops=, unresolved=, external=, di=, handoffs=, truncated= quoted from the
summary line.unresolved= split into external= (framework and other calls outside the
tree, or on a receiver of unknown type), di= (interface and service-locator hops), and the
remainder, and that none were bound to a guessed implementation.After the report, offer an interactive view of flow.json in one sentence. The markdown and the
record stay authoritative. Build it only with ${CLAUDE_PLUGIN_ROOT}/scripts/build-view.mjs flow,
never hand-written; the shared medium resolver decides the destination, with this plugin's medium
option ${user_config.medium}, or "" when that reads empty or unsubstituted (never put a
${user_config.*} string in a shell command), and its report line is printed. Procedure:
${CLAUDE_PLUGIN_ROOT}/reference/rendered-view.md.
Publish or Send is a hand-off, not a consumer list; that is
/architecture:map-events.flow.json and flow.md under the
resolved output directory.--out, and no confirmed architecture_dir is a stop, not a
default./architecture:map-events./architecture:adr./planning:design integration.sequenceDiagram, as
/planning:design (if enabled) draws its sequence flows. The decision is recorded in
${CLAUDE_PLUGIN_ROOT}/reference/config.md.Application is application,
Domain is domain, and Infrastructure is infrastructure. Other directories keep their own
name. The artifact says when consecutive hops inside one role pair were collapsed.IOrders _orders followed by _orders.Place does not become
the Place method on another class, and _cache.Add(x) does not become the one Add method
in the tree: its receiver is a Dictionary, so the hop is external-call and is not walked.
The hop cites the call site and stops.--depth counts followed callees. A callee that still contains
a call is why truncated=yes. Do not narrate the diagram as complete.{"from_role": object per line, or the array is [] on its key's line. render-flow.sh
exits 1 on any other shape and writes nothing.git ls-files is the file set. The adapter does not read project files,
configuration, or other languages. Read: C#. Declined: Node, Go, Python, Rust, JVM, Ruby, and
PHP; their files are never read, and a tree with no C# file is refused. A comment is not a call. A declaration line is not a hop.[Route("...")] and [HttpGet("...")]
(and the Post, Put, Delete, and Patch attribute forms) match a route entry, as do the same
quoted strings on MapGet/MapPost and the other Map* methods. Pointer: when checking the
route forms the adapter matches, fetch
controller routing § Attribute routing with HTTP verb attributes
and
minimal APIs § Routing
live. A verb prefix on the entry
(GET /orders/{id}) is matched against the Http* attribute names beside the route, or the
Map* name. The script does not compose a class-level [Route(...)] with a method route; that
is a limit of this adapter.What SKILL.md sets; muted values are Claude Code's defaults
bashnpx claudepluginhub melodic-software/claude-code-plugins --plugin architecture15 skills in this plugin
/adrArchitecture decision records: record (retires reversed record on yes; if no convention, writes nothing until human picks a shape), audit unbacked records (read-only), prune accepted. Use for 'write an ADR', 'record this decision', why we chose X, design interview, current ADRs. Skip if no alternative was weighed, or indices/migrations/status./enforce-boundariesEnforce boundariesArchitecture module-boundary checks in the repo: each rule recorded in ## Boundary rules gets the strongest supported mechanism, proven to fail on an injected violation and pass once removed. Use for 'enforce our boundary rules', 'add an architecture test', 'make this layering rule fail the build', or confirmed boundary findings./improveCodebase scan for module friction (shallow modules, module seams, locality, cross-boundary leaks): HTML report, Design-It-Twice interview. Use for 'improve architecture', 'shallow modules', 'locality', deepening, compare interface, derive conventions, layer boundaries, which references cross a boundary. Not for cross-dimension: /improvement:find./improve-layoutImprove layoutCo-change folder-layout check from git history: finds co-change clusters and folder spread, judges cards against repo layout style, and interviews on a target layout (moves no files). Use for 'co-change layout', 'co-change clusters', or whether co-changing files live in the right folders. Not for module depth/boundaries: /architecture:improve./map-componentsMap componentsC4 component view of a deployable's modules: one arrow per internal build reference, citing its declaration. Use for 'component diagram', 'what is inside this service', 'module dependencies', arrow direction, or layering. Not for repos (/architecture:map-landscape), deployables (/architecture:map-containers), module design (/architecture:improve)./map-containersMap containersC4 container diagram of a system: deployables, stores and brokers their tracked config binds, and resolved endpoint edges. Use for 'what actually runs', 'deployables and databases', 'modular monolith', or service-to-broker binding. Not for repos (/architecture:map-landscape), one deployable (/architecture:map-components), or environment topology.Other plugins' skills for the same job