jpskill.com
🛠️ 開発・MCP コミュニティ

codebase-analysis

Systematically analyze codebase structure, complexity, dependencies, and architectural patterns to understand project organization

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o codebase-analysis.zip https://jpskill.com/download/17331.zip && unzip -o codebase-analysis.zip && rm codebase-analysis.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/17331.zip -OutFile "$d\codebase-analysis.zip"; Expand-Archive "$d\codebase-analysis.zip" -DestinationPath $d -Force; ri "$d\codebase-analysis.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して codebase-analysis.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → codebase-analysis フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

Codebase Analysis Skill

目的

プロジェクトのコードベースを包括的かつ体系的に分析し、以下を理解する。

  • プロジェクトの構造と構成
  • 技術スタックと依存関係
  • アーキテクチャパターンと規約
  • コードの複雑さと品質メトリクス
  • 主要なコンポーネントとその関係

この Skill を使用するタイミング

以下の場合に自動的に起動する。

  • 新しいプロジェクトでの作業を開始するとき
  • ユーザーがコードベースを「分析」、「レビュー」、「監査」、または「理解」するように依頼したとき
  • アーキテクチャに関する決定を行う前
  • リファクタリングまたは大規模な変更を計画するとき
  • 新しい開発者をオンボーディングするとき

分析方法

フェーズ 1: 発見 (プロジェクト構造)

目標: プロジェクトのハイレベルな構成をマッピングする

ツール: Glob, LS, Read

プロセス:

  1. package.jsontsconfig.json、またはフレームワーク固有の設定を読み取ってプロジェクトの種類を特定する
  2. ルートレベルで LS を使用してディレクトリ構造をマッピングする:
    特定すべき主要なディレクトリ:
    - ソースコード: src/, app/, pages/, components/
    - テスト: __tests__/, tests/, *.test.*, *.spec.*
    - 設定: config/, .config/
    - ドキュメント: docs/, README.md
    - ビルド出力: dist/, build/, .next/
  3. 重要なファイルをスキャンする:
    • ビルド設定: vite.config.*, webpack.config.*, next.config.*
    • TypeScript: tsconfig.json, tsconfig.*.json
    • パッケージ管理: package.json, package-lock.json, yarn.lock, pnpm-lock.yaml
    • 環境: .env*, .env.example
    • Git: .gitignore, .git/

フェーズ 2: 技術スタック分析

目標: フレームワーク、ライブラリ、およびバージョンを特定する

ツール: Read, Grep

プロセス:

  1. package.json を読み取る:

    • dependencies (ランタイムライブラリ) を抽出する
    • devDependencies (開発ツール) を抽出する
    • scripts (利用可能なコマンド) をメモする
    • engines (Node.js のバージョン要件) を確認する
  2. フレームワークを特定する:

    • Next.js: 依存関係に next があるか、next.config.*app/ または pages/ ディレクトリがあるかを確認する
    • React: reactreact-dom があるかを確認する
    • Vue: vue*.vue ファイルがあるかを確認する
    • Svelte: svelte*.svelte ファイルがあるかを確認する
    • Angular: @angular/coreangular.json があるかを確認する
  3. 主要なライブラリを特定する:

    • 状態管理: Redux, Zustand, MobX, Pinia
    • ルーティング: react-router, vue-router, next/navigation
    • UI ライブラリ: MUI, Ant Design, shadcn/ui, Chakra UI
    • スタイリング: Tailwind CSS, styled-components, emotion, CSS modules
    • テスト: Vitest, Jest, Playwright, Cypress
    • ビルドツール: Vite, Webpack, esbuild, Turbopack

フェーズ 3: アーキテクチャパターン分析

目標: コードの構成とパターンを理解する

ツール: Grep, Glob, Read

プロセス:

  1. コンポーネントパターン (React/Vue/Svelte の場合):

    Glob を使用して以下を検索する: **/*.{jsx,tsx,vue,svelte}
    分析:
    - コンポーネントの命名規則
    - ファイル構造 (同じ場所に配置されたスタイル、テスト)
    - コンポーネントのサイズ (コード行数)
  2. API/Backend パターン:

    Grep を使用して以下を検索する:
    - API ルート: "export.*GET|POST|PUT|DELETE"
    - データベースクエリ: "prisma\.|mongoose\.|sql"
    - 認証: "auth|jwt|session"
  3. 状態管理パターン:

    Grep を使用して以下を検索する:
    - Context API: "createContext|useContext"
    - Redux: "createSlice|useSelector"
    - Zustand: "create.*useStore"
  4. ファイル構成パターン:

    • Monorepo: packages/apps/turbo.jsonnx.json があるかを確認する
    • Feature-based: features/modules/ のようなディレクトリがあるかを確認する
    • Layer-based: components/services/utils/hooks/ があるかを確認する

フェーズ 4: コード品質と複雑さの評価

目標: 潜在的な問題と技術的負債を特定する

ツール: Grep, Bash, Read

プロセス:

  1. Linting & Formatting:

    • 以下があるかを確認する: .eslintrc*, .prettierrc*, biome.json
    • 利用可能な場合はリンターを実行する: npm run lint (Bash 経由)
  2. テストカバレッジ:

    • テストファイルを検索する: Glob を使用して **/*.{test,spec}.{js,ts,jsx,tsx} を検索する
    • カバレッジを計算する: 利用可能な場合は npm run test:coverage を実行する
  3. TypeScript の厳密さ:

    • tsconfig.json を読み取る
    • strict: truestrictNullChecks などがあるかを確認する
    • @ts-ignore または any の使用箇所を検索する (Grep)
  4. コードの複雑さの指標:

    Grep を使用して潜在的な問題をフラグ付けする:
    - 大きなファイル: 500 行を超えるファイルを検索する
    - 深いネスト: 過剰なインデントを検索する
    - TODO/FIXME コメント: "TODO|FIXME|HACK" を Grep する
    - コンソールログ: "console\.(log|debug|warn)" を Grep する

