yudefine/nuxt-supabase-starter/supabase-migration
Claude Code and agent skill by yudefine/nuxt-supabase-starter
- community
Checking that the SKILL.md file is still in the repository.
Supabase migration 檔與 schema DDL 規範。觸發:supabase migration new、CREATE FUNCTION / ALTER TABLE / CREATE INDEX。NOT for RLS policy 的內容設計(走 supabase-rls)。
Install
npx vskill@latest install yudefine/nuxt-supabase-starter/supabase-migrationSKILL.md
The same SKILL.md was published earlier as yudefine/nuxt-supabase-starter/supabase-migration.
Supabase Migration 規範
核心規則(supabase migration new、search_path、SECURITY DEFINER 不放 exposed schema、view security_invoker、不改已 apply 的 migration、timestamp 契約、MCP 禁 DDL、reset → lint → gen types → typecheck、advisors、pending migration 分類、expand-contract)在 rules/modules/db-schema/supabase/migration.md,本 skill 不複述,只補實作細節。
PR-isolated DB preview env / schema diff gate / production data sanitization 規約見rules/core/db-preview-env.md(capability + safety contract)與rules/modules/db-runtime/supabase-self-hosted/preview-env.md(self-host 實作層 + image trip-wires)。Cookbook 範本:vendor/snippets/db-preview-env/。
SOP
Phase 1 -- 建立 migration 檔
- READ 讀取 module rule
rules/modules/db-schema/supabase/migration.md(或 runtime 已交付的同名規約;改supabase/migrations/**/*.sql時已自動載入就不重讀)。 - DELEGATE 執行
supabase migration new <topic>產生檔名;一個 migration 只放一個主題。
Phase 2 -- 撰寫 DDL
- READ 讀取
rules/DDL撰寫慣例判準.md。 - WRITE 需要
SECURITY DEFINER函式時,讀取templates/security-definer-function.md與templates/security-definer-function.example.md撰寫;要讓 PostgREST(Data API)呼叫時,再讀取templates/public-thin-wrapper.md與templates/public-thin-wrapper.example.md在public建 wrapper。 - WRITE 其餘 DDL 依已載入規則撰寫;RLS policy 的內容設計轉
supabase-rlsskill。
Phase 3 -- 本機驗證
- DELEGATE 依 module rule 對每一個新增或修改的 migration 跑 reset → lint → gen types → typecheck,再跑
supabase db advisors並逐條處置 security 類 finding。 - DELEGATE 檢查有沒有 migration 被改名:
``bash git diff --cached --diff-filter=R -- 'supabase/migrations/' | grep -q . && echo "BLOCK: migration renamed" || echo "OK" ``
印 BLOCK 時 STOP,把檔名還原成 main 上的檔名,不 commit 新 timestamp(判準見 migration.md § Timestamp 不可變)。
Phase 4 -- Production 韌性分類與 gate(self-host production)
- DELEGATE 執行
node scripts/postgrest-resilience/classify-migration.mjs <migration.sql>(本 skill 目錄下的投影資源);找不到投影資源時 NEVER 改用其他 runtime 的路徑猜一個,回報標準未送達並保留 evidence 要求。 - THINK 讀取
rules/Production韌性分類判準.md,依分類器的overall決定 online、expand-contract 或 hard stop。 - DELEGATE online 路線部署時執行
node scripts/postgrest-resilience/ready-watch.mjs --url=<admin-ready-url>與node scripts/postgrest-resilience/smoke-runner.mjs --endpoint=<name=url>,保存/ready、smoke summary 與 PostgREST logs 作為 evidence。
Phase 5 -- 疑難排解
- READ 執行或部署遇錯時,讀取
rules/疑難排解與Owner修復判準.md依症狀處置;owner 修復是 MCP 跑 DDL 的唯一例外,只照該 rule 的四步做。
Claude host contract
The resource declaration projects helpers under .claude/skills/supabase-migration/scripts/postgrest-resilience/. Run each .mjs helper with Claude Bash and the Node runner from the repository cwd; preserve the returned terminal output as evidence.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingtemplate/.claude/skills/supabase-migration/SKILL.md
Popularity
- Repository stars
- 45
- Repository forks
- 2
- 7-day trend score
- 19
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 25 Nov 2026, 10 days ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Grok Build (Cursor)
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/yudefine/nuxt-supabase-starter/supabase-migration)