Codebase Architecture Analysis
When to use this skill
Use this skill when you need to understand the high-level architecture and structure of a codebase. Specifically, use it when you need to:
- Create architecture diagrams for documentation
- Understand component relationships and dependencies
- Assess hosting infrastructure and deployment architecture
- Generate comprehensive architectural overviews
- Document data flow between system components
- Create visual representations of code organization
Overview
This skill guides a specialized agent through a comprehensive analysis of a GitHub repository to produce detailed architecture documentation. The analysis includes ASCII diagrams, component maps, infrastructure details, and file-level assessments.
Workflow
Step 1: Repository Setup
Input required:
- GitHub repository URL or
owner/repo format
- Optional: Specific branch or commit to analyze
Actions:
- Clone the repository using the GitHub PAT from environment variables
- Verify the repository is cloned successfully
- Document the repository metadata (language, size, structure)
YOU MUST CLONE THE REPOSITORY AND INSPECT THE FILES USING BASH TOOLS AND GIT CLI RATHER THAN MCP.
Step 2: Codebase Discovery and Assessment
Analyze the directory structure:
- Map the complete directory tree
- Identify major components/modules/packages
- Classify directories by purpose (src, config, tests, build, etc.)
- Count files by type (TypeScript, Python, JSON, etc.)
- Identify entry points and main application files
For each file, assess:
- File type and purpose
- Size and complexity
- Key imports and dependencies
- What module/component it belongs to
- Role in the overall system
Step 3: Create Architecture Diagrams
Create multiple ASCII diagrams:
System Architecture Diagram
- High-level components and their relationships
- External systems and services
- Data flow between components
Deployment Architecture
- Hosting infrastructure (cloud platform, containers, etc.)
- Service relationships
- Network and database layers
File Structure Diagram
- Directory hierarchy showing major components
- Key files and their purposes
- Organization by feature or layer
Data Flow Diagram
- How data moves through the system
- API endpoints and their interactions
- Database access patterns
Example ASCII diagram structure:
┌─────────────────────────────────────────────────┐
│ Client (React) │
├─────────────────────────────────────────────────┤
│ - Components │
│ - Pages │
│ - State Management │
└────────────────┬────────────────────────────────┘
│ HTTP/WebSocket
┌────────────────▼────────────────────────────────┐
│ Backend Server (Node.js) │
├─────────────────────────────────────────────────┤
│ - API Routes │
│ - Authentication │
│ - Business Logic │
└────────────────┬────────────────────────────────┘
│
┌────────────────▼────────────────────────────────┐
│ Database & External APIs │
├─────────────────────────────────────────────────┤
│ - PostgreSQL / MongoDB │
│ - Third-party Services │
└─────────────────────────────────────────────────┘
Step 4: Component Analysis
For each major component, document:
- Purpose and responsibilities
- Key files and entry points
- External dependencies
- Interactions with other components
- API surface (if applicable)
Document component categories:
- Frontend Components: UI components, pages, layouts
- Backend Services: API endpoints, middleware, handlers
- Business Logic: Core algorithms, processing
- Infrastructure: Configuration, build, deployment
- Testing: Test utilities, test files
- Documentation: READMEs, specs, guides
Step 5: Technology Stack Assessment
Identify and document:
- Programming languages used
- Key frameworks and libraries
- Database systems
- External services and APIs
- Development tools and build systems
- Container/deployment technologies
- Version numbers where significant
Step 6: Hosting and Infrastructure Analysis
Assess the deployment architecture:
- Identify hosting platform (AWS, GCP, Vercel, Cloudflare, etc.)
- Document service configuration
- Environment variables
- Build processes
- Deployment scripts
- Identify infrastructure-as-code files (Terraform, Docker, etc.)
- Document scaling considerations
- Identify external service dependencies
Step 7: Generate Final Documentation
Create a comprehensive architecture document including:
Executive Summary
- Project purpose
- High-level architecture overview
- Technology stack
- Hosting platform and deployment
Architecture Diagrams (multiple views as described in Step 3)
Component Catalog
- List of major components
- Purpose of each
- Key files
- Dependencies
File Structure Overview
- Directory layout with purposes
- Important files highlighted
Data Flow Explanation
- How requests are processed
- Database interactions
- External API calls
Technology Details
- Language versions
- Framework versions
- Key library versions
- Database schema summary (if visible in code)
Deployment and Hosting
- Hosting platform details
- Build and deployment process
- Environment configuration
- Scaling considerations
Dependencies and Integrations
- List of external services
- API integrations
- Authentication/authorization approach
Common Patterns
For Monolithic Applications
- Single codebase containing frontend, backend, and shared logic
- Clear separation between presentation, business logic, and data layers
- Review package.json/requirements.txt for all dependencies
For Microservices
- Multiple services in separate directories or repositories
- Service communication documented in deployment config
- API contracts between services
- Separate databases per service (typically)
For Full-Stack Web Applications
- Frontend framework (React, Vue, Angular, etc.)
- Backend framework (Node.js/Express, Python/Django, etc.)
- Database (SQL or NoSQL)
- API layer connecting frontend and backend
Edge Cases
Large Codebases:
- Focus on major components first
- Group related files together
- Create summary before diving into details
Polyglot Repositories:
- Separate analysis by language when relevant
- Document language integration points
- Highlight cross-language dependencies
Complex Infrastructure:
- Document infrastructure-as-code separately
- Identify deployment stages (dev, staging, prod)
- Note auto-scaling or load balancing configurations
Output Format
The final architecture analysis should be delivered as:
- A comprehensive Markdown document with embedded ASCII diagrams
- Clear section headers and navigation
- Links between related sections
- Visual hierarchy showing component relationships
- Concise but complete descriptions
Tools and Resources
The agent may use:
- Git commands to explore repository structure
- File reading tools to examine source code
- Text parsing to extract key information
- ASCII art libraries for diagram generation
Example Use Case
User Request: "Analyze the architecture of the user-management microservice in our platform"
Agent Process:
- Clones the user-management repository
- Maps the directory structure (controllers, models, tests, config)
- Creates ASCII diagrams showing:
- Service components (auth handler, user DB access, role manager)
- Data flow (API request → controller → service → database)
- Deployment (Docker container → Kubernetes → PostgreSQL)
- Documents all dependencies and integrations
- Provides complete architecture documentation
Success Criteria
The analysis is complete when:
- ✅ Repository successfully cloned and analyzed
- ✅ All major components identified
- ✅ Multiple ASCII diagrams created showing different views
- ✅ File structure documented and explained
- ✅ Technology stack clearly identified
- ✅ Hosting/deployment architecture understood
- ✅ Data flow between components visible
- ✅ Comprehensive documentation generated
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: codebase-architecture-analysis3description: Analyze a GitHub codebase to create comprehensive architecture documentation including ASCII diagrams, component relationships, data flow, hosting infrastructure, and file structure assessment. Use when this capability is needed.4---56# Codebase Architecture Analysis78## When to use this skill910Use this skill when you need to understand the high-level architecture and structure of a codebase. Specifically, use it when you need to:11- Create architecture diagrams for documentation12- Understand component relationships and dependencies13- Assess hosting infrastructure and deployment architecture14- Generate comprehensive architectural overviews15- Document data flow between system components16- Create visual representations of code organization1718## Overview1920This skill guides a specialized agent through a comprehensive analysis of a GitHub repository to produce detailed architecture documentation. The analysis includes ASCII diagrams, component maps, infrastructure details, and file-level assessments.2122## Workflow2324### Step 1: Repository Setup2526**Input required:**27- GitHub repository URL or `owner/repo` format28- Optional: Specific branch or commit to analyze2930**Actions:**311. Clone the repository using the GitHub PAT from environment variables322. Verify the repository is cloned successfully333. Document the repository metadata (language, size, structure)3435YOU MUST CLONE THE REPOSITORY AND INSPECT THE FILES USING BASH TOOLS AND GIT CLI RATHER THAN MCP.3637### Step 2: Codebase Discovery and Assessment3839**Analyze the directory structure:**401. Map the complete directory tree412. Identify major components/modules/packages423. Classify directories by purpose (src, config, tests, build, etc.)434. Count files by type (TypeScript, Python, JSON, etc.)445. Identify entry points and main application files4546**For each file, assess:**47- File type and purpose48- Size and complexity49- Key imports and dependencies50- What module/component it belongs to51- Role in the overall system5253### Step 3: Create Architecture Diagrams5455**Create multiple ASCII diagrams:**56571. **System Architecture Diagram**58 - High-level components and their relationships59 - External systems and services60 - Data flow between components61622. **Deployment Architecture**63 - Hosting infrastructure (cloud platform, containers, etc.)64 - Service relationships65 - Network and database layers66673. **File Structure Diagram**68 - Directory hierarchy showing major components69 - Key files and their purposes70 - Organization by feature or layer71724. **Data Flow Diagram**73 - How data moves through the system74 - API endpoints and their interactions75 - Database access patterns7677Example ASCII diagram structure:7879```80┌─────────────────────────────────────────────────┐81│ Client (React) │82├─────────────────────────────────────────────────┤83│ - Components │84│ - Pages │85│ - State Management │86└────────────────┬────────────────────────────────┘87 │ HTTP/WebSocket88┌────────────────▼────────────────────────────────┐89│ Backend Server (Node.js) │90├─────────────────────────────────────────────────┤91│ - API Routes │92│ - Authentication │93│ - Business Logic │94└────────────────┬────────────────────────────────┘95 │96┌────────────────▼────────────────────────────────┐97│ Database & External APIs │98├─────────────────────────────────────────────────┤99│ - PostgreSQL / MongoDB │100│ - Third-party Services │101└─────────────────────────────────────────────────┘102```103104### Step 4: Component Analysis105106**For each major component, document:**107- Purpose and responsibilities108- Key files and entry points109- External dependencies110- Interactions with other components111- API surface (if applicable)112113**Document component categories:**114- **Frontend Components**: UI components, pages, layouts115- **Backend Services**: API endpoints, middleware, handlers116- **Business Logic**: Core algorithms, processing117- **Infrastructure**: Configuration, build, deployment118- **Testing**: Test utilities, test files119- **Documentation**: READMEs, specs, guides120121### Step 5: Technology Stack Assessment122123**Identify and document:**124- Programming languages used125- Key frameworks and libraries126- Database systems127- External services and APIs128- Development tools and build systems129- Container/deployment technologies130- Version numbers where significant131132### Step 6: Hosting and Infrastructure Analysis133134**Assess the deployment architecture:**1351. Identify hosting platform (AWS, GCP, Vercel, Cloudflare, etc.)1362. Document service configuration137 - Environment variables138 - Build processes139 - Deployment scripts1403. Identify infrastructure-as-code files (Terraform, Docker, etc.)1414. Document scaling considerations1425. Identify external service dependencies143144### Step 7: Generate Final Documentation145146**Create a comprehensive architecture document including:**1471481. **Executive Summary**149 - Project purpose150 - High-level architecture overview151 - Technology stack152 - Hosting platform and deployment1531542. **Architecture Diagrams** (multiple views as described in Step 3)1551563. **Component Catalog**157 - List of major components158 - Purpose of each159 - Key files160 - Dependencies1611624. **File Structure Overview**163 - Directory layout with purposes164 - Important files highlighted1651665. **Data Flow Explanation**167 - How requests are processed168 - Database interactions169 - External API calls1701716. **Technology Details**172 - Language versions173 - Framework versions174 - Key library versions175 - Database schema summary (if visible in code)1761777. **Deployment and Hosting**178 - Hosting platform details179 - Build and deployment process180 - Environment configuration181 - Scaling considerations1821838. **Dependencies and Integrations**184 - List of external services185 - API integrations186 - Authentication/authorization approach187188## Common Patterns189190### For Monolithic Applications191- Single codebase containing frontend, backend, and shared logic192- Clear separation between presentation, business logic, and data layers193- Review package.json/requirements.txt for all dependencies194195### For Microservices196- Multiple services in separate directories or repositories197- Service communication documented in deployment config198- API contracts between services199- Separate databases per service (typically)200201### For Full-Stack Web Applications202- Frontend framework (React, Vue, Angular, etc.)203- Backend framework (Node.js/Express, Python/Django, etc.)204- Database (SQL or NoSQL)205- API layer connecting frontend and backend206207## Edge Cases208209**Large Codebases:**210- Focus on major components first211- Group related files together212- Create summary before diving into details213214**Polyglot Repositories:**215- Separate analysis by language when relevant216- Document language integration points217- Highlight cross-language dependencies218219**Complex Infrastructure:**220- Document infrastructure-as-code separately221- Identify deployment stages (dev, staging, prod)222- Note auto-scaling or load balancing configurations223224## Output Format225226The final architecture analysis should be delivered as:2271. A comprehensive Markdown document with embedded ASCII diagrams2282. Clear section headers and navigation2293. Links between related sections2304. Visual hierarchy showing component relationships2315. Concise but complete descriptions232233## Tools and Resources234235The agent may use:236- Git commands to explore repository structure237- File reading tools to examine source code238- Text parsing to extract key information239- ASCII art libraries for diagram generation240241## Example Use Case242243**User Request:** "Analyze the architecture of the user-management microservice in our platform"244245**Agent Process:**2461. Clones the user-management repository2472. Maps the directory structure (controllers, models, tests, config)2483. Creates ASCII diagrams showing:249 - Service components (auth handler, user DB access, role manager)250 - Data flow (API request → controller → service → database)251 - Deployment (Docker container → Kubernetes → PostgreSQL)2524. Documents all dependencies and integrations2535. Provides complete architecture documentation254255## Success Criteria256257The analysis is complete when:258- ✅ Repository successfully cloned and analyzed259- ✅ All major components identified260- ✅ Multiple ASCII diagrams created showing different views261- ✅ File structure documented and explained262- ✅ Technology stack clearly identified263- ✅ Hosting/deployment architecture understood264- ✅ Data flow between components visible265- ✅ Comprehensive documentation generated266267---268> Converted and distributed by [TomeVault](https://tomevault.io/claim/thomasgauvin) — claim your Tome and manage your conversions.269<!-- tomevault:4.0:skill_md:2026-04-11 -->