From cc-arsenal
Generate Mermaid diagrams from codebase analysis including architecture, database schema, deployment, and security diagrams. This skill should be used when users want to create system diagrams, ER diagrams, architecture visualizations, or deployment diagrams.
npx claudepluginhub mgiovani/cc-arsenal --plugin cc-arsenal-teamsThis skill is limited to using the following tools:
> **Cross-Platform AI Agent Skill**
Creates isolated Git worktrees for feature branches with prioritized directory selection, gitignore safety checks, auto project setup for Node/Python/Rust/Go, and baseline verification.
Executes implementation plans in current session by dispatching fresh subagents per independent task, with two-stage reviews: spec compliance then code quality.
Dispatches parallel agents to independently tackle 2+ tasks like separate test failures or subsystems without shared state or dependencies.
Cross-Platform AI Agent Skill This skill works with any AI agent platform that supports the skills.sh standard.
Generate Mermaid diagrams including architecture, database schema, deployment, and security architecture.
CRITICAL: Diagrams must represent REAL components. Before adding ANY element:
| Type | Output File | Description |
|---|---|---|
er | docs/data-model.md | Entity-Relationship diagram from database models |
arch | docs/architecture.md | System architecture and component relationships |
deployment | docs/deployment.md | Deployment infrastructure and CI/CD |
security | docs/security.md | Security architecture and data flow |
Use the Explore agent to thoroughly analyze the codebase before generating diagrams:
command argumentser, arch, deployment, securityBefore generating, spawn parallel agents to verify different aspects. See references/detection-patterns.md for specific detection commands per diagram type.
Example: Generating an architecture diagram
Agent 1 - Verify Services:
- prompt: "Find all actual service files/classes in the codebase. Return a list of verified service names with their file paths. Do NOT assume - only return what you can find."
- agent-type: "Explore"
Agent 2 - Verify Databases:
- prompt: "Find all database configurations and connections. Look for DB URLs, ORM configs, connection pools. Return verified database technologies with evidence."
- agent-type: "Explore"
Agent 3 - Verify External Integrations:
- prompt: "Find all external API calls, third-party service integrations. Look for HTTP clients, SDK imports, webhook handlers. Return verified external dependencies."
- agent-type: "Explore"
Agent 4 - Verify Data Flow:
- prompt: "Trace how data flows between components. Look at imports, function calls, event handlers. Return verified connections between components."
- agent-type: "Explore"
Merge results -> Only include verified entities in diagram
**Verification checklist before adding to diagram**:
1. Read the actual source file to confirm it exists
2. For relationships, verify the import/reference exists in code
3. For counts (e.g., "5 services"), run: `find . -name "*service*" | wc -l`
4. Remove any component that cannot be verified with actual code
### Phase 4: Generate Mermaid Diagram
- Create appropriate Mermaid syntax based on type
- **ONLY include verified components** - no assumptions
- Include meaningful labels and relationships
- Add comments for clarity
- Keep diagram readable (not too complex)
For Mermaid syntax patterns per diagram type, see [references/mermaid-patterns.md](references/mermaid-patterns.md).
### Phase 5: Load and Populate Template
- Template location: `assets/templates/`
- Select based on diagram type:
- `er` -> `data-model.md`
- `arch` -> `architecture.md`
- `deployment` -> `deployment.md`
- `security` -> `security.md`
Replace placeholders:
- `{{PROJECT_NAME}}` - Git repo or directory name
- `{{DATE}}` - Current date
- `{{ER_DIAGRAM}}` or `{{DIAGRAM_CONTENT}}` - Generated Mermaid code
- `{{ENTITIES}}` or `{{COMPONENTS}}` - Entity/component descriptions
### Phase 6: Create or Update Documentation
- Output to appropriate file in `docs/`
- If file exists, ask before overwriting
- Preserve custom content if possible
### Phase 7: Report Results
- Show diagram type and output file
- Display summary of what was detected
- Provide next steps
## Usage Examples
Generate specific diagram type:
docs-diagram er docs-diagram arch docs-diagram deployment docs-diagram security With additional context:
docs-diagram er for user and order tables
docs-diagram arch for microservices architecture
docs-diagram deployment with Docker and Kubernetes
Show available types:
docs-diagram
er)arch)deployment)security)This skill includes the following Claude Code-specific enhancements:
Use the Explore agent to thoroughly analyze the codebase before generating diagrams:
Use Task tool with Explore agent:
- prompt: "For [DIAGRAM_TYPE] diagram, find all relevant components. For ER: find model/entity files and their relationships. For arch: find services, APIs, databases. For deployment: find Docker/K8s configs. Return ONLY verified files with their actual content structure."
- subagent_type: "Explore"
$ARGUMENTSer, arch, deployment, securityBefore generating, spawn parallel agents to verify different aspects. See references/detection-patterns.md for specific detection commands per diagram type.
Example: Generating an architecture diagram
Agent 1 - Verify Services:
- prompt: "Find all actual service files/classes in the codebase. Return a list of verified service names with their file paths. Do NOT assume - only return what you can find."
- subagent_type: "Explore"
Agent 2 - Verify Databases:
- prompt: "Find all database configurations and connections. Look for DB URLs, ORM configs, connection pools. Return verified database technologies with evidence."
- subagent_type: "Explore"
Agent 3 - Verify External Integrations:
- prompt: "Find all external API calls, third-party service integrations. Look for HTTP clients, SDK imports, webhook handlers. Return verified external dependencies."
- subagent_type: "Explore"
Agent 4 - Verify Data Flow:
- prompt: "Trace how data flows between components. Look at imports, function calls, event handlers. Return verified connections between components."
- subagent_type: "Explore"
Merge results -> Only include verified entities in diagram
Verification checklist before adding to diagram:
find . -name "*service*" | wc -lFor Mermaid syntax patterns per diagram type, see references/mermaid-patterns.md.
assets/templates/er -> data-model.mdarch -> architecture.mddeployment -> deployment.mdsecurity -> security.mdReplace placeholders:
{{PROJECT_NAME}} - Git repo or directory name{{DATE}} - Current date{{ER_DIAGRAM}} or {{DIAGRAM_CONTENT}} - Generated Mermaid code{{ENTITIES}} or {{COMPONENTS}} - Entity/component descriptionsdocs/