Стандарты REST API на NestJS

engineering

api-conventions is a Claude Code skill that enforces REST endpoint design conventions across the MX Space TypeScript/NestJS codebase. It covers the full controller lifecycle: `@ApiController` (which auto-prepends `/api/v{version}` in production), authentication decorators such as `@Auth()` and `@CurrentUser()`, and a global `ResponseInterceptor` that wraps return values into `{ data }` or `{ data, meta }` envelopes — with `withMeta` detected by an internal Symbol to avoid double-wrapping. Response fields are converted to snake_case at the wire boundary via `transformResponseCase`, and specific subtrees can opt out with `@BypassCaseTransform`. Pagination always lives in `meta` and is built with `MetaObjectBuilder`; `BasePgCrudFactory` reduces CRUD boilerplate. Business errors use `BusinessException` with `ErrorCodeEnum`, while standard NestJS HTTP exceptions handle generic cases. The skill is invoked automatically when writing controllers or HTTP request handlers.