フェーズ 5: 依存関係とセキュリティ分析

目標: 古いまたは脆弱な依存関係を特定する

ツール: Bash, Read

プロセス:

  1. ロックファイルを確認する:

    • package-lock.jsonyarn.lockpnpm-lock.yaml の存在
  2. セキュリティ監査を実行する (npm/pnpm が利用可能な場合):

    npm audit --json
    # or
    pnpm audit --json
  3. 古い依存関係を確認する:

    npm outdated

出力形式

構造化された分析レポートを提供する。

# Codebase Analysis Report

## Project Overview
- **Name**: [package.json からのプロジェクト名]
- **Type**: [フレームワーク/ライブラリ]
- **Version**: [バージョン]
- **Node.js**: [必要なバージョン]

## Technology Stack
### Core Framework
- [フレームワーク名とバージョン]

### Key Dependencies
- UI: [ライブラリ]
- State: [ライブラリ]
- Routing: [ライブラリ]
- Styling: [ライブラリ]
- Testing: [ライブラリ]

### Build Tools
- [Vite/Webpack/etc]

## Architecture

### Directory Structure

[主要なディレクトリのツリーのような表現]


### Patterns Identified
- [コンポーネントパターン]
- [状態管理のアプローチ]
- [API 構造]
- [ファイル構成]

## Code Quality Metrics
- **TypeScript**: [strict/loose/none]
- **Linting**: [ESLint/Biome/none]
- **Testing**: [X 個のテストファイルが見つかりました, coverage: Y%]
- **Code Issues**: [TODOs: X, Console logs: Y]

## Recommendations
1. [優先度の高い推奨事項]
2. [次の優先度]
3. ...

## Risk Areas
- [潜在的な問題または技術的負債]

## Next Steps
- [分析に基づく推奨されるアクション]

Best Practices

  1. Progressive Detail: ハイレベルから始める
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Codebase Analysis Skill

Objective

Perform comprehensive, systematic analysis of project codebases to understand:

  • Project structure and organization
  • Technology stack and dependencies
  • Architectural patterns and conventions
  • Code complexity and quality metrics
  • Key components and their relationships

When to Use This Skill

Auto-invoke when:

  • Starting work on a new project
  • User asks to "analyze", "review", "audit", or "understand" the codebase
  • Before making architectural decisions
  • Planning refactoring or major changes
  • Onboarding new developers

Analysis Methodology

Phase 1: Discovery (Project Structure)

Goal: Map the high-level project organization

Tools: Glob, LS, Read

Process:

  1. Identify project type by reading package.json, tsconfig.json, or framework-specific configs
  2. Map directory structure using LS at root level:
    Key directories to identify:
    - Source code: src/, app/, pages/, components/
    - Tests: __tests__/, tests/, *.test.*, *.spec.*
    - Config: config/, .config/
    - Documentation: docs/, README.md
    - Build output: dist/, build/, .next/
  3. Scan for important files:
    • Build configs: vite.config.*, webpack.config.*, next.config.*
    • TypeScript: tsconfig.json, tsconfig.*.json
    • Package management: package.json, package-lock.json, yarn.lock, pnpm-lock.yaml
    • Environment: .env*, .env.example
    • Git: .gitignore, .git/

Phase 2: Technology Stack Analysis

Goal: Identify frameworks, libraries, and versions

Tools: Read, Grep

Process:

  1. Read package.json:

    • Extract dependencies (runtime libraries)
    • Extract devDependencies (development tools)
    • Note scripts (available commands)
    • Check engines (Node.js version requirements)
  2. Identify framework:

    • Next.js: Check for next in dependencies, next.config.*, app/ or pages/ directory
    • React: Check for react and react-dom
    • Vue: Check for vue, *.vue files
    • Svelte: Check for svelte, *.svelte files
    • Angular: Check for @angular/core, angular.json
  3. Identify key libraries:

    • State management: Redux, Zustand, MobX, Pinia
    • Routing: react-router, vue-router, next/navigation
    • UI libraries: MUI, Ant Design, shadcn/ui, Chakra UI
    • Styling: Tailwind CSS, styled-components, emotion, CSS modules
    • Testing: Vitest, Jest, Playwright, Cypress
    • Build tools: Vite, Webpack, esbuild, Turbopack

