⚠️ CODE COPYING RULE ⚠️
YOU MUST COPY THE EXACT CODE FROM index.jsx - DO NOT WRITE YOUR OWN CODE
When creating inline previews:
- Read
/mnt/skills/user/mindmap-skill/index.jsx
- Copy the ENTIRE component code exactly as written
- Only modify: the embedded data objects (OPML structure and color palette)
- Everything else stays identical - all logic, state management, event handlers, styling
If you write your own implementation of ANY feature, you have failed. The code in index.jsx is the only correct implementation.
Overview
Use this skill when someone needs to review, adjust, or create an interactive mind map. The instructions apply to any subject matter. Ensure the content and layout reflect the topic the requester provides.
Guardrails
CRITICAL: NEVER REWRITE THE CODE
- DO NOT rewrite, refactor, or modify ANY of the code logic from
index.jsx
- DO NOT change function names, state management, event handlers, or component structure
- DO NOT add your own implementation of zoom, pan, drag, expand/collapse, or any other features
- ONLY action allowed: Copy the exact code from
index.jsx and embed data into it
- The code in
index.jsx is the ONLY correct implementation - use it verbatim
- If you find yourself writing code logic instead of copying it, STOP immediately
What you ARE allowed to do:
- Embed the mindmap data (OPML structure) as JavaScript objects
- Embed the color palette as JavaScript objects
- Change the content of the data (node labels, descriptions, children)
- Use Tailwind classes for styling in place of the CSS file
What you are NOT allowed to do:
- Rewrite any of the React component logic
- Create your own implementation of any feature
- Change how state is managed
- Modify event handlers or interaction logic
- Refactor the code structure
When to Respond
- The requester wants to add, edit, or remove nodes in the mind map outline.
- A new mind map topic must be set up.
- The preview fails to render correctly and needs debugging.
- The requester explicitly asks to modify colors, typography, or spacing.
Preview Modes
Inline Preview (default): Create a single .jsx React artifact that embeds all mindmap data inline for immediate preview in the chat interface. Parse the OPML structure and color palette into JavaScript objects within the component. This mode is ideal for quick iteration and sharing.
Multi-file Setup: When the user specifically requests downloadable files, mentions "local server", or asks for files they can host, create the traditional multi-file structure with separate mindmap.opml, palette.xml, index.html, index.jsx, and styles.css files.
Standard Workflow
Determine preview mode
- Default to inline preview (React artifact) unless the user requests downloadable files
- For inline preview, create a single
.jsx artifact with embedded data
- For multi-file, follow the traditional multi-file workflow
Clarify the intent
- Confirm the mind map topic and the exact hierarchy or copy edits
- Gather the precise text for new or updated nodes, including detailed notes
- Only ask about visual preferences if the user explicitly mentions wanting to change colors or styling
Update data structure
- Use
mindmap.opml as the source of truth; translate its hierarchy directly unless the requester provides new or updated nodes
- Create the hierarchical structure with roughly 5-8 main branches and 3-6 children each
- Keep node labels short (1-3 words) and use detailed notes for extended descriptions
- Maintain balanced depth across branches
Apply color palette
- Use the existing color palette from
palette.xml unless the user explicitly requests color changes
- Colors are already optimized for technical content and should not be modified without explicit user request
- If color changes are requested, ensure hex values remain unique and visually distinct
Create preview
- For inline preview: Generate a complete React component with all data embedded
- For multi-file: Create separate OPML, palette, HTML, and CSS files
Report back
- Summarize the structure created and any assumptions made
- Provide preview instructions if using multi-file mode
Inline Preview Implementation
When creating inline previews:
Read mindmap.opml and palette.xml from the repository first. Parse both files and embed their contents as JavaScript data so the preview matches the source of truth.
Convert OPML hierarchy into nested JavaScript objects with structure:
{
text: "Node Label",
note: "Detailed description for this node",
children: [/* nested nodes */]
}
Embed color palette as an array:
const colors = [
{ name: 'Color-1', rgb: 'RRGGBB', r: R, g: G, b: B },
// ... more colors
]
Include all React logic, styling, and data in a single .jsx file
Mirror the component structure and state handling from index.jsx so that interactions remain identical.
Use Tailwind utility classes for styling
Ensure the component has no required props and uses a default export
Create radial layout with main topic at center and branches radiating outward
DO NOT include any title or description text overlays - the mindmap should be clean with only nodes visible
Default Node State
IMPORTANT: All child nodes should be COLLAPSED by default when the mindmap first loads.
- Only the center node and main branches (level 1) are visible initially
- Child nodes (level 2+) are hidden until user clicks the + button
- This creates a clean, uncluttered initial view
- Prevents overwhelming viewers with too much information at once
- Users progressively reveal details as they explore
Set initial state: const [expandedNodes, setExpandedNodes] = useState({}); (empty object = all collapsed)
CRITICAL: Initialize hiddenNodes after building the node tree:
// After setNodes(newNodes) and setConnections(newConnections):
const initialHidden = {};
Object.values(newNodes).forEach(node => {
if (node.level >= 2) {
initialHidden[node.id] = true;
}
});
setHiddenNodes(initialHidden);
Required Interactive Features
CRITICAL: All inline previews MUST include these features. Do not omit any:
Zoom Controls
- Mouse wheel scroll to zoom in/out
- Maintain zoom state with useState
- Apply zoom via CSS transform on the canvas
- Typical range: 0.5x to 2x
Pan/Drag Canvas
- Click and drag background to pan the entire view
- Track pan offset with useState
- Change cursor to 'grab' when hovering, 'grabbing' when dragging
- Apply pan via CSS transform:
translate(${pan.x}px, ${pan.y}px)
Node Expansion/Collapse
- Display +/- button on hover for nodes with children
- Clicking + expands to show child nodes
- Clicking - collapses to hide child nodes
- Track expanded state with useState object keyed by node ID
- Button should appear styled with node's color
Reset Hidden Children
- Display reset button (↻) for expanded nodes that have hidden children
- Clicking reset unhides all collapsed child nodes
- Only show when node is expanded AND has hidden children
Node Dragging
- Click and drag individual nodes to reposition them
- Drag should move node and all its descendants together
- Update node positions in state
- Prevent click event from firing if user dragged (hasDragged flag)
Detail Popovers
- Click node to show detailed popover with description
- Display node label, description, and list of children
- Position popover intelligently based on node position (avoid edges)
- Click same node again to close popover
- Style popover border with node's color
Visual Feedback
- Hover effects: scale node slightly (1.05-1.1x)
- Selected node: larger scale (1.15x) with colored glow
- Smooth transitions on all interactions
- Connection lines from center to branch nodes
State Management
- selectedNode: currently clicked node ID
- hoveredNode: currently hovered node ID
- zoom: current zoom level
- pan: { x, y } for canvas position
- expandedNodes: object mapping node IDs to boolean
- hiddenNodes: object tracking collapsed children
- draggingNode: ID of node being dragged
- dragOffset: { x, y } offset during drag
Reference the original index.jsx file for implementation details if needed.
Typography
For inline React artifacts:
- Use system font stack:
-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif
- Inline artifacts cannot load custom fonts, so rely on clean system fonts
For multi-file setups:
- Always load Hubot Sans via Google Fonts in
index.html (mirror the link/preconnect tags in the repository). System fonts serve only as safety fallbacks.
- Font stack:
'Hubot Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif
Font sizing:
- Center node: 1.25rem, weight 700
- Branch nodes: 0.95rem, weight 600
- Popover title: 1.125rem, weight 700
- Popover description: 0.95rem
- Child labels: 0.9rem, weight 600
- Child details: 0.75rem
Multi-file Structure
When users request downloadable files:
mindmap.opml — Hierarchical outline; each <outline> element becomes a node. text holds the label, _note holds extended details
palette.xml — Defines branch colors. Each <color> entry needs a unique name, six-character rgb value (without #), and matching r, g, b integers
index.html — Minimal loader that pulls in React/Babel and mounts the mind map
index.jsx — React-based viewer that fetches the OPML and palette, lays out the mind map, and wires up interactions
styles.css — Visual design for nodes, popovers, background, typography
Package all files into a ZIP archive and provide server instructions:
- Extract the ZIP file
- Open terminal in the extracted folder
- Run:
python3 -m http.server 3000
- Open browser to
http://localhost:3000/index.html
Quality Checklist
- All child nodes collapsed by default - only center + main branches visible on load
- Node labels stay short (1-3 words); detailed notes capture descriptive text
- Hierarchical structure is balanced and logical
- Colors are not modified unless explicitly requested by the user
- Layout keeps the map readable with proper spacing
- All content is accurate and relevant to the requested topic
- ALL interactive features are implemented:
- ✓ Scroll to zoom (wheel events)
- ✓ Click and drag to pan canvas
- ✓ Click and drag individual nodes
- ✓ Hover to show +/- buttons (for nodes with children)
- ✓ Click +/- to expand/collapse children
- ✓ Reset button (↻) to unhide children
- ✓ Click nodes to show/hide detail popovers
- ✓ Hover effects with smooth transitions
- ✓ Visual feedback (scale, glow, cursor changes)
Color Palette Protection
The color palette in palette.xml is optimized and should not be changed unless the user explicitly requests it. Do not offer to change colors, do not ask about color preferences, and do not modify the palette as part of normal workflow. Only change colors when the user specifically says they want different colors.
Troubleshooting Tips
- Blank Preview — Check that data structure is valid JavaScript/XML
- Overlapping Nodes — Reduce node counts per branch or adjust spacing
- Missing Interactions — Verify event handlers are properly bound
- Layout Issues — Ensure container dimensions and SVG viewBox are correctly set
- Missing Features — If zoom, pan, drag, or expand/collapse don't work, refer to the Required Interactive Features section and cross-check with the original
index.jsx implementation. Every feature must be included.
1---2name: mindmap-skill3description: Maintain and evolve interactive mind maps generated from OPML outlines and XML palettes.4license: MIT5---6
7# ⚠️ CODE COPYING RULE ⚠️
8
9**YOU MUST COPY THE EXACT CODE FROM `index.jsx` - DO NOT WRITE YOUR OWN CODE**
10
11When creating inline previews:
121. Read `/mnt/skills/user/mindmap-skill/index.jsx`
132. Copy the ENTIRE component code exactly as written
143. Only modify: the embedded data objects (OPML structure and color palette)
154. Everything else stays identical - all logic, state management, event handlers, styling
16
17If you write your own implementation of ANY feature, you have failed. The code in `index.jsx` is the only correct implementation.
18
19# Overview
20
21Use this skill when someone needs to review, adjust, or create an interactive mind map. The instructions apply to any subject matter. Ensure the content and layout reflect the topic the requester provides.
22
23# Guardrails
24
25**CRITICAL: NEVER REWRITE THE CODE**
26- DO NOT rewrite, refactor, or modify ANY of the code logic from `index.jsx`
27- DO NOT change function names, state management, event handlers, or component structure
28- DO NOT add your own implementation of zoom, pan, drag, expand/collapse, or any other features
29- ONLY action allowed: Copy the exact code from `index.jsx` and embed data into it
30- The code in `index.jsx` is the ONLY correct implementation - use it verbatim
31- If you find yourself writing code logic instead of copying it, STOP immediately
32
33**What you ARE allowed to do:**
34- Embed the mindmap data (OPML structure) as JavaScript objects
35- Embed the color palette as JavaScript objects
36- Change the content of the data (node labels, descriptions, children)
37- Use Tailwind classes for styling in place of the CSS file
38
39**What you are NOT allowed to do:**
40- Rewrite any of the React component logic
41- Create your own implementation of any feature
42- Change how state is managed
43- Modify event handlers or interaction logic
44- Refactor the code structure
45
46# When to Respond
47
48- The requester wants to add, edit, or remove nodes in the mind map outline.
49- A new mind map topic must be set up.
50- The preview fails to render correctly and needs debugging.
51- The requester explicitly asks to modify colors, typography, or spacing.
52
53# Preview Modes
54
55**Inline Preview (default)**: Create a single `.jsx` React artifact that embeds all mindmap data inline for immediate preview in the chat interface. Parse the OPML structure and color palette into JavaScript objects within the component. This mode is ideal for quick iteration and sharing.
56
57**Multi-file Setup**: When the user specifically requests downloadable files, mentions "local server", or asks for files they can host, create the traditional multi-file structure with separate `mindmap.opml`, `palette.xml`, `index.html`, `index.jsx`, and `styles.css` files.
58
59# Standard Workflow
60
611. **Determine preview mode**
62 - Default to inline preview (React artifact) unless the user requests downloadable files
63 - For inline preview, create a single `.jsx` artifact with embedded data
64 - For multi-file, follow the traditional multi-file workflow
65
662. **Clarify the intent**
67 - Confirm the mind map topic and the exact hierarchy or copy edits
68 - Gather the precise text for new or updated nodes, including detailed notes
69 - Only ask about visual preferences if the user explicitly mentions wanting to change colors or styling
70
713. **Update data structure**
72 - Use `mindmap.opml` as the source of truth; translate its hierarchy directly unless the requester provides new or updated nodes
73 - Create the hierarchical structure with roughly 5-8 main branches and 3-6 children each
74 - Keep node labels short (1-3 words) and use detailed notes for extended descriptions
75 - Maintain balanced depth across branches
76
774. **Apply color palette**
78 - Use the existing color palette from `palette.xml` unless the user explicitly requests color changes
79 - Colors are already optimized for technical content and should not be modified without explicit user request
80 - If color changes are requested, ensure hex values remain unique and visually distinct
81
825. **Create preview**
83 - For inline preview: Generate a complete React component with all data embedded
84 - For multi-file: Create separate OPML, palette, HTML, and CSS files
85
866. **Report back**
87 - Summarize the structure created and any assumptions made
88 - Provide preview instructions if using multi-file mode
89
90# Inline Preview Implementation
91
92When creating inline previews:
93
94- Read `mindmap.opml` and `palette.xml` from the repository first. Parse both files and embed their contents as JavaScript data so the preview matches the source of truth.
95- Convert OPML hierarchy into nested JavaScript objects with structure:
96 ```javascript
97 {
98 text: "Node Label",
99 note: "Detailed description for this node",
100 children: [/* nested nodes */]
101 }
102 ```
103
104- Embed color palette as an array:
105 ```javascript
106 const colors = [
107 { name: 'Color-1', rgb: 'RRGGBB', r: R, g: G, b: B },
108 // ... more colors
109 ]
110 ```
111
112- Include all React logic, styling, and data in a single `.jsx` file
113- Mirror the component structure and state handling from `index.jsx` so that interactions remain identical.
114- Use Tailwind utility classes for styling
115- Ensure the component has no required props and uses a default export
116- Create radial layout with main topic at center and branches radiating outward
117- **DO NOT include any title or description text overlays** - the mindmap should be clean with only nodes visible
118
119## Default Node State
120
121IMPORTANT: All child nodes should be COLLAPSED by default when the mindmap first loads.
122- Only the center node and main branches (level 1) are visible initially
123- Child nodes (level 2+) are hidden until user clicks the + button
124- This creates a clean, uncluttered initial view
125- Prevents overwhelming viewers with too much information at once
126- Users progressively reveal details as they explore
127
128Set initial state: `const [expandedNodes, setExpandedNodes] = useState({});` (empty object = all collapsed)
129
130**CRITICAL: Initialize hiddenNodes after building the node tree:**
131```javascript
132// After setNodes(newNodes) and setConnections(newConnections):
133const initialHidden = {};
134Object.values(newNodes).forEach(node => {
135 if (node.level >= 2) {
136 initialHidden[node.id] = true;
137 }
138});
139setHiddenNodes(initialHidden);
140```
141
142## Required Interactive Features
143
144CRITICAL: All inline previews MUST include these features. Do not omit any:
145
1461. **Zoom Controls**
147 - Mouse wheel scroll to zoom in/out
148 - Maintain zoom state with useState
149 - Apply zoom via CSS transform on the canvas
150 - Typical range: 0.5x to 2x
151
1522. **Pan/Drag Canvas**
153 - Click and drag background to pan the entire view
154 - Track pan offset with useState
155 - Change cursor to 'grab' when hovering, 'grabbing' when dragging
156 - Apply pan via CSS transform: `translate(${pan.x}px, ${pan.y}px)`
157
1583. **Node Expansion/Collapse**
159 - Display +/- button on hover for nodes with children
160 - Clicking + expands to show child nodes
161 - Clicking - collapses to hide child nodes
162 - Track expanded state with useState object keyed by node ID
163 - Button should appear styled with node's color
164
1654. **Reset Hidden Children**
166 - Display reset button (↻) for expanded nodes that have hidden children
167 - Clicking reset unhides all collapsed child nodes
168 - Only show when node is expanded AND has hidden children
169
1705. **Node Dragging**
171 - Click and drag individual nodes to reposition them
172 - Drag should move node and all its descendants together
173 - Update node positions in state
174 - Prevent click event from firing if user dragged (hasDragged flag)
175
1766. **Detail Popovers**
177 - Click node to show detailed popover with description
178 - Display node label, description, and list of children
179 - Position popover intelligently based on node position (avoid edges)
180 - Click same node again to close popover
181 - Style popover border with node's color
182
1837. **Visual Feedback**
184 - Hover effects: scale node slightly (1.05-1.1x)
185 - Selected node: larger scale (1.15x) with colored glow
186 - Smooth transitions on all interactions
187 - Connection lines from center to branch nodes
188
1898. **State Management**
190 - selectedNode: currently clicked node ID
191 - hoveredNode: currently hovered node ID
192 - zoom: current zoom level
193 - pan: { x, y } for canvas position
194 - expandedNodes: object mapping node IDs to boolean
195 - hiddenNodes: object tracking collapsed children
196 - draggingNode: ID of node being dragged
197 - dragOffset: { x, y } offset during drag
198
199Reference the original `index.jsx` file for implementation details if needed.
200
201## Typography
202
203**For inline React artifacts:**
204- Use system font stack: `-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif`
205- Inline artifacts cannot load custom fonts, so rely on clean system fonts
206
207**For multi-file setups:**
208- Always load Hubot Sans via Google Fonts in `index.html` (mirror the link/preconnect tags in the repository). System fonts serve only as safety fallbacks.
209- Font stack: `'Hubot Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif`
210
211**Font sizing:**
212- Center node: 1.25rem, weight 700
213- Branch nodes: 0.95rem, weight 600
214- Popover title: 1.125rem, weight 700
215- Popover description: 0.95rem
216- Child labels: 0.9rem, weight 600
217- Child details: 0.75rem
218
219# Multi-file Structure
220
221When users request downloadable files:
222
223- `mindmap.opml` — Hierarchical outline; each `<outline>` element becomes a node. `text` holds the label, `_note` holds extended details
224- `palette.xml` — Defines branch colors. Each `<color>` entry needs a unique `name`, six-character `rgb` value (without `#`), and matching `r`, `g`, `b` integers
225- `index.html` — Minimal loader that pulls in React/Babel and mounts the mind map
226- `index.jsx` — React-based viewer that fetches the OPML and palette, lays out the mind map, and wires up interactions
227- `styles.css` — Visual design for nodes, popovers, background, typography
228
229Package all files into a ZIP archive and provide server instructions:
2301. Extract the ZIP file
2312. Open terminal in the extracted folder
2323. Run: `python3 -m http.server 3000`
2334. Open browser to `http://localhost:3000/index.html`
234
235# Quality Checklist
236
237- **All child nodes collapsed by default** - only center + main branches visible on load
238- Node labels stay short (1-3 words); detailed notes capture descriptive text
239- Hierarchical structure is balanced and logical
240- Colors are not modified unless explicitly requested by the user
241- Layout keeps the map readable with proper spacing
242- All content is accurate and relevant to the requested topic
243- **ALL interactive features are implemented:**
244 - ✓ Scroll to zoom (wheel events)
245 - ✓ Click and drag to pan canvas
246 - ✓ Click and drag individual nodes
247 - ✓ Hover to show +/- buttons (for nodes with children)
248 - ✓ Click +/- to expand/collapse children
249 - ✓ Reset button (↻) to unhide children
250 - ✓ Click nodes to show/hide detail popovers
251 - ✓ Hover effects with smooth transitions
252 - ✓ Visual feedback (scale, glow, cursor changes)
253
254# Color Palette Protection
255
256The color palette in `palette.xml` is optimized and should not be changed unless the user explicitly requests it. Do not offer to change colors, do not ask about color preferences, and do not modify the palette as part of normal workflow. Only change colors when the user specifically says they want different colors.
257
258# Troubleshooting Tips
259
260- **Blank Preview** — Check that data structure is valid JavaScript/XML
261- **Overlapping Nodes** — Reduce node counts per branch or adjust spacing
262- **Missing Interactions** — Verify event handlers are properly bound
263- **Layout Issues** — Ensure container dimensions and SVG viewBox are correctly set
264- **Missing Features** — If zoom, pan, drag, or expand/collapse don't work, refer to the Required Interactive Features section and cross-check with the original `index.jsx` implementation. Every feature must be included.