Back to Skills

Analyze Codebase

mpazaryna
Updated Today
13 views
2
2
View on GitHub
Metageneral

About

This skill analyzes a codebase to automatically generate a developer-focused `codebase_analysis.md` file. It detects project types (like MCP servers or Next.js apps) and merges technology-specific templates with a base template. Use it when you need a comprehensive technical overview of a codebase's structure and technologies.

Documentation

Analyze Codebase (Modular Templates)

Follow the Workflow for the FOLDER_PATH then Report the completed work.

Variables

FOLDER_PATH: (to be provided by user)

Workflow

If no FOLDER_PATH is provided, STOP immediately and ask the user to provide it.

Step 1: Project Detection & Template Loading

First, analyze the target directory to detect project type and load appropriate templates:

  1. Scan for key indicator files in the target directory
  2. Load base analysis template from .assets/base.md
  3. Load technology-specific templates based on detection
  4. Merge templates into comprehensive analysis structure

Step 2: Technology Detection Logic

Detect project types by scanning for these files:

  • MCP Server: package.json contains @modelcontextprotocol/sdk
  • Next.js: next.config.js or next.config.ts exists
  • Cloudflare Worker: wrangler.toml or wrangler.jsonc exists
  • React App: package.json contains react
  • TypeScript: tsconfig.json exists
  • Jest Testing: jest.config.js or jest.config.cjs exists
  • iOS App: Package.swift or *.xcodeproj exists
  • Python: requirements.txt or pyproject.toml exists

Step 3: Template Integration

For each detected technology, read the corresponding template file:

Base Template: Always include /assets/base.md

Technology Templates (include if detected):

  • MCP Server → /assets/mcp-server.md
  • Next.js → /assets/nextjs.md
  • Cloudflare Workers → /assets/cloudflare-worker.md
  • TypeScript → /assets/typescript.md
  • Jest → /assets/jest-testing.md
  • iOS → /assets/ios-swift.md

Step 4: Execute Comprehensive Analysis

Using the merged template structure, analyze the codebase following these sections:

  1. Project Overview (from base template)
  2. Technology-Specific Analysis (from detected templates)
  3. Directory Structure Analysis (enhanced by tech templates)
  4. File-by-File Breakdown (guided by tech-specific patterns)
  5. Architecture Deep Dive (incorporating tech-specific patterns)
  6. Testing Analysis (if testing framework detected)
  7. Deployment Analysis (if deployment config detected)
  8. Technology Stack Breakdown (comprehensive based on detections)
  9. Visual Architecture Diagram (enhanced with tech-specific components)
  10. Key Insights & Recommendations (tech-specific improvements)

Step 5: Create Analysis Document

Create a comprehensive codebase_analysis.md that includes:

  • Detected technologies and their specific analysis sections
  • Integration between different technology stacks
  • Technology-specific recommendations and best practices

Report

# [Project Name] Modular Codebase Analysis

> Modular Codebase Analysis - Last updated: [timestamp]
> Detected Technologies: [list of detected tech stack]

## Technology Detection Results
- **Project Type**: [Primary type based on detection]
- **Tech Stack**: [All detected technologies]
- **Templates Applied**: [List of templates that were merged]

## Quick Reference

### Primary Entry Points
[Technology-specific entry points based on detected stack]

### Key Integration Files
[Files specific to detected technologies]

### Common Patterns
[Patterns from merged templates]

## Testing Focus
[Testing analysis based on detected framework]

## Environment Setup
[Environment information based on detected deployment type]

## Debug Tips
[Debug information specific to detected technologies]

## Technology-Specific Insights
[Insights from each applied template]

Example Usage

When you run this command on the compass project:

  1. Detection Phase:

    • Finds wrangler.jsonc → Cloudflare Worker detected
    • Finds @modelcontextprotocol/sdk in package.json → MCP Server detected
    • Finds jest.config.cjs → Jest testing detected
    • Finds tsconfig.json → TypeScript detected
  2. Template Loading:

    • Read /assets/base.md
    • Read /assets/mcp-server.md
    • Read /assets/cloudflare-worker.md
    • Read /assets/typescript.md
    • Read /assets/jest-testing.md
  3. Merged Analysis: Creates comprehensive analysis combining all templates

This approach ensures you get the right analysis depth for each project's specific technology stack.

Quick Install

/plugin add https://github.com/mpazaryna/claude-toolkit/tree/main/learn-project

Copy and paste this command in Claude Code to install this skill

GitHub 仓库

mpazaryna/claude-toolkit
Path: generated-skills/learn-project
agentic-frameworkagentic-workflowclaude-code

Related Skills