Invocation
Workflow
Extract nodes and edges
Read labels, connections, and any grouping or color hints from the user’s request or conversation context.
Assign colors and positions
Choose a color scheme and set x/y coordinates for a readable layout. Layout patterns are defined in
TEMPLATE.md.Write the HTML file
Write a complete self-contained file to
/tmp/diagram.html using the Cytoscape.js template.Wait for render
Call
mcp__chrome-devtools__wait_for on a string that appears in the legend or a node label. Timeout 10000ms.Take screenshot
Call
mcp__chrome-devtools__take_screenshot and verify nodes are visible and not overlapping.Use cases
Architecture diagrams
Map services, databases, queues, and external dependencies in a system design or infrastructure overview.
Flowcharts
Visualize decision trees, approval flows, onboarding sequences, and any branching process.
Dependency graphs
Show package dependencies, module imports, or data pipeline stages with directed edges.
The rendered diagram is interactive: drag nodes to rearrange, scroll to zoom, and drag the background to pan. The Cytoscape.js CDN (
cytoscape.min.js v3.29.2) loads entirely in the browser.Self-review checklist
Before delivering, the skill verifies all of the following:- Screenshot shows all nodes with readable text — no overflow, no overlap
- Solid edges are solid, dashed edges are dashed (stored as
dashed: 'yes', notdashed: true) cy.fit(cy.elements(), 60)is the last line of the script- CDN URL is exactly
https://cdnjs.cloudflare.com/ajax/libs/cytoscape/3.29.2/cytoscape.min.js - Legend matches the color scheme used in the diagram
- Hint text
drag nodes · scroll to zoom · drag background to panis present - No node has
widthorheightset tolabel— always explicit pixel values wait_foris called beforetake_screenshot
Golden rules
1. Never use boolean edge attributes
1. Never use boolean edge attributes
Cytoscape selectors do not reliably match boolean data values. Always store edge style flags as strings:
dashed: 'yes' or dashed: 'no'. Use selector edge[dashed = "yes"].2. Never render to PNG
2. Never render to PNG
Always write
/tmp/diagram.html and open it in the browser. Static images cannot be dragged or zoomed by the user.3. Always call cy.fit last
3. Always call cy.fit last
cy.fit(cy.elements(), 60) must be the final line in the script block. Without it, the diagram may render off-screen or at wrong zoom.4. Always use new_page for first open
4. Always use new_page for first open
Use
mcp__chrome-devtools__new_page with url: file:///tmp/diagram.html. Only use navigate_page with type: reload for subsequent reloads.5. Always wait before screenshotting
5. Always wait before screenshotting
Call
wait_for on a text string that appears after Cytoscape renders (legend text or a node label). Never call take_screenshot immediately after new_page.6. Never set node dimensions to label
6. Never set node dimensions to label
Always use explicit pixel widths and heights (e.g.
width: 200px, height: 80px). The label value causes unpredictable sizing.7. Always use text-wrap: wrap with text-max-width
7. Always use text-wrap: wrap with text-max-width
Without these, long labels overflow node boundaries invisibly.
Reference files
| File | Contents |
|---|---|
TEMPLATE.md | Complete Cytoscape.js HTML template, color palette, layout patterns for common diagram types |
TROUBLESHOOTING.md | Failure diagnosis table: symptoms, causes, fixes |