Code style review

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

Code style review is an AI agent skill from the GitHub repository markerikson/opencode-config-example. Document coding conventions, patterns, and guidelines for an existing codebase. Use when onboarding to a new project to understand its coding style, or when creating style documentation for team reference.

How to use this skill

Skill file

Code Style Review Skill

Create code style documentation that captures coding conventions, patterns, and guidelines for an existing codebase.

When to Use This Skill

Don't use for:

File Location

Code style reviews live in the dev-plans repository:

dev-plans/
└── {project}/
    └── architecture/
        ├── YYYY-MM-DD-architecture.md
        └── YYYY-MM-DD-code-style.md

Naming: YYYY-MM-DD-code-style.md

Analysis Process

1. Gather Evidence

Before writing, examine:

Config files:

Sample code:

Existing docs:

2. Observe, Don't Prescribe

Document what IS, not what should be:


Document Template

# Code Style: {Project Name}

**Analyzed:** YYYY-MM-DD
**Codebase:** {path or repo}

---

## Naming Conventions

### Files and Directories

[How are files named? kebab-case, camelCase, PascalCase?]

- Source files: `{pattern}` (e.g., `user-service.ts`)
- Test files: `{pattern}` (e.g., `user-service.test.ts`)
- Component files: `{pattern}` (if applicable)
- Directories: `{pattern}`

### Functions and Methods

[Naming patterns for functions]

// Example from codebase


### Classes and Types

[Naming patterns for classes, interfaces, types]

// Example from codebase


### Variables and Constants

- Variables: `{pattern}` (e.g., camelCase)
- Constants: `{pattern}` (e.g., SCREAMING_SNAKE_CASE)
- Private members: `{pattern}` (e.g., _prefixed or #private)

---

## File Organization

### Directory Structure Pattern

src/

├── {pattern}/ # {what goes here}

├── {pattern}/ # {what goes here}

└── {pattern}/ # {what goes here}


### File Structure Pattern

[How are individual files typically organized?]

// 1. Imports (grouped how?)

// 2. Types/interfaces

// 3. Constants

// 4. Main exports

// 5. Helper functions


### Module Boundaries

[How are modules separated? Barrel exports? Index files?]

---

## Import Style

### Grouping

[How are imports organized?]

// Example showing import organization


### Preferred Patterns

- Absolute vs relative imports: {pattern}
- Barrel imports: {used/not used}
- Type imports: {inline vs separate}

---

## Code Patterns

### Common Patterns

#### {Pattern Name}

**Where used:** {locations}

// Example from codebase


#### {Pattern Name}

**Where used:** {locations}

// Example from codebase


### Async Patterns

[How is async code typically written?]

// Example


### State Management (if applicable)

[Patterns for managing state]

---

## Error Handling

### Error Types

[What error types/classes are used?]

// Example


### Throwing Errors

[Pattern for throwing errors]

### Catching Errors

[Pattern for catching and handling errors]

### Logging

[How is logging done? What levels? What format?]

// Example


---

## Testing

### Test File Location

- Pattern: `{where tests live}`
- Naming: `{test file naming pattern}`

### Test Structure

// Example test structure from codebase


### Mocking Patterns

[How are mocks typically done?]

### What Gets Tested

[Unit tests? Integration tests? What's the focus?]

---

## Tooling

### Linter

- Tool: {ESLint, Biome, etc.}
- Config: `{path to config}`
- Key rules: {notable enabled/disabled rules}

### Formatter

- Tool: {Prettier, Biome, etc.}
- Config: `{path to config}`
- Key settings: {tab width, quotes, etc.}

### Type Checking

- Config: `{path to tsconfig}`
- Strictness: {strict mode? key compiler options}

### Pre-commit

[Any pre-commit hooks? Husky? lint-staged?]

---

## Do's and Don'ts

### Do

- [Pattern to follow]
- [Pattern to follow]
- [Pattern to follow]

### Don't

- [Anti-pattern to avoid]
- [Anti-pattern to avoid]
- [Anti-pattern to avoid]

---

## Inconsistencies Noted

[Any inconsistencies observed in the codebase - not judgmental, just factual]

- {inconsistency 1}
- {inconsistency 2}

Writing Guidelines

  1. Evidence-based: Every pattern should have a file path reference
  2. Examples: Include actual code snippets from the codebase
  3. Neutral tone: Describe what exists, not what's "right" or "wrong"
  4. Actionable: Someone should be able to write conforming code after reading
  5. Concise: Keep under 400 lines - trim if needed

Section Priority

Always include:

Include when relevant:

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.