codebase-consolidation
Codebase Consolidation & Analysis
Systematically analyze codebases to identify consolidation opportunities, document architecture, and generate actionable insights.
Quick Reference
- Analysis Dimensions - 8 analysis dimensions with detailed criteria
- Consolidation Patterns - Common refactoring patterns with examples
- Report Templates - Output format templates
When to Use
- Starting on a new codebase - Understand structure quickly
- Planning refactoring - Identify consolidation opportunities
- Code review preparation - Comprehensive analysis before changes
- Documentation needs - Generate architecture docs
- Technical debt assessment - Quantify and prioritize improvements
- Onboarding new developers - Create codebase overview
- Pre-release audits - Quality and security review
Don't use for: Single file analysis, quick bug fixes, simple feature additions
Core Purpose
Comprehensive codebase analysis:
- Code Duplication - Find duplicate code for consolidation
- Architectural Analysis - Document system structure and patterns
- Refactoring Opportunities - Identify improvement areas
- Technical Debt Assessment - Quantify and prioritize debt
- Documentation Generation - Create architecture diagrams and docs
- Multi-Perspective Analysis - Review from architect, developer, product views
- Quality Metrics - Complexity, coverage, maintainability
Analysis Dimensions
| Dimension | Focus |
|---|---|
| Code Duplication | Find duplicate/similar code blocks |
| Architectural Structure | System architecture and component relationships |
| Code Organization | Module structure and separation of concerns |
| Refactoring Opportunities | Large files, complex functions |
| Technical Debt | TODOs, missing tests, outdated deps |
| Quality Metrics | LOC, complexity, coverage |
| Design Patterns | Patterns and anti-patterns in use |
| Cross-Cutting Concerns | Error handling, logging, security |
See analysis-dimensions.md for detailed criteria.
Analysis Workflow
- Discovery - Project structure, file counts, configuration
- Dependency Analysis - cargo tree, outdated, audit
- Duplication Detection - Large files, tech debt markers
- Complexity Analysis - LOC statistics, long functions
- Architecture Mapping - Components, dependencies, data flow
- Quality Assessment - Coverage, linting, formatting
- Documentation Review - Doc generation, API documentation
- Synthesis - Comprehensive report with recommendations
Output Formats
- Executive Summary - Health score, key metrics, priorities
- Architecture Documentation - System diagram, patterns, data flows
- Refactoring Roadmap - Phased plan with tasks and estimates
- Technical Debt Report - Quantified debt, payoff strategy
- Onboarding Document - Developer guide to codebase
See report-templates.md for complete templates.
Best Practices
✓ Start with high-level structure, use automated tools, prioritize findings, provide concrete examples with file paths, estimate effort, consider multiple perspectives
✗ Don't analyze without clear goals, only report problems, provide generic advice, ignore context, recommend big rewrites, overwhelm with detail
See consolidation-patterns.md for refactoring patterns and examples.
More from d-o-hub/rust-self-learning-memory
loop-agent
Execute workflow agents iteratively for refinement and progressive improvement until quality criteria are met. Use when tasks require repetitive refinement, multi-iteration improvements, progressive optimization, or feedback loops until convergence.
51web-search-researcher
Research topics using web search and content fetching to find accurate, current information. Use when you need modern information, official documentation, best practices, technical solutions, or comparisons beyond your training data.
46perplexity-researcher-reasoning-pro
Highest level of research and reasoning capabilities for complex decision-making with significant consequences, strategic planning, technical architecture decisions, multi-stakeholder problems, or high-complexity troubleshooting requiring expert-level judgment and sophisticated reasoning chains. Prioritizes actively maintained repositories and validates website sources for 2025 relevance.
44context-retrieval
Retrieve relevant episodic context from memory for informed decision-making. Use when you need past episodes, patterns, or solutions to similar tasks.
44rust-code-quality
Perform comprehensive Rust code quality reviews against best practices for async Rust, error handling, testing, and project structure
43codebase-analyzer
Analyze implementation details, trace data flow, explain technical workings, locate files, and consolidate codebases. Use when you need to understand HOW code works, find file locations, or assess technical debt.
40