architecture-analyzer
Analyze and visualize software architecture patterns, dependencies, and module boundaries for migration planning
What this skill does
# Architecture Analyzer Skill
Analyzes and visualizes software architecture patterns and dependencies to support migration planning, module boundary identification, and architectural decision-making.
## Purpose
Enable comprehensive architecture analysis for:
- Component dependency mapping
- Layered architecture detection
- Coupling and cohesion metrics
- Architectural violation detection
- Module boundary identification
- Dependency graph generation
## Capabilities
### 1. Component Dependency Mapping
- Extract dependencies between modules/packages
- Map inter-service communications
- Identify external system integrations
- Track data flow between components
- Generate dependency matrices
### 2. Layered Architecture Detection
- Identify architectural layers (presentation, business, data)
- Detect layer violations
- Map cross-cutting concerns
- Analyze layer dependencies
- Validate architectural patterns
### 3. Coupling/Cohesion Metrics
- Calculate afferent coupling (Ca)
- Calculate efferent coupling (Ce)
- Compute instability index (I = Ce / (Ca + Ce))
- Measure module cohesion
- Identify highly coupled components
### 4. Architectural Violation Detection
- Detect circular dependencies between modules
- Identify layer bypassing
- Find direct database access from UI layers
- Check for proper abstraction usage
- Validate dependency rules
### 5. Module Boundary Identification
- Detect logical module groupings
- Identify bounded contexts
- Map shared kernel areas
- Analyze module interfaces
- Suggest decomposition boundaries
### 6. Dependency Graph Generation
- Generate DOT format graphs
- Create Mermaid diagrams
- Export to PlantUML
- Produce interactive visualizations
- Support multiple granularity levels
## Tool Integrations
This skill can leverage the following external tools when available:
| Tool | Purpose | Integration Method |
|------|---------|-------------------|
| Structure101 | Architecture visualization | Export analysis |
| Lattix | Dependency analysis | CLI / API |
| NDepend | .NET architecture analysis | CLI |
| JDepend | Java package dependencies | CLI |
| Madge | JavaScript/TypeScript | CLI |
| deptree | Python dependencies | CLI |
| go-arch-lint | Go architecture | CLI |
| ast-grep | Pattern matching | MCP Server |
## Usage
### Basic Analysis
```bash
# Invoke skill for architecture analysis
# The skill will analyze structure and dependencies
# Expected inputs:
# - targetPath: Path to codebase root
# - analysisDepth: 'module' | 'package' | 'class' | 'function'
# - outputFormat: 'json' | 'dot' | 'mermaid' | 'plantuml'
# - includeMetrics: boolean
```
### Analysis Workflow
1. **Discovery Phase**
- Identify project structure
- Detect build configuration
- Map source directories
2. **Extraction Phase**
- Parse import/require statements
- Extract module dependencies
- Identify external dependencies
3. **Analysis Phase**
- Calculate coupling metrics
- Detect architectural patterns
- Identify violations
- Map boundaries
4. **Visualization Phase**
- Generate dependency graphs
- Create architecture diagrams
- Produce metric reports
## Output Schema
```json
{
"analysisId": "string",
"timestamp": "ISO8601",
"target": {
"path": "string",
"language": "string",
"moduleCount": "number",
"totalFiles": "number"
},
"architecture": {
"pattern": "string (layered|modular|monolithic|microservices)",
"layers": [
{
"name": "string",
"modules": ["string"],
"allowedDependencies": ["string"]
}
],
"boundedContexts": [
{
"name": "string",
"modules": ["string"],
"interfaces": ["string"]
}
]
},
"modules": [
{
"name": "string",
"path": "string",
"files": "number",
"linesOfCode": "number",
"dependencies": ["string"],
"dependents": ["string"],
"metrics": {
"afferentCoupling": "number",
"efferentCoupling": "number",
"instability": "number",
"cohesion": "number"
}
}
],
"dependencies": [
{
"from": "string",
"to": "string",
"type": "import|call|inherit|implement",
"count": "number"
}
],
"violations": [
{
"type": "circular|layer-bypass|abstraction-leak",
"severity": "high|medium|low",
"from": "string",
"to": "string",
"description": "string",
"recommendation": "string"
}
],
"metrics": {
"averageCoupling": "number",
"maxCoupling": "number",
"cyclomaticComplexity": "number",
"circularDependencies": "number",
"layerViolations": "number"
},
"graphs": {
"dot": "string (file path)",
"mermaid": "string (file path)",
"plantuml": "string (file path)"
}
}
```
## Integration with Migration Processes
This skill integrates with the following Code Migration/Modernization processes:
- **legacy-codebase-assessment**: Architecture understanding
- **monolith-to-microservices**: Service boundary identification
- **migration-planning-roadmap**: Dependency-based planning
- **code-refactoring**: Coupling reduction targets
## Configuration
### Skill Configuration File
Create `.architecture-analyzer.json` in the project root:
```json
{
"analysisDepth": "module",
"excludePaths": [
"node_modules",
"vendor",
"dist",
"build",
".git",
"__tests__"
],
"modulePatterns": {
"javascript": "src/*",
"java": "src/main/java/**",
"python": "src/*"
},
"layers": {
"enabled": true,
"definitions": [
{
"name": "presentation",
"patterns": ["**/ui/**", "**/views/**", "**/controllers/**"],
"allowedDependencies": ["business", "shared"]
},
{
"name": "business",
"patterns": ["**/services/**", "**/domain/**"],
"allowedDependencies": ["data", "shared"]
},
{
"name": "data",
"patterns": ["**/repositories/**", "**/dao/**"],
"allowedDependencies": ["shared"]
},
{
"name": "shared",
"patterns": ["**/common/**", "**/utils/**"],
"allowedDependencies": []
}
]
},
"rules": {
"maxCoupling": 10,
"maxModuleSize": 5000,
"forbiddenDependencies": [
{"from": "presentation", "to": "data"}
]
},
"visualization": {
"formats": ["mermaid", "dot"],
"groupBy": "layer",
"showMetrics": true
}
}
```
## MCP Server Integration
When ast-grep MCP Server is available for pattern detection:
```javascript
// Example architecture pattern detection
{
"tool": "ast_grep_search",
"arguments": {
"pattern": "import { $_ } from '../data/$_'",
"language": "typescript",
"path": "./src/ui"
}
}
```
## Architectural Patterns
### Layered Architecture
```
┌─────────────────────────────────┐
│ Presentation Layer │
│ (UI, Controllers, Views) │
└──────────────┬──────────────────┘
│
┌──────────────▼──────────────────┐
│ Business Layer │
│ (Services, Domain, Logic) │
└──────────────┬──────────────────┘
│
┌──────────────▼──────────────────┐
│ Data Layer │
│ (Repositories, DAOs, ORM) │
└─────────────────────────────────┘
```
### Modular Monolith
```
┌─────────────────────────────────────────────┐
│ Application Shell │
├───────────┬───────────┬───────────┬─────────┤
│ Module A │ Module B │ Module C │ Shared │
│ ┌─────┐ │ ┌─────┐ │ ┌─────┐ │ ┌─────┐ │
│ │ UI │ │ │ UI │ │ │ UI │ │ │Utils│ │
│ ├─────┤ │ ├─────┤ │ ├─────┤ │ └─────┘ │
│ │Logic│ │ │Logic│ │ │Logic│ │ │
│ ├─────┤ │ ├─────┤ │ ├─────┤ │ │
│ │Data │ │ │Data │ │ │Data │ │ │
│ └─────┘ │ └─────┘ │ └─────┘ │ │
└───────────┴───────────┴───────────┴─────────┘
```
### Microservices (Target)
```
┌─────────┐ ┌─────────┐ ┌─────────┐
│Service A│ │Service B│ │SerRelated in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.