/layered-flow-chart:layered-flow-chartfrom layered-flow-chart
Create, update, and refine interactive hierarchical flow diagrams with automatic ELK layout and drill-down navigation. Outputs a React Flow viewer with zoom, pan, minimap, detail inspector, and progressively deeper levels. Use this skill when users ask to: - Visualize a processing flow, architecture, or pipeline as an interactive diagram - Create a layered/hierarchical flow chart with drill-down - Diagram a codebase flow with expandable detail levels - "Make a flow diagram of X" or "Visualize the X process" - Update an existing flow chart to reflect code changes - Improve or refine an existing flow chart (layout, detail, boundary connections) Triggers: "flow diagram", "flow chart", "process visualization", "layered chart", "interactive diagram", "drill-down diagram", "処理フロー図", "フローチャート", "フロー図解", "update flow", "refine flow", "フロー更新", "フロー改善"
Ships in layered-flow-chart. 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.
Create, update, and refine interactive hierarchical flow diagrams. React Flow renders the graph and ELK calculates node and edge positions automatically. Nodes with childLevelId open progressively finer levels; leaf nodes open a source-aware detail inspector.
Before starting, determine which mode applies:
| Mode | Trigger | Existing data.js? | Code investigation? |
|---|---|---|---|
| Create | "Make a flow diagram of X" | No | Full (3-phase pipeline) |
| Update | "Update the flow to reflect latest code" | Yes | Targeted (diff-focused) |
| Refine | "Improve the layout / add details / add boundary arrows" | Yes | None or minimal |
How to determine the mode:
index.html + data.js) → if yes, Update or Refineboundary → RefineThis mode requires deep code investigation BEFORE building the HTML. To prevent shallow analysis, you MUST split the work into 3 phases using SubAgents. Do NOT skip phases or combine them.
Investigation is done in serial steps using multiple Explore agents. Each step builds on the previous output. Do NOT parallelize - the layered nature of the chart requires understanding the high level before deciding what to drill into.
Understand the overall flow at the highest abstraction level. This becomes the root level of the chart.
Prompt template:
Investigate the following flow/process in this codebase: {user's description}
Produce a HIGH-LEVEL overview report. Focus on the main stages/phases of the flow, NOT implementation details.
## Flow Overview
- Purpose: (one sentence)
- Entry point: (file:line)
- Overall pattern: (e.g., pipeline, event-driven, request-response)
## Root Level Steps (the main stages):
For each major stage (aim for 5-10):
1. **{Stage Name}**
- Role: {what this stage does, one sentence}
- Key file(s): {primary file(s) involved}
- Complexity: simple | moderate | complex
- Branches to: {next stage(s), if any}
## Connections:
- {StageA} -> {StageB} (label if conditional)
- {StageA} -> {StageC} [dashed, on failure]
Focus on identifying WHAT the stages are and HOW they connect. Do not drill into implementation details yet.
After Step 1-1, review the output and decide:
Investigate the selected stages in detail. These become the drill-down levels of the chart.
Prompt template:
I am investigating this flow: {user's description}
Here is the high-level overview already produced:
{paste Step 1-1 output}
Now deep-dive into these specific stages: {list of selected stages}
For EACH stage, produce a detailed sub-flow:
### Stage: {name}
#### Sub-steps:
1. **{Sub-step Name}**
- Role: {what it does}
- Key file(s): {file:line-range}
- Tech: {libraries/frameworks involved}
- Input: {what it receives}
- Output: {what it produces}
- Branches to: {next sub-step(s), if any}
- Notes: {error handling, edge cases, important details}
#### Connections:
- {SubStepA} -> {SubStepB}
Investigate EVERY file involved. List concrete function names, file paths, and line numbers. Aim for 4-8 sub-steps per stage.
If the deep dive revealed that the root level needs corrections (missing stages, wrong connections, stages that should be split), spawn one more Explore agent to verify and patch.
Prompt template:
Here is a high-level flow overview:
{Step 1-1 output}
And here are the deep-dive findings:
{Step 1-2 output}
Based on the deep-dive, does the high-level overview need corrections?
Check for:
- Missing stages that the deep-dive revealed
- Stages that should be split or merged
- Connections that are wrong or missing
- Stages marked as simple that are actually complex (or vice versa)
Output ONLY the corrections needed (or "No corrections needed"). Use the same format as the original overview for any additions/changes.
Spawn a general-purpose agent. Pass it the Phase 1 report AND the Data Schema section below. The agent constructs the window.LAYERED_GRAPH JavaScript object.
Prompt template:
Convert the following investigation report into a window.LAYERED_GRAPH JavaScript object for a flow chart.
## Investigation Report
{paste Step 1-1 output (with Step 1-3 corrections applied if any)}
## Deep Dive Report
{paste Step 1-2 output}
## Schema Rules
{paste the "Data Schema", "Node Kinds", and "Connection Kinds" sections from this SKILL.md}
Output ONLY the JavaScript for data.js:
- window.LAYERED_GRAPH = { ... };
- document.title = `${window.LAYERED_GRAPH.meta.title} | Layered Flow Chart`;
Requirements:
- Do NOT generate x/y coordinates; ELK computes all layout
- Choose a semantic `kind` for every node and edge
- Set `childLevelId` only when a matching level exists
- Include sourceRefs, technologies, input/output, and details where available
- Aim for 5-10 nodes per level. If the investigation found fewer, that's fine, but do not drop discovered steps
Before assembling the HTML, use AskUserQuestion to ask the user where to place the generated file.
Determine the "main file path" from the Phase 1 investigation (the entry point or key file identified in Step 1-1). Use its parent directory as the option 2 suggestion.
AskUserQuestion config:
/tmp 配下 (Recommended) — /tmp/{project}/flow-{name}/ に出力します。プロジェクトを汚しません。{detected main file's directory}/flow-{name}/ に出力します。READMEの代わりなどプロジェクト内に置きたい場合に。Use the user's choice to determine the output directory for the next phase.
/tmp/{project}/flow-{name}/ (create dir with mkdir -p if needed){main file's directory}/flow-{name}/You (the main agent) handle the final assembly. The viewer is prebuilt — the LLM only generates data.js, no HTML/CSS/React generation needed.
mkdir -p {output-dir}cp ~/.claude/skills/layered-flow-chart/assets/template.html {output-dir}/index.htmlcp ~/.claude/skills/layered-flow-chart/assets/viewer.js {output-dir}/viewer.jscp ~/.claude/skills/layered-flow-chart/assets/viewer.css {output-dir}/viewer.css{output-dir}/data.js (the only LLM-generated file)open {output-dir}/index.html (the prebuilt IIFE works from file://; no server required)Use when an existing flow chart HTML needs to reflect code changes (new features, refactored modules, removed endpoints, etc.).
data.js file (in the same directory as the flow chart's index.html) to extract the current window.LAYERED_GRAPH objectSpawn an Explore agent focused on what changed, not the entire codebase.
Prompt template:
An existing flow chart describes this process: {brief description}
Here are the current nodes and connections in the chart:
{paste extracted LAYERED_GRAPH summary - just level IDs, node IDs, titles, and sourceRefs}
The user says the following has changed: {user's description of changes}
Investigate the codebase and report:
1. **New steps** that should be added (with file:line, role, connections)
2. **Removed steps** that no longer exist in the code
3. **Modified steps** where the role, file, tech, or connections changed
4. **Connection changes** (new, removed, or changed connections)
For each change, provide the same detail level as the existing nodes (file paths, tech, input/output).
Only report actual changes - do not re-describe unchanged parts.
Based on the diff report:
window.LAYERED_GRAPH objectkind if network crossings or failure paths changeddata.js file in-place (update window.LAYERED_GRAPH and document.title only — do not touch viewer assets)Use when the chart's content is correct but the presentation needs improvement. No or minimal code investigation.
CRITICAL: Always refine the surrounding context, not just the target.
When a user asks to refine a specific module, you MUST also review and potentially revise its surrounding layers:
Parent Layer (the level containing the target node)
├── Sibling nodes: are they at the same resolution as the refined target?
├── Connections: do arrow counts and labels still make sense?
└── Grouping: should siblings be split/merged to match the new granularity?
Target Node (what the user asked to refine)
└── The node itself + its drill-down level if it has one
Child Layer (the drill-down of the target, if any)
├── Sub-nodes: does the internal structure match the refined understanding?
└── Connections back to parent: are input/output descriptions consistent?
Why this matters: Refining one module often reveals that:
boundary flagsdata.js file to extract the current window.LAYERED_GRAPH objectBefore proceeding, use AskUserQuestion to confirm the refine scope with the user. Present the identified impact zone and let them choose.
Example question:
「{target node}」の改善にあたり、影響範囲を確認させてください。
1. Target only — 指定ノードとそのドリルダウンのみ
2. Target + neighbors — 前後のノード・接続も見直す(推奨)
3. Full layer review — 対象レイヤー全体のノード数・粒度・接続を再構成
4. (Other — 自由記述)
This prevents over-engineering a simple label fix, while ensuring the user is aware when broader changes are recommended.
For each node in the impact zone, check:
kind: 'boundary' or kind: 'failure'?For each layer in the impact zone:
| Request | Action | Impact zone |
|---|---|---|
| "Add boundary connections" | Set kind: 'boundary' on cross-network connections | All levels |
| "Improve layout" | Simplify the model, shorten labels, and adjust array order; ELK recalculates positions | All levels |
| "Add more detail to X" | Enrich X + check neighbor resolution parity | Parent + child + neighbors |
| "Add a drill-down for X" | New level + set childLevelId + check if neighbors need drill-downs too | Parent + new child |
| "Fix overlapping arrows" | Simplify cross-links or adjust model order and let ELK reroute | Affected level |
data.js file in-place (modify window.LAYERED_GRAPH and document.title only — do not touch viewer assets)window.LAYERED_GRAPH is the semantic source of truth. Coordinates and edge bend points are deliberately absent: ELK derives them at runtime.
window.LAYERED_GRAPH = {
version: 1,
rootLevelId: 'root',
meta: {
title: 'Order Processing',
product: 'LAYERED FLOW',
logo: 'OP',
repository: 'https://github.com/org/repo', // optional
},
levels: {
root: { /* Level */ },
'validate-detail': { /* Level */ },
},
}
document.title = `${window.LAYERED_GRAPH.meta.title} | Layered Flow Chart`
{
title: 'Level title',
description: 'One sentence describing this abstraction level.',
nodes: [ /* Node[] */ ],
edges: [ /* Edge[] */ ],
}
Keep a level focused on one resolution. Prefer 4-8 nodes. When a level exceeds 10 nodes, split it into meaningful phases or child levels instead of shrinking labels.
{
id: 'validate',
kind: 'decision',
icon: '02', // optional short marker
title: 'Validate request',
summary: 'Check required fields and business constraints.',
childLevelId: 'validate-detail', // optional; must match a level key
technologies: ['Zod', 'TypeScript'],
sourceRefs: [
{ path: 'src/validate.ts', line: 18, symbol: 'validateOrder' },
],
input: 'OrderDraft', // optional inspector field
output: 'ValidatedOrder', // optional inspector field
details: ['Reject missing items'], // optional inspector bullets
color: '#0f766e', // optional override; prefer semantic kind colors
}
Do not generate x, y, width, height, hasChildren, or a duplicated file string. Use childLevelId and structured sourceRefs.
| Kind | Use for |
|---|---|
input | External request, event, file, or user input |
ui | Browser/client component or interaction |
process | Internal transformation or orchestration |
decision | Validation, guard, branch, or lookup with multiple outcomes |
api | HTTP/RPC handler or service boundary |
storage | Database, cache, queue, or persistent/in-memory store |
output | Response, redirect, rendered result, or terminal outcome |
{ id: 'parse-validate', source: 'parse', target: 'validate' }
{ id: 'validate-save', source: 'validate', target: 'save', label: 'valid' }
{ id: 'validate-error', source: 'validate', target: 'error', label: 'invalid', kind: 'failure' }
{ id: 'browser-api', source: 'browser', target: 'api', label: 'POST /orders', kind: 'boundary' }
Every edge ID must be unique within its level. Source and target must reference nodes in the same level.
kind for a normal in-process flow.kind: 'failure' for validation errors, exceptions, not-found branches, and retry loops. These render as dashed amber edges.kind: 'boundary' when crossing a network, process, storage, or external-service boundary. These render as thick indigo edges.index.html, viewer.js, or viewer.css in generated output. Only generate or edit data.js.childLevelId opens that level. Clicking a leaf opens the inspector.h/j/k/l or arrow keys navigate, y copies the selected leaf as Markdown, q/Escape closes or goes back.index.html directly from file:// requires no dev server.viewer/src/ require npm run build, which regenerates tracked viewer assets and syncs docs/.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub texmeijin/layered-flow-chart --plugin layered-flow-chart2 skills in this plugin