Date: 2026-06-16 Status: Approved design, pending implementation plan
A user-invocable Claude Code skill, /mindmap, that turns any input — a file,
pasted text, or a bare topic — into a Markmap .md
file that renders as a zoomable, interactive mindmap. The skill is
prompt-driven: Claude reads the input and builds the hierarchy; the only code is
an optional render step that produces standalone HTML.
.md from varied inputs.--render..md (no Mermaid/OPML in this version).| Decision | Choice |
|---|---|
| Output format | Markmap .md (renders as interactive zoomable mindmap) |
| Input sources | A file, pasted text, or a topic prompt |
| Structure logic | Hybrid — follow+condense structured input; smart-extract otherwise |
| Rendering | .md by default; interactive .html only with --render |
| Build approach | Prompt-driven skill + thin render helper (Approach A) |
Prompt-driven skill following the existing deep-research-skills/skills/<name>/
convention.
mindmap-skill/
└── skills/
└── mindmap/
├── SKILL.md # instructions + format spec + worked example
└── render.sh # optional: npx markmap-cli wrapper for --render
---
name: mindmap
user-invocable: true
description: Generate an interactive Markmap mindmap from a file, pasted text, or a topic.
allowed-tools: Bash, Read, Write, Glob
---
/mindmap <file> # read file → mindmap
/mindmap "pasted text or notes" # map the text
/mindmap "transformer attention" # topic → generate from knowledge
/mindmap <input> --render # also produce interactive .html
/mindmap <input> --output x.md # choose output path
Each unit has one clear purpose and can be understood independently. Units 1–3
are pure instructions in SKILL.md; only unit 4 is code.
.md with correct frontmatter and nested nodes.render.sh shells npx markmap-cli when --render
is passed./mindmap <arg> [--render] [--output path]
│
▼
1. INPUT RESOLVER
• arg matches an existing file path? → Read it
• arg is multi-line / long / quoted prose? → treat as raw text
• arg is a short phrase, no file match? → treat as topic (from knowledge)
│
▼
2. STRUCTURE BUILDER (hybrid)
• Has clear headings/bullets? → follow that outline, condense each node
• Unstructured / topic? → extract key concepts, group into 4–7 branches
• Depth target: 3–4 levels; nodes are phrases, not sentences
│
▼
3. MARKMAP WRITER → write <output>.md
(default: <inputname>.mindmap.md, or <topic-slug>.mindmap.md)
│
▼
4. RENDERER (only if --render)
• bash render.sh <md> → npx markmap-cli <md> -o <html> --no-open
• report the .html path
The Markmap writer emits exactly this shape:
---
title: <map title>
markmap:
colorFreezeLevel: 2
maxWidth: 300
---
# <Central topic>
## <Branch 1>
- <point>
- <sub-point>
- <point>
## <Branch 2>
- <point>
Rules:
# H1 = the root node (central topic).## H2 = main branches; ###/bullets = deeper levels.**bold**, `code`, links) is allowed and passes through.colorFreezeLevel: 2, maxWidth: 300) are fixed, not
user-facing knobs.Target 4–7 main branches and condense aggressively. For a very large source document, map its structure and key points rather than every line — legibility over completeness.
<inputname>.mindmap.md — e.g. report.md → report.mindmap.md; topic
transformer attention → transformer-attention.mindmap.md. Override with
--output.
The .md is the contract: it is always produced when input is valid. Rendering
is best-effort and degrades gracefully.
| Situation | Behavior |
|---|---|
| Arg looks like a file path but doesn’t exist | Don’t silently treat as topic. Report “no file at X” and ask: map as a topic, or fix the path? |
| Empty / whitespace-only input | Stop; ask for content or a topic. |
| Ambiguous arg (short text vs. topic) | Default to topic generation; state the assumption in one line so the user can correct it. |
| Output file already exists | Write name.mindmap.md; if taken, suffix -2, -3. Never overwrite silently. |
--render but npx/node missing |
.md already written. Report rendering skipped; show the exact npx markmap-cli command to run manually. Non-fatal. |
--render network / npx fetch fails |
Same as above — .md is the guaranteed deliverable; HTML is best-effort. |
--render path: needs node/npx (uses npx markmap-cli, no global
install). render.sh checks command -v npx first and exits cleanly with
guidance if absent.$1 = path to the .md; optional $2 = output .html path
(default: swap extension).npx exists → npx markmap-cli "$md" -o "$html" --no-open →
print the html path.npx only. No other state.LLM智能体记忆系统研究报告.md); verify single H1, 4–7 branches, condensed
phrases, valid frontmatter."transformer attention" → verify a coherent map
from knowledge.--render — confirm .html is produced and opens as an interactive map;
confirm graceful message when npx is faked-missing.A test passes when the .md opens correctly at
markmap.js.org or the VS Code Markmap extension and the
hierarchy reads cleanly.