Help users quickly understand the overall architecture and core logic of an unfamiliar code repository, conducting in-depth analysis from the perspective of a first-time developer.
Core Principles:
- Parallel subagent processing - Use multiple subagents to analyze different dimensions in parallel, avoiding blowing up the main agent's context
- Code snippets first - Output core code snippets and file paths so users can locate them directly
- Process-driven - Explain clearly how the project runs from a process perspective
Trigger Scenarios
- "Deeply research the xxx project"
- "Help me analyze this code repository"
- "Understand this project's architecture"
- "Analyze the github.com/user/repo repository"
- "I want to quickly get started with this project"
Analysis Modes
| Mode | Number of Subagents | Estimated Time | Applicable Scenarios |
|---|---|---|---|
| Quick | 3-4 | 2-3 minutes | Quickly understand the project |
| Standard | 5-6 | 5-8 minutes | Daily analysis [default] |
| Deep | 7-8 | 10-15 minutes | In-depth understanding of important projects |
| UltraDeep | 9-10 | 20-30 minutes | Comprehensive mastery of core projects |
Execution Flow
Phase 1: Project Discovery (DISCOVERY)
Goal: Obtain the code repository, identify the project type and tech stack
Activities:
- Clone the repository based on the GitHub address, or use a local directory
- Scan the project root directory to identify the tech stack
- Read README, CLAUDE.md, and other documentation
Tech Stack Identification:
| File | Tech Stack |
|---|---|
package.json |
Node.js/JavaScript/TypeScript |
requirements.txt / pyproject.toml |
Python |
pom.xml / build.gradle |
Java |
go.mod |
Go |
Cargo.toml |
Rust |
Output: Create a working directory <project>/docs/analysis-temp/
Phase 2: Parallel Analysis (PARALLEL ANALYSIS)
Key: Use the Agent tool to launch multiple subagents in parallel, each focusing on one dimension
Standard mode launches 6 subagents:
[单个消息中并行启动所有 subagent]
- Agent(subagent_type="Explore", description="分析项目结构", prompt="...")
- Agent(subagent_type="Explore", description="分析启动流程", prompt="...")
- Agent(subagent_type="Explore", description="分析核心业务流程", prompt="...")
- Agent(subagent_type="Explore", description="分析数据模型", prompt="...")
- Agent(subagent_type="Explore", description="分析依赖关系", prompt="...")
- Agent(subagent_type="Explore", description="分析配置系统", prompt="...")
Subagent Prompt Template:
Each subagent's prompt uses the following format:
你是一个{分析领域}专家。
## 任务要求
请阅读以下规范文件,按要求分析项目:
{SKILL_PATH}/reference/subagents/{分析器名称}.md
## 项目路径
{PROJECT_PATH}
## 输出要求
- 输出 JSON 格式结果
- 包含代码片段、文件路径、行号
- 包含 Mermaid 图表代码
Subagent and Specification File Correspondence:
| Subagent | Specification File |
|---|---|
| Project Structure Analysis | reference/subagents/structure-analyzer.md |
| Startup Flow Analysis | reference/subagents/startup-analyzer.md |
| Business Process Analysis | reference/subagents/business-flow-analyzer.md |
| Data Model Analysis | reference/subagents/data-model-analyzer.md |
| Dependency Relationship Analysis | reference/subagents/dependency-analyzer.md |
| Configuration System Analysis | reference/subagents/config-analyzer.md |
Phase 3: Result Aggregation (AGGREGATION)
Goal: Collect the analysis results of all subagents
Activities:
- Wait for all subagents to complete
- Read each subagent's output
- Merge into a unified analysis result
Phase 4: Report Generation (REPORT GENERATION)
Key: Generate the report progressively, writing each chapter separately
Chapter generation order (each appended using Edit):
- Report Header and Project Overview
- Quick Start Guide
- Startup Process Detailed Explanation
- Core Business Processes
- Module Details
- Data Model
- Configuration Instructions
- Dependency Analysis
- Summary
Report Template: Reference reference/report-template.md
Quality Standards: Reference reference/quality-standards.md
Reference Files
| File | Purpose |
|---|---|
reference/subagents/structure-analyzer.md |
Project Structure Analysis Specification |
reference/subagents/startup-analyzer.md |
Startup Process Analysis Specification |
reference/subagents/business-flow-analyzer.md |
Business Process Analysis Specification |
reference/subagents/data-model-analyzer.md |
Data Model Analysis Specification |
reference/subagents/dependency-analyzer.md |
Dependency Relationship Analysis Specification |
reference/subagents/config-analyzer.md |
Configuration System Analysis Specification |
reference/report-template.md |
Report Template |
reference/quality-standards.md |
Quality Standards Checklist |
Output Requirements
| Project | Requirements |
|---|---|
| File Name | repo-analysis-YYYYMMDD.md |
| Location | <项目根目录>/docs/ |
| Temporary File | <项目根目录>/docs/analysis-temp/ |