# Add Table

> Adds a new database table and generates all six layers of the platform codebase, from schema to UI, with validation at each step.

- Skill: `joshuashepherd/add-table` (Agent Skill)
- Install (CLI): `npx skillmds add joshuashepherd/add-table`
- Raw SKILL.md: https://api.skillmd.com/api/skills/joshuashepherd/add-table/raw
- Safety review: PASS (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools, Dev Tooling
- Tags: Codegen, Database, Drizzle, Multi Tenant, Pnpm, Schema
- Author: JoshuaShepherd (https://skillmd.com/u/joshuashepherd)
- Updated: 2026-08-22
- Page: https://skillmd.com/skills/joshuashepherd/add-table

---


Add a new entity to the platform by working bottom-up through all six layers.

Entity name: $0

## Process

1. **Layer 1 — Schema**: Add the table definition to `src/lib/database/schema.ts` following existing patterns. Include `organization_id` for multi-tenant scoping. Use appropriate column types matching existing conventions.
2. **Layer 2 — Zod**: Run `pnpm generate:schemas` then `pnpm contracts:check`
3. **Layer 3 — Services**: Run `pnpm generate:services` then `pnpm services:check`
4. **Layer 4 — Routes**: Run `pnpm generate:routes` then `pnpm routes:check`
5. **Layer 5 — Hooks**: Run `pnpm generate:hooks` then `pnpm hooks:check`
6. **Layer 6 — UI**: Run `pnpm generate:ui` then `pnpm 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:gen` to create the migration
- Do not run `pnpm drizzle:push` without explicit user confirmation

