| name | dependency-graph |
| description | Generates a Mermaid dependency graph showing import relationships between modules. Use when analyzing coupling, finding circular deps, or planning refactors. |
Dependency Graph
Generate a Mermaid flowchart showing import and dependency
relationships between modules, packages, or plugins.
When To Use
- Understanding what depends on what
- Finding circular dependencies
- Analyzing coupling between modules
- Planning refactoring by seeing dependency impact
- Answering "what breaks if I change this?"
When NOT To Use
- Runtime call paths (use
cartograph:call-chain)
- Type hierarchies (use
cartograph:class-diagram)
Workflow
Step 1: Explore the Codebase
Dispatch the codebase explorer agent:
Agent(cartograph:codebase-explorer)
Prompt: Explore [scope] and return a structural model.
Focus on import statements and cross-module dependencies
for a dependency graph. Track both internal and external
imports.
Step 2: Generate Mermaid Syntax
Transform the structural model into a Mermaid flowchart
with directed edges representing dependencies.
Rules for dependency graphs:
- Use
flowchart LR (left-right) for dependency direction
- Each node is a module or package
- Edges point from dependent to dependency (A --> B means
"A depends on B")
- Color-code by dependency type:
- Default arrows for internal dependencies
- Dotted arrows (
-.->) for external/optional deps
- Thick arrows (
==>) for critical path dependencies
- Group into subgraphs by package/plugin
- If depth parameter given, limit transitive dependencies