/meta:draw-architecture [file]from meta
Draws a repo's architecture as one Mermaid diagram in ARCHITECTURE.md, and keeps it true. The diagram is processes and boundaries: what crosses between a project's halves, such as a frontend and its backend, and what it starts or reaches outside itself, each edge labelled with what carries it, found by greps across both sides. Declines where a table serves: no crossing, fan-in or fan-out means no diagram. Renders each diagram with mermaid-cli by a bundled script and Reads the PNG before calling it done, since a diagram can parse and still draw too tall to read. Ends the file with the code the diagram is drawn from, and points the repo's CLAUDE.md or AGENTS.md at it, since nothing else loads it. Run again, it audits: rereads that code, lists where the file disagrees, and corrects it in place on a yes, never regenerating. Written for Claude Code first, a person second. Not for a flowchart of one procedure, a data model or a sequence diagram.
Ships in meta. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Draw one diagram of a repo, processes and boundaries: what crosses
between the project's halves, and what it starts or reaches outside
itself. Write it to ARCHITECTURE.md at the repo's root, or the file
the argument names, with the code it is drawn from listed at the end,
and point the repo's instruction file at it. On a repo whose file
exists, audit it against that code instead of drawing it again.
The reader is a Claude Code session, then a person. A session reads one or two files well and misses what sits between them. For one Tauri app six diagrams were drafted, and the one kept was this one: it was drawn from greps across both halves, where each of the other five redrew one or two files a session reads anyway (observed 2026-11-21). So this skill draws that one and no other.
Left alone, such a file rots. A client repo's ARCHITECTURE.md was
1,143 lines after 81 commits, and stated one count as three in one
section and as nine in two others, where the repo held nine (observed
2026-11-21). The sources section and the audit are what this skill adds
against that.
Past this file, references/finding-crossings.md
and references/coding-markdown.md; then
mermaid-cli's README and mmdc -h, GitHub's Creating diagrams by
curl -s 'https://docs.github.com/api/article/body?pathname=/en/get-started/writing-on-github/working-with-advanced-formatting/creating-diagrams',
and Claude Code's memory page by
curl -s https://code.claude.com/docs/en/memory.md. A live page that
contradicts a line here wins: say so, act on the page, and route the fix
by capture-learning, bar a dated measured line that names the page it
overrules and the call that measured it, which a page changed since its
date sends back to re-measure. An observed claim is cited or marked
pending a doc check, and stands, marked observed, only where no page
covers it.
git rev-parse --show-toplevel
git ls-files --cached --others -- ARCHITECTURE.md docs/ARCHITECTURE.md
Name the project's halves first: the processes or runtimes that cannot call each other as plain functions, such as a webview and a native core, a browser page and a server, an extension's page script and its background worker. A repo with one runtime has no halves; its boundary is the process and what lies outside it.
Then inventory every crossing, from both sides. Grep the caller's side and the answering side for each kind, and keep only what both show, or what one side starts and the outside answers:
references/finding-crossings.md has each kind's question and the greps that answered it for a Tauri app. For another stack, find its own names for these kinds by reading its entry points; that reference lists no other stack's, since none was read. A repo's own rule or README on its invariants names most crossings in prose: read it before grepping, and check each against the code.
Record, per crossing: the two ends, the mechanism, what it carries, and the file and pattern that proved it. That last column becomes the file's sources section.
Draw only where something crosses, fans in or fans out. A picture earns its place when two or more mechanisms join the same pair of parts, when several parts reach one, or when one reaches several: those are what prose and a table tell badly.
Decline where a table serves, and say so. Where every part runs to its own destination, the drawing is parallel columns, each one row of a table. One repo's "what deploys where" drew as eight such columns with no crossing, and its table also carried a column the picture could not (observed 2026-11-21). Then:
ARCHITECTURE.md;One fence, flowchart TD:
style <id> fill:transparent per subgraph.invoke: a command, answered Result. A solid arrow for
what a side asks for, a dotted one for what arrives unasked.flowchart LR shrank past reading where TD read.A chain of yes-or-no tests is one node with numbered branches, never a column of diamonds: step 5 says what the column draws as.
The Tauri app's diagram held three subgraphs, thirteen nodes and sixteen labelled edges, and read at one screen (observed 2026-11-21). That is an example, not a limit; the render decides.
Never call a diagram done from its source. A fence can parse with
no error and draw unreadably: an eleven-test chain drew 187 by 3,053
pixels (observed 2026-11-21, mermaid-cli 12.2.0). Write the draft to
<scratchpad>/ARCHITECTURE.md first, the session's scratchpad or any
folder outside the repo, then:
uv run --no-project "${CLAUDE_SKILL_DIR}/scripts/render-diagrams.py" <scratchpad>/ARCHITECTURE.md --out <scratchpad>/render
Run it alone, as written, since the pre-approval matches this command
text and a compound loses it. It runs mmdc over the file, which
writes one PNG per fence, and prints a line per PNG: its number, its
size in pixels at scale 1, ok or what it is over, and its path.
| Exit | Means | Then |
|---|---|---|
| 0 | each PNG listed | Read every PNG, flagged or not |
| 1 | mmdc failed; a parse error prints Parse error on line and the text beside it | fix the fence, run again |
| 2 | a bad argument | fix the call |
| 3 | mmdc is not installed | below |
| 4 | the file holds no mermaid fence | fix the draft |
Look for, in each image: a label cut off or laid over another; an
arrow that cannot be followed from end to end; a part drawn far from
what it talks to; TALL or WIDE, which is a diagram over 1,200
pixels high or 1,600 across, this skill's own limits. Redraw and render
again until it reads at one screen.
With no mmdc, exit 3, the diagram is unrendered: say so, and never
report it as checked. The install is the user's, once:
npm install -g @mermaid-js/mermaid-cli@12, on Node 22.13 or later
(mermaid-cli README and package.json, read 2026-11-21), held to the
major every measurement here was taken on. It brings
Puppeteer, whose install downloads a Chrome of its own, 726 MB under
~/.cache/puppeteer (observed 2026-11-21, puppeteer 25.18.1). Where
that download was skipped, exit 1 says Could not find chrome-headless-shell: pass --browser with the path of an installed
Chrome or Edge, which drew the same diagram at the same size here
(observed 2026-11-21, Edge on Windows).
Never run mmdc by npx. It downloads the package and runs it in
one step, and auto mode blocks "Downloading and executing code" by
default (permission-modes page, read 2026-11-21): it refused that
command twice, where the installed mmdc ran with no prompt (observed
2026-11-21).
The render proves the parse and the layout, not GitHub's colours.
mermaid-cli draws its own theme. GitHub renders a mermaid fence in
Markdown files, issues, pull requests, discussions and wikis, and an
info fence prints the Mermaid version it runs (Creating diagrams,
read 2026-11-21). For the colours, keep to step 4's shapes, or paste
the fence into a GitHub comment's Preview, which posts nothing.
Write ARCHITECTURE.md with Write, about 80 lines, in this order:
# <Project> architecture and one paragraph: what the project
is in a sentence, the README and the rules that hold the rest, each
linked, and that this file restates neither.## Processes and boundaries: the fence.## What the diagram is drawn from: "Reread these when one
changes, and redraw the diagram where they disagree", then a bullet
per pattern and file from step 2's last column.Link out; restate nothing. A count, a command list or a rule that another file holds is linked, never copied: a number in two files is a number that will disagree with itself. The Tauri app's file came to 87 lines because its README and its rule already held the prose (observed 2026-11-21).
Nothing loads ARCHITECTURE.md on its own, so without a pointer no
session reads it. Add one to the repo's root CLAUDE.md, or to its
AGENTS.md where that is the file the repo keeps:
`ARCHITECTURE.md` draws what crosses between <the halves> and what
<project> reaches outside itself. **Read it before adding <each kind of
crossing it shows>**, and redraw it in the same commit: its last
section names the code it is drawn from.
@ARCHITECTURE.md. An
import loads with the CLAUDE.md that holds it and saves no context
(memory page § "Import additional files", read 2026-11-21), so it
would charge every session for a file only some changes need.Reread the code, then correct the file in place. Read the file whole, then:
AskUserQuestion, whether to make them.A file this skill did not write has no sources section. Work out what its diagram shows by step 2, audit against that, and offer the section as one more finding. Leave its length and its other sections alone, and name in the report only what was not checked. A file with several fences is rendered whole, since the script draws each, and each fence's named parts are checked against the code.
Never regenerate: a file redrawn from scratch loses the paragraphs a person wrote and argued for, and costs the full read the sources section exists to save.
Committing is commit-changes's. Where the repo's own instructions ask
for the diagram to change with the code, that is the same commit.
npx.mmdc or a browser: name the command; it is the
user's to run.--out, outside the repo, so no PNG
lands in the working tree.What SKILL.md sets; muted values are Claude Code's defaults
Use when asked to draw, diagram, map or visualize a repo's or an app's architecture, for 'a visual of what's going on in this project', to write an ARCHITECTURE.md, or to check, audit or refresh one that exists: 'is ARCHITECTURE.md still true', 'the architecture diagram is out of date', 'redraw the architecture after this change'. Not to fix or restyle one Mermaid fence in another document.
inheritxhighOther plugins' skills for the same job
npx claudepluginhub wardawgmalvicious/claude-plugins --plugin meta8 skills in this plugin
/audit-agent-setupAudits a repo's Claude Code setup on this machine and reports what to fix and what to add: hooks, permission rules, skills, subagents, plugins and MCP servers. Edits, writes and connects nothing. Runs the checks a generic recommender cannot: plugins declared off and the payload's reason for it, .mcp.json placeholders, literal header values and tracking, servers at the wrong scope, tenant pins that MCP servers ignore, and CLAUDE.md rules nothing enforces. Reuses the deployed agents and skills and microsoft-learn-mcp before proposing anything new, names scope-instructions, /doctor and /fewer-permission-prompts where one owns the question, and places each item in the repo, the repo the user's own config is authored in (through capture-learning from another repo) or nowhere. Typed only: audit-agent-setup [category]./find-sessionFinds a past Claude Code session by what was said in it — words from a prompt the user typed, a compaction summary or the session's name — across every repo on this machine, and gives the claude --resume command that reopens it. Runs the script bundled with the skill over the transcripts on disk, ranks one prompt holding every term above terms scattered through a long session, and reports how far back the transcripts reach, since an older session is gone. Naming the current session is /rename; running and background sessions are claude agents./init-user-instructionsAudits and rewrites ~/.claude/CLAUDE.md, Claude Code's user-scope instructions, from its source claude/CLAUDE.md in the repo the user's config is authored in, as init-account-instructions writes claude.ai's Account block; with no user-scope file yet, drafts a short first one, written on a yes. A bundled script checks the line count against the lint cap, ~/ pointers that resolve nowhere, skills named but not deployed at user scope, tools claimed on PATH or not installed, dated rules by age, counts that want a derivation command and drift from each deployed copy, then reads this machine's transcripts: corrections repeated across sessions, each rule's error text after its date, and whether the Account block loads, masked and reported as counts. Routes every line to the home that loads it, interviews, and proposes a table and a diff, adding a line only for a standing behavior the user states and only by displacing another. A repo's CLAUDE.md is scope-instructions'; one session's learning is capture-learning's./measure-session-costReports what a Claude Code session cost at API list prices, by phase, by model and by subagent, from its transcripts on disk, through a bundled script holding a dated price table. Prices each call's context, read from or written to the prompt cache, and its output; splits the session at each compaction and each idle gap over an hour; names every call that rewrote its context to the cache and why, whether the start, a compaction, an expired cache or a model switch; gives the context at the first call, before any work, and the tools called with the size of what they returned. Takes a session id or its start, the current session, or a repo's newest sessions, in every account's config directory. A model, speed or usage shape the table lacks is reported unpriced, never guessed. Reads only. Finding a session by what was said in it is find-session's. Typed only: measure-session-cost [id | --repo FOLDER --last N]./scope-instructionsSorts a repo's agent instructions into the homes that load them when they are needed. Weighs each section of a root CLAUDE.md or AGENTS.md, each folder README's must-know lines and each file another coding tool reads against root, a paths: rule, a nested CLAUDE.md or AGENTS.md, a skill, a hook, a README or nowhere, by the event that loads each home and whether that event comes before the mistake. Reads every instruction file itself, in its own context, so the scoping rule loads where the proposal is written. Measures the repo's own session transcripts per folder with a bundled script: who worked there, whether they opened its README first, which nested files and rules loaded, how often they compacted. Finds an AGENTS.md a CLAUDE.md silences and a fact two tools' files hold apart. Proposes every move in one table and edits only on approval. Where /init and /doctor refresh and trim a root file, this moves what does not belong there./ship-pluginShips a Claude Code plugin so it installs and runs where its users are. A plugin gets no build step, so a .mcp.json pointing at a gitignored dist/ installs cleanly and its server never starts; chat, Cowork and Claude Code each load a different part of a plugin, and a top-level bin/ makes chat, Cowork and org sync refuse it; version means something different for a local-path marketplace, one added by source and one synced to a claude.ai organization; a synced marketplace is labelled with its repository's owner/repo and nothing renames it, and Delete source removes every plugin for every member. Ends with an install test in a throwaway CLAUDE_CONFIG_DIR (claude plugin validate, install --config, claude mcp list) and claude plugin eval for the plugin's own skills. Not for a mod, which plugin-authoring makes.