Use when designing modular systems, breaking up monoliths, or defining module boundaries and APIs. Trigger with modularization requests, system decomposition, or coupling analysis.
npx claudepluginhub emasoft/emasoft-plugins --plugin emasoft-architect-agentThis skill uses the workspace's default tool permissions.
This skill teaches architects how to decompose systems into well-defined modules with clear boundaries, minimal coupling, and high cohesion. Proper modularization is the foundation of maintainable, scalable, and testable software systems.
README.mdreferences/api-design-guide.mdreferences/boundary-patterns.mdreferences/dependency-analysis.mdreferences/module-testing.mdreferences/op-apply-solid-principles.mdreferences/op-decompose-monolith.mdreferences/op-design-module-apis.mdreferences/op-detect-circular-dependencies.mdreferences/op-identify-module-boundaries.mdreferences/op-manage-module-dependencies.mdreferences/solid-principles.mdreferences/strangler-pattern.mdBreak complex systems into bounded contexts with DDD. Map business capabilities to service boundaries, define ubiquitous language, assess cohesion/coupling. Use when refactoring monoliths or designing new architectures.
Guides structuring monoliths into modules with enforced boundaries for team autonomy in large codebases, avoiding microservices overhead.
Guides refactoring code, module restructuring, dependency management, file splitting, component extraction, and system architecture design using SOLID principles, layering, and organization rules.
Share bugs, ideas, or general feedback.
This skill teaches architects how to decompose systems into well-defined modules with clear boundaries, minimal coupling, and high cohesion. Proper modularization is the foundation of maintainable, scalable, and testable software systems.
What is a Module?
A module is a self-contained unit of code that:
Why Modularization Matters:
| Benefit | Explanation |
|---|---|
| Maintainability | Changes to one module do not ripple through the entire system |
| Testability | Modules can be tested in isolation with mocked dependencies |
| Scalability | Teams can work on different modules in parallel |
| Reusability | Well-designed modules can be reused across projects |
| Understandability | Smaller modules are easier to comprehend than monolithic code |
Use this skill when:
Execute these phases in order:
Copy this checklist and track your progress:
| Phase | Output Artifact | Contents |
|---|---|---|
| Principle Application | Principle analysis document | SOLID compliance assessment for each module |
| Boundary Identification | Module boundary map | Modules, responsibilities, bounded contexts |
| API Design | API specification | Interface definitions, contracts, DTOs |
| Dependency Management | Dependency graph | Module relationships, shared code strategy |
| Validation | Quality report | Coupling metrics, cohesion scores, test strategy |
For detailed principles, see references/solid-principles.md:
For detailed boundary identification, see references/boundary-patterns.md:
For detailed API design, see references/api-design-guide.md:
For shared code strategies, see references/dependency-analysis.md:
For monolith decomposition, see references/strangler-pattern.md:
For testing strategies, see references/module-testing.md:
| Problem | Cause | Solution |
|---|---|---|
| Module too large | Multiple responsibilities | Apply SRP - split into focused modules |
| Circular dependency detected | Modules depend on each other | Extract common code or invert dependency |
| Cannot test module in isolation | Hidden dependencies | Apply DIP - inject dependencies |
| API breaks consumers | Missing versioning | Implement semantic versioning |
| Shared module causes ripple changes | Too much shared code | Reduce shared code surface, consider duplication |
| Unclear module boundaries | No bounded context analysis | Map domain concepts, identify change vectors |
| High coupling detected | Direct concrete dependencies | Introduce interfaces, reduce API surface |
| Low cohesion in module | Unrelated functionality | Move unrelated code to appropriate modules |
Domain Analysis:
- Products, Orders, Customers, Payments, Shipping
Module Breakdown:
1. ProductCatalog Module
- Product CRUD
- Category management
- Search/filtering
2. OrderManagement Module
- Order creation/cancellation
- Order status tracking
- Order history
3. CustomerModule
- Customer profiles
- Authentication
- Address management
4. PaymentModule
- Payment processing
- Refunds
- Payment methods
5. ShippingModule
- Shipping rate calculation
- Label generation
- Tracking
6. InventoryModule
- Stock levels
- Reservations
- Reorder alerts
Dependency Graph:
WebAPI
|
+-> ProductCatalog
+-> OrderManagement --> PaymentModule
| |-> ShippingModule
| +-> InventoryModule
+-> CustomerModule
Before (Monolith):
UserService (2000 lines)
- registerUser()
- authenticateUser()
- resetPassword()
- updateProfile()
- uploadAvatar()
- sendVerificationEmail()
- checkPermissions()
- generateUserReport()
After (Modules):
1. AuthenticationModule
- authenticateUser()
- resetPassword()
2. UserProfileModule
- updateProfile()
- uploadAvatar()
3. RegistrationModule
- registerUser()
- sendVerificationEmail()
4. PermissionsModule
- checkPermissions()
5. UserReportingModule
- generateUserReport()
| Resource | Use When |
|---|---|
| SOLID Principles Reference | Applying design principles |
| Boundary Patterns | Identifying module boundaries |
| API Design Guide | Designing module interfaces |
| Dependency Analysis | Analyzing and visualizing dependencies |
| Strangler Pattern | Breaking up monoliths gradually |
| Module Testing Guide | Testing modular systems |
| Phase | Purpose | Key Output |
|---|---|---|
| Principle Application | Apply SOLID to guide design | Principle compliance checklist |
| Boundary Identification | Find natural module boundaries | Module boundary map |
| API Design | Define module interfaces | API contracts |
| Dependency Management | Manage relationships | Dependency graph |
| Validation | Verify quality | Coupling/cohesion metrics |
Key Principles:
| Issue | Cause | Solution |
|---|---|---|
| Circular dependency detected | Modules depend on each other bidirectionally | Use tldr arch to visualize layers, extract shared interface to utility module, apply Dependency Inversion Principle |
| Module boundaries unclear | Insufficient domain analysis or overlapping responsibilities | Review boundary-patterns.md, map domain concepts again, identify change vectors, redefine bounded contexts |
| Cannot test module in isolation | Hidden dependencies or tight coupling | Apply Dependency Injection, create interface abstractions, use mocking framework for dependencies |
| API breaking consumer modules | Missing versioning strategy or backward compatibility | Implement semantic versioning, add deprecation warnings before removal, maintain parallel versions during transition |
| High coupling metrics | Direct concrete dependencies between modules | Introduce interface abstractions, reduce API surface area, review api-design-guide.md for minimal surface pattern |
| Module too large (>500 LOC) | Multiple responsibilities violating SRP | Split by responsibility using solid-principles.md, create sub-modules with focused interfaces |
| Shared module causes ripple changes | Over-shared code between modules | Review dependency-analysis.md, reduce shared surface, consider strategic duplication over coupling |
| Deployment dependencies blocking independence | Runtime coupling or database sharing | Plan strangler pattern migration using strangler-pattern.md, introduce service boundaries, separate databases |
Final Note: Perfect modularization is achieved iteratively. Start with clear principles, make reasonable boundary decisions, and refine as you learn more about the system's actual behavior and change patterns.