| type | skill |
| name | Code Review |
| description | Review code quality, patterns, and best practices |
| skillSlug | code-review |
| phases | ["R","V"] |
| generated | "2026-03-18T00:00:00.000Z" |
| status | filled |
| scaffoldVersion | 2.0.0 |
Code Review
Guidelines for reviewing code changes in the @dotcontext/cli project.
When to Use
- Reviewing a pull request or diff
- Validating code during the Review (R) or Validation (V) phases of the PREVC workflow
- Checking a new service, generator, or utility for adherence to project patterns
- Evaluating MCP gateway handler implementations
Project Standards
TypeScript Configuration
- Target: ES2020, Module: CommonJS
- Strict mode enabled (
"strict": true)
- Declarations and source maps generated
- Path alias:
@generators/agents/* maps to src/generators/agents/*
Code Organization Patterns
Service Layer (22 services in src/services/):
- Each service lives in its own directory under
src/services/
- Exports through
index.ts barrel files
- Constructor takes an options object or required config
- Methods are async where I/O is involved
- Example:
FillService, WorkflowService, AIContextMCPServer
Generators (src/generators/):
- Separate generators for docs, agents, plans, skills
- Accept options objects, return typed result objects (e.g.,
SkillGeneratorResult)
- Use frontmatter serialization from
src/types/scaffoldFrontmatter.ts
Utilities (src/utils/):
- Pure functions or thin wrappers:
frontMatter.ts, contentSanitizer.ts, gitService.ts
- CLI UI abstraction:
cliUI.ts with CLIInterface type
- i18n:
i18n.ts with TranslateFn type and en/pt-BR locale support
MCP Gateway Handlers (src/services/mcp/gateway/):
- One file per gateway:
explore.ts, context.ts, sync.ts, etc.
- Exports: handler function, params type, options type, action type
- Uses
createJsonResponse/createErrorResponse/createTextResponse from response.ts
- Barrel re-export through
index.ts and gatewayTools.ts
Review Checklist
Architecture
TypeScript Quality
Error Handling
Naming Conventions
Testing
Frontmatter
i18n
Instructions
Reviewing a Service Change
- Check the service's public interface -- does it follow the options-object constructor pattern?
- Verify barrel exports in
index.ts are updated
- Check for proper error handling (try/catch with typed errors)
- Ensure no side effects in constructors (async init should be a separate method)
- Look for dependency injection points (e.g.,
AIContextMCPServer accepts contextBuilder for testing)
Reviewing an MCP Tool Change
- Verify Zod schema has
.describe() on every param with action prefix
- Check that the handler switch covers all actions in the enum
- Confirm responses use
createJsonResponse/createErrorResponse consistently
- Verify new types are re-exported through
gatewayTools.ts
- Check that
repoPath uses the caching mechanism via getRepoPath()
Reviewing a Generator Change
- Check output paths are constructed with
path.join(repoPath, outputDir, ...)
- Verify
force flag is respected (skip existing files when false)
- Ensure frontmatter is generated via
createSkillFrontmatter/serializeFrontmatter from scaffoldFrontmatter.ts
- Check that the result type includes all relevant counts (generated, skipped, etc.)
Reviewing a Workflow Change
- Verify phase transitions follow PREVC order (P -> R -> E -> V -> C)
- Check scale-dependent phase inclusion (QUICK: E+V only, SMALL: P+E+V, MEDIUM: P+R+E+V, LARGE: all)
- Ensure gate checks are enforced unless
autonomous or force is true
- Verify workflow status file is written to
.context/runtime/workflows/