analyze_dependencies – Dependency Analysis
Comprehensive dependency mapping with circular reference detection and coupling analysis
Use local-llm:analyze_dependencies to understand your project’s dependency structure and identify architectural issues.
Perfect For
Architecture Review
Understanding component relationships and dependency flow patterns before major refactoring or system redesign initiatives.
Circular Dependency Detection
Identifying problematic circular imports that cause build failures, runtime errors, and architectural complexity.
Bundle Optimisation
Analysing import patterns to reduce bundle size through tree-shaking improvements and dependency consolidation.
Code Coupling Assessment
Measuring tight coupling between modules to identify refactoring opportunities and improve maintainability.
Package.json Security Analysis
Dependency version conflict detection, vulnerability assessment, and supply chain security analysis.
Quick Start
local-llm:analyze_dependencies with:
- projectPath: "C:/my-project"
- analysisType: "comprehensive"
- includePackageJson: true
Focused circular dependency detection:
local-llm:analyze_dependencies with:
- projectPath: "C:/complex-app/src"
- analysisType: "circular"
- checkDevDependencies: false
Dependency Analysis Output
Circular Dependency Detection
- Import Cycle Mapping: Complete circular dependency chains with file-by-file import paths
- Severity Assessment: Risk categorisation from build-breaking to performance-impacting cycles
- Resolution Strategies: Specific recommendations for breaking cycles through dependency injection or interface extraction
Coupling Analysis
- High Coupling Detection: Modules with excessive interdependencies requiring architectural refactoring
- Fan-in/Fan-out Metrics: Module dependency statistics showing central components and isolated modules
- Modularity Assessment: Cohesion scoring and separation of concerns evaluation
Package Management Analysis
- Version Conflict Detection: Incompatible dependency versions and resolution recommendations
- Unused Dependency Identification: Package.json entries without corresponding imports
- Security Vulnerability Assessment: Known CVEs in dependencies with severity ratings
Analysis Example
Circular Dependency Detection
// Circular dependency example
// UserService.ts imports OrderService
// OrderService.ts imports UserService
// PaymentService.ts imports both
Detected Cycles:
1. UserService.ts → OrderService.ts → UserService.ts
2. ComponentA.tsx → ComponentB.tsx → ComponentC.tsx → ComponentA.tsx
Analysis Results
- Critical Cycle: UserService ↔ OrderService – Breaks build in strict mode
- Component Cycle: A → B → C → A – Runtime circular reference warning
- Resolution Strategy: Extract shared interfaces to break service dependencies
- High Coupling: PaymentService depends on 12 other modules – Consider facade pattern
Parameters
Parameter | Type | Description | Example |
---|---|---|---|
projectPath | string | Root directory for dependency analysis | “C:/my-project” |
filePath | string | Single file dependency analysis | “C:/src/UserService.ts” |
analysisType | enum | Focus area for analysis | “circular” | “coupling” | “comprehensive” |
includePackageJson | boolean | Analyse package.json dependencies | true |
checkDevDependencies | boolean | Include development dependencies | false |
Analysis Type Specialisation
- circular: Focus on circular dependency detection and resolution strategies
- coupling: Analyse module coupling, cohesion, and architectural patterns
- comprehensive: Full dependency analysis including package management and security
Advanced Configuration
Enterprise Architecture Analysis: Comprehensive dependency assessment for large-scale applications with detailed architectural recommendations.
// Full enterprise analysis
local-llm:analyze_dependencies with:
- projectPath: "C:/enterprise-app"
- analysisType: "comprehensive"
- includePackageJson: true
- checkDevDependencies: true
// Microservice dependency analysis
local-llm:analyze_dependencies with:
- projectPath: "C:/microservice/src"
- analysisType: "coupling"
- includePackageJson: false
Dependency Cleanup Workflow:
- Run comprehensive analyze_dependencies for baseline assessment
- Address critical circular dependencies immediately
- Use find_unused_files to identify orphaned modules
- Refactor high coupling areas with suggest_refactoring
- Verify improvements with follow-up dependency analysis
Pro Tips
Circular Dependency Prevention: Run dependency analysis before major feature development to establish clean architectural baselines.
Build Performance: High coupling and circular dependencies significantly impact build times – prioritise resolution in active development areas.
Refactoring Planning: Use dependency maps to plan refactoring sequences, starting with least-coupled modules to minimise cascading changes.
Related Functions
- analyze_project_structure – High-level architectural analysis with component organisation
- suggest_refactoring – Specific refactoring recommendations for decoupling modules
- find_unused_files – Identify orphaned modules for dependency cleanup
- trace_execution_path – Follow execution flow through dependency chains
Use local-llm:analyze_dependencies to map your project’s architecture – let Houtini handle the complex dependency analysis while Claude focuses on architectural strategy.