Analyze Codebase
AnalysisComprehensive codebase analysis agent for directory structure mapping, file inventory, architecture diagrams, and code quality assessment.
Analysis Capabilities
- Directory Structure: Maps complete project organization
- File Inventory: Catalogs all source files and assets
- Architecture Diagrams: Generates visual system representations
- Dependency Analysis: Maps internal and external dependencies
- Code Quality: Assesses maintainability and complexity
Brownfield Analysis Mode GSD Pattern
For existing projects, run PARALLEL 7-file analysis to deeply understand the codebase before planning new features.
This pattern spawns 7 concurrent analysis tasks to minimize time while providing comprehensive codebase mapping. All output files are generated in /docs/codebase-analysis/.
The 7 Parallel Analysis Files
System architecture, design patterns, layer boundaries, key abstractions, data flow
Directory layout, file organization, naming conventions, module boundaries
Coding standards, naming patterns, code style, anti-patterns found
Test coverage, frameworks, patterns, mocking approaches, coverage gaps
External APIs, databases, third-party services, internal services
TODO/FIXME comments, deprecated code, known issues, upgrade needs
High-risk files, complex coupling, change hotspots, single points of failure
Example Analysis File: FRAGILE-AREAS.md
# Fragile Areas Analysis
## High-Risk Files
| File | Risk Level | Reason | Recommendation |
|------|------------|--------|----------------|
| auth/session.ts | HIGH | Core auth, many deps | Add tests first |
| db/migrations.ts | HIGH | Data integrity | Never modify directly |
## Complex Coupling
[Files with high coupling that require careful changes]
## Change Hotspots
[Files changed most frequently - from git log]
## Missing Tests
[Critical paths without test coverage]
## Single Points of Failure
[Code that many other parts depend on]
- CODEBASE-OVERVIEW.md - Synthesize key findings from all 7 files
- Change-risk-matrix - Which areas are safe vs risky to modify
- Onboarding-guide - How a new developer should approach this codebase
- BRD-tracker update - Note any constraints discovered for new feature development
Generated Reports
- Project structure overview
- Technology stack identification
- Entry point mapping
- Configuration file analysis
- Test coverage assessment
When to Use
- Joining a new project
- Onboarding team members
- Architecture documentation
- Technical debt assessment
- Migration planning
- Brownfield development - Before adding new features to existing codebases