| name | supabase-verification |
| description | Use when verifying Supabase schema changes or generating types |
Supabase Verification Workflow
Prerequisites
Before running any PNPM scripts (including Supabase commands), you MUST verify the script exists in package.json. See the general-pnpm-scripts skill for the verification workflow.
Type Generation
- Command:
pnpm sb:dev:types
- Generates TypeScript types from local Supabase schema
- Output:
src/types/database.types.ts
When to Run Type Generation
- After applying migrations
- After schema changes via Supabase Studio
- Before committing database changes
- When TypeScript shows type mismatches with DB
Testing Migrations
Apply incrementally (preserves data):
- Command:
pnpm sb:dev:push
- Applies new migrations only
- Preserves existing test data
- Use for day-to-day development
Full reset (clean slate):
- Command:
pnpm sb:dev:reset
- Resets local database to clean state
- Re-applies all migrations in order
- Use for final verification before production or when DB is corrupted
Verification Workflow
Daily development:
- Make schema changes (migration or Studio)
- Apply migrations:
pnpm sb:dev:push
- Regenerate types:
pnpm sb:dev:types
- Test application with new types
- Commit migration files AND regenerated types together
Before production push:
- Verify migrations from scratch:
pnpm sb:dev:reset
- Regenerate types:
pnpm sb:dev:types
- Test application thoroughly
- Push to production:
pnpm sb:prod:push
Database Lint Verification
CRITICAL: Run after every migration:
cd spark/frontend/my-vite-app
supabase db lint
What It Checks:
- RLS performance (auth.uid() optimization)
- Duplicate policies
- Duplicate indexes
- Other performance issues
Required Action: Fix all warnings before deploying.