AI Skill Report Card
Reviewing Code Architecture
Code Architecture Review
Quick Start
Python# Example review of a problematic class class UserService: def __init__(self): self.db = MySQLConnection() # Tight coupling self.email = SMTPClient() # Multiple responsibilities def create_user(self, data): # Missing validation, error handling user = User(**data) self.db.save(user) self.email.send_welcome(user.email) return user # Issues identified: # 1. Violates Single Responsibility Principle # 2. Tight coupling to concrete implementations # 3. Missing input validation # 4. No error handling # 5. Technical debt: hardcoded dependencies
Recommendation▾
Add more concrete input/output examples with actual code snippets showing before/after refactoring
Workflow
Progress:
- Scan for architectural smells - Large classes, long methods, deep nesting
- Check SOLID principles - SRP, OCP, LSP, ISP, DIP violations
- Identify technical debt - TODO comments, deprecated APIs, workarounds
- Review error handling - Missing try-catch, silent failures
- Assess coupling/cohesion - Tight coupling, low cohesion patterns
- Check security issues - SQL injection, XSS, hardcoded secrets
- Evaluate testability - Static dependencies, complex constructors
- Suggest refactoring - Concrete improvement recommendations
Recommendation▾
Include specific tools or metrics for measuring technical debt and architectural quality
Examples
Example 1: Input: Method with 150 lines handling user registration, validation, email sending, and logging Output:
- Violation: Single Responsibility Principle
- Technical Debt: Monolithic method reduces maintainability
- Solution: Extract ValidationService, EmailService, AuditService
- Refactor: Use Command pattern with discrete handlers
Example 2: Input: Repository class directly instantiating database connections Output:
- Violation: Dependency Inversion Principle
- Bug Risk: Connection leaks, no transaction management
- Solution: Inject IDbConnection interface, use connection pooling
- Pattern: Repository with Unit of Work
Recommendation▾
Provide templates for common architectural review reports or checklists for different code review scenarios
Best Practices
- Start with high-impact issues - Focus on bugs and security first
- Provide specific solutions - Don't just identify problems, suggest fixes
- Consider context - Legacy systems may need gradual refactoring approach
- Balance pragmatism - Not every principle violation needs immediate fixing
- Use architectural patterns - Suggest established patterns (Strategy, Factory, Observer)
- Think in layers - Separate concerns across presentation, business, data layers
- Consider non-functional requirements - Performance, scalability, maintainability
Common Pitfalls
- Over-engineering - Don't suggest complex patterns for simple problems
- Ignoring business context - Consider delivery timelines and technical debt tolerance
- Missing the forest for trees - Focus on systemic issues, not just code style
- Perfectionism - Prioritize critical issues over minor violations
- One-size-fits-all - Tailor suggestions to team skill level and codebase maturity
- Forgetting testing - Always consider how changes affect test coverage and complexity