From code-graph
Use when generating architecture documentation, visual diagrams, or call graphs for a codebase. Triggers on requests to document, visualize, or map code architecture, data flow, or function relationships.
How this skill is triggered — by the user, by Claude, or both
Slash command
/code-graph:generating-docsThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Systematic approach to analyzing a codebase and producing three visual documentation artifacts: architecture overview (Mermaid), data flow diagrams (Mermaid), and an interactive function call graph (HTML/Cytoscape.js).
Systematic approach to analyzing a codebase and producing three visual documentation artifacts: architecture overview (Mermaid), data flow diagrams (Mermaid), and an interactive function call graph (HTML/Cytoscape.js).
Before generating anything, understand the project:
1. Read top-level files: package.json, pyproject.toml, Cargo.toml, go.mod, etc.
2. Map directory structure (2 levels deep)
3. Identify entry points: main files, app factories, route registrations
4. Identify the tech stack: framework, ORM, API style (REST/GraphQL/RPC)
Identify layers by reading actual source files:
| Layer | What to look for |
|---|---|
| Entry/API | Route definitions, controllers, handlers, CLI commands |
| Business Logic | Service classes, use cases, domain models, validators |
| Data Access | ORM models, repositories, database queries, migrations |
| Infrastructure | Config loading, logging, caching, external API clients |
| Shared | Utilities, types, constants, middleware |
For Python projects: look for urls.py, views.py, models.py, services/, api/
For TypeScript projects: look for routes/, controllers/, services/, models/, lib/
Pick the 3-5 most important operations by looking at:
Trace each operation through the layers, noting:
For function call graphs, systematically:
{caller: "module.function", callee: "module.function"}Group nodes by module. Identify:
Use graph TD for top-down layer diagrams:
graph TD
subgraph API Layer
routes[Routes/Controllers]
middleware[Middleware]
end
subgraph Business Logic
services[Services]
validators[Validators]
end
subgraph Data Layer
models[Models/ORM]
repos[Repositories]
end
routes --> services
middleware --> routes
services --> validators
services --> repos
repos --> models
Use sequenceDiagram for each operation:
sequenceDiagram
participant Client
participant Router
participant AuthService
participant UserRepo
participant DB
Client->>Router: POST /login
Router->>AuthService: authenticate(credentials)
AuthService->>UserRepo: findByEmail(email)
UserRepo->>DB: SELECT * FROM users
DB-->>UserRepo: user record
UserRepo-->>AuthService: User
AuthService-->>Router: JWT token
Router-->>Client: 200 {token}
Generate this JSON structure and embed in the HTML viewer template at ${CLAUDE_PLUGIN_ROOT}/skills/generating-docs/html-viewer.html:
{
"nodes": [
{"data": {"id": "module.func", "label": "func", "module": "module", "type": "entry|hotspot|normal|leaf"}}
],
"edges": [
{"data": {"source": "module.caller", "target": "module.callee"}}
],
"modules": ["module1", "module2"]
}
Node types determine visual styling:
entry: green border - no callers in codebasehotspot: red border, larger - called by 3+ functionsnormal: default stylingleaf: gray, smaller - no outgoing calls| Artifact | Format | Key Content |
|---|---|---|
| Architecture | Mermaid graph TD | Layers, components, dependencies |
| Data Flow | Mermaid sequenceDiagram | Operations traced through layers |
| Call Graph | HTML + Cytoscape.js | Functions, calls, modules, hotspots |
npx claudepluginhub rhedbull/call-graphGenerates Mermaid flowcharts visualizing high-level codebase component relationships. Use for onboarding, PR reviews, and understanding system structure.
Automatically analyzes codebases to generate zero-config architecture diagrams by detecting project type, tech stack, and structure. For repo overviews without custom specs.
Scans codebases to auto-generate Mermaid diagrams like ER for DB schemas/models, sequence for API routes, architecture for services, and state diagrams from file structure.