Architecture review

From markerikson/opencode-config-example · View interactive version

Architecture review is an AI agent skill from the GitHub repository markerikson/opencode-config-example. Create architecture review documents to understand and document existing codebases. Use when onboarding to an unfamiliar codebase, conducting architecture audits, or creating reference documentation for team members.

How to use this skill

Skill file

Architecture Review Skill

Create architecture review documents that comprehensively document an existing codebase's structure, patterns, and systems.

When to Use This Skill

Don't use for:

File Location

Architecture reviews live in the dev-plans repository:

dev-plans/
└── {project}/
    ├── architecture/
    │   ├── 2025-12-29-backend-architecture.md
    │   └── 2025-12-15-api-layer-review.md
    └── current-focus.md

Naming: YYYY-MM-DD-{system-or-area}-architecture.md

Document Template

Title and Metadata

# [System/Codebase Name] - Architecture Review

**Review Date:** [Date]
**Codebase:** [Path or repo name]
**Scope:** [What parts of the codebase this covers]

---

Executive Summary

One paragraph summarizing what this system does and its key architectural characteristics.

## Executive Summary

[Brief description of the system's purpose, its main components, and notable architectural patterns. Reader should understand what this codebase does and its general shape after this paragraph.]

Tech Stack

Document the languages, frameworks, and key dependencies.

## Tech Stack

**Language(s):** [TypeScript, Python, Go, etc.]
**Framework(s):** [React, Express, FastAPI, etc.]
**Runtime:** [Node.js, Bun, Deno, etc.]

### Key Dependencies

| Package | Purpose |
|---------|---------|
| `package-name` | [What it's used for] |
| `package-name` | [What it's used for] |

### Dev Dependencies

| Package | Purpose |
|---------|---------|
| `vitest` | Testing |
| `eslint` | Linting |

Include:

Directory Structure

Show the high-level folder organization with brief descriptions.

## Directory Structure

src/

├── api/ # API routes and handlers

│ ├── routes/ # Route definitions

│ └── middleware/ # Request middleware

├── components/ # React components

│ ├── ui/ # Reusable UI primitives

│ └── features/ # Feature-specific components

├── hooks/ # Custom React hooks

├── store/ # State management

│ ├── slices/ # Redux slices

│ └── api/ # RTK Query definitions

├── types/ # TypeScript type definitions

└── utils/ # Utility functions


### Key Directories

#### `src/api/`

[2-3 sentences describing what's in this directory and how it's organized]

#### `src/store/`

[Description]

Guidelines:

Core Systems

Document the major systems/subsystems and how they work.

## Core Systems

### [System Name]

**Purpose:** [What this system does]
**Key Files:** 
- `path/to/main-file.ts`
- `path/to/related-file.ts`

[2-4 paragraphs explaining how this system works, its responsibilities, and how it fits into the larger architecture]

#### How It Works

[Detailed explanation with code snippets if helpful]

// Example showing key pattern


#### Key Concepts

- **[Concept 1]:** [Definition]
- **[Concept 2]:** [Definition]

Repeat for each major system. Typical systems to document:

Data Flow

Describe how data moves through the application.

## Data Flow

### [Flow Name] (e.g., "User Request Flow")

[User Action] → [Component] → [Hook/Action] → [API] → [Backend] → [Database]

↓

[State Update]

↓

[Re-render]


[Prose explanation of the flow]

### [Another Flow Name]

[Diagram and explanation]

Include:

Key Data Structures

Document important types, interfaces, and data shapes.

## Key Data Structures

### [Type/Interface Name]

**Location:** `path/to/types.ts`
**Purpose:** [What this represents]

interface AppState {

user: User | null;

settings: Settings;

// ... key fields

}


**Usage:** [Where and how this is used]

### [Another Type]

[Same structure]

Focus on:

Architectural Patterns

Document recurring patterns used throughout the codebase.

## Architectural Patterns

### 1. [Pattern Name]

**What:** [Brief description]
**Where:** [Where this pattern is used]
**Why:** [Why this pattern was chosen]

// Example implementation


### 2. [Pattern Name]

[Same structure]

Common patterns to look for:

File Index

Quick reference to important files.

## File Index

### Entry Points
| File | Purpose |
|------|---------|
| `src/index.ts` | Application entry point |
| `src/App.tsx` | Root component |

### Configuration
| File | Purpose |
|------|---------|
| `tsconfig.json` | TypeScript configuration |
| `vite.config.ts` | Build configuration |

### Core Logic
| File | Purpose |
|------|---------|
| `src/store/index.ts` | Store configuration |
| `src/api/client.ts` | API client setup |

Configuration

Document how configuration is managed.

## Configuration

### Config Files

| File | Purpose |
|------|---------|
| `tsconfig.json` | TypeScript compiler options |
| `.env.example` | Environment variable template |
| `vite.config.ts` | Build configuration |

### Environment Variables

| Variable | Purpose | Required |
|----------|---------|----------|
| `DATABASE_URL` | Database connection | Yes |
| `API_KEY` | External API access | Yes |
| `DEBUG` | Enable debug logging | No |

### Runtime Configuration

[How is configuration loaded? dotenv? Config files? Environment-specific?]

Build & Deploy

Document how to build, test, and deploy.

## Build & Deploy

### Common Commands

| Command | Purpose |
|---------|---------|
| `pnpm install` | Install dependencies |
| `pnpm dev` | Run development server |
| `pnpm build` | Production build |
| `pnpm test` | Run tests |
| `pnpm typecheck` | Type check without emit |

### Build Process

[How does the build work? What's the output?]

### Deployment

[How is this deployed? CI/CD? Manual? What environments exist?]

External Integrations

Document external services and APIs.

## External Integrations

### [Service Name]

**Purpose:** [What it's used for]
**Integration Point:** `path/to/integration.ts`
**Docs:** [Link to service docs]

### [Database/Storage]

**Type:** [PostgreSQL, MongoDB, S3, etc.]
**Connection:** [How is it connected?]
**Schema:** [Where are schemas/migrations defined?]

Observations & Recommendations

Optional section for noting issues, tech debt, or improvement opportunities.

## Observations

### Strengths
- [What's working well]
- [Good patterns in use]

### Areas of Concern
- [Potential issues or tech debt]
- [Inconsistencies noted]

### Recommendations
- [Suggested improvements]
- [Refactoring opportunities]

Writing Guidelines

  1. Audience: Engineers unfamiliar with the codebase
  2. Tone: Descriptive, neutral, educational
  3. Depth: Cover breadth first, depth where it matters
  4. Examples: Include code snippets to make patterns concrete
  5. Visual: Use diagrams, trees, and tables for clarity

Section Priority

Always include:

Include when helpful:

Optional:

Common Pitfalls

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.