diagramer
Draw block diagrams in code: measured pieces composed like UI (row, col, box, tree), placed on an 8 px grid with a few hints, joined by routed arrows, checked…
от hyper-code-harness★ 22 звезды на GitHub
Установить diagramer в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Diagramer: diagrams in code
The engine is diagramer.draw. A diagram is a tree of pieces — plain data that knows its size when built (text is measured with the SVG font). You compose pieces like UI, lay them out, route arrows between the same variables, ask the engine what is wrong, and render SVG. No coordinates by hand, no guessing widths.
Rendering is independent of any board: the result of render is an HTML fragment with one <svg> — put it on the canvas (canvas.show({ args: { html } })), into a document, or onto a Wireframer board (below), where every piece becomes clickable.
The pipeline
const g = ctx.fns.diagramer.draw;
// 1. pieces
const app = g.chip({ label: "app", note: "libpq", tone: "blue", id: "app" });
const db = g.drum({ label: "Postgres", tone: "green", id: "db" });
const box = g.box({ title: "Backend", body: g.row({ items: [app, g.chip({ label: "cache" })], gap: 3 }), tone: "blue", dashed: true });
// 2. composition
const root = g.col({ items: [box, db], gap: g.gap({ label: "SQL" }) });
// 3. layout (+ hints)
const L = g.layout({ root, hints: [g.under({ piece: db, anchor: app })] });
// 4. arrows, by the same variables
const wires = [g.link({ layout: L, from: app, to: db, label: "SQL" })];
// 5. self-check, then render
const problems = g.check({ layout: L, wires, maxWidth: 145 }); // [] when clean
const html = g.render({ sheet: "backend", layout: L, wires });
- Pieces:
chip(filled block, label + note),drum(storage cylinder),text(caption),box(titled frame that fits around its body;w/hto force a size),space. - Composition:
row,col(gap, align),wrap(flow to a width),tree(parent centred over children),free(your own offsets when the picture is not a tree).gap({ label })gives exactly the space a labelled arrow needs. - Layout:
layout({ root, hints })— everything on a grid of 8 px steps. Hints move single pieces:under(centre under/over another),align(one line on an axis). A hint that drags a piece into another is reported bycheck. - Arrows:
link(one arrow, label on its longest segment),fan(one to many: trunk, bus, drops). Point arrows at the piece you mean; to enter a framed group, target the inner group rather than a chip behind its title. - Self-check:
check→ sentences ("arrow connect crosses the title of Backends");report→ the same as data (rectangles, overlap, shift that clears it, advice). Always fix untilcheckis empty — the examples test fails on any problem. - Ids: give
idto every piece someone may point at — it becomesdata-widget-id="<sheet>.<id>"; ids are unique per sheet (renderthrows on duplicates). Every piece, group and arrow also takeswidgetId: a full Wireframer widget id written verbatim (no sheet prefix), the same aswidgetIdof thew.*kit.selectablekeeps anydata-widget-idalready present in the SVG, so kit markup and hand-tagged SVG mix with diagram parts.
On a Wireframer board
A set of diagrams is a design folder of the Wireframer kind: studio.json + one boards/<sheet>.ts per sheet. Wireframer gives the canvas (pan, zoom, select, Ask agent, redraw on save); a sheet returns d.board({ title, body: g.render({ sheet: d.id, … }) }).
await ctx.fns.diagramer.create({ file: "diagrams/<topic>", title, lang: "ru", sheets: [{ id: "flow", kind: "flow" }] })— or copy a sheet fromexamples/demo/boards/intoboards/and list it instudio.json.- Edit
boards/<sheet>.tswith the write/edit tool. await ctx.fns.wireframer.open({ file: "diagrams/<topic>" })once; every save redraws the tab by itself.- Check:
wireframer.refresh({})→problemsmust be empty; to look yourselfwireframer.snapshot({ file, board })→ PNG, read it. - Point at a place:
wireframer.focus({ widget: "<sheet>.<id>" }).
export default async function (ctx: Context, d: types.wireframer.Scope): Promise<string> {
const g = ctx.fns.diagramer.draw;
// … pieces, layout, wires as above …
const problems = g.check({ layout: L, wires });
const note = problems.length ? `<pre style="color:#da1e28">${problems.join("\n")}</pre>` : "";
return d.board({ title: "Backend", body: g.render({ sheet: d.id, layout: L, wires }) + note });
}
Ask agent. Every piece with an id and every labelled arrow is a widget <sheet>.<id>. The person clicks it and presses Ask agent; you receive <design-target … id="backend.db" file="…/boards/backend.ts" line="5"/>. Edit that line and keep the ids — generated ids shift when calls are reordered.
Sandbox. Sheets run in Wireframer's worker: ctx.fns gives drawing functions only (diagramer.*, diagrams.*, svg.*, w.*, markdown.*), no database, state or network. Data is literal in the file. 10 s per sheet, 2 MB HTML.
Other sheet kinds
- Flowchart (auto layout, DAG only):
svg.flowHelpers+diagramer.flow({ sheet, nodes, edges, direction?, mainPath? }). Example: `e
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- examples/demo/boards/drawengine.ts
- examples/demo/boards/failover.ts
- examples/demo/boards/iostack.ts
- examples/demo/boards/k8s.ts
- examples/demo/boards/linux.ts
- examples/demo/boards/oidc.ts
- examples/demo/boards/pgdraw.ts
- examples/demo/boards/postgres.ts
- examples/demo/studio.json
- package.json
- src/diagramer/KitTools.ts
- src/diagramer/Shape.ts
- src/diagramer/create.ts
- src/diagramer/diagramer.test.ts
- src/diagramer/draw/End.ts
- src/diagramer/draw/Hint.ts
- src/diagramer/draw/Issue.ts
- src/diagramer/draw/Piece.ts
- src/diagramer/draw/Placed.ts
- src/diagramer/draw/Rect.ts
- src/diagramer/draw/Wire.ts
- src/diagramer/draw/align.ts
- src/diagramer/draw/box.ts
- src/diagramer/draw/check.ts
- src/diagramer/draw/chip.ts
- src/diagramer/draw/col.ts
- src/diagramer/draw/draw.test.ts
- src/diagramer/draw/drum.ts
- src/diagramer/draw/fan.ts
- src/diagramer/draw/free.ts
- src/diagramer/draw/gap.ts
- src/diagramer/draw/layout.ts
- src/diagramer/draw/link.ts
- src/diagramer/draw/measure.ts
- src/diagramer/draw/render.ts
- src/diagramer/draw/report.ts
- src/diagramer/draw/row.ts
- src/diagramer/draw/space.ts
- src/diagramer/draw/text.ts
- src/diagramer/draw/tree.ts
FAQ
Что делает скилл diagramer?
Draw block diagrams in code: measured pieces composed like UI (row, col, box, tree), placed on an 8 px grid with a few hints, joined by routed arrows, checked for collisions in plain words and rendered as one SVG — inline anywhere, or as selectable sheets on a Wireframer board with Ask agent.
Как установить скилл diagramer?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл diagramer запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…