Scaffold a new feature module with all required directories and boilerplate. Use when the user wants to create a new feature, add a new module, or set up a new domain area in the codebase.
Scaffold a new feature module at src/features/<name>/ following the project's established co-location pattern.
The user provides: <feature-name> in kebab-case (e.g., file-upload, report-export)
Every feature module gets this structure:
src/features/<name>/
├── components/ # React components ("use client" boundary lives here)
├── actions/ # Server Actions ({verb}.action.ts)
├── hooks/ # Custom React hooks
├── stores/ # Zustand domain store ({name}.store.ts)
├── validation/ # Zod schemas ({name}Schemas.ts)
└── types.ts # Feature-specific TypeScript types
types.ts// src/features/<name>/types.ts
// Feature-specific types for <Name>
export interface <Name>Data {
id: string
tenantId: string
// TODO: add feature-specific fields
}
validation/<name>Schemas.ts — Zod schemas// src/features/<name>/validation/<name>Schemas.ts
import { z } from 'zod'
export const create<Name>Schema = z.object({
// TODO: add validation fields
})
export type Create<Name>Input = z.infer<typeof create<Name>Schema>
| Element | Convention | Example |
|---|---|---|
| Feature directory | kebab-case | file-upload/ |
| Components | PascalCase | FileUploadView.tsx |
| Server Actions | {verb}.action.ts | uploadFile.action.ts |
| Stores | {domain}.store.ts | fileUpload.store.ts |
| Types file | types.ts | types.ts |
| Zod schemas | camelCase + Schema | fileUploadSchema |
| Validation file | {name}Schemas.ts | fileUploadSchemas.ts |
export default)@/ alias for all importsindex.ts) in feature modules'use client' directive'use server' + import 'server-only'eq(table.tenantId, currentUser.tenantId) tenant filterTell the user:
src/features/<name>/types.ts, create server actions with /add-server-action, add componentssrc/app/(app)/<name>/page.tsxExisting modules to match patterns against:
src/features/dashboard/ — full example (actions, components, hooks, stores, types, validation)src/features/glossary/ — example with extra subdirs (matching, parsers)src/features/taxonomy/ — simpler example