agent-coordination
Agent assignment matrix, blocker escalation, and TDM coordination patterns. Use when assigning work to specialists, managing blockers, or coordinating…
Database migration creation with mandatory RLS policies and ARCHitect approval workflow. Use when creating migrations, adding tables with RLS, or updating Prisma schema.
$ npx -y skills add bybren-llc/safe-agentic-workflow --skill migration-patterns --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/migration-patternsContext preview
The summary Claude sees to decide when to auto-load this skill.
Database migration creation with mandatory RLS policies and ARCHitect approval workflow. Use when creating migrations, adding tables with RLS, or updating Prisma schema.
name: migration-patterns description: Database migration creation with mandatory RLS policies and ARCHitect approval workflow. Use when creating migrations, adding tables with RLS, or updating Prisma schema. disable-model-invocation: true allowed-tools: Read, Bash, Grep, Glob
Guide database migration creation with mandatory RLS policies, following security-first architecture and approval workflow.
Invoke this skill when:
-- 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
-- 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:
1. Document proposed changes 2. Get ARCHitect approval (create issue or discussion) 3. Only proceed after explicit approval
# Generate migration npx prisma migrate dev --name descriptive_name # Verify migration file created ls prisma/migrations/
Edit the generated migration to include:
# 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:
CREATE POLICY {table}_user_select ON {table}
FOR SELECT TO {{PROJECT}}_app_user
USING (user_id = current_setting('app.current_user_id', true));CREATE POLICY {table}_user_insert ON {table}
FOR INSERT TO {{PROJECT}}_app_user
WITH CHECK (user_id = current_setting('app.current_user_id', true));CREATE POLICY {table}_admin_all ON {table}
FOR ALL TO {{PROJECT}}_app_user
USING (current_setting('app.user_role', true) = 'admin');CREATE 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:
SAW — SAFe Agentic Workflow AI Agent Harness for Multi-Agent Team Workflows Built on SAFe methodology (Scaled Agile Framework), adapted for AI agent teams (Now With AI-DLC!) Works for any team with repeatable processes: Software, Marketing, Research, Legal, Operations.
Agent assignment matrix, blocker escalation, and TDM coordination patterns. Use when assigning work to specialists, managing blockers, or coordinating…
API route implementation patterns with RLS, Zod validation, and error handling. Use when creating API routes, implementing endpoints, or adding server-side…
Documentation templates for ADRs, runbooks, and architecture docs. Use when creating architectural decision records, operational runbooks, or technical…
Deployment workflows, pre-deploy validation, and smoke testing patterns. Use when deploying to staging or production, running smoke tests, or validating…
Frontend patterns for Next.js App Router, Clerk auth, shadcn/Radix UI, and PostHog analytics. Use when building UI components, creating pages, implementing…
Advanced git operations including rebase, bisect, cherry-pick, and conflict resolution. Use when rebasing branches, debugging with bisect, cherry-picking…