con un clic
d2-architect
Scan a codebase and auto-generate relevant diagrams from its structure
Instalar con Codex o Claude Copia este prompt, pégalo en Codex, Claude u otro asistente, y deja que revise la página de la skill y la instale por ti.
Menú
Scan a codebase and auto-generate relevant diagrams from its structure
Instalar con Codex o Claude Copia este prompt, pégalo en Codex, Claude u otro asistente, y deja que revise la página de la skill y la instale por ti.
Basado en la clasificación ocupacional SOC
Use when checking Paperclip org health, reviewing agent efficiency, diagnosing token waste, verifying governance compliance, or before and after making org changes. Also use when agents seem idle or unproductive, costs spike, tasks stall, heartbeats fail silently, you see 409 conflicts, stale locks, blocked deadlocks, or suspect agents burning tokens with no progress.
This skill should be used when the user asks to "show dev-setup config", "change the worktrees directory", "update the port pattern", "configure dev-setup settings", or wants to view or update settings in .claude/dev-setup.json.
Generate dev server lifecycle scripts (start/stop/status/ports) from detected project structure
This skill should be used when the user asks to "create a worktree", "set up an isolated workspace", "create a branch for a feature", "start working on a new branch", or before executing an implementation plan that needs an isolated git workspace.
Generate a D2 diagram from a text description
Internal routing hub for d2 diagram skills
| name | d2-architect |
| description | Scan a codebase and auto-generate relevant diagrams from its structure |
| argument-hint | ["path"] |
| allowed-tools | Read, Bash, Glob, Grep, Write |
User request: "$ARGUMENTS"
Analyze a codebase or project path and generate a relevant suite of D2 diagrams (typically 3-4 types based on what's found).
/d2-diagram generates one diagram from a text description/d2-architect generates multiple diagrams from actual code/files at a given pathPLUGIN_DIR=$(find "$HOME/.claude/plugins/cache" -type d -name "d2" -path "*/skills/d2" 2>/dev/null | head -1)
[ -z "$PLUGIN_DIR" ] && PLUGIN_DIR=$(find "$HOME" -maxdepth 8 -type d -name "d2" -path "*/skills/d2" 2>/dev/null | head -1)
If still empty, stop: "Plugin not found. Is it installed?"
bash "$PLUGIN_DIR/scripts/ensure-deps.sh"
If .claude/d2.json does not exist, display a one-time nudge before continuing:
First time using the d2 plugin? Run
/d2-configto pick a theme and output settings. Using defaults for now (theme 0 / Neutral,./diagrams).
If .claude/d2.json exists, read output_directory, theme_id, layout, sketch, auto_validate, auto_render.
Resolve output path:
output_directory is "same" AND an input path is known: OUTPUT_DIR={input_directory}OUTPUT_DIR={output_directory or ./diagrams}find {path} \( -name "*.py" -o -name "*.ts" -o -name "*.js" -o -name "*.rb" -o -name "*.go" \) | grep -v node_modules | grep -v dist | head -50
find {path} \( -name "*.sql" -o -name "*.prisma" -o -name "*schema*" \) | grep -v node_modules | head -20
find {path} \( -name "routes*" -o -name "router*" -o -name "urls*" -o -name "endpoints*" \) | grep -v node_modules | head -20
find {path} \( -name "docker-compose*" -o -name "Dockerfile*" -o -name "k8s" -o -name "*.yaml" \) | grep -v node_modules | head -10
Read key files to understand the domain (models, routes, services, main entry point).
Based on what's found:
| Found | Generates |
|---|---|
Database models / ORM / schema files / .sql / .prisma | ER diagram |
| API routes / controllers / endpoints | Sequence diagram (request flow) |
Service classes / modules / services/ directory | Architecture diagram |
Class files with inheritance (extends, implements) | Class diagram |
| Config / deployment files (docker, k8s, cloud) | Architecture diagram (deployment view) |
Select 2-4 most relevant types. Do not generate all 4 unless the codebase clearly warrants it.
Read the global policies from $PLUGIN_DIR/SKILL.md. For each diagram to generate:
If a diagram would exceed the visual budget, split into overview + detail.
For each selected type, load the specialist:
cat "$PLUGIN_DIR/specialists/d2-{type}.md"
Follow the specialist's compositional patterns using the actual code found in Step 5. The structural decisions from Step 6b (abstraction, grouping, direction, engine) govern the output. After generating, run the repair pass from $PLUGIN_DIR/SKILL.md before validating.
For each generated diagram:
d2 validate {output_file}
Fix any errors using $PLUGIN_DIR/references/guides/troubleshooting.md.
auto_render=true or user requests)d2 {file} {OUTPUT_DIR}/{basename}.svg
Analyzed: {path}
Generated {N} diagrams:
✅ {OUTPUT_DIR}/er-{name}-{timestamp}.d2 (ER — 5 tables, 4 relationships)
✅ {OUTPUT_DIR}/sequence-{name}-{timestamp}.d2 (Sequence — 4 actors, 8 messages)
✅ {OUTPUT_DIR}/architecture-{name}-{timestamp}.d2 (Architecture — 6 components)
Validation: all passed
If 3 or more diagrams were generated:
Generated {N} diagrams — want me to assemble them into a system design document?
I'll embed each diagram in the relevant section.
If fewer than 3 diagrams: skip silently.
-not -path "*/node_modules/*" and -not -path "*/dist/*".