mk:preview
Renders code, architecture or a git diff as a markdown or self-contained HTML explanation, diagram, slide deck or diff view.
| Source | .claude/skills/preview/SKILL.md |
| Owner | docs |
| Runtime | claude-code |
| Risk | medium |
| Phase | on-demand |
What it does
Renders code, architecture or a git diff as a visual explanation, diagram, slide deck or diff view, in markdown or as a self-contained HTML page. There is no live server. Reach for it when a reader needs to understand an unfamiliar code path, a diagram would show a topology faster than prose, or a pre-PR diff needs a visual summary.
When not to use
| Need | Use |
|---|---|
| Publish-grade SVG or PNG diagram files | mk:tech-graph |
| Plan critique or scope review | mk:plan-ceo-review |
| A review verdict | mk:review |
| A diagram inside a README | mk:mermaidjs-v11 |
Usage
| Command | Output |
|---|---|
/mk:preview --explain <topic> | Markdown explanation with ASCII and Mermaid |
/mk:preview --diagram <topic> | Markdown diagram |
/mk:preview --slides <topic> | Markdown slides |
/mk:preview --ascii <topic> | Terminal-friendly ASCII diagram |
/mk:preview --html --explain <topic> | HTML explanation, opened in the browser |
/mk:preview --html --diagram <topic> | HTML diagram with zoom and pan |
/mk:preview --html --slides <topic> | HTML slide deck |
/mk:preview --html --diff [ref] | HTML diff view: KPI grid, file map, change cards |
For --diff, ref defaults to main and can be a branch, commit, range or PR number (a PR number needs gh). --ascii does not combine with --html. With no arguments the skill asks which operation you want.
Steps
- The skill resolves flags, then reads the references for the mode (
references/generation-modes.md,mermaid-essentials.md,html-design-rules.md,analytical-modes.md) and the HTML template fromassets/. - It turns the topic into a slug: lowercase, hyphens, 80 characters at most.
- It writes the file and prints the path. In headless, SSH or WSL environments it prints the path instead of opening a browser.
Output
If .meowkit/state/active-plan exists, files go to {plan}/visuals/; otherwise to tasks/visuals/, with a warning on stderr. An existing file is overwritten. HTML pages are self-contained, 500 KB at most, load Mermaid from a CDN, and have a light and dark toggle. --diff only displays the change. The verdict stays with mk:review.
Gotchas
| Trap | Detail |
|---|---|
Mermaid .node class | Page CSS named .node leaks into Mermaid diagrams. Name card classes differently. |
| Mermaid theme | It is read once at load, so switching the page theme does not re-skin the diagram. |
| Topic text | It is untrusted. HTML output encodes < > & " '. |
| Slug mismatch | Truncation at 80 characters can give a filename that differs from the title. |