Skip to content

Instantly share code, notes, and snippets.

@aessam
Created June 22, 2025 21:45
Show Gist options
  • Save aessam/963beecba29660a532b11f03b27e1b92 to your computer and use it in GitHub Desktop.
Save aessam/963beecba29660a532b11f03b27e1b92 to your computer and use it in GitHub Desktop.
Universal prompt for Claude Code to generate interactive multi-level dependency graphs for any codebase. Creates beautiful D3.js visualizations with 3 zoom levels: system overview (40k ft), module view (10k ft), and full dependency graph. Works with Rust, JavaScript, Python, Go, Java, and more.

Analyze this codebase and create a multi-level interactive dependency graph visualization as a single HTML file.

Level 1 - System Overview (40,000ft view):

  • Show only top-level directories/subsystems
  • Group by: Frontend, Backend, Core, Database, Tests, Tools, External
  • Display as large nodes with # of files and primary language
  • Show only major connections between subsystems

Level 2 - Module View (10,000ft view):

  • Show ~30-50 most important modules/packages
  • Size nodes by: (dependents × 3) + (lines of code / 100)
  • Cluster by parent directory
  • Color by category type

Level 3 - Full Dependency Graph:

  • Show all internal packages/modules
  • Include external dependencies
  • Use force-directed layout
  • Allow filtering by category

Requirements:

  1. Auto-detect project type from build files (Cargo.toml, package.json, go.mod, etc.)
  2. Extract dependencies using language-specific patterns
  3. Create single self-contained HTML using D3.js from CDN
  4. Include dark theme like the Zed editor graph
  5. Add interactive features: zoom, pan, click for details, search, filter by category
  6. Show stats: total modules, total dependencies, most connected nodes
  7. Add level switcher buttons and breadcrumb navigation
  8. Use colors to indicate: language type, dependency depth, or module category
  9. Make node sizes reflect importance (more dependents = bigger)
  10. Include keyboard shortcuts (R=reset, 1/2/3=switch levels, /=search)

Start by analyzing the project structure, then generate the complete HTML file with embedded data and visualization code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment