codebase-analysis
Systematically analyze codebase structure, complexity, dependencies, and architectural patterns to understand project organization
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
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
$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. 下の青いボタンを押して
codebase-analysis.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
codebase-analysisフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 1
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
Codebase Analysis Skill
目的
プロジェクトのコードベースを包括的かつ体系的に分析し、以下を理解する。
- プロジェクトの構造と構成
- 技術スタックと依存関係
- アーキテクチャパターンと規約
- コードの複雑さと品質メトリクス
- 主要なコンポーネントとその関係
この Skill を使用するタイミング
以下の場合に自動的に起動する。
- 新しいプロジェクトでの作業を開始するとき
- ユーザーがコードベースを「分析」、「レビュー」、「監査」、または「理解」するように依頼したとき
- アーキテクチャに関する決定を行う前
- リファクタリングまたは大規模な変更を計画するとき
- 新しい開発者をオンボーディングするとき
分析方法
フェーズ 1: 発見 (プロジェクト構造)
目標: プロジェクトのハイレベルな構成をマッピングする
ツール: Glob, LS, Read
プロセス:
package.json、tsconfig.json、またはフレームワーク固有の設定を読み取ってプロジェクトの種類を特定する- ルートレベルで LS を使用してディレクトリ構造をマッピングする:
特定すべき主要なディレクトリ: - ソースコード: src/, app/, pages/, components/ - テスト: __tests__/, tests/, *.test.*, *.spec.* - 設定: config/, .config/ - ドキュメント: docs/, README.md - ビルド出力: dist/, build/, .next/ - 重要なファイルをスキャンする:
- ビルド設定:
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
プロセス:
-
package.json を読み取る:
dependencies(ランタイムライブラリ) を抽出するdevDependencies(開発ツール) を抽出するscripts(利用可能なコマンド) をメモするengines(Node.js のバージョン要件) を確認する
-
フレームワークを特定する:
- Next.js: 依存関係に
nextがあるか、next.config.*、app/またはpages/ディレクトリがあるかを確認する - React:
reactとreact-domがあるかを確認する - Vue:
vue、*.vueファイルがあるかを確認する - Svelte:
svelte、*.svelteファイルがあるかを確認する - Angular:
@angular/core、angular.jsonがあるかを確認する
- Next.js: 依存関係に
-
主要なライブラリを特定する:
- 状態管理: 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
プロセス:
-
コンポーネントパターン (React/Vue/Svelte の場合):
Glob を使用して以下を検索する: **/*.{jsx,tsx,vue,svelte} 分析: - コンポーネントの命名規則 - ファイル構造 (同じ場所に配置されたスタイル、テスト) - コンポーネントのサイズ (コード行数) -
API/Backend パターン:
Grep を使用して以下を検索する: - API ルート: "export.*GET|POST|PUT|DELETE" - データベースクエリ: "prisma\.|mongoose\.|sql" - 認証: "auth|jwt|session" -
状態管理パターン:
Grep を使用して以下を検索する: - Context API: "createContext|useContext" - Redux: "createSlice|useSelector" - Zustand: "create.*useStore" -
ファイル構成パターン:
- Monorepo:
packages/、apps/、turbo.json、nx.jsonがあるかを確認する - Feature-based:
features/、modules/のようなディレクトリがあるかを確認する - Layer-based:
components/、services/、utils/、hooks/があるかを確認する
- Monorepo:
フェーズ 4: コード品質と複雑さの評価
目標: 潜在的な問題と技術的負債を特定する
ツール: Grep, Bash, Read
プロセス:
-
Linting & Formatting:
- 以下があるかを確認する:
.eslintrc*,.prettierrc*,biome.json - 利用可能な場合はリンターを実行する:
npm run lint(Bash 経由)
- 以下があるかを確認する:
-
テストカバレッジ:
- テストファイルを検索する: Glob を使用して
**/*.{test,spec}.{js,ts,jsx,tsx}を検索する - カバレッジを計算する: 利用可能な場合は
npm run test:coverageを実行する
- テストファイルを検索する: Glob を使用して
-
TypeScript の厳密さ:
tsconfig.jsonを読み取るstrict: true、strictNullChecksなどがあるかを確認する@ts-ignoreまたはanyの使用箇所を検索する (Grep)
-
コードの複雑さの指標:
Grep を使用して潜在的な問題をフラグ付けする: - 大きなファイル: 500 行を超えるファイルを検索する - 深いネスト: 過剰なインデントを検索する - TODO/FIXME コメント: "TODO|FIXME|HACK" を Grep する - コンソールログ: "console\.(log|debug|warn)" を Grep する
フェーズ 5: 依存関係とセキュリティ分析
目標: 古いまたは脆弱な依存関係を特定する
ツール: Bash, Read
プロセス:
-
ロックファイルを確認する:
package-lock.json、yarn.lock、pnpm-lock.yamlの存在
-
セキュリティ監査を実行する (npm/pnpm が利用可能な場合):
npm audit --json # or pnpm audit --json -
古い依存関係を確認する:
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
- 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:
- Identify project type by reading
package.json,tsconfig.json, or framework-specific configs - 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/ - 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/
- Build configs:
Phase 2: Technology Stack Analysis
Goal: Identify frameworks, libraries, and versions
Tools: Read, Grep
Process:
-
Read package.json:
- Extract
dependencies(runtime libraries) - Extract
devDependencies(development tools) - Note
scripts(available commands) - Check
engines(Node.js version requirements)
- Extract
-
Identify framework:
- Next.js: Check for
nextin dependencies,next.config.*,app/orpages/directory - React: Check for
reactandreact-dom - Vue: Check for
vue,*.vuefiles - Svelte: Check for
svelte,*.sveltefiles - Angular: Check for
@angular/core,angular.json
- Next.js: Check for
-
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:
-
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) -
API/Backend patterns:
Use Grep to search for: - API routes: "export.*GET|POST|PUT|DELETE" - Database queries: "prisma\.|mongoose\.|sql" - Authentication: "auth|jwt|session" -
State management patterns:
Use Grep to find: - Context API: "createContext|useContext" - Redux: "createSlice|useSelector" - Zustand: "create.*useStore" -
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/
- Monorepo: Check for
Phase 4: Code Quality & Complexity Assessment
Goal: Identify potential issues and technical debt
Tools: Grep, Bash, Read
Process:
-
Linting & Formatting:
- Check for:
.eslintrc*,.prettierrc*,biome.json - Run linter if available:
npm run lint(via Bash)
- Check for:
-
Testing coverage:
- Find test files: Use Glob for
**/*.{test,spec}.{js,ts,jsx,tsx} - Calculate coverage: Run
npm run test:coverageif available
- Find test files: Use Glob for
-
TypeScript strictness:
- Read
tsconfig.json - Check
strict: true,strictNullChecks, etc. - Look for
@ts-ignoreoranyusage (Grep)
- Read
-
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:
-
Check for lock files:
- Presence of
package-lock.json,yarn.lock,pnpm-lock.yaml
- Presence of
-
Run security audit (if npm/pnpm available):
npm audit --json # or pnpm audit --json -
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
- Progressive Detail: Start with high-level overview, dive deeper only when needed
- Context Window Management: For large codebases, analyze in chunks (by directory/feature)
- 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)
- Time Efficiency: Complete analysis in < 60 seconds for typical projects
- 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 checksproject-initialization- Compare against templates to identify missing setuprefactoring-safe- Identify refactoring opportunities- Framework-specific skills (
nextjs-optimization,react-patterns) - Auto-invoke based on detected framework
Error Handling
If analysis cannot complete:
- Missing dependencies: Suggest running
npm install - Corrupted files: Report specific files and continue with partial analysis
- Large codebase: Switch to targeted analysis mode (specific directories only)
- Permission issues: Request necessary file access permissions
Version History
- 1.0.0 (2025-01-03): Initial skill creation with progressive disclosure support