supabase-migration

supabase-migration is a skill for Claude Code from YuDefine/nuxt-supabase-starter. It costs 56 tokens per session (1,129 once invoked), scanned A, original, MIT.

A set of rules for changing a Supabase database through migration files. Supabase is a hosted PostgreSQL database service, and migrations are recorded database changes that can be deployed consistently.

In plain words
What is it for?
It guides schema changes, indexes, database functions, views, and migration deployment, including when remote SQL tools may be used.
Why use it?
It prevents database objects from being created with the wrong owner or with security settings that bypass row-level access rules.

Skill for Claude Code

Written for Claude Code: installed under .claude/. Also seen: mentions CLAUDE.md.

Good fit It guides schema changes, indexes, database functions, views, and migration deployment, including when remote SQL tools may be used.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/yudefine/nuxt-supabase-starter/supabase-migration
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add YuDefine/nuxt-supabase-starter --skill supabase-migration
Clone the repo
git clone --depth 1 https://github.com/YuDefine/nuxt-supabase-starter

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for supabase-migration

README.md
[![agentmods](https://agentmods.dev/badge/skills/yudefine/nuxt-supabase-starter/supabase-migration/github.svg)](https://agentmods.dev/skills/yudefine/nuxt-supabase-starter/supabase-migration)
Your own site
<a href="https://agentmods.dev/skills/yudefine/nuxt-supabase-starter/supabase-migration"><img src="https://agentmods.dev/badge/skills/yudefine/nuxt-supabase-starter/supabase-migration/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for supabase-migration

Your own site · 80×15
<a href="https://agentmods.dev/skills/yudefine/nuxt-supabase-starter/supabase-migration"><img src="https://agentmods.dev/badge/skills/yudefine/nuxt-supabase-starter/supabase-migration.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 56 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,129 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00056 $0.01129
Opus 5 $0.00028 $0.00564
Sonnet 5 $0.00011 $0.00226
Haiku 4.5 $0.00006 $0.00113

Measured 9d ago against content hash 0be5927a9933, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

supabase-migration scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

template/.claude/skills/supabase-migration/SKILL.md · 114 lines

How it starts

The opening of the file, as written. The whole thing — 114 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Supabase Migration 規範

Migration 核心規則已定義在 CLAUDE.md(Local-First、MCP 禁止 DDL、search_path、不可變原則)。 本 skill 補充 CLAUDE.md 未涵蓋的實作細節。

MCP 禁止執行 DDL

禁止使用以下 MCP 工具執行 DDL(CREATE / ALTER / DROP):

  • mcp__remote-supabase__apply_migration
  • mcp__remote-supabase__execute_sql

原因: MCP 使用 supabase_admin role 連線,透過它建立的 table/index/function 的 owner 是 supabase_admin 而非 postgres。當 CI/CD 用 migration 檔案部署時,postgres role 無法修改這些物件,導致部署失敗。

正確做法:

  • 所有 DDL 透過 supabase migration new 建立 migration 檔案
  • 透過 CI/CD pipeline 部署(owner = postgres
  • Remote MCP 只能用於:SELECT 查詢、除錯、檢查 table owner

View 安全設定

所有 view 需設定 security_invoker:

CREATE OR REPLACE VIEW your_schema.my_view
WITH (security_invoker = true)
AS SELECT ...;

原因: Postgres 的 view 預設 bypass RLS(以 view owner 的權限執行)。不加 security_invoker = true 等於 RLS 對 view 無效。

SECURITY DEFINER 函式位置

NEVER 將 SECURITY DEFINER 函式放在 exposed schema(public):

-- ❌ public schema — 透過 Data API 可直接呼叫,繞過所有存取控制
CREATE FUNCTION public.dangerous_func() ... SECURITY DEFINER ...;

-- ✅ private schema + 明確 GRANT
CREATE FUNCTION your_schema.safe_func() ... SECURITY DEFINER SET search_path = '' ...;
GRANT EXECUTE ON FUNCTION your_schema.safe_func TO authenticated;

若需要透過 PostgREST(Data API)呼叫,在 public 建立 thin wrapper(SECURITY INVOKER)呼叫 private schema 的實作。

開發流程

supabase migration new <description>    # 建立 migration
# 編輯 SQL(保持單一主題)
supabase db reset                       # 套用到本機
supabase db lint --level warning        # 安全檢查
supabase db advisors                    # Schema 建議(CLI v2.81.3+,涵蓋 index/security/performance)
supabase gen types typescript --local | tee app/types/database.types.ts > /dev/null
pnpm typecheck                          # 類型檢查

supabase db advisors 需 CLI v2.81.3+。若版本不足,可用 MCP get_advisors 替代。

Schema 規範

Schema 邊界

  • core / auth: 授權相關(user_roles、allowed_emails、user_preferences)
  • app / 專案名稱: 業務資料表
  • public: 不存放業務資料,僅作 RPC 入口薄 wrapper

Read the full file on GitHub · 114 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 114 lines · 56 tokens per session scan A 0be5927a9933

Subscribe to this mod's changes

supabase-migration is a skill published in the GitHub repository YuDefine/nuxt-supabase-starter (45 stars, last pushed today), licensed MIT. It adds 56 tokens to every session and 1,129 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

explorer

Build and modify Studio Explorer surfaces, including notebooks, chats, SQL snippets, query cells, and their shared toolbar patterns.

supabase/supabase · 27 tokens

azure-cosmos-db-py

Build Azure Cosmos DB NoSQL services with Python/FastAPI following production-grade patterns. Use when implementing database client setup with dual auth (DefaultAzureCredential + emulator), service layer classes with CRUD operations, partition key strategies, parameterized queries, or TDD patterns for Cosmos. Triggers…

microsoft/skills · 96 tokens

slides

Build a Grida slides deck — a .canvas bundle in slides mode whose pages are SVG documents (16:9, one SVG per slide). Use when creating a presentation, pitch deck, slideshow, or talk.

gridaco/grida · 46 tokens

dotcanvas

Author and edit a Grida .canvas board — a .canvas.json manifest plus document files (references, generated images, notes) placed on an infinite canvas. Use when working on a .canvas bundle or arranging visuals/design work spatially. For a linear deck/presentation, use the slides skill instead.

gridaco/grida · 69 tokens

supabase

Use when doing ANY task involving Supabase. Triggers: Supabase products (Database, Auth, Edge Functions, Realtime, Storage, Vectors, Cron, Queues); client libraries and SSR integrations (supabase-js, @supabase/ssr) in Next.js, React, SvelteKit, Astro, Remix; auth issues (login, logout, sessions, JWT, cookies…

supabase/agent-skills · 185 tokens

supabase-postgres-best-practices

Postgres best practices maintained by Supabase, for Postgres running anywhere. Load this skill BEFORE writing or changing anything that lives in a Postgres database: creating or altering tables and columns (including choosing column types), schema design, migrations and declarative schema files, RLS policies and the…

supabase/agent-skills · 182 tokens