From layered-flow-chart
Create, update, and refine interactive hierarchical flow diagrams as single-file HTML with drill-down navigation. Outputs a FigJam/Miro-like visual with stacking modal layers - clicking a node opens a deeper detail view. 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", "フロー更新", "フロー改善"
How this skill is triggered — by the user, by Claude, or both
Slash command
/layered-flow-chart:layered-flow-chartThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Create, update, and refine interactive hierarchical flow diagrams from a single HTML file. Nodes are clickable - drilling down opens stacking modal layers with progressively finer detail.
Create, update, and refine interactive hierarchical flow diagrams from a single HTML file. Nodes are clickable - drilling down opens stacking modal layers with progressively finer detail.
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 LEVELS JavaScript object.
Prompt template:
Convert the following investigation report into a LEVELS 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 Positioning Guide", "Connection Path Collision Prevention", and "Color Palette Suggestions" sections from this SKILL.md}
Output ONLY the JavaScript for data.js:
- const LEVELS = { ... };
- const HEADER_LOGO = '...';
- document.title = '... | Layered Flow Chart';
Requirements:
- Follow the Node Positioning Guide strictly - space nodes to avoid overlap
- Trace EVERY connection path to verify no node collision (see Collision Prevention)
- Choose colors from the palette based on node purpose
- Set hasChildren: true for nodes that have matching sub-levels
- Include file references, techs, 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 template and data are separate files — the LLM only generates data.js, no HTML generation needed.
mkdir -p {output-dir}cp ~/.claude/skills/layered-flow-chart/assets/template.html {output-dir}/index.html (zero LLM generation){output-dir}/data.js (this is the only LLM-generated file)open {output-dir}/index.htmlUse 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 LEVELS 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 LEVELS summary - just node IDs, titles, and file references}
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:
boundary flags if new network crossings were introduceddata.js file in-place (update LEVELS/HEADER_LOGO/document.title only — do not touch index.html)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 LEVELS 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:
boundary: true that weren't before?For each layer in the impact zone:
boundary flags| Request | Action | Impact zone |
|---|---|---|
| "Add boundary connections" | Add boundary: true to cross-network connections | All levels |
| "Improve layout" | Recalculate positions, fix collisions | 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 hasChildren + check if neighbors need drill-downs too | Parent + new child |
| "Fix overlapping arrows" | Reposition per Collision Prevention | Affected level |
data.js file in-place (modify LEVELS/HEADER_LOGO/document.title only — do not touch index.html)The LEVELS object is a flat map. Key = level ID, value = level definition.
const LEVELS = {
root: { ... }, // Required. Entry point.
'node-id': { ... }, // Sub-level for a node with hasChildren: true
};
{
title: 'Level Title',
description: 'Subtitle text',
nodes: [ /* Node[] */ ],
connections: [ /* Connection[] */ ],
}
{
id: 'unique-id', // Must match LEVELS key if hasChildren: true
title: 'Node Title', // Supports \n for line breaks
description: 'Short desc',
icon: 'emoji-or-letter', // Single emoji or character
color: '#3B82F6', // Accent color (hex)
x: 50, // Horizontal position (0-100%)
y: 50, // Vertical position (0-100%)
techs: ['React', 'API'], // Tech badges (optional)
file: 'src/foo.ts:10-20', // Source file reference (optional)
hasChildren: true, // true = clicking drills down (needs matching LEVELS entry)
// Popover fields (shown on click for leaf nodes):
input: 'Request body', // (optional)
output: 'JSON response', // (optional)
details: ['point 1', ...], // Bullet list (optional)
annotation: true, // Yellow dashed style, non-clickable (optional)
}
{ from: 'node-a', to: 'node-b' } // Default gray arrow
{ from: 'node-a', to: 'node-b', dashed: true, label: 'on failure' } // Dashed yellow + label
{ from: 'node-a', to: 'node-b', boundary: true, label: 'HTTP' } // Thick indigo arrow (network boundary)
Use boundary: true for connections that cross a network or process boundary. These render as thick indigo (#6366f1) arrows with bold labels, making architecture boundaries immediately visible.
When to use:
When NOT to use (keep default gray):
Typical label examples: HTTP, gRPC, SQL, WebSocket, fetch, REST, GraphQL
x / y are percentages (0-100) of the canvas. Node is centered at that point.x values, same y (e.g., x: 15/40/65/90, y: 50)y values on one side, converge to single point on otherx, different y for branches (e.g., y: 28 and y: 72)Bezier curves are auto-drawn between nodes. Before finalizing positions, mentally trace every connection path to ensure no node sits on the path:
| Use Case | Hex |
|---|---|
| Input/UI | #3B82F6 |
| Storage | #F59E0B |
| Auth/API | #EF4444 |
| Processing | #8B5CF6 |
| Display | #10B981 |
| Save/Output | #14B8A6 |
| Warning | #F59E0B |
index.html (the template) — only generate/edit data.jsCanvasLayer manages its own nodeRefs - do not add useEffect that clears refsah-${levelId}) to avoid conflictsnpx claudepluginhub texmeijin/layered-flow-chart --plugin layered-flow-chartGenerates interactive HTML architecture diagrams with animated step-by-step flows, mode toggles, and side panel details. For service maps, CI/CD pipelines, data flows, and workshop diagrams.
Generates GitHub-renderable Mermaid flowcharts from PRDs, docs, or codebases with evidence maps tracing nodes to sources. Useful for creating user flow diagrams.
Generates professional diagrams (flowcharts, architecture diagrams, comparisons, mind maps, timelines) as draw.io XML files from concepts or documents.