draft-diagram
Skill0 starsChanged 3 months agoMITView on GitHub
Creates interactive React Flow diagrams from crafted stories. Outputs a standalone HTML file (interactive) and a PNG export for embedding in articles, carousels, or sharing. Use when the user asks to make a diagram, flowchart, concept map, or visual from a story, or says "turn this into a diagram", "make a flowchart", "visualize this", or "create a concept map".
In this repository23 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- remotion-best-practicesSkill
- add-inspirationSkill
- brandSkill
- craft-contentSkill
- draft-articleSkill
- draft-carouselSkill
- draft-imagesSkill
- draft-videoSkill
- heygen-avatarSkill
- heygen-videoSkill
- humanizerSkill
- ingestSkill
- initSkill
- linkedin-postSkill
- lintSkill
- listenSkill
- meetingSkill
- voiceSkill
- wikiSkill
- youtube-descriptionSkill
- youtube-shortSkill
- youtube-uploadSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
20 rules. About 0 are common, 6 are distinctive, and 14 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
14
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 10
When the user runs /draft-diagram, optionally followed by a story slug and/or a brand flag:
- Very specific: line 12
Brand flag: If the user passes --{profile} (e.g., --work), use that brand profile from .amplifyrc brandProfiles.{profile} instead of the …
- Distinctive: line 21
Read the config and resolve the vault path.
- Very specific: line 24
If the user passed a --{profile} flag, look up brandProfiles.{profile} in .amplifyrc.
- Very specific: line 39
Read {vaultPath}/Voice.md if it exists for tone context.
- Very specific: line 43
If the user provided a slug (e.g., /draft-diagram why-we-rebuilt-onboarding), use it directly.
- Very specific: line 45
If no slug, scan {vaultPath}/{paths.stories}/ for story folders that have a story.md.
- Very specific: line 47
Read the story's story.md and raw.md (if it exists) to understand the narrative.
- Distinctive: line 112
Write the diagram as a markdown file with YAML frontmatter to the story folder:
- Very specific: line 153
Import and call renderDiagramHtml from src/diagram/render-html.ts:
- Distinctive: line 161
Read the saved diagram file's frontmatter to get nodes and edges.
- Very specific: line 162
Call the render function by reading src/diagram/render-html.ts to understand the HTML template structure, then generate equivalent HTML …
- Very specific: line 166
Read src/diagram/render-html.ts to get the HTML template.
- Very specific: line 168
Write the HTML to {vaultPath}/{paths.stories}/{slug}/assets/diagram-{diagramType}.html.
- Very specific: line 171
Use the Playwright MCP tool to open the generated HTML file with browser_navigate using a file:// URL.
- Distinctive: line 172
Wait for the diagram to render (wait for the title text to appear).
- Very specific: line 176
Ensure the assets/ directory exists before writing.
- Distinctive: line 227
When building diagrams from stories:
- Distinctive: line 230
Label edges sparingly: Only add edge labels when the relationship isn't obvious from context.
- Very specific: line 233
Group related nodes: Use the group field to cluster nodes that belong together conceptually.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Draft Diagram
Instructions
When the user runs /draft-diagram, optionally followed by a story slug and/or a brand flag:
Brand flag: If the user passes --{profile} (e.g., --work), use that brand profile from .amplifyrc brandProfiles.{profile} instead of the default brand section. Example: /draft-diagram --work my-story-slug
Step 0: Load Context
Find the .amplifyrc config file. Check these locations in order:
.amplifyrcin the current working directory.amplifyrcat the path specified byVAULT_PATHenvironment variable
Read the config and resolve the vault path.
Resolve the brand:
- If the user passed a
--{profile}flag, look upbrandProfiles.{profile}in.amplifyrc. If it exists, use that profile. Also read{vaultPath}/{paths.brand}/{profile}-Brand.mdif it exists (e.g.,Work-Brand.md). - Otherwise, fall back to the default
brandsection in.amplifyrcand read{vaultPath}/{paths.brand}/Brand.md.
Build a brand context from the resolved profile:
primary: {brand.primary or #35656e}
secondary: {brand.secondary or brand.charcoal or #394646}
accent: {brand.accent or brand.lemon or #fee19a}
background: {brand.background or brand.ivory or #f8f9fa}
fontFamily: {brand.fontBody or "Inter, system-ui, sans-serif"}The brand profile may include extended color tokens beyond primary/secondary/accent (e.g., teal, sky, evergreen, marigold). Use these for richer diagrams when appropriate — data viz nodes, category colors, status indicators.
Read {vaultPath}/Voice.md if it exists for tone context.
Step 1: Find the Story
If the user provided a slug (e.g., /draft-diagram why-we-rebuilt-onboarding), use it directly.
If no slug, scan {vaultPath}/{paths.stories}/ for story folders that have a story.md. List them and let the user pick.
Read the story's story.md and raw.md (if it exists) to understand the narrative.
Step 2: Pick Diagram Type
Present the four diagram types with examples. Use AskUserQuestion:
- Flow: process steps, decision trees, system architecture (e.g., "How our AI pipeline works")
- Concept map: ideas connected by relationships (e.g., "How these 3 principles connect")
- Timeline: events in sequence with branching (e.g., "My transformation from X to Y")
- Comparison: side-by-side contrasts (e.g., "Old way vs new way")
Step 3: Extract Diagram Content
Analyze the story content and identify the key concepts, relationships, and flow that should be diagrammed. Consider:
- For flow: What are the steps? Where are the decision points? What's the start and end?
- For concept map: What are the core ideas? How do they relate to each other?
- For timeline: What events happened? In what order? Any branches or parallel paths?
- For comparison: What two things are being contrasted? What dimensions differ?
Present a text outline of proposed nodes and edges:
## Proposed Diagram: "{title}"
### Nodes
1. [input] Start: "You have a story"
2. [default] Free Write: "Stream of consciousness"
3. [default] Find the Moment: "Identify the 5-second shift"
4. [output] Narrative: "Clean, shaped story"
### Connections
- Start -> Free Write: "begin here"
- Free Write -> Find the Moment: "dig deeper"
- Find the Moment -> Narrative: "shape it"
Want to add, remove, or change anything?Let the user refine the outline. Loop until they approve.
Step 4: Build the Diagram Structure
Convert the approved outline into typed nodes and edges. Apply brand colors from Step 0.
Layout rules per diagram type:
- Flow: top-to-bottom direction. Input nodes get accent color background. Output nodes get primary color background with white text. Default nodes get white background with primary border.
- Concept map: top-to-bottom direction (dagre handles radial-like spacing). Central concept gets primary background. Related concepts get white with primary border.
- Timeline: left-to-right direction. First event gets accent background. Last event gets primary background. Middle events get white with primary border.
- Comparison: left-to-right direction. Group headers get primary background. Items under each group get white with primary border.
Build the DiagramNode[] and DiagramEdge[] arrays. Each node gets:
id: kebab-case slug (e.g.,"free-write")label: display texttype:"input"for entry points,"output"for endpoints,"default"otherwisestyle: brand-appropriate colors per the rules above
Each edge gets:
id:"e-{source}-{target}"sourceandtarget: matching node idslabel: relationship description (optional, keep short)animated: true for the primary/happy path
Step 5: Save Diagram File
Write the diagram as a markdown file with YAML frontmatter to the story folder:
Filename: diagram-{diagramType}-{slug}-{YYYY-MM-DD}.md
Location: {vaultPath}/{paths.stories}/{slug}/
Frontmatter (DiagramFrontmatter):
title: "{diagram title}"
type: diagram
diagramType: flow
status: draft
source: "[[story]]"
platform: web
nodeCount: 4
edgeCount: 3
creativeBrief:
purpose: "Show the content creation process"
audience: "LinkedIn audience"
nodes:
- id: start
label: "You have a story"
type: input
style:
background: "#fee19a"
border: "2px solid #35656e"
color: "#394646"
# ... all nodes
edges:
- id: e-start-free-write
source: start
target: free-write
label: "begin here"
animated: true
# ... all edgesContent (below frontmatter): Director's notes about the diagram, what it communicates, and how it fits the story.
Step 6: Render Outputs
Import and call renderDiagramHtml from src/diagram/render-html.ts:
import { renderDiagramHtml } from "../../../src/diagram/render-html.js";Actually, since this is a skill (not compiled code), generate the HTML directly:
- Read the saved diagram file's frontmatter to get nodes and edges.
- Call the render function by reading
src/diagram/render-html.tsto understand the HTML template structure, then generate equivalent HTML output.
Or more practically: use the node/edge data from Step 4 and build the HTML file using this approach:
- Read
src/diagram/render-html.tsto get the HTML template. - Construct the HTML by substituting the title, nodes JSON, edges JSON, brand colors, and layout direction into the template.
- Write the HTML to
{vaultPath}/{paths.stories}/{slug}/assets/diagram-{diagramType}.html.
To generate the PNG:
- Use the Playwright MCP tool to open the generated HTML file with
browser_navigateusing afile://URL. - Wait for the diagram to render (wait for the title text to appear).
- Take a screenshot with
browser_take_screenshotand save to{vaultPath}/{paths.stories}/{slug}/assets/diagram-{diagramType}.png. - Close the page.
Ensure the assets/ directory exists before writing.
Step 7: Signal and Report
Emit a diagram_created signal to {vaultPath}/{paths.signals}/signals.json:
{
"id": "sig-[timestamp]-[random6hex]",
"type": "diagram_created",
"timestamp": "[ISO timestamp]",
"data": {
"slug": "[story-slug]",
"diagramType": "[flow|concept-map|timeline|comparison]",
"storySource": "[[story]]",
"nodeCount": 4,
"edgeCount": 3,
"htmlPath": "assets/diagram-flow.html",
"pngPath": "assets/diagram-flow.png"
}
}Log to session memory at {vaultPath}/{paths.memory}/sessions/YYYY-MM-DD.md:
- **HH:MM** — diagram_created: Created {diagramType} diagram for "{title}" ({nodeCount} nodes, {edgeCount} edges)Report what was done:
Diagram created for "{story title}":
Type: {diagramType}
Nodes: {nodeCount}
Edges: {edgeCount}
Files:
{stories}/{slug}/diagram-{type}-{slug}-{date}.md (source)
{stories}/{slug}/assets/diagram-{type}.html (interactive)
{stories}/{slug}/assets/diagram-{type}.png (static image)
Next steps:
- Open the HTML file in a browser for the interactive version
- Use the PNG in /draft-carousel or /draft-article
- Edit the .md file to refine nodes and edges, then re-run to regenerateDiagram Design Guidelines
When building diagrams from stories:
- Keep it simple. 5-12 nodes is the sweet spot. More than 15 and it becomes hard to read.
- Label edges sparingly. Only add edge labels when the relationship isn't obvious from context.
- Use the story's language. Node labels should use the same words the story uses, not abstract jargon.
- Animate the main path. Set
animated: trueon edges that form the primary flow so users can follow it. - Group related nodes. Use the
groupfield to cluster nodes that belong together conceptually. - Match the story's tone. A personal transformation gets warm colors and gentle flow. A technical process gets clean lines and neutral tones.
Story Folder Structure
{stories}/{slug}/
raw.md <- free write + interview (craft-content)
story.md <- pure narrative (craft-content)
video-{hook}-{slug}-{date}.md <- video timeline (draft-video)
carousel-{hook}-{slug}-{date}.md <- carousel cards (draft-carousel)
article-{hook}-{slug}-{date}.md <- blog post (draft-article)
diagram-{type}-{slug}-{date}.md <- diagram source (draft-diagram)
assets/ <- generated assets
diagram-{type}.html <- interactive React Flow diagram
diagram-{type}.png <- static screenshotDoes it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