Phase 3: Architecture Pattern Analysis

Goal: Understand code organization and patterns

Tools: Grep, Glob, Read

Process:

  1. Component patterns (for React/Vue/Svelte):

    Use Glob to find: **/*.{jsx,tsx,vue,svelte}
    Analyze:
    - Component naming conventions
    - File structure (co-located styles, tests)
    - Component size (lines of code)
  2. API/Backend patterns:

    Use Grep to search for:
    - API routes: "export.*GET|POST|PUT|DELETE"
    - Database queries: "prisma\.|mongoose\.|sql"
    - Authentication: "auth|jwt|session"
  3. State management patterns:

    Use Grep to find:
    - Context API: "createContext|useContext"
    - Redux: "createSlice|useSelector"
    - Zustand: "create.*useStore"
  4. File organization patterns:

    • Monorepo: Check for packages/, apps/, turbo.json, nx.json
    • Feature-based: Check for directories like features/, modules/
    • Layer-based: Check for components/, services/, utils/, hooks/

Phase 4: Code Quality & Complexity Assessment

Goal: Identify potential issues and technical debt

Tools: Grep, Bash, Read

Process:

  1. Linting & Formatting:

    • Check for: .eslintrc*, .prettierrc*, biome.json
    • Run linter if available: npm run lint (via Bash)
  2. Testing coverage:

    • Find test files: Use Glob for **/*.{test,spec}.{js,ts,jsx,tsx}
    • Calculate coverage: Run npm run test:coverage if available
  3. TypeScript strictness:

    • Read tsconfig.json
    • Check strict: true, strictNullChecks, etc.
    • Look for @ts-ignore or any usage (Grep)
  4. Code complexity indicators:

    Use Grep to flag potential issues:
    - Large files: Find files > 500 lines
    - Deep nesting: Search for excessive indentation
    - TODO/FIXME comments: Grep for "TODO|FIXME|HACK"
    - Console logs: Grep for "console\.(log|debug|warn)"

Phase 5: Dependency & Security Analysis

Goal: Identify outdated or vulnerable dependencies

Tools: Bash, Read

Process:

  1. Check for lock files:

    • Presence of package-lock.json, yarn.lock, pnpm-lock.yaml
  2. Run security audit (if npm/pnpm available):

    npm audit --json
    # or
    pnpm audit --json
  3. Check for outdated dependencies:

    npm outdated

Output Format

Provide a structured analysis report:

# Codebase Analysis Report

## Project Overview
- **Name**: [project name from package.json]
- **Type**: [framework/library]
- **Version**: [version]
- **Node.js**: [required version]

## Technology Stack
### Core Framework
- [Framework name & version]

### Key Dependencies
- UI: [library]
- State: [library]
- Routing: [library]
- Styling: [library]
- Testing: [library]

### Build Tools
- [Vite/Webpack/etc]

## Architecture

### Directory Structure

[tree-like representation of key directories]


### Patterns Identified
- [Component patterns]
- [State management approach]
- [API structure]
- [File organization]

## Code Quality Metrics
- **TypeScript**: [strict/loose/none]
- **Linting**: [ESLint/Biome/none]
- **Testing**: [X test files found, coverage: Y%]
- **Code Issues**: [TODOs: X, Console logs: Y]

## Recommendations
1. [Priority recommendation]
2. [Next priority]
3. ...

## Risk Areas
- [Potential issues or technical debt]

## Next Steps
- [Suggested actions based on analysis]

Best Practices

  1. Progressive Detail: Start with high-level overview, dive deeper only when needed
  2. Context Window Management: For large codebases, analyze in chunks (by directory/feature)
  3. Tool Selection:
    • Use Glob for file discovery (faster than find)
    • Use Grep for pattern search (faster than reading all files)
    • Use Read only for critical files (package.json, configs)
  4. Time Efficiency: Complete analysis in < 60 seconds for typical projects
  5. Actionable Insights: Always provide specific, actionable recommendations

Integration with Other Skills

This skill works well with:

  • quality-gates - Use analysis results to run appropriate quality checks
  • project-initialization - Compare against templates to identify missing setup
  • refactoring-safe - Identify refactoring opportunities
  • Framework-specific skills (nextjs-optimization, react-patterns) - Auto-invoke based on detected framework

Error Handling

If analysis cannot complete:

  1. Missing dependencies: Suggest running npm install
  2. Corrupted files: Report specific files and continue with partial analysis
  3. Large codebase: Switch to targeted analysis mode (specific directories only)
  4. Permission issues: Request necessary file access permissions

Version History

  • 1.0.0 (2025-01-03): Initial skill creation with progressive disclosure support