Skip to content

Commit 707f573

Browse files
committed
feat: initial release v0.1.0
Agent skill + prompt templates that generate rich HTML pages for visual diff reviews, architecture overviews, plan audits, data tables, and project recaps. Replaces ASCII diagrams with styled self-contained HTML files. Core skill with 11 diagram types, 9 aesthetic directions, Mermaid deep theming with zoom controls, CSS Grid layouts, and optional AI-generated illustrations via surf-cli. Five prompt templates: /generate-web-diagram, /diff-review, /plan-review, /project-recap, /fact-check. Reference docs for CSS patterns, library usage, and responsive navigation.
0 parents  commit 707f573

17 files changed

+4175
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.DS_Store

CHANGELOG.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Changelog
2+
3+
## [0.1.0] - 2026-02-16
4+
5+
Initial release.
6+
7+
### Skill
8+
- Core workflow: Think (pick aesthetic) → Structure (read template) → Style (apply design) → Deliver (write + open)
9+
- 11 diagram types with rendering approach routing (Mermaid, CSS Grid, HTML tables, Chart.js)
10+
- 9 aesthetic directions (monochrome terminal, editorial, blueprint, neon, paper/ink, sketch, IDE-inspired, data-dense, gradient mesh)
11+
- Mermaid deep theming with `theme: 'base'` + `themeVariables`, hand-drawn mode, ELK layout
12+
- Zoom controls (buttons, scroll-to-zoom, drag-to-pan) required on all Mermaid containers
13+
- Proactive table rendering — agent generates HTML instead of ASCII for complex tables
14+
- Optional AI-generated illustrations via surf-cli + Gemini Nano Banana Pro
15+
- Both light and dark themes via CSS custom properties and `prefers-color-scheme`
16+
- Quality checks: squint test, swap test, overflow protection, zoom controls verification
17+
18+
### References
19+
- `css-patterns.md` — theme setup, depth tiers, node cards, grid layouts, data tables, status badges, KPI cards, before/after panels, connectors, animations (fadeUp, fadeScale, drawIn, countUp), collapsible sections, overflow protection, generated image containers
20+
- `libraries.md` — Mermaid (CDN, ELK, deep theming, hand-drawn mode, CSS overrides, diagram examples), Chart.js, anime.js, Google Fonts with 13 font pairings
21+
- `responsive-nav.md` — sticky sidebar TOC on desktop, horizontal scrollable bar on mobile, scroll spy
22+
23+
### Templates
24+
- `architecture.html` — CSS Grid card layout, terracotta/sage palette, depth tiers, flow arrows, pipeline with parallel branches
25+
- `mermaid-flowchart.html` — Mermaid flowchart with ELK + handDrawn mode, teal/cyan palette, zoom controls
26+
- `data-table.html` — HTML table with KPI cards, status badges, collapsible details, rose/cranberry palette
27+
28+
### Prompt Templates
29+
- `/generate-web-diagram` — generate a diagram for any topic
30+
- `/diff-review` — visual diff review with architecture comparison, KPI dashboard, code review, decision log
31+
- `/plan-review` — plan vs. codebase with current/planned architecture, risk assessment, understanding gaps
32+
- `/project-recap` — project mental model snapshot for context-switching
33+
- `/fact-check` — verify factual accuracy of review pages and plan docs against actual code

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Nico Bailon
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 202 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,202 @@
1+
<p>
2+
<img src="banner.png" alt="visual-explainer" width="1100">
3+
</p>
4+
5+
# visual-explainer
6+
7+
**An agent skill + prompt templates that replace ASCII diagrams with beautiful, self-contained HTML pages — architecture overviews, flowcharts, diff reviews, data tables, and more.**
8+
9+
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=for-the-badge)](LICENSE)
10+
11+
```
12+
> draw a diagram of our authentication flow
13+
14+
> visualize the database schema
15+
16+
> /diff-review main
17+
```
18+
19+
The agent builds a styled HTML page — CSS Grid layouts, Mermaid flowcharts, Google Fonts, dark/light themes, staggered animations — and opens it in your browser. One file, no build step, no dependencies.
20+
21+
## Why
22+
23+
Every coding agent defaults to ASCII art when you ask for a diagram. Box-drawing characters, monospace alignment hacks, text arrows. It works for trivial cases, but anything beyond a 3-box flowchart turns into an unreadable mess that nobody would put in a presentation or share with a team.
24+
25+
It gets worse with tables. Ask the agent to compare 15 requirements against a plan and you get a wall of pipes and dashes that wraps and breaks in the terminal. The data is there but it's painful to read.
26+
27+
This skill replaces all of that with real HTML pages that look like someone designed them — because the agent follows a design-aware workflow with reference templates, CSS patterns, and font pairings before generating each diagram.
28+
29+
## Install
30+
31+
The skill follows the [Agent Skills specification](https://agentskills.io/specification). Clone it into your agent's skills directory:
32+
33+
### Pi
34+
35+
```bash
36+
git clone https://github.com/nicobailon/visual-explainer.git ~/.pi/agent/skills/visual-explainer
37+
```
38+
39+
Restart Pi. The skill auto-discovers from the skills directory.
40+
41+
To get the slash commands (`/diff-review`, `/plan-review`, etc.), copy the prompt templates and install the [pi-prompt-template-model](https://github.com/nicobailon/pi-prompt-template-model) extension for skill auto-injection:
42+
43+
```bash
44+
cp ~/.pi/agent/skills/visual-explainer/prompts/*.md ~/.pi/agent/prompts/
45+
pi install npm:pi-prompt-template-model
46+
```
47+
48+
Without the extension the prompts still work as normal templates, but the agent won't get the skill auto-injected — it would need to discover and load it on its own.
49+
50+
### Claude Code
51+
52+
```bash
53+
git clone https://github.com/nicobailon/visual-explainer.git ~/.claude/skills/visual-explainer
54+
```
55+
56+
### Other agents
57+
58+
Any agent that supports the Agent Skills spec can load the skill by pointing at the directory containing `SKILL.md`. If your agent doesn't support auto-discovery, paste the contents of `SKILL.md` into your system prompt directly.
59+
60+
### Manual (no git)
61+
62+
```bash
63+
mkdir -p ~/.agent/skills/visual-explainer
64+
curl -L https://github.com/nicobailon/visual-explainer/archive/refs/heads/main.tar.gz | \
65+
tar -xz --strip-components=1 -C ~/.agent/skills/visual-explainer
66+
```
67+
68+
### Optional: AI-generated images
69+
70+
If you have [surf-cli](https://github.com/nicobailon/surf-cli) installed with its Chrome extension, the skill can generate illustrations via Gemini Nano Banana Pro and embed them in diagrams — hero banners, conceptual illustrations, educational diagrams. The agent checks for surf availability automatically and skips image generation gracefully if it's not installed. Everything else works without it.
71+
72+
## Usage
73+
74+
**Ask naturally.** The agent sees the skill description and loads it when you mention diagrams, architecture, flowcharts, schemas, or visualizations:
75+
76+
```
77+
> draw a diagram of our authentication flow
78+
> visualize the database schema
79+
> create an architecture overview of the notification system
80+
```
81+
82+
**Proactive table rendering.** When the agent is about to render a complex ASCII table (4+ rows or 3+ columns), it generates a styled HTML table instead and opens it in the browser. Comparisons, audits, feature matrices, status reports — anything tabular gets the HTML treatment automatically.
83+
84+
**Force-load** if the agent doesn't pick it up on its own:
85+
86+
```
87+
> /skill:visual-explainer draw the microservices architecture
88+
```
89+
90+
Output goes to `~/.agent/diagrams/` and the result opens in your browser.
91+
92+
## Prompt Templates
93+
94+
The skill ships with five prompt templates that become slash commands in Pi:
95+
96+
| Command | What it does |
97+
|---------|-------------|
98+
| `/generate-web-diagram` | Generate an HTML diagram for any topic |
99+
| `/diff-review` | Visual diff review — before/after architecture, KPI dashboard, code review, decision log |
100+
| `/plan-review` | Compare a plan against the codebase — current vs. planned architecture, risk assessment |
101+
| `/project-recap` | Visual snapshot for context-switching back to a project after days away |
102+
| `/fact-check` | Verify factual accuracy of a review page, plan doc, or spec against the actual code |
103+
104+
### `/diff-review`
105+
106+
Accepts any git ref. Generates architecture comparison, file map, structured Good/Bad/Ugly code review, decision log with confidence indicators, and re-entry context.
107+
108+
```
109+
/diff-review main # feature branch vs main (default)
110+
/diff-review abc123 # single commit
111+
/diff-review main..HEAD # committed changes only
112+
/diff-review #42 # pull request
113+
/diff-review HEAD # uncommitted changes only
114+
```
115+
116+
### `/plan-review`
117+
118+
Compares a codebase against an implementation plan. Current vs. planned architecture diagrams, change-by-change breakdown, dependency analysis, risk assessment, and Good/Bad/Ugly review of the plan itself.
119+
120+
```
121+
/plan-review ~/docs/refactor-plan.md # plan + working directory
122+
/plan-review ~/docs/refactor-plan.md ./src # plan + explicit path
123+
```
124+
125+
### `/project-recap`
126+
127+
Mental model snapshot — architecture diagram, recent activity, decision log, working/broken/blocked dashboard, cognitive debt hotspots. Takes an optional time window:
128+
129+
```
130+
/project-recap # last 2 weeks (default)
131+
/project-recap 30d # last 30 days
132+
```
133+
134+
### `/fact-check`
135+
136+
Extracts every verifiable claim from a document (file references, function names, line counts, behavior descriptions), re-checks each against the actual code, corrects inaccuracies, and adds a verification summary:
137+
138+
```
139+
/fact-check # most recent review page
140+
/fact-check ~/.agent/diagrams/diff-review.html # specific file
141+
/fact-check ~/Documents/docs/refactor-plan.md # plan doc
142+
```
143+
144+
## Diagram Types
145+
146+
| Type | Rendering | When to use |
147+
|------|-----------|-------------|
148+
| Architecture (text-heavy) | CSS Grid cards + flow arrows | System overviews with rich descriptions |
149+
| Architecture (topology) | Mermaid | Service maps, connection diagrams |
150+
| Flowchart / Pipeline | Mermaid | CI/CD, data pipelines, processes |
151+
| Sequence | Mermaid | Service-to-service calls, request flows |
152+
| Data flow | Mermaid with edge labels | ETL, event streaming, message flows |
153+
| Schema / ER | Mermaid | Database schemas, entity relationships |
154+
| State machine | Mermaid | State transitions, decision trees |
155+
| Mind map | Mermaid | Hierarchical breakdowns, project structure |
156+
| Data table | HTML `<table>` | Comparisons, audits, feature matrices |
157+
| Timeline | CSS | Roadmaps, release history, project phases |
158+
| Dashboard | CSS Grid + Chart.js | Metrics overviews, KPI displays |
159+
160+
The agent picks the right rendering approach automatically. Mermaid handles anything with connections and automatic edge routing. CSS Grid handles text-heavy content where card descriptions matter more than topology. HTML tables handle structured data.
161+
162+
## How It Works
163+
164+
```
165+
SKILL.md (workflow + design principles)
166+
167+
references/ ← agent reads on-demand before each generation
168+
├── css-patterns.md (layouts, animations, theming, depth tiers)
169+
├── libraries.md (Mermaid deep theming, Chart.js, anime.js, font pairings)
170+
└── responsive-nav.md (sticky sidebar TOC for multi-section pages)
171+
172+
templates/ ← agent reads the matching reference template
173+
├── architecture.html (CSS Grid cards with flow arrows — terracotta/sage palette)
174+
├── mermaid-flowchart.html (Mermaid + ELK + handDrawn mode — teal/cyan palette)
175+
└── data-table.html (tables with KPIs and status badges — rose/cranberry palette)
176+
177+
~/.agent/diagrams/filename.html → opens in browser
178+
```
179+
180+
The agent follows a four-step workflow: pick an aesthetic direction (9 options — monochrome terminal, editorial, blueprint, neon, paper/ink, sketch, IDE-inspired, data-dense, gradient mesh), read the right reference template, generate a self-contained HTML file with both light and dark theme support, and open it. Each template uses a deliberately different color palette so the agent absorbs variety rather than a single look.
181+
182+
Every diagram is a single `.html` file with all styles inlined. The only external requests are Google Fonts and optional CDN libraries (Mermaid, Chart.js, anime.js). No build step, no npm, no bundler. Open it in any browser, send it to a colleague, drop it in a PR.
183+
184+
## Customization
185+
186+
Output directory and browser command are in `SKILL.md` under the "Deliver" section — edit to match your setup. To add diagram types, aesthetic directions, or CSS patterns, edit the respective files. The agent reads them fresh each time, so changes take effect immediately (unless you modify the frontmatter `description`, which needs a Pi restart for re-indexing).
187+
188+
## Limitations
189+
190+
- Diagrams require a browser to view — no inline terminal rendering
191+
- Mermaid diagrams initialize once at page load; switching OS theme requires a refresh for the Mermaid SVG (CSS-styled elements respond instantly)
192+
- Google Fonts need an internet connection on first load (system font fallbacks are included)
193+
- Very complex Mermaid diagrams (50+ nodes) may need the ELK layout engine for clean edge routing, which adds CDN weight
194+
- The agent picks aesthetics based on skill guidance, not pixel-perfect design specs — results vary by model capability
195+
196+
## Credits
197+
198+
Borrows ideas from [Anthropic's frontend-design skill](https://github.com/anthropics/skills) and [interface-design](https://github.com/Dammyjay93/interface-design), adapted for one-shot diagram generation.
199+
200+
## License
201+
202+
MIT

0 commit comments

Comments
 (0)