---
globs:
  - "src/**/*.ts"
---

# API Design Patterns

- **Files:** `kebab-case.ts` | **Types:** `PascalCase` | **Functions:** `camelCase`
- **Module exports order:** types/interfaces → functions → constants
- **Errors:** Custom error classes extending `Error` with error codes and context
- **Async:** Use `async/await` with typed `Promise<T>` returns, try/catch for rejections
- **Validation:** Zod schemas at all public API boundaries — never return `any`
- **File I/O:** Absolute paths from project root, check existence, atomic writes (write to temp → rename)
