.claude/skills/create-migration/SKILL.md
Créer une migration Supabase avec RLS. TRIGGERS : migration, créer table, modifier schema, nouvelle table, alter table
npx skillsauth add SomtechSolutionMAxime/somtech-pack create-migrationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
ls -la supabase/migrations/
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);
| Opération | USING | WITH CHECK | |-----------|-------|------------| | SELECT | ✅ | ❌ | | INSERT | ❌ | ✅ | | UPDATE | ✅ | ✅ | | DELETE | ✅ | ❌ |
Important : Utiliser (select auth.uid()) (pas auth.uid() direct) pour la performance.
Utiliser MCP Supabase pour appliquer la migration (jamais CLI directe).
Documenter dans modules/{module}/prd/{module}.md.
tools
Documentation de référence SomCraft — DMS Markdown-native avec AI, MCP server, et Studio. À consulter pour toute question sur l'architecture, les APIs, les concepts, ou l'exploitation d'une instance SomCraft. TRIGGERS : somcraft, dms, document management, workspace somcraft, studio somcraft, mcp somcraft, api somcraft
tools
Déployer une instance SomCraft pour un client existant (migrations Supabase + Fly.io + skills). Orchestre 7 phases : pré-flight, plan, migrations, seed, déploiement, smoke tests, installation des skills. TRIGGERS : deploy-somcraft, déployer somcraft, installer somcraft, somcraft client, setup somcraft, upgrade somcraft, status somcraft
tools
Génère l'intégralité de la configuration d'un silo SomTech : docker-compose, services Fly.io, constitutions d'agents, et templates d'environnement. Valide les métadonnées d'application avant génération. À utiliser après validation initiale du client et avant déploiement.
development
Exécute le déploiement complet d'une silo après sa génération : conteneurs Docker, environnement de développement Fly.io, branche Git, et configuration Netlify. Transforme les configs générées en infrastructure active avec URLs stables et builds automatisés.