/codebase-intel:codebase-architecture-scannerfrom codebase-intel
Scans codebase to generate comprehensive high-level and detailed architectural documentation
Ships in codebase-intel. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
This skill helps you automatically scan your codebase and generate comprehensive architectural documentation at multiple levels of detail.
Use this skill when you need to:
This skill generates documentation at three levels:
Identify Project Type and Stack
package.json, build configs, and framework filesScan Directory Structure
Glob to map out key directories (src/, app/, pages/, components/, etc.)api/, lib/, utils/, services/, etc.)Analyze Key Files
pages/api/, app/api/, or framework-specific route filesMap Dependencies and Integrations
Identify Cross-Cutting Concerns
Generate High-Level Overview Create a document with:
Generate Component-Level Documentation For each major component/module:
Generate Implementation Details
Create Visual Diagrams with Mermaid Generate Mermaid diagrams embedded in markdown for:
System Architecture Diagrams:
Flow Diagrams:
Data Architecture:
Mermaid Syntax Examples:
Flowchart (System Architecture):
flowchart TB
User[User] --> NextJS[Next.js App]
NextJS --> API[API Routes]
API --> Auth[Auth Service]
API --> DB[(Database)]
API --> AI[AI Service]
AI --> OpenAI[OpenAI API]
AI --> Claude[Claude API]
C4 Context Diagram:
C4Context
title System Context for <Your System>
Person(user, "End User", "Uses the product")
System(app, "Your System", "The application being documented")
System_Ext(idp, "Identity Provider", "OAuth / SSO")
System_Ext(db, "Managed Database", "Primary datastore")
System_Ext(mail, "Email Service", "Transactional email")
Rel(user, app, "Uses", "HTTPS")
Rel(app, idp, "Authenticates via", "OIDC")
Rel(app, db, "Reads and writes", "TCP")
Rel(app, mail, "Sends notifications", "API")
Sequence Diagram (User Flow):
sequenceDiagram
actor User
participant App
participant API
participant Auth
participant AI
User->>App: Click "Summarize"
App->>API: POST /api/summarize
API->>Auth: Verify token
Auth-->>API: Token valid
API->>AI: Summarize document
AI-->>API: Summary text
API->>App: Return summary
App->>User: Display summary
Entity Relationship Diagram:
erDiagram
USER ||--o{ DOCUMENT : uploads
USER {
uuid id PK
string email
string tier
}
DOCUMENT {
uuid id PK
uuid user_id FK
string title
json metadata
timestamp created_at
}
DOCUMENT ||--o{ SUMMARY : has
SUMMARY {
uuid id PK
uuid document_id FK
text content
}
State Diagram (Auth Flow):
stateDiagram-v2
[*] --> Unauthenticated
Unauthenticated --> Authenticating: Login
Authenticating --> Authenticated: Success
Authenticating --> Unauthenticated: Failure
Authenticated --> Unauthenticated: Logout
Authenticated --> [*]
Class Diagram (Service Layer):
classDiagram
class NPCGenerator {
+generateNPC(params)
+validateInput(input)
-callAI(prompt)
}
class GuardrailService {
+checkSRDCompliance(content)
+sanitizeInput(text)
}
class AIService {
+callOpenAI(prompt)
+callClaude(prompt)
}
NPCGenerator --> GuardrailService
NPCGenerator --> AIService
How to Embed Mermaid in Markdown:
mermaid language identifierOrganize Documentation
docs/architecture/ directory if not existsoverview.md - High-level architecturecomponents.md - Component detailsimplementation.md - Implementation guidedata-flow.md - Data flow documentationintegrations.md - External integrationssecurity.md - Security architecturediagrams/ - Visual diagrams (if generated)Cross-Reference Existing Documentation
Generate Table of Contents
docs/architecture/overview.md# Architecture Overview
## System Context
[Brief description of the system and its purpose]
## Technology Stack
- **Frontend**: [Framework and key libraries]
- **Backend**: [Framework and key services]
- **Database**: [Database technology]
- **Infrastructure**: [Hosting, CDN, etc.]
- **External Services**: [Third-party integrations]
## High-Level Architecture
```mermaid
flowchart TB
subgraph "Client Layer"
Web[Web App]
Mobile[Mobile App]
end
subgraph "Application Layer"
API[API Routes]
Auth[Auth Service]
Business[Business Logic]
end
subgraph "Data Layer"
DB[(Database)]
Cache[(Cache)]
end
subgraph "External Services"
AI[AI Services]
Payment[Payment Gateway]
Email[Email Service]
end
Web --> API
Mobile --> API
API --> Auth
API --> Business
Business --> DB
Business --> Cache
Business --> AI
Business --> Payment
Business --> Email
sequenceDiagram
actor User
participant Client
participant API
participant Auth
participant Service
participant DB
participant External
User->>Client: Initiates action
Client->>API: HTTP Request
API->>Auth: Verify credentials
Auth-->>API: Auth result
alt Authenticated
API->>Service: Process request
Service->>DB: Query/Update data
DB-->>Service: Data result
opt External Service Needed
Service->>External: API call
External-->>Service: Response
end
Service-->>API: Processed result
API-->>Client: Success response
Client-->>User: Display result
else Not Authenticated
API-->>Client: 401 Unauthorized
Client-->>User: Show login
end
flowchart LR
subgraph "CDN"
CDN[Static Assets]
end
subgraph "App Server"
Server[Next.js Server]
end
subgraph "Database"
Primary[(Primary DB)]
Replica[(Read Replica)]
end
subgraph "External"
AI[AI APIs]
Storage[Object Storage]
end
CDN --> Server
Server --> Primary
Server --> Replica
Server --> AI
Server --> Storage
docs/architecture/components.md# Component Architecture
## [Component 1 Name]
### Purpose
[What this component does and why it exists]
### Structure
[Directory structure]
### Key Files
- `path/to/file.ts` - [Description]
- `path/to/other.ts` - [Description]
### Public API
[List of exported functions, classes, components]
### Dependencies
- Internal: [List internal dependencies]
- External: [List external dependencies]
### Configuration
[Environment variables, config files]
### Security Considerations
[Auth, validation, sanitization relevant to this component]
### Component Interaction
```mermaid
flowchart LR
Component1[This Component]
Component2[Dependency A]
Component3[Dependency B]
External[External Service]
Component1 -->|uses| Component2
Component1 -->|calls| Component3
Component1 -.->|optional| External
style Component1 fill:#e1f5ff
[Repeat for each major component]
### File: `docs/architecture/implementation.md`
```markdown
# Implementation Guide
## Code Organization
[Explain the organizational patterns used]
## Critical Patterns
### Pattern Name
- **Location**: `path/to/pattern.ts`
- **Purpose**: [Why this pattern exists]
- **Usage**: [How to use it]
- **Example**:
```typescript
[Code example]
[How to test different parts of the system]
[How the application is built]
[How to configure the application]
## Tips for Best Results
1. **Start Broad, Then Go Deep**: Begin with the high-level overview, then drill into specific components
2. **Use Grep Strategically**: Search for patterns like `export`, `import`, `API`, `useAuth`, etc.
3. **Follow the Data**: Trace data flow from API endpoints → services → database
4. **Document the "Why"**: Include architectural decisions and trade-offs
5. **Keep It Updated**: Run this skill after major refactors or new features
6. **Link to Code**: Always include file paths and line references
7. **Validate Against Running System**: Cross-check documentation against actual behavior
8. **Use Mermaid Diagrams**: Embed Mermaid diagrams in markdown for version-controllable, auto-rendering visuals that display in GitHub/GitLab
## Advanced Options
When invoking this skill, you can specify:
- **`--focus=<component>`**: Focus on a specific component or subsystem
- Examples: `--focus=auth`, `--focus=api`, `--focus=database`
- **`--level=<1|2|3>`**: Generate only specific documentation level
- `--level=1`: High-level overview only (executives, stakeholders)
- `--level=2`: Component-level details (developers)
- `--level=3`: Implementation details (maintainers)
- **`--format=<markdown|c4|mermaid>`**: Specify diagram format (default: `mermaid`)
- `markdown`: Text-based diagrams and descriptions
- `c4`: C4 model diagrams (context, container, component)
- `mermaid`: Mermaid diagrams embedded in markdown (recommended - renders on GitHub/GitLab)
- **`--update`**: Update existing documentation rather than regenerate
- Preserves manual edits and ADRs
- Only updates outdated sections
- **`--diagrams=<all|minimal|none>`**: Control diagram generation
- `all`: Generate all diagram types (flowcharts, sequences, ERDs, etc.)
- `minimal`: Only system context and high-level architecture
- `none`: Text-based documentation only
## Example Invocations
```bash
# Generate component-level docs for auth subsystem with Mermaid diagrams
/codebase-architecture-scanner --focus=auth --level=2 --format=mermaid
# Generate full documentation with all diagram types
/codebase-architecture-scanner --diagrams=all
# Update existing docs without regenerating everything
/codebase-architecture-scanner --update
# High-level overview only for stakeholder presentation
/codebase-architecture-scanner --level=1 --diagrams=minimal
This skill should:
After generating documentation:
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
5 skills in this plugin
/codebase-healthUse when onboarding to an unfamiliar codebase, before major refactors, during periodic health checks, or when diagnosing why code keeps breaking. Also use when assessing bus factor, churn hotspots, or development velocity on any git repository./grill-with-docsGrilling session that challenges your plan against the existing domain model, sharpens terminology, and updates documentation (CONTEXT.md, ADRs) inline as decisions crystallise. Use when user wants to stress-test a plan against their project's language and documented decisions./read-the-damn-docsUse when implementing, integrating, upgrading, debugging, or answering anything involving third-party APIs, libraries, frameworks, CLIs, cloud services, model/provider SDKs, fast-moving product behavior, user requests for latest/current/official behavior, unfamiliar repo docs/specs, errors that may indicate API drift, or high-stakes auth, security, billing, data, migration, deployment, compliance, or privacy behavior. Forces Codex to web-search for current official docs and read primary docs before assuming from memory./teach-code-to-masteryUse when the user wants to DEEPLY understand code — a set of changes, a PR, a session of work, a tricky module, an algorithm, or a technical concept in the codebase — not just have it summarized. Teaches incrementally and gates progress on demonstrated mastery, using free-recall restatement and quizzes. Triggers on 'teach me X', 'help me understand X', 'quiz me on X', 'I want to really get X', 'walk me through what we built'. Single sitting, code only: not for exam or certification prep, and not for multi-session courses or books.npx claudepluginhub stylusnexus/agent-plugins --plugin codebase-intel