Agent skill
interactive-infographic-overlay
This skill generates a complete interactive diagram MicroSim directory with a text-to-image prompt, data.json overlay file, main.html, index.md, and mkdocs.yml integration. Use this skill when an intelligent textbook chapter specifies a diagram overlay MicroSim that needs a scientific illustration with interactive callout labels, explore/quiz modes, and an edit mode for calibrating marker positions. The skill produces annotation-free image prompts and data.json files compatible with the shared diagram.js library.
Install this agent skill to your Project
npx add-skill https://github.com/dmccreary/claude-skills/tree/main/skills/interactive-infographic-overlay
SKILL.md
Interactive Infographic Overlay Generator
Version: 1.0
Overview
This skill generates a complete MicroSim directory for interactive diagram overlays used in intelligent textbooks. It produces all files needed for a diagram where:
- A text-to-image LLM generates an annotation-free scientific illustration
- The
diagram.jsshared library renders interactive numbered markers, leader lines, and labels over the image - Students can explore (hover for info), take quizzes (identify structures), and instructors can edit marker positions
When to Use This Skill
Use this skill when:
- A chapter content spec includes a
#### Diagram:details block with type "Interactive Infographic" or "Diagram" that requires a scientific illustration with labeled callouts - The textbook needs a labeled anatomy diagram, structural diagram, process diagram, or any image with identified regions
- The specification calls for explore mode (hover to learn), quiz mode (identify structures), or both
Do NOT use this skill when:
- The diagram is better served by Mermaid, Chart.js, or p5.js drawing (no background image needed)
- The content is a pure simulation with dynamic elements (use microsim-generator instead)
- The diagram needs only simple inline markdown images with no interactivity
Prerequisites
The project must have the shared diagram library installed:
docs/sims/shared-libs/
├── diagram.js (interactive overlay engine)
└── style.css (shared styles for all diagram MicroSims)
If shared-libs/ does not exist, install it from this skill's bundled assets:
mkdir -p docs/sims/shared-libs
cp ~/.claude/skills/interactive-infographic-overlay/assets/shared-libs/diagram.js docs/sims/shared-libs/
cp ~/.claude/skills/interactive-infographic-overlay/assets/shared-libs/style.css docs/sims/shared-libs/
Always check that the project's copy is up to date with the skill's bundled version before creating new diagram MicroSims.
Workflow
Step 1: Gather Diagram Requirements
Extract from the chapter content specification or user request:
- Subject — What the diagram depicts (e.g., "animal cell cross-section," "moss sporophyte anatomy," "mossarium layers")
- Structures to label — List of 5-15 structures/regions with:
- Name/label
- Brief description (1-2 sentences)
- Approximate position in the image
- Suggested color for the marker
- Image style — Scientific illustration style (flat, watercolor, realistic, etc.)
- Image dimensions — Typically 1200×900 (landscape 4:3) or 900×1200 (portrait 3:4)
- Layout —
side-panel(default, labels on right),top-bottom, ordual-panel - Context tips — Optional exam tips, hints, or additional info per structure
Step 2: Create the MicroSim Directory
Create the directory under docs/sims/:
mkdir -p docs/sims/{sim-id}
Where {sim-id} is a kebab-case name (e.g., moss-sporophyte, mossarium-layers, animal-cell).
Step 3: Generate image-prompt.md
Create docs/sims/{sim-id}/image-prompt.md with a detailed prompt for the text-to-image LLM. Use the template in references/image-prompt-template.md.
Critical rules for all image prompts:
- NO TEXT IN THE IMAGE — The image must contain absolutely no text, labels, arrows, callout lines, numbers, or annotation marks of any kind. All labeling is handled by diagram.js.
- Specify exact dimensions, background color, and art style
- Describe each structure with precise position, color, shape, and size
- Use percentage-based positioning (e.g., "centered at 40% from left, 30% from top")
- Specify the viewing angle (cross-section, top-down, side view, etc.)
Step 4: Generate data.json
Create docs/sims/{sim-id}/data.json with the overlay data. See references/data-json-schema.md for the complete schema and field definitions.
Position guidelines:
xandyare percentages of the image dimensions (0 = left/top, 100 = right/bottom)- Place markers at the visual center of each structure
- Space markers at least 5-8% apart to avoid overlap
- Use the
?edit=trueURL parameter to calibrate positions after image generation
Step 5: Generate main.html
Create docs/sims/{sim-id}/main.html using the template in assets/main-template.html. Replace {TITLE}, {IMAGE_FILENAME}, and {ALT_TEXT} with the actual values.
Step 6: Generate index.md
Create docs/sims/{sim-id}/index.md with documentation and an embedded iframe. Include:
- Title with
hide: tocfrontmatter - Embedded iframe (
height="640px" width="100%") - Fullscreen link
- Usage instructions for explore, quiz, and edit modes
- Numbered list of all labeled structures
Step 7: Update mkdocs.yml
Add two entries to mkdocs.yml:
- Navigation — Add the MicroSim to the nav section under MicroSims
- Exclude image prompt from build — Add
sims/{sim-id}/image-prompt.mdto theexclude_docs:block to prevent mkdocs from rendering it as a page. Create theexclude_docs:block if it doesn't exist yet.
Step 8: Inform the User
Report all files created and provide next steps:
- Copy image prompt into text-to-image tool
- Save generated image to the MicroSim directory
- View at
http://127.0.0.1:8000/{repo}/sims/{sim-id}/main.html - Calibrate positions with
?edit=true - Copy calibrated JSON back into data.json
Calibration Workflow
After the image is generated and saved, marker positions will likely need adjustment:
- Open
main.html?edit=truein the browser - Drag each numbered marker to the correct position on the image
- Click "Copy JSON" to get the calibrated coordinates
- Replace the
calloutsarray indata.jsonwith the copied data - Reload the page to verify positions
This edit mode is built into diagram.js and requires no additional code.
Layout Options
| Layout | Description | Best For |
|---|---|---|
side-panel |
Image left (65%), labels right (35%) | Most diagrams — default choice |
top-bottom |
Labels above and below image | Wide panoramic images |
dual-panel |
Labels left (22%), image center (56%), labels right (22%) | Diagrams with many callouts (12+) |
Color Palette for Markers
#8E44AD purple — nucleus, central structures
#E74C3C red — energy-related structures
#3498DB blue — membrane structures
#2ECC71 green — photosynthetic structures
#E67E22 orange — transport structures
#1ABC9C teal — storage structures
#F39C12 gold — signaling structures
#9B59B6 violet — genetic structures
#34495E dark gray — structural elements
#16A085 sea green — fluid/matrix regions
Common Pitfalls
- Text in generated images — Always verify the image has NO text, labels, or arrows. Regenerate if the LLM adds annotations.
- Marker overlap — Keep callout positions at least 5-8% apart. Use edit mode to fine-tune.
- Missing shared-libs — Verify
docs/sims/shared-libs/diagram.jsandstyle.cssexist before testing. - Forgetting exclude_docs — The
image-prompt.mdfile will cause mkdocs build warnings if not excluded. - Wrong image path — The
imagefield in data.json must match the exact filename (case-sensitive).
Resources
references/
data-json-schema.md— Complete data.json schema with field definitions and examplesimage-prompt-template.md— Template for generating image prompts
assets/
main-template.html— HTML template for main.html with placeholder variablesshared-libs/diagram.js— Interactive diagram overlay engine (explore, quiz, edit modes)shared-libs/style.css— Shared styles for all diagram MicroSims
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
book-chapter-generator
This skill generates a structured chapter outline for intelligent textbooks by analyzing course descriptions, learning graphs, and concept dependencies. Use this skill after the learning graph has been created and before generating chapter content, to design an optimal chapter structure that respects concept dependencies and distributes content evenly across all of the chapter in a book.
learning-graph-generator
Generates a comprehensive learning graph from a course description, including 200 concepts with dependencies, taxonomy categorization, and quality validation reports. Use this when the user wants to create a structured knowledge graph for educational content.
readme-generator
This skill creates or updates a README.md file in the GitHub home directory of the current project. The README.md file it generates will conform to GitHub best practices, including badges, project overview, site metrics, getting started instructions, and comprehensive documentation.
story-generator
This skill generates graphic novel narratives about physicists and scientists for intelligent textbooks. It creates compelling, historically-accurate stories with image prompts designed for high school students. Use this skill when the user wants to add a new scientist story to the Physics History Graphic Novels section of an MkDocs Material textbook, or when creating educational graphic novel content about historical scientists.
microsim-utils
Utility tools for MicroSim management including quality validation, screenshot capture, icon management, and index page generation. Routes to the appropriate utility based on the task needed.
quiz-generator
This skill generates interactive multiple-choice quizzes for each chapter of an intelligent textbook, with questions aligned to specific concepts from the learning graph and distributed across Bloom's Taxonomy cognitive levels to assess student understanding effectively. Uses serial execution (one agent) for token efficiency. Use this skill after chapter content has been written and the learning graph exists.
Didn't find tool you were looking for?