{"id":"code-dev-review-migration-must-should-nit","audience":"developers","category":"coding","track":"coding","technique":"format","title":"Review a migration with one MUST, one SHOULD and one NIT","free":false,"task":"Review this Postgres 16 migration as exactly 3 numbered comments: one 'MUST (L<n>): ...', then one 'SHOULD (L<n>): ...', then one 'NIT (L<n>): ...', each under 25 words. Team rule: anything that blocks writes on a table over 1 million rows is a MUST. Don't flag the ADD COLUMN with a constant DEFAULT; on Postgres 11+ it doesn't rewrite the table. No code blocks, no summary.","materialLabel":"The migration, with line numbers (attached to your prompt automatically)","material":" 1 | -- 2026_11_05_add_fulfillment_status.sql\n 2 | -- migraton for the new fulfillment dashboard (FUL-61)\n 3 | ALTER TABLE orders ADD COLUMN fulfillment_status TEXT NOT NULL DEFAULT 'pending';\n 4 |\n 5 | CREATE INDEX idx_orders_fulfillment_status ON orders (fulfillment_status);\n 6 |\n 7 | UPDATE orders SET fulfillment_status = 'shipped' WHERE shipped_at IS NOT NULL;\n 8 |\n 9 | -- no down migration yet, will add later\n\nContext\n- orders: 41 million rows, ~300 writes per second at peak\n- the migration runner wraps each file in a single transaction\n- deploys go out at 14:00 UTC, which is peak traffic for EU customers\n- Line 7 touches about 38 million rows\n- Author: Kemal (first migration on this team)\n- Our migration guide says every file needs a down section","rules":[{"type":"numberedItems","count":3},{"type":"codeBlocks","count":0},{"type":"maxProseWords","max":100}],"mistakes":[{"title":"No severity labels","why":"Without your scheme, the AI writes a flat list where nothing says what blocks the merge.","fix":"Show the shape: \"1. MUST (L5): ... 2. SHOULD (L9): ... 3. NIT (L2): ...\".","checks":["r0"]},{"title":"Flagging a non-issue","why":"The AI often warns that ADD COLUMN with DEFAULT rewrites the table, which stopped being true in Postgres 11.","fix":"Add: \"Postgres 16. Don't flag the ADD COLUMN DEFAULT on line 3.\"","checks":["r2"]},{"title":"Wrong priority","why":"Without your rule, the AI may rank the missing down migration above a write-blocking index.","fix":"Add: \"Anything that blocks writes on a table over 1M rows is a MUST.\"","checks":["r1"]},{"title":"A long review with fixes","why":"The AI lists 6 or more points and pastes rewritten SQL.","fix":"Add: \"Exactly 3 numbered comments under 25 words each. No code blocks.\"","checks":["numberedItems","codeBlocks","maxProseWords"]}],"promptHints":[{"label":"Gives the labels","patterns":["must","should","nit"]},{"label":"Asks for line numbers","patterns":["\\(L","line number","L\\d"]},{"label":"Gives the priority rule","patterns":["1 ?million","blocks writes","lock"]},{"label":"Names the Postgres version","patterns":["postgres(ql)? ?1[1-9]","pg ?16","version"]},{"label":"Sets the number of comments","patterns":["\\b(3|three)\\b.{0,20}comment","exactly \\d"]}],"hint":"A migration review is about what will hurt production, ranked the way your team ranks it. Give the AI your labels, your rule and the Postgres version.","rubricLabels":["The three comments start with MUST (L<n>):, SHOULD (L<n>): and NIT (L<n>): in that order, each with a line number","The MUST comment is about line 5 or line 7 blocking writes on the 41-million-row orders table (e.g. the index needs CREATE INDEX CONCURRENTLY outside the transaction, or the 38-million-row UPDATE should be batched), and the NIT is about the 'migraton' typo on line 2 or another small issue","Does not flag the ADD COLUMN ... DEFAULT 'pending' on line 3 as a problem"]}