# CLAUDE.md
This file provides guidance to Claude Code when working with this codebase.
Generated by [sourcebook](https://github.com/maroondlabs/sourcebook). Review and edit — the best context comes from human + machine together.
## Quick Reference
- **routing:** API endpoints use Fastify routes
- **testing:** Tests use Node.js built-in test runner. Test utilities in: test/logger/logger-test-utils.js.
## Commands
- **Test:** `npm run lint && npm run unit && npm run test:typescript`
- **Lint:** `npm run lint:eslint`
## Critical Constraints
- **Core modules:** Hub files (most depended on): lib/symbols.js (imported by 19 files); lib/errors.js (imported by 17 files); fastify.js (imported by 17 files); lib/hooks.js (imported by 7 files); lib/warnings.js (imported by 5 files). Changes here have the widest blast radius.
## Stack
TypeScript
## Project Structure
- `types/` — TypeScript type definitions
- `test/` — Tests
- `scripts/` — Build / utility scripts
- `lib/` — Library code
- `docs/` — Documentation
## Core Modules (by structural importance)
- `lib/symbols.js`
- `lib/errors.js`
- `lib/schemas.js`
- `lib/decorate.js`
- `lib/error-status.js`
## Conventions & Patterns
- **Dominant patterns:**
- API endpoints use Fastify routes. Follow this pattern for new routes.
- Tests use Node.js built-in test runner. Test utilities in: test/logger/logger-test-utils.js.
## Before Making Changes
- **Check file importance** before editing. Hub files (listed in Core Modules) affect many other files — changes here have the widest blast radius.
- **Follow existing patterns.** This project has established conventions (listed above). Match them instead of introducing new approaches.
- **Respect constraints.** Review the Critical Constraints section before making structural changes.
If the sourcebook MCP server is available (`sourcebook serve`), verify before acting:
- `get_blast_radius` — check what breaks if you edit a hub file
- `query_conventions` — confirm the right pattern before adding new code
- `get_pressing_questions` — get a briefing before editing an unfamiliar file
## What to Add Manually
The most valuable context is what only you know. Add:
- Architectural decisions and why they were made
- Past incidents that shaped current conventions
- Deprecated patterns to avoid in new code
- Domain-specific rules or terminology
- Environment setup beyond what .env.example shows