com um clique
api-validation
Use when adding or changing API validation in apps/api.
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Menu
Use when adding or changing API validation in apps/api.
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Baseado na classificação ocupacional SOC
Use when adding, changing, extracting, or reusing client components, including Storybook stories and controls.
Use when adding or changing forms in apps/client.
Use when changing GitHub OAuth, session cookies, SessionGuard, logout, or authenticated API request identity.
Use when adding or changing routes in apps/client.
Use when adding or changing client state, React Query data flow, immutable context values, or Zustand stores.
Use when styling apps/client with Tailwind CSS v4.
| name | api-validation |
| description | Use when adding or changing API validation in apps/api. |
Generated from ai/registry.json. Do not edit manually.
Canonical skill: ../../../ai/skills/api-validation.md.
Referenced context:
../../../ai/rules/api-validation-rules.md../../../ai/architecture/api-app.md../../../ai/examples/good-api-validation.mdThis file is compiled from canonical AI knowledge files. Edit canonical files under ai, then run npm run ai:sync.
ai/skills/api-validation.mdUse this skill when adding or changing API controllers, route params, request DTOs, or validation behavior in apps/api.
Keep request validation at Nest boundaries while preserving service ownership of authorization, existence checks, and business rules.
ai/rules/api-validation-rules.mdai/architecture/api-app.mdai/examples/good-api-validation.mdapi-module-architecture when the validation change also restructures controllers, use cases, support services, providers, or module exports.UuidParam, the shared wrapper around ParseUUIDPipe, for UUID route params.UuidParam instead of raw string params.@Body() type is a DTO with validation decorators.npm --workspace @capture-flag/api run build.ai/rules/api-validation-rules.mdRules for Nest controllers, DTOs, and request validation in apps/api.
ValidationPipe enabled in src/main.ts.class-validator decorators for request bodies.class-transformer decorators such as @Transform and @Type for normalization.UuidParam, the shared wrapper around ParseUUIDPipe, for every UUID route param before passing it into services.@Transform before validating.@IsUUID() or @IsEmail().@IsIn(...) and shared role constants.string params for IDs backed by Prisma @db.Uuid fields.UuidParam instead of raw string params.@Body() type is a DTO with validation decorators.npm --workspace @capture-flag/api run build after API validation changes.ai/architecture/api-app.mdapps/api is a NestJS API backed by Prisma and PostgreSQL.
request.user.id to services.SessionGuard and AuthenticatedRequest.AuthenticatedApiGuard, then API token tenant/scope guards.ApiTokenGuard directly, followed by tenant/scope guards.UuidParam, the shared wrapper around ParseUUIDPipe, in controllers.support services hold concrete reusable responsibilities such as access, audit, input normalization, read models, credentials, config state, references, validation, writers, or initializers.PrismaService./api/v1./api/v1/docs is filtered to the supported management subset.applyHttpSecurity() before request handling.ai/examples/good-api-validation.mdSource: apps/api/src/feature-flags/feature-flags.controller.ts (sha256: 1949c60371de22bf12e05ef4e366708dc2c7adfb69027c12f50516f741152f07)
Source: apps/api/src/projects/dto/projects.dto.ts (sha256: 8ba57f5fea22889c71de3571a4285309d127ceecfa8b7527b215dbf9e432508b)
Why this is canonical:
UuidParam, a small wrapper around ParseUUIDPipe, at controller boundaries.Canonical controller and colocated DTO patterns from apps/api.
@Get("configs/:configId/feature-flags")
list(@CurrentUserId() userId: string, @UuidParam("configId") configId: string) {
return this.listFeatureFlags.execute({ userId, configId });
}
Controllers parse UUID params and pass authenticated user identity to use-case services.
export class CreateProjectDto {
@ApiProperty({ maxLength: 120, minLength: 1 })
@Transform(({ value }) => trimString(value))
@IsString()
@MinLength(1)
@MaxLength(120)
name!: string;
@ApiPropertyOptional({ maxLength: 80, minLength: 1 })
@Transform(({ value }) => trimString(value))
@IsOptional()
@IsString()
@MinLength(1)
@MaxLength(80)
slug?: string;
}
DTOs normalize strings before validation and keep database-aware rules in services.