analyze-codebase

Analyze a codebase to generate a comprehensive architecture and structure report. Use when user wants to understand a codebase, explore project structure, or generate analysis.

16 stars

Best use case

analyze-codebase is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Analyze a codebase to generate a comprehensive architecture and structure report. Use when user wants to understand a codebase, explore project structure, or generate analysis.

Teams using analyze-codebase should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/analyze-codebase/SKILL.md --create-dirs "https://raw.githubusercontent.com/diegosouzapw/awesome-omni-skill/main/skills/development/analyze-codebase/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/analyze-codebase/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How analyze-codebase Compares

Feature / Agentanalyze-codebaseStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Analyze a codebase to generate a comprehensive architecture and structure report. Use when user wants to understand a codebase, explore project structure, or generate analysis.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Codebase Analysis Workflow

Execute a 3-phase codebase analysis workflow. This workflow explores a codebase, analyzes its architecture, and generates a comprehensive report.

**CRITICAL: Complete ALL 3 phases.** After completing each phase, immediately proceed to the next phase without waiting for user prompts.

## Phase Overview

1. **Codebase Exploration** - Explore structure, patterns, and dependencies
2. **Deep Analysis** - Analyze findings to identify architecture and patterns
3. **Output & Context Loading** - Present options and deliver results in user's preferred format

---

## Phase 1: Codebase Exploration

**Goal:** Thoroughly explore the codebase to gather raw findings.

1. Determine the analysis path:
   - If `$ARGUMENTS` was provided, use that path
   - Otherwise, use the current working directory
   - Inform the user of the scope being analyzed

2. **Launch 3 code-explorer agents in parallel** using the Task tool with `subagent_type: "dev-tools:code-explorer"`:

   **Agent 1: Project Structure & Configuration**
   ```
   Explore and analyze the project structure and configuration.
   Path to analyze: [path]

   Focus on:
   - Project root structure (directories and their purposes)
   - Entry points (main files, index files, CLI entry points)
   - Configuration files (package.json, pyproject.toml, tsconfig.json, etc.)
   - Build configuration (webpack, vite, rollup, etc.)
   - Development tools (.eslintrc, .prettierrc, etc.)
   - CI/CD configuration (.github/workflows, Jenkinsfile, etc.)
   - Environment configuration (.env.example, config files)

   Return a structured report of:
   - Directory structure overview
   - Key entry points and their purposes
   - Configuration summary
   - Build and development tooling
   ```

   **Agent 2: Core Modules & Business Logic**
   ```
   Explore and analyze the core modules and business logic.
   Path to analyze: [path]

   Focus on:
   - Core source directories (src/, lib/, app/)
   - Key classes, functions, and modules
   - Business logic and domain models
   - State management (if applicable)
   - Data models and schemas
   - Service layers and APIs
   - Utility and helper modules

   Return a structured report of:
   - Key modules and their responsibilities
   - Important classes/functions with brief descriptions
   - Design patterns observed
   - Code organization patterns
   ```

   **Agent 3: Dependencies & Integrations**
   ```
   Explore and analyze dependencies and external integrations.
   Path to analyze: [path]

   Focus on:
   - Package dependencies (production vs development)
   - Internal module dependencies (how modules import each other)
   - External API integrations
   - Database connections and ORM usage
   - Third-party service integrations
   - Authentication/authorization mechanisms
   - Caching layers
   - Message queues or event systems

   Return a structured report of:
   - Dependency analysis (major frameworks, libraries)
   - External integration points
   - Data storage mechanisms
   - Communication patterns
   ```

3. **Wait for all agents to complete** and collect their findings.

4. **Synthesize exploration findings:**
   - Combine results from all 3 agents
   - Identify overlapping or conflicting information
   - Note any gaps in coverage
   - Create a consolidated findings document

---

## Phase 2: Deep Analysis

**Goal:** Analyze exploration findings to identify architecture, patterns, and insights.

1. **Launch codebase-analyzer agent** using the Task tool with `subagent_type: "dev-tools:codebase-analyzer"`:

   ```
   Analyze the following codebase exploration findings and produce a deep analysis.

   Path analyzed: [path]

   ## Exploration Findings

   [Include the synthesized findings from Phase 1]

   ---

   Produce a comprehensive analysis covering:
   1. Architecture style identification
   2. Key modules and their responsibilities
   3. Dependency relationships between modules
   4. Technology stack summary
   5. Code patterns and conventions
   6. Entry points and data flow
   7. External integrations
   8. Testing approach
   9. Build and deployment patterns
   10. Strengths and areas for improvement
   ```

2. **Wait for analysis to complete** and collect the results.

---

## Phase 3: Output & Context Loading

**Goal:** Present output options and deliver analysis results in the user's preferred format.

1. **Ask user for output preferences** using `AskUserQuestion` with multi-select:

   ```
   Question: "How would you like to use the analysis results?"
   Header: "Output"
   Options:
     - Label: "Save detailed report"
       Description: "Generate a comprehensive markdown report to internal/reports/"
     - Label: "Load into session context"
       Description: "Inject analysis into this session so I can reference it when answering questions"
     - Label: "Update project docs"
       Description: "Update README.md and/or CLAUDE.md with analysis summary"
   MultiSelect: true
   ```

