| name | architecture-review |
| description | Review code for architecture compliance against GopherPaw's layered architecture rules. Use when the user asks to review, audit, or check code for architecture violations, dependency issues, or design pattern compliance. |
Architecture Compliance Review
When to Use
- After implementing a new module (post-implementation check)
- Before merging significant changes
- When user asks "does this code follow our architecture?"
- Periodic health check of the codebase
Review Checklist
Review Progress:
- [ ] Check 1: Layer dependency compliance
- [ ] Check 2: Interface-first design
- [ ] Check 3: Error handling completeness
- [ ] Check 4: Test coverage and edge cases
- [ ] Check 5: Global state and concurrency safety
- [ ] Check 6: Contract document alignment
Check 1: Layer Dependency Compliance
Verify that imports follow the dependency rules:
Allowed:
cmd/ --> internal/* (any)
channels/ --> agent/ (interface only)
agent/ --> llm/, memory/, tools/ (interface only), config/
scheduler/ --> agent/ (interface only), config/
llm/, memory/, tools/ --> config/ (only)
Forbidden:
llm/ --> agent/ (infra must not import domain)
memory/ --> agent/ (infra must not import domain)
tools/ --> channels/ (tools must not import interface layer)
Any circular dependencies
How to check:
- Read the import statements of each
.go file in the target package
- Verify each import is allowed by the dependency matrix above
- Flag any violations with the specific file and import path
Check 2: Interface-First Design
Verify that consumers depend on interfaces, not concrete types:
Check 3: Error Handling Completeness
Check 4: Test Coverage and Edge Cases
Check 5: Global State and Concurrency
Check 6: Contract Document Alignment
Output Format
# Architecture Review Report
## Summary
[PASS/FAIL] - [N] violations found
## Violations
### [Severity: Critical/Warning/Info]
- **File**: `internal/xxx/yyy.go`
- **Check**: [which check failed]
- **Issue**: [description]
- **Fix**: [recommended fix]
## Recommendations
- [General improvement suggestions]
Severity Levels
- Critical: Must fix before proceeding (dependency violations, missing error handling)
- Warning: Should fix soon (missing tests, undocumented interfaces)
- Info: Nice to have (naming suggestions, minor style issues)