Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Database migration creation with mandatory RLS policies and ARCHitect approval workflow. Use when creating migrations, adding tables with RLS, updating ORM schema, adding GRANT statements, or planning data migrations. Do NOT use for application code changes without schema impact.
.claude/skills/bybren-llc-migration-patterns/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 15% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 5% | 0% |
| case-10 | ✗→✓ | ▲ Improved | 12% | 0% |
| case-11 | ✗→✓ | ▲ Improved | 34% | 0% |
| case-13 | ✗→✓ | ▲ Improved | -11% | 0% |
Guide database migration creation with mandatory RLS policies, following security-first architecture and approval workflow.
sql-- FORBIDDEN: RLS policies in separate file -- RLS MUST be in the same migration.sql file as the table creation -- FORBIDDEN: Table without RLS CREATE TABLE user_data (...); -- Missing: ALTER TABLE user_data ENABLE ROW LEVEL SECURITY; -- FORBIDDEN: Resolve applied migrations npx prisma migrate resolve --applied "migration_name" -- This bypasses migration verification -- FORBIDDEN: Missing user_id index CREATE TABLE payments (...); -- Missing: CREATE INDEX idx_payments_user_id ON payments(user_id); -- FORBIDDEN: Schema changes without ARCHitect approval -- All migrations require approval before PR
sql-- CORRECT: Complete migration with RLS in same file CREATE TABLE user_data ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), user_id TEXT NOT NULL, data JSONB, created_at TIMESTAMPTZ DEFAULT NOW() ); -- Enable RLS (SAME FILE - MANDATORY) ALTER TABLE user_data ENABLE ROW LEVEL SECURITY; -- User policy CREATE POLICY user_data_user_select ON user_data FOR SELECT TO {{PROJECT}}_app_user USING (user_id = current_setting('app.current_user_id', true)); -- Index for RLS performance (MANDATORY) CREATE INDEX idx_user_data_user_id ON user_data(user_id); -- Grant permissions GRANT SELECT, INSERT, UPDATE ON user_data TO {{PROJECT}}_app_user;
Before ANY schema change:
text1. Document proposed changes 2. Get ARCHitect approval (create issue or discussion) 3. Only proceed after explicit approval
bash# Generate migration npx prisma migrate dev --name descriptive_name # Verify migration file created ls prisma/migrations/
Edit the generated migration to include:
ALTER TABLE ... ENABLE ROW LEVEL SECURITYbash# Test migration DATABASE_URL="..." npx prisma migrate dev # Verify RLS is enabled psql -c "SELECT tablename, rowsecurity FROM pg_tables WHERE schemaname = 'public';"
After successful migration:
docs/database/DATA_DICTIONARY.md (MANDATORY)sqlCREATE POLICY {table}_user_select ON {table} FOR SELECT TO {{PROJECT}}_app_user USING (user_id = current_setting('app.current_user_id', true));
sqlCREATE POLICY {table}_user_insert ON {table} FOR INSERT TO {{PROJECT}}_app_user WITH CHECK (user_id = current_setting('app.current_user_id', true));
sqlCREATE POLICY {table}_admin_all ON {table} FOR ALL TO {{PROJECT}}_app_user USING (current_setting('app.user_role', true) = 'admin');
sqlCREATE POLICY {table}_system_all ON {table} FOR ALL TO {{PROJECT}}_app_user USING (current_setting('app.context_type', true) = 'system');
Before PR:
For production migrations:
docs/database/RLS_DATABASE_MIGRATION_SOP.md (MANDATORY)docs/database/DATA_DICTIONARY.md (update after changes)docs/database/RLS_IMPLEMENTATION_GUIDE.mddocs/database/RLS_POLICY_CATALOG.mddocs/guides/SECURITY_FIRST_ARCHITECTURE.md| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→pass | 16,684 | 10,763 | -35% | 1 | 1 | 0% | 2,927 | 3,363 | +15% | 0 | 0 | — |
case-02 | fail→fail | 16,015 | 10,267 | -36% | 1 | 1 | 0% | 2,973 | 3,406 | +15% | 0 | 0 | — |
case-03 | fail→pass | 17,613 | 9,005 | -49% | 1 | 1 | 0% | 2,705 | 2,828 | +5% | 0 | 0 | — |
case-04 | pass→fail | 15,431 | 11,158 | -28% | 1 | 1 | 0% | 2,733 | 3,192 | +17% | 0 | 0 | — |
case-05 | pass→pass | 11,439 | 10,574 | -8% | 1 | 1 | 0% | 1,991 | 3,100 | +56% | 0 | 0 | — |
case-06 | pass→pass | 17,560 | 14,707 | -16% | 1 | 1 | 0% | 3,172 | 3,783 | +19% | 0 | 0 | — |
case-07 | pass→pass | 14,406 | 6,994 | -51% | 1 | 1 | 0% | 2,331 | 2,507 | +8% | 0 | 0 | — |
case-08 | pass→pass | 11,725 | 5,474 | -53% | 1 | 1 | 0% | 1,737 | 2,084 | +20% | 0 | 0 | — |
case-09 | pass→pass | 12,466 | 6,247 | -50% | 1 | 1 | 0% | 1,994 | 2,307 | +16% | 0 | 0 | — |
case-10 | fail→pass | 13,081 | 6,782 | -48% | 1 | 1 | 0% | 2,128 | 2,374 | +12% | 0 | 0 | — |
case-11 | fail→pass | 9,475 | 5,697 | -40% | 1 | 1 | 0% | 1,660 | 2,228 | +34% | 0 | 0 | — |
case-12 | pass→pass | 10,146 | 5,031 | -50% | 1 | 1 | 0% | 1,689 | 2,062 | +22% | 0 | 0 | — |
case-13 | fail→pass | 15,714 | 5,029 | -68% | 1 | 1 | 0% | 2,199 | 1,959 | -11% | 0 | 0 | — |
case-14 | fail→pass | 6,969 | 3,414 | -51% | 1 | 1 | 0% | 1,015 | 1,802 | +78% | 0 | 0 | — |
case-15 | fail→pass | 10,363 | 2,895 | -72% | 1 | 1 | 0% | 1,478 | 1,636 | +11% | 0 | 0 | — |
case-16 | fail→pass | 8,773 | 3,323 | -62% | 1 | 1 | 0% | 1,560 | 1,666 | +7% | 0 | 0 | — |
case-17 | fail→pass | 7,146 | 5,439 | -24% | 1 | 1 | 0% | 1,063 | 2,076 | +95% | 0 | 0 | — |
case-18 | pass→pass | 16,384 | 6,972 | -57% | 1 | 1 | 0% | 2,210 | 2,381 | +8% | 0 | 0 | — |
case-19 | fail→pass | 8,515 | 3,566 | -58% | 1 | 1 | 0% | 1,379 | 1,833 | +33% | 0 | 0 | — |
case-20 | pass→pass | 11,949 | 5,018 | -58% | 1 | 1 | 0% | 2,056 | 2,095 | +2% | 0 | 0 | — |
case-21 | fail→pass | 9,873 | 1,966 | -80% | 1 | 1 | 0% | 1,359 | 1,518 | +12% | 0 | 0 | — |
case-22 | pass→pass | 6,929 | 1,816 | -74% | 1 | 1 | 0% | 924 | 1,477 | +60% | 0 | 0 | — |
case-23 | pass→pass | 4,138 | 2,304 | -44% | 1 | 1 | 0% | 657 | 1,517 | +131% | 0 | 0 | — |
case-24 | pass→pass | 10,923 | 6,040 | -45% | 1 | 1 | 0% | 1,716 | 2,289 | +33% | 0 | 0 | — |
case-25 | fail→pass | 9,033 | 5,543 | -39% | 1 | 1 | 0% | 1,260 | 2,103 | +67% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 25 cases were attempted. The headline lift of +44 percentage points is the difference between those two pass rates over the 25 comparable cases. 1 case got worse with the skill loaded, and it is included in that figure.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.