| name | project-summary |
| description | Analyze GitHub projects and generate comprehensive architecture documentation (architecture.md). Use when users request project analysis, architecture summaries, or documentation of code structure. Triggers on queries like "analyze this GitHub project", "generate architecture.md", "summarize project structure", or "document the codebase architecture". |
Project Summary
Overview
This skill helps analyze GitHub projects and generate a comprehensive architecture.md file that documents the project's structure, key components, file purposes, and architectural decisions.
Workflow
Step 1: Gather Project Information
Before analyzing, collect the necessary information:
-
Get the GitHub repository URL or local path
- If URL is provided, use web scraping to fetch README and repository structure
- If local path is provided, use bash tools to explore the directory
-
Identify the project type
- Detect programming language(s) from file extensions
- Identify frameworks (React, Django, Flask, etc.)
- Determine build tools (package.json, requirements.txt, Cargo.toml, etc.)
Step 2: Analyze Project Structure
Systematically explore and document the project:
-
Map the directory structure
tree -L 3 -I 'node_modules|__pycache__|.git|dist|build'
-
Identify key directories and their purposes
/src or /app - Main source code
/tests or /test - Test files
/docs - Documentation
/config - Configuration files
/public or /static - Static assets
/scripts - Build/deployment scripts
-
Catalog important files
- Configuration files (package.json, setup.py, Cargo.toml, etc.)
- Entry points (main.py, index.js, main.rs, etc.)
- Documentation (README.md, CONTRIBUTING.md, etc.)
Step 3: Analyze Code Architecture
Examine the codebase systematically:
-
Identify architectural patterns
- MVC, MVVM, microservices, monolithic, etc.
- Component structure (for frontend projects)
- Module organization (for backend projects)
-
Document key components
- Core modules and their responsibilities
- API endpoints or routes
- Database models or schemas
- Service layers
- Utility functions
-
Map dependencies and relationships
- Internal module dependencies
- External library usage
- Data flow between components
Step 4: Generate ASCII Architecture Diagrams
IMPORTANT: Always include ASCII diagrams to visually represent the architecture. Use the decision tree below to auto-select the diagram style โ do NOT manually guess.
4.0 Auto-Select Diagram Style (Decision Tree)
Run through these checks in order after Step 2โ3 analysis. Use the first matching pattern:
้กน็ฎๅๆ็ปๆ
โ
โโ ๅญๅจ docker-compose.yml / kubernetes/ / ๅคไธช็ฌ็ซ service ็ฎๅฝ?
โ โโโถ Pattern 4: ๅพฎๆๅกไบคไบๅพ
โ
โโ ๅญๅจ DAG / pipeline / workflow / etl / airflow / prefect ๅ
ณ้ฎ่ฏ?
โ โโโถ Pattern 1: ็บฟๆงๅค็ๆตๆฐด็บฟ
โ
โโ ๅญๅจ components/ / pages/ / views/ (ๅ็ซฏๆกๆถ็นๅพ)?
โ โโ ๅตๅฅๅฑ็บง โฅ 3 ๅฑ? โโโถ Pattern 6: ๅตๅฅ็ปไปถๆถๆ
โ โโ ๅฆๅ โโโถ Pattern 3: ๆจกๅไพ่ตๆ
โ
โโ ๅญๅจๆๆพไธญ้ดไปถ้พ (middleware/ / interceptor / filter / handler)?
โ โโโถ Pattern 5: ่ฏทๆฑๅค็ๆตๆฐด็บฟ
โ
โโ ๅญๅจๆธ
ๆฐๅๅฑ็ฎๅฝ (controllers/ + services/ + models/ / repositories/)?
โ โโโถ Pattern 2: ๅ็ดๅๅฑๆถๆ
โ
โโ ไปฅไธๅไธๆๆพ?
โโโถ Pattern 3: ๆจกๅไพ่ตๆ (ๆ้็จๅ
ๅบ)
ๅคๅ้กน็ฎ๏ผๅฆๅ
จๆ ๏ผ๏ผๅ็ซฏ็จ Pattern 2 ๆ 5๏ผๅ็ซฏ็จ Pattern 6๏ผๅๅผ็ปไธคๅผ ๅพใ
4.1 Width Adaptation๏ผๅฎฝๅบฆ่ช้ๅบ๏ผ
ๅจ็ๆ ASCII ๅพๅ๏ผๅ
็กฎๅฎ็ฎๆ ๅฎฝๅบฆ๏ผ
| ๅบๆฏ | ็ฎๆ ๅฎฝๅบฆ | ่ฏดๆ |
|---|
| ้ป่ฎค๏ผๆชๆๅฎ๏ผ | 80 ๅ | ๅ
ผๅฎนๆๆ็ป็ซฏๅ GitHub PR ้ข่ง |
็จๆทๆๅฎ --wide ๆๅฎฝๅฑ | 120 ๅ | ๅ
่ฎธๆดๅค่็นๅนถๆ |
| ็ฎๅ้กน็ฎ๏ผโค5 ไธชๆจกๅ๏ผ | 60 ๅ | ้ฟๅ
็ฉบ็ฝ่ฟๅค |
ๅฎฝๅบฆๆงๅถ่งๅ๏ผ
ๆฏไธช box ็ๅฎฝๅบฆ = ceil(ๆ้ฟๆ ็ญพๅญ็ฌฆๆฐ / 2) * 2 + 4 (ๅซ่พนๆก๏ผไฟๆๅถๆฐ)
ๆฐดๅนณ Pattern 1 ่็นๆฐไธ้:
80 ๅๆจกๅผ: ๆๅค 4 ไธช่็นๅนถๆ (ๆฏ่็น ~14 ๅ + 5 ๅ็ฎญๅคด)
120 ๅๆจกๅผ: ๆๅค 6 ไธช่็นๅนถๆ
่ถ
ๅบ่็นๆฐๆถ๏ผๆ่กๅค็:
โโโโโโโโ โโโโโโโโ โโโโโโโโ
โ A โโโโโโถโ B โโโโโโถโ C โ
โโโโโโโโ โโโโโโโโ โโโโฌโโโโ
โ
โโโโโโโโ โผ
โ E โโโโโโโโโโโโโ
โโโโโโโโ โ D โ
โโโโโโโโ
ไธญ่ฑๆๆททๆๅฏน้ฝ่งๅ๏ผไธญๆๅญ็ฌฆๅ 2 ๅ๏ผ๏ผ
def visual_width(s):
return sum(2 if '\u4e00' <= c <= '\u9fff' else 1 for c in s)
def center_label(label, box_inner_width):
vw = visual_width(label)
pad = box_inner_width - vw
return ' ' * (pad // 2) + label + ' ' * (pad - pad // 2)
็ๆๆถๆๆญค้ป่พๅฟ็ฎๆๆๅทฅๆ กๅฏน๏ผ็กฎไฟๆกๅ
ๆๅญ่ง่งๅฑ
ไธญใ
ASCII Diagram Style Reference
Use these box-drawing character sets:
| ็จ้ | ๅญ็ฌฆ้ |
|---|
| ๆฎ้ๆจกๅๆก | โโโ โ โโโ |
| ๅผบ่ฐ/้กถๅฑๆก | โโโ โ โโโ |
| ่็บฟ/ๅฏ้ๆก | โโโโ โ โโโโ |
| ็ฎญๅคด | โโโถ โโโท โโโ โ โผ โฒ |
| ๅๆฏ/ๆฑๅ | โโโ โโโ โฌ โด โผ |
Pattern 1: ็บฟๆงๅค็ๆตๆฐด็บฟ๏ผๆฐดๅนณ๏ผ
For sequential data/request processing pipelines:
โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ
โ ่พๅ
ฅๅฑ โโโโโโถโ ๅค็ๅฑ โโโโโโถโ ไธๅกๅฑ โโโโโโถโ ่พๅบๅฑ โ
โ Input โ โ Process โ โ Business โ โ Output โ
โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ
Pattern 2: ๅ็ดๅๅฑๆถๆ
For layered/tiered system architecture:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ่กจ็คบๅฑ (UI Layer) โ
โ React Components / Templates โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ ไธๅก้ป่พๅฑ (Service Layer) โ
โ Controllers / Use Cases โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ ๆฐๆฎ่ฎฟ้ฎๅฑ (Data Layer) โ
โ Repositories / ORM Models โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ ๆฐๆฎๅบ (Database) โ
โ PostgreSQL / Redis โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Pattern 3: ๆจกๅไพ่ตๅพ๏ผๆ ๅฝข๏ผ
For showing module/component dependencies:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ไธปๅบ็จๅ
ฅๅฃ โ
โ main.py / index.js โ
โโโโโโโโฌโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโ
โ โ
โผ โผ
โโโโโโโโโโโโ โโโโโโโโโโโโ
โ ๆจกๅ A โ โ ๆจกๅ B โ
โ auth/ โ โ api/ โ
โโโโโโฌโโโโโโ โโโโโโฌโโโโโโ
โ โ
โผ โผ
โโโโโโโโโโโโ โโโโโโโโโโโโ
โ ๅทฅๅ
ทๅบ โ โ ๆฐๆฎๅบ โ
โ utils/ โ โ db/ โ
โโโโโโโโโโโโ โโโโโโโโโโโโ
Pattern 4: ๅพฎๆๅก/็ปไปถไบคไบๅพ
For distributed systems or service interactions:
โโโโโโโโโโโโโโโโโโโ
โ API Gateway โ
โโโโโโโโโโฌโโโโโโโโโ
โโโโโโโโโโโผโโโโโโโโโโ
โ โ โ
โผ โผ โผ
โโโโโโโโโโโโ โโโโโโโโโโ โโโโโโโโโโ
โ Auth Svc โ โUser Svcโ โ Order โ
โ :8001 โ โ :8002 โ โ Svc โ
โโโโโโโโโโโโ โโโโโโฌโโโโ โ :8003 โ
โ โโโโโฌโโโโโ
โผ โผ
โโโโโโโโโโโโโโโโโโโโ
โ ๆฐๆฎๅบ้็พค โ
โ PostgreSQL/Redis โ
โโโโโโโโโโโโโโโโโโโโ
Pattern 5: ่ฏทๆฑๅค็ๆตๆฐด็บฟ๏ผๅธฆๆณจ้๏ผ
For detailed request/data flow with annotations:
็จๆท่ฏทๆฑ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Middleware โ
โ [่ฎค่ฏ] โโโถ [้ๆต] โโโถ [ๆฅๅฟ่ฎฐๅฝ] โ
โโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Router โ
โ /api/v1/* โโโถ APIHandler โ
โ /static/* โโโถ StaticHandler โ
โโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโดโโโโโโโโโโโ
โผ โผ
โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ
โ Controller โ โ Cache โ
โ (ไธๅกๅค็) โ โ (Redis) โ
โโโโโโโโฌโโโโโโโ โโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโ
โ Database โ
โ (่ฏป/ๅๅ็ฆป) โ
โโโโโโโโโโโโโโโ
Pattern 6: ๅตๅฅ็ปไปถๆถๆ
For frontend component hierarchies or nested modules:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ App โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Layout โ โ
โ โ โโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โ โ
โ โ โ Navbar โ โ Sidebar โ โ โ
โ โ โโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โ โ
โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ
โ โ โ Main Content โ โ โ
โ โ โ โโโโโโโโโโ โโโโโโโโโโโโโโ โ โ โ
โ โ โ โ List โ โ Detail โ โ โ โ
โ โ โ โโโโโโโโโโ โโโโโโโโโโโโโโ โ โ โ
โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Diagram Selection Guide:
- Pipeline (Pattern 1): CI/CD, data processing, ETL pipelines
- Layered (Pattern 2): Web apps, backend services with clear tiers
- Dependency tree (Pattern 3): Libraries, monorepos, module graphs
- Service mesh (Pattern 4): Microservices, distributed systems
- Request flow (Pattern 5): API servers, middleware-heavy apps
- Nested (Pattern 6): Frontend frameworks, plugin architectures
Step 5: Generate architecture.md
IMPORTANT: Generate the architecture.md document in Chinese (Simplified Chinese).
Create a comprehensive architecture document with the following structure in Chinese:
# ้กน็ฎๆถๆ
## ้กน็ฎๆฆ่ฟฐ
[้กน็ฎ็็ฎ่ฆๆ่ฟฐๅๅ
ถ็ฎ็]
## ๆๆฏๆ
- **็ผ็จ่ฏญ่จ**: [ไพๅฆ๏ผPython 3.9+, TypeScript]
- **ๆกๆถ**: [ไพๅฆ๏ผReact 18, Django 4.2]
- **ๆฐๆฎๅบ**: [ไพๅฆ๏ผPostgreSQL, MongoDB]
- **ๆๅปบๅทฅๅ
ท**: [ไพๅฆ๏ผWebpack, Vite]
- **ๆต่ฏๅทฅๅ
ท**: [ไพๅฆ๏ผJest, pytest]
## ้กน็ฎ็ปๆ
[ๅธฆๆณจ้็็ฎๅฝๆ ]
## ๆถๆๆป่ง
[ๆ นๆฎ้กน็ฎ็ฑปๅ้ๆฉๅนถ็ๆๅ้็ ASCII ๆถๆๅพ๏ผๅ่ Step 4 ็ๆจกๅผใ
ๅฟ
้กปๅ
ๅซ่ณๅฐไธไธช ASCII ๅพๅฑ็คบๆจกๅๅ
ณ็ณปๆๅค็ๆต็จใ]
[ๅจๆญคๆๅ
ฅ ASCII ๆถๆๅพ]
## ๅค็ๆตๆฐด็บฟ
[ๅฆๆ้กน็ฎๆๆๆพ็ๆฐๆฎ/่ฏทๆฑๅค็ๆต็จ๏ผ็จ ASCII ๆตๆฐด็บฟๅพๅฑ็คบ๏ผ
- ๆฐๆฎ่ฟๅ
ฅ็ณป็ปๅ็ป่ฟๅชไบๆจกๅ
- ๅๆจกๅ็ๅค็่่ดฃ
- ๆ็ป่พๅบๅฝขๅผ]
[ๅจๆญคๆๅ
ฅๅค็ๆตๆฐด็บฟ ASCII ๅพ๏ผๅฆ้็จ๏ผ]
## ๆ ธๅฟ็ปไปถ
### [็ปไปถ/ๆจกๅๅ็งฐ]
- **ไฝ็ฝฎ**: `path/to/component`
- **็จ้**: [่ฏฅ็ปไปถ็ๅ่ฝ่ฏดๆ]
- **ๅ
ณ้ฎๆไปถ**:
- `file1.ext` - [็ฎ่ฆๆ่ฟฐ]
- `file2.ext` - [็ฎ่ฆๆ่ฟฐ]
- **ไพ่ตๅ
ณ็ณป**: [่ฏฅ็ปไปถไพ่ต็ๅ
ถไป้จๅ]
[ไธบๆฏไธชไธป่ฆ็ปไปถ้ๅคๆญค็ปๆ]
## ๆถๆๆจกๅผ
[ๆ่ฟฐไฝฟ็จ็ๆถๆๆจกๅผ๏ผไพๅฆ๏ผMVCใๅๅฑๆถๆ็ญ]
## ๆฐๆฎๆต
[่ฏดๆๆฐๆฎๅฆไฝๅจ็ณป็ปไธญๆตๅจ๏ผ้
ๅ ASCII ๆตๅๅพ]
## ้
็ฝฎ่ฏดๆ
[่ฎฐๅฝ้่ฆ็้
็ฝฎๆไปถๅ็ฏๅขๅ้]
## ๆๅปบไธ้จ็ฝฒ
[่ฏดๆๆๅปบ่ฟ็จๅ้จ็ฝฒๆต็จ๏ผๅฆๆๆๆพ๏ผ]
## ๅ
ณ้ฎ่ฎพ่ฎกๅณ็ญ
[ๅผๅพๆณจๆ็ๆถๆๆ่ฎพ่ฎกๅณ็ญ]
## ๆต่ฏ็ญ็ฅ
[ๆต่ฏๆนๆณๅ็ปๆๆฆ่ฟฐ]
Step 6: Review and Refine
Before finalizing:
-
Verify completeness
- All major components documented
- Key files have purpose descriptions
- Relationships are clear
- At least one ASCII diagram is present
-
Check accuracy
- File paths are correct
- Component descriptions match actual code
- Technology versions are accurate
- ASCII diagrams accurately reflect actual architecture
-
Ensure clarity
- Use clear, concise language
- Include examples where helpful
- Avoid overly technical jargon unless necessary
- ASCII diagrams are readable at standard terminal widths (โค80 chars preferred)
Best Practices
- Use Chinese (Simplified Chinese) for all content in architecture.md - All descriptions, explanations, and documentation should be in Chinese
- Always include ASCII architecture diagrams - At minimum: one overview diagram + one data/request flow diagram
- Use the decision tree (Step 4.0) to select diagram style - Never manually guess; run through the tree in order and use the first match
- Respect width budget (Step 4.1) - Default 80 cols; fold to next row when nodes exceed the limit; verify Chinese character double-width alignment
- Be thorough but concise - Document all important aspects without overwhelming detail
- Use examples - Include code snippets or file excerpts when they clarify concepts
- Focus on "why" not just "what" - Explain architectural decisions and their rationale
- Make it actionable - Help new developers understand how to navigate and contribute
ASCII Diagram Quick Reference
Box styles:
ๆฎ้ โโโโ โ โโโโ
ๅผบ่ฐ โโโโ โ โโโโ
ๅ่ง โญโโโฎ โ โฐโโโฏ
Connectors:
ๆฐดๅนณ โโโโ โโโโ
ๅ็ด โ โ
็ฎญๅคด โโโถ โโโท โโโ โผ โฒ
ๅๅ โโโ โโโ โฌ โด โผ
Labels inline:
โโ[ๆ ็ญพ]โโโถ โโ[ๅผบ่ฐ]โโโถ
Common Project Types
Frontend Projects (React/Vue/Angular)
- Focus on component hierarchy
- Document state management approach
- Note routing structure
- Explain build configuration
Backend Projects (Django/Flask/Express)
- Document API structure
- Explain database models
- Note middleware and authentication
- Describe service layers
Full-stack Projects
- Clearly separate frontend and backend documentation
- Document API contracts
- Explain data synchronization
- Note deployment architecture
Library/Package Projects
- Focus on public API
- Document internal modules
- Explain build and distribution process
- Note testing and examples