Skill Instructions
Use this skill for any feature or fix that adds or reads persisted data.
Mandatory Sequence
For every new persisted field/column:
- •Add the column in
backend/src/db/schema.tswithNOT NULL DEFAULT <value>. - •Generate migration with Drizzle Kit.
- •Add matching
ALTER TABLElogic inbackend/src/db/client.tsinsiderunAlterMigrations(). - •Read values null-safe in routes/services (
?? defaultValue).
Hard Rules
- •Never remove or rename existing columns.
- •Never add non-null columns without defaults.
- •Never read newly added fields without fallback.
- •Never manually edit generated Drizzle SQL migrations.
Verification Checklist
- •Schema update exists.
- •Generated migration exists.
- •Alter migration for existing DBs exists.
- •Runtime reads are fallback-safe.
Response Format
Report these items explicitly:
- •New/changed columns
- •Added alter-migration statements
- •Null-safe read locations
- •Remaining migration risk (if any)