2. **Handle the user's selection:**

   ### If NEITHER option is selected:
   - Display a brief summary (~200-300 words) directly in the chat
   - Confirm: "Analysis complete. Key findings displayed above."
   - Skip to final message

   ### If "Save detailed report" is selected:
   - Ensure output directory exists: `mkdir -p internal/reports`
   - **Launch report-generator agent** using Task tool with `subagent_type: "dev-tools:report-generator"`:
     ```
     Generate a comprehensive codebase analysis report in markdown format.

     Path analyzed: [path]
     Analysis date: [current date]

     ## Analysis Findings

     [Include the complete analysis from Phase 2]

     ---

     Generate a well-structured markdown report and save it to:
     internal/reports/codebase-analysis-report.md
     ```
   - Confirm: "Report saved to `internal/reports/codebase-analysis-report.md`"

   ### If "Load into session context" is selected:
   - Ask for detail level (Condensed summary or Full analysis)
   - Display the formatted context directly in the response
   - Confirm: "Analysis loaded into session context."

   ### If "Update project docs" is selected:
   - Ask which files to update (README.md, CLAUDE.md, or both)
   - Launch report-generator agent with appropriate mode
   - Confirm which files were updated

3. **Final message:**
   - Summarize what was done
   - Offer next steps: ask questions, run on different path, deep-dive modules

---

## Error Handling

If any phase fails:
1. Explain what went wrong
2. Ask the user how to proceed: Retry, Skip, or Abort

If an agent returns incomplete results:
- Note the gaps in coverage
- Continue with available information
- Document limitations in the final report

## Agent Coordination

When launching parallel agents in Phase 1:
- Give each agent a distinct focus area
- Wait for all agents to complete before synthesizing
- Handle agent failures gracefully (continue with partial results)

When calling Task tool for agents:
- Use `model: "opus"` for codebase-analyzer agent
- Use default model (sonnet) for code-explorer and report-generator agents

Related Skills

analyze-rust-optimizations

16
from diegosouzapw/awesome-omni-skill

This skill performs thorough analysis of Rust libraries to find optimization opportunities. It should be used when reviewing Rust code for performance improvements, memory efficiency, or when profiling indicates bottlenecks. Focuses on runtime performance and memory usage through dynamic profiling tools and static code analysis.

analyze-project-architecture

16
from diegosouzapw/awesome-omni-skill

LLM-based architectural analysis that transforms raw project data into meaningful structure

analyze-pr-performance

16
from diegosouzapw/awesome-omni-skill

Analyze code review pipeline performance for a specific PR. Use when investigating slow PRs, identifying bottlenecks, or debugging performance issues in code reviews.

analyze

16
from diegosouzapw/awesome-omni-skill

Deep analysis and investigation

analyze-m1-module-for-migration

16
from diegosouzapw/awesome-omni-skill

Systematically analyze a Magento 1 module to determine its purpose, usage, and migration requirements for Magento 2. Use when you need to decide whether to migrate a M1 module, find alternatives, or skip it.

analyze-function

16
from diegosouzapw/awesome-omni-skill

Deep line-by-line analysis of a function or method. Explains what each line does, why it's written that way, performance implications, edge cases, and design patterns. Use when user says "analyze-function", "analyze {function}", "deep dive on {function}", or "explain {function} line by line".

analyze-friction

16
from diegosouzapw/awesome-omni-skill

Orchestrate 3-stage friction analysis workflow across conversations. Extracts raw friction, abstracts patterns, and presents for approval. Use when user wants to analyze conversation history for improvement opportunities.

analyze-code

16
from diegosouzapw/awesome-omni-skill

Deep code analysis using consultant agent. Identifies technical debt, risks, and improvement opportunities.

analyze-code-structure

16
from diegosouzapw/awesome-omni-skill

Examine code organization and identify structural patterns. Use when reviewing module design.

analyze-architecture

16
from diegosouzapw/awesome-omni-skill

Comprehensive brownfield architecture analysis for existing codebases. Discovers structure, identifies patterns, assesses quality, calculates production readiness, and provides actionable recommendations. Use when analyzing existing codebases to understand architecture, assess quality, or prepare for modernization.

acc-analyze-solid-violations

16
from diegosouzapw/awesome-omni-skill

Analyzes PHP codebase for SOLID principle violations. Detects God classes (SRP), type switches (OCP), broken contracts (LSP), fat interfaces (ISP), and concrete dependencies (DIP). Generates actionable reports with severity levels and remediation recommendations.

30-analyze-impact-150

16
from diegosouzapw/awesome-omni-skill

[30] ANALYZE. Understand how changes impact the system — what's the core, what's affected, what depends on what. Use when planning changes, analyzing systems, debugging issues, or anytime you need to see the full picture of cause and effect. Triggers on "what's affected", "impact analysis", "dependencies", "scope mapping", or when you need to understand ripple effects.