---
description: Generate a full vertical slice — DB schema → API endpoint → frontend page — for one feature.
argument-hint: <feature-name> [domain]
---

# /create-feature

## Purpose

Generate a complete vertical slice for a new feature: Prisma model + migration, .NET CQRS handlers + controller (or NestJS module), Angular feature (or Next.js route), i18n keys, and tests.

## Required context

- `CLAUDE.md` (conventions), `knowledge/patterns/`, the matching blueprint in `.claude/blueprints/`
- `prisma/schema.prisma`, `dotnet/src/` layout, `apps/web-angular/src/app/features/`

## Inputs

- `$1` — feature name in kebab-case (e.g. `leave-request`)
- `$2` — optional domain folder (defaults to the feature name)

## Execution steps

1. Clarify the entity shape with the user if not obvious (fields, relations, permissions).
2. **DB:** add the model to `prisma/schema.prisma` (audit fields + soft delete + tenantId). Mirror in `database/migrations/`. Do NOT run `prisma migrate` without confirmation.
3. **Backend:** scaffold `dotnet/src/Domain/<Domain>/`, `Application/<Domain>/{Commands,Queries}`, `Api/Controllers/<Domain>Controller.cs` following the `ApiResponse<T>` convention. (Or a NestJS module if the feature lives there.)
4. **Contracts:** add Zod schemas to `packages/api-contracts/`.
5. **Frontend:** scaffold `apps/web-angular/src/app/features/<domain>/` (standalone, signals, OnPush) with list + form, wired through `BaseApiService`.
6. **i18n:** add `en` + `th` keys.
7. **Tests:** add a validator test (backend) and a component test (frontend).

## Validation checklist

- [ ] `pnpm validate` passes
- [ ] `dotnet build` + `dotnet test` pass (if .NET touched)
- [ ] `pnpm --filter web-angular typecheck` passes
- [ ] i18n keys exist in both `en` and `th`
- [ ] Permissions added to `permission.constants.ts` + `PermissionConstants.cs` + seed

## Expected output

A working feature reachable from a route, with API + DB + tests.

## Failure handling

If schema is ambiguous, stop and ask. If a migration would be destructive, write an ADR and confirm before applying.
