diegomarino/claude-toolshed/d2-architect
Claude Code and agent skill by diegomarino/claude-toolshed
- community
Checking that the SKILL.md file is still in the repository.
Scan a codebase and auto-generate relevant diagrams from its structure
Install
npx vskill@latest install diegomarino/claude-toolshed/d2-architectSKILL.md
/d2-architect
User request: "$ARGUMENTS"
Task
Analyze a codebase or project path and generate a relevant suite of D2 diagrams (typically 3-4 types based on what's found).
Difference from /d2-diagram
/d2-diagramgenerates one diagram from a text description/d2-architectgenerates multiple diagrams from actual code/files at a given path
Process
Step 1: Resolve Plugin Path
If still empty, stop: "Plugin not found. Is it installed?"
Step 2: Ensure Dependencies
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).
Step 3: Read Config
If .claude/d2.json exists, read output_directory, theme_id, layout, sketch, auto_validate, auto_render.
Resolve output path:
- If
output_directoryis"same"AND an input path is known:OUTPUT_DIR={input_directory} - Otherwise:
OUTPUT_DIR={output_directory or ./diagrams}
Step 4: Resolve Target Path
- If no argument, use current directory.
- If argument is a file, analyze that single file.
- If argument is a directory, explore it.
Step 5: Explore Codebase
Read key files to understand the domain (models, routes, services, main entry point).
Step 6: Infer Diagram Types
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.
Step 6b: Apply Composition Policies
Read the global policies from $PLUGIN_DIR/SKILL.md. For each diagram to generate:
- Determine abstraction level (context/container/component/deployment)
- Choose grouping criterion (layer/domain/ownership/environment)
- Check estimated node count against visual budget (max 12 top-level, 7 per group)
- Select layout engine (dagre for <8 nodes, elk for >=8)
- Set direction explicitly (right for flows, down for hierarchies)
If a diagram would exceed the visual budget, split into overview + detail.
Step 7: Generate Each Diagram
For each selected type, load the specialist:
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.
Step 8: Validate
For each generated diagram:
Fix any errors using $PLUGIN_DIR/references/guides/troubleshooting.md.
Step 9: Render (if auto_render=true or user requests)
Step 10: Report
Step 11: Offer design document (opt-in)
If 3 or more diagrams were generated:
If fewer than 3 diagrams: skip silently.
Common Mistakes
- Generating all 4 diagram types when only 2 are warranted — select only types with clear evidence in the code.
- Empty PLUGIN_DIR — if both find commands return nothing, stop and report the install message.
- Including node_modules or dist — always exclude with
-not -path "*/node_modules/*"and-not -path "*/dist/*". - Inferring from file names only — read actual function bodies, model fields, and route handlers.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingplugins/d2/skills/d2-architect/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/diegomarino/claude-toolshed/d2-architect)