add-table
Add a new database table and generate all six layers. Use when adding a new entity to the platform.
SKILL.mdclaude/codegen/add-table/SKILL.md
GitHubAdd a new entity to the platform by working bottom-up through all six layers.
Entity name: $0
Process
- Layer 1 — Schema: Add the table definition to
src/lib/database/schema.tsfollowing existing patterns. Includeorganization_idfor multi-tenant scoping. Use appropriate column types matching existing conventions. - Layer 2 — Zod: Run
pnpm generate:schemasthenpnpm contracts:check - Layer 3 — Services: Run
pnpm generate:servicesthenpnpm services:check - Layer 4 — Routes: Run
pnpm generate:routesthenpnpm routes:check - Layer 5 — Hooks: Run
pnpm generate:hooksthenpnpm hooks:check - Layer 6 — UI: Run
pnpm generate:uithenpnpm ui:check
Rules
- Validate each layer before proceeding to the next
- If any layer fails, fix it before continuing (always fix at the source layer)
- Never modify a lower layer to satisfy an upper layer's needs
- After all layers pass, run
pnpm drizzle:gento create the migration - Do not run
pnpm drizzle:pushwithout explicit user confirmation