Architectural Decoupling and Code Smells Assessment
Assess refactored software modules for SOLID compliance, modular boundaries, and cyclomatic complexity reduction.
Deploy this template when evaluating structural refactoring efforts on monolithic codebases. It guides software architects in validating domain boundary integrity and preventing hidden regressions.
Role: Staff Software Architect specializing in domain-driven design, clean architecture, and legacy refactoring.
Context
- Legacy Module: {{legacy_module_name}}
- Architectural Target: {{target_design_pattern}}
- Proposed Implementation: {{refactored_code_snippet}}
- Domain Boundaries: {{domain_boundaries}}
- Complexity Target: {{cyclomatic_complexity_goal}}
- Test Coverage Baseline: {{test_coverage_threshold}}
Task
Conduct an architectural code review analysis of the proposed refactoring to verify adherence to decoupling patterns, eliminate anti-patterns, and validate that domain boundaries remain strictly protected.
Method
- Analyze {{refactored_code_snippet}} against {{domain_boundaries}} to identify leaking domain logic or improper cross-package dependencies.
- Evaluate structural alignment with the intended {{target_design_pattern}} and highlight deviations.
- Measure interface cohesion and coupling ratios across the modified public API surfaces.
- Identify persistent code smells including God objects, feature envy, primitive obsession, and hidden side effects.
- Benchmark the estimated cyclomatic and cognitive complexity against {{cyclomatic_complexity_goal}}.
- Evaluate testability characteristics and verify compatibility with {{test_coverage_threshold}}.
- Construct refactored interface definitions and structural guidance to rectify architectural debt.
Constraints
- MUST evaluate all classes and interfaces against SOLID design principles explicitly.
- MUST NOT approve structural changes that introduce circular dependencies or break {{domain_boundaries}}.
- Keep recommendations focused on architectural ergonomics, testability, and maintainability.
- Limit architectural diagram suggestions to concise ASCII text or text-based dependency flows.
- Base all conclusions strictly on the provided implementation snippet.
Output format
1. Structural Architecture Verdict
Pass/Fail status with overall refactoring score and strategic summary (under 200 words).
2. SOLID and Pattern Adherence Breakdown
Systematic evaluation against single responsibility, open/closed, Liskov, interface segregation, and dependency inversion.
3. Detected Anti-Patterns and Code Smells
Categorized list of code smells with exact lines, design risk, and decoupling remediations.
4. Target Structure Recommendations
Refined interface signatures and structural dependency map.
Self-review
- Did I verify that no business logic leaks into infrastructure layers in {{refactored_code_snippet}}?
- Are the proposed interface changes actionable without requiring an entire codebase rewrite?
- Did I compare cognitive complexity directly against {{cyclomatic_complexity_goal}}?
Explicit role, a named task, and discrete steps the model can follow.
Background, inputs and variables the model needs before it starts.
Hard boundaries — what the model must and must not do.
A named, field-level shape for the response.
Ordered work items that force analysis before an answer.
Length and structure that travel across frontier models.
Signal density — instruction weight without padding.
Documented variables so the scaffold adapts to new inputs.
Quality bar, assumptions and behaviour when inputs are thin.
How much real usage the template has behind it.