Agent skill
create-migration
Créer une migration Supabase avec RLS. TRIGGERS : migration, créer table, modifier schema, nouvelle table, alter table
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/create-migration-somtechsolutionmaxim-somtech-pack
SKILL.md
Create Migration Supabase
Procédure
1. Vérifier les migrations existantes
ls -la supabase/migrations/
2. Créer le fichier migration
Nom : {timestamp}_{description}.sql
-- Migration: {nom}
-- Description: {description}
-- ============================================
-- TABLE
-- ============================================
create table if not exists {table_name} (
id uuid primary key default gen_random_uuid(),
user_id uuid references auth.users(id) on delete cascade not null,
created_at timestamptz default now() not null,
updated_at timestamptz default now() not null
);
-- ============================================
-- RLS (OBLIGATOIRE)
-- ============================================
alter table {table_name} enable row level security;
-- SELECT: USING uniquement
create policy "{table_name}_select_own"
on {table_name} for select
to authenticated
using ((select auth.uid()) = user_id);
-- INSERT: WITH CHECK uniquement
create policy "{table_name}_insert_own"
on {table_name} for insert
to authenticated
with check ((select auth.uid()) = user_id);
-- UPDATE: USING + WITH CHECK
create policy "{table_name}_update_own"
on {table_name} for update
to authenticated
using ((select auth.uid()) = user_id)
with check ((select auth.uid()) = user_id);
-- DELETE: USING uniquement
create policy "{table_name}_delete_own"
on {table_name} for delete
to authenticated
using ((select auth.uid()) = user_id);
-- ============================================
-- INDEXES
-- ============================================
create index if not exists idx_{table_name}_user_id
on {table_name}(user_id);
create index if not exists idx_{table_name}_created_at
on {table_name}(created_at desc);
3. Règles RLS
| Opération | USING | WITH CHECK |
|---|---|---|
| SELECT | ✅ | ❌ |
| INSERT | ❌ | ✅ |
| UPDATE | ✅ | ✅ |
| DELETE | ✅ | ❌ |
Important : Utiliser (select auth.uid()) (pas auth.uid() direct) pour la performance.
4. Appliquer
Utiliser MCP Supabase pour appliquer la migration (jamais CLI directe).
5. Mettre à jour le PRD module
Documenter dans modules/{module}/prd/{module}.md.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?