Identifies boundaries between modules or components in software systems through static code analysis and dependency detection. Use when Claude needs to analyze software architecture, identify module boundaries, detect boundary violations, find circular dependencies, or assess component coupling. Supports Python (packages and imports) and Java (packages and dependencies). Trigger when users ask to "identify boundaries", "find component boundaries", "detect boundary violations", "analyze module structure", "check architecture", or "find circular dependencies".
87
81%
Does it follow best practices?
Impact
96%
1.20xAverage score across 3 eval scenarios
Passed
No known issues
Identify and analyze boundaries between software components to ensure proper architectural separation.
When a user requests boundary analysis:
Identify component boundaries based on:
Detect boundary violations including:
Analyze code structure without execution.
Python:
Java:
Script: Use scripts/analyze_boundaries.py for automated Python analysis
Review code for boundary patterns.
Process:
See: boundary-indicators.md for patterns
Layers (top to bottom):
Rules:
Violations:
Boundaries:
Rules:
Violations:
Boundaries (inside to outside):
Dependency Rule:
Violations:
Boundary indicators:
domain/, infrastructure/, api/)__init__.py with controlled exportsCommon violations:
infrastructure_name)See: boundary-indicators.md for details
Boundary indicators:
com.example.domain, com.example.infrastructure)Common violations:
See: boundary-indicators.md for details
Questions to clarify:
For automated analysis:
python scripts/analyze_boundaries.py <project_directory>For manual analysis:
Look for:
Document:
Check for:
See: violation-patterns.md for patterns
Structure:
IDENTIFIED BOUNDARIES
- boundary1/ (N modules)
- boundary2/ (M modules)
BOUNDARY VIOLATIONS
[CRITICAL] module_a depends on higher layer module_b
[HIGH] Circular dependency: module_c -> module_d -> module_c
[MEDIUM] module_e accesses private implementation
RECOMMENDATIONS
- Fix critical violations first
- Introduce interfaces for concrete dependencies
- Refactor circular dependenciesImpact: Breaks architectural principles, prevents proper separation
Priority: Fix immediately
Impact: Reduces flexibility, complicates testing
Priority: Fix soon
Impact: Breaks encapsulation, reduces maintainability
Priority: Fix when refactoring
Impact: Reduces code clarity
Priority: Fix opportunistically
Pattern:
# domain/services.py
from api.serializers import UserSerializer # VIOLATIONDetection: Lower layer imports from higher layer
Fix: Move serialization to API layer
Pattern:
# module_a.py
from module_b import ClassB
# module_b.py
from module_a import ClassA # VIOLATIONDetection: A imports B, B imports A
Fix: Extract shared interface, use dependency injection
Pattern:
# api/routes.py
from infrastructure.repositories import UserRepository # VIOLATIONDetection: API directly uses infrastructure (skips service layer)
Fix: Use service layer as intermediary
Pattern:
# domain/services.py
from infrastructure.email import SMTPEmailSender # VIOLATION
class NotificationService:
def __init__(self):
self.sender = SMTPEmailSender()Detection: Domain depends on concrete infrastructure class
Fix: Depend on interface, inject implementation
User: "Identify the component boundaries in this codebase" → Analyze structure, identify boundaries, report findings
User: "Check if there are any boundary violations" → Analyze dependencies, detect violations, report with severity
User: "Is my domain layer properly isolated?" → Check domain dependencies, verify no infrastructure/API imports
User: "Find circular dependencies in the project" → Analyze import graph, identify cycles, report
User: "Does this follow clean architecture?" → Identify layers, check dependency directions, report violations
User: "Why is this module hard to test?" → Analyze dependencies, identify concrete couplings, suggest fixes
Use the provided script for Python projects:
python scripts/analyze_boundaries.py /path/to/projectOutput:
Limitations:
For Java or manual analysis, follow the workflow using reference patterns.
0f00a4f
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.