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.
npx skills add YuDefine/nuxt-supabase-starter --skill db-migrationgit clone --depth 1 https://github.com/YuDefine/nuxt-supabase-starterWrote 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.
[](https://agentmods.dev/skills/yudefine/nuxt-supabase-starter/db-migration)<a href="https://agentmods.dev/skills/yudefine/nuxt-supabase-starter/db-migration"><img src="https://agentmods.dev/badge/skills/yudefine/nuxt-supabase-starter/db-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.
<a href="https://agentmods.dev/skills/yudefine/nuxt-supabase-starter/db-migration"><img src="https://agentmods.dev/badge/skills/yudefine/nuxt-supabase-starter/db-migration.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00016 | $0.02187 |
| Opus 5.5 | $0.00006 | $0.00875 |
| Sonnet 5.5 | $0.00003 | $0.00437 |
| Haiku 4.5 | $0.00002 | $0.00219 |
Grade A, and why
db-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 8d 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.
How it starts
The opening of the file, as written. The whole thing — 170 lines — stays where its author put it; the contents beside it link to each section on GitHub.
User Input
$ARGUMENTS
Outline
建立新的 Supabase migration,確保符合 rules/modules/db-schema/supabase/migration.md 的所有規範(該規約帶 paths: gating,三端都投影)。
Step 1: 確認需求
詢問使用者要建立什麼樣的 migration:
- 新增表格?
- 修改欄位?
- 建立函式?
- 新增 RLS 政策?
Step 2: 建立 Migration 檔案
使用 Supabase CLI 建立 migration(禁止手動建立 .sql 檔案):
supabase migration new <description_in_snake_case>
Step 3: 撰寫 Migration 內容
根據需求撰寫 SQL,必須遵守以下規範:
函式規範(防 search_path injection)
-- ✅ 正確:search_path 必須是空字串
CREATE OR REPLACE FUNCTION schema_name.function_name()
RETURNS return_type
LANGUAGE plpgsql
SECURITY DEFINER
SET search_path = '' -- 必須是空字串
AS $$
BEGIN
-- 使用完整路徑:schema_name.table_name
SELECT * FROM core.users WHERE id = auth.uid();
END;
$$;
-- ❌ 禁止:任何其他 search_path 值
SET search_path = public, pg_temp -- 禁止
SET search_path = public -- 禁止
Schema 規範
- 使用正確的 schema 前綴(如
public.、core.,或專案自訂業務 schema) - 所有表格/函式引用使用完整路徑(避免裸表名觸發
search_pathresolution)
Step 4: 本地測試與類型產生(自動)
依序執行以下步驟,任何步驟失敗則停止並顯示錯誤。MUST 透過 package.json 偵測 consumer 是走遠端 wrapper(pnpm db:*,含 existing-server / self-hosted)還是本機 Docker。NEVER 看到遠端 wrapper 就改跑本機 supabase start。
set -e # 多行指令任何一步失敗就整段停(下面用 `|| exit`/`rc=$?` 明列處理的步驟除外)
# 從 package.json 讀 types 路徑(若有自訂);fallback 到 conventional locations
# 避開頂層 return(Node script 不允許)— 用 if/else 與 .find()
TYPES=$(node -e "
const fs = require('fs');
const pkg = require('./package.json');
const custom = pkg.config && pkg.config.dbTypesPath;
const candidates = [
'packages/core/app/types/database.types.ts',
'app/types/database.types.ts',
'shared/types/database.types.ts',
'src/types/database.types.ts',
];
const path = custom || candidates.find(function(p) { return fs.existsSync(p); }) || 'app/types/database.types.ts';
console.log(path);
")
USE_DB_WRAPPER=$(node -e "process.exit(require('./package.json').scripts?.['db:reset'] ? 0 : 1)" 2>/dev/null && echo yes || echo no)
USE_DB_COPY=$(node -e "process.exit(require('./package.json').scripts?.['db:copy'] ? 0 : 1)" 2>/dev/null && echo yes || echo no)
if [ "$USE_DB_COPY" = yes ]; then
# forward-only 第二段:在臨時副本上重放 + lint + 重生 types,用完 drop;NEVER reset、NEVER 對主線 DB db:migrate
# (副本契約見 vendor/snippets/worktree-db-isolation/README.md § 10;失敗一律停下,NEVER 退回 db:reset/主線 db:migrate)
# `--drop` 在副本不存在時本來就 exit 0(契約 § 10);drop 失敗不能吞——否則 `--purpose schema` 沿用殘留舊副本,驗到的是舊狀態
pnpm db:copy --drop || exit 1
pnpm db:copy --purpose schema || exit 1
# set -e 下 `a && b; rc=$?` 會在 a/b 失敗時直接退出、跳過 drop:改 `|| rc=$?` 讓 drop 一定跑
rc=0
{ pnpm db:migrate --target copy && pnpm db:types --target copy && pnpm db:lint --target copy; } || rc=$? # lint 必須零警告
pnpm db:copy --drop || echo '⚠ 臨時副本沒 drop 乾淨:pnpm db:copy --list 查' >&2
[ "$rc" -eq 0 ] || exit "$rc"
pnpm typecheck
elif [ "$USE_DB_WRAPPER" = yes ]; then
# 遠端 / existing-server:走 pnpm db:*(wrapper 會擋本機 Docker;db:reset 內部跑 db:types 寫到 $TYPES)
# 只有 per-worktree 拓樸(target mode,只重建自己的 clone)才准 reset;
# shared 拓樸共用 DB NEVER reset(判定見 [[db-topology-invariant]] § Forward-only)→ 交 CI supabase-check,沒接就停
f=$(ls scripts/supabase/db-reset.sh scripts/db-reset.sh 2>/dev/null | head -1)
if [ -z "$f" ] || ! grep -qE "reset_target|Target mode never claims" "$f"; then
if [ ! -f .github/workflows/supabase-check.yml ]; then
echo 'shared 拓樸且缺 .github/workflows/supabase-check.yml:無處驗 migration 重放,停下;先依 vendor/snippets/supabase-ci/README.md 接上 supabase-check' >&2
exit 1
fi
# 第一段(pnpm db:copy 導入前):reset 重放、lint、types drift 交 PR 的 CI supabase-check
echo 'DEFERRED_TO_CI: shared 拓樸不 reset 共用 DB;migration 重放、db lint、types drift 交 PR 的 supabase-check'
pnpm typecheck
exit $?
fi
pnpm db:reset
pnpm db:lint # 安全檢查(必須零警告:wrapper 契約沒有 --fail-on,exit code 不擋 warning,要讀輸出確認)
pnpm typecheck
else
# 本機 Docker(this-machine;沒有 pnpm db:reset wrapper)
supabase db reset
supabase db lint --level warning --fail-on warning
# 直接重導向到 $TYPES — 不用 tee(pipeline 會吞 supabase gen types 失敗狀態)
supabase gen types typescript --local > "$TYPES"
pnpm typecheck
fi
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.
- 8d ago First seen · 170 lines · 16 tokens per session scan A ab8b47f53696
db-migration is a skill published in the GitHub repository YuDefine/nuxt-supabase-starter (45 stars, last pushed yesterday), licensed MIT. It adds 16 tokens to every session and 2,187 once invoked, about $0.0001 per session on Opus 5.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-11-22.
db-migration compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| db-migrationYuDefine/nuxt-supabase-starter | Skill | 45 | yesterday | MIT | A | 16 | Claude Code |
| explorersupabase/supabase | Skill | 116k | today | Apache-2.0 | A | 27 | Claude Code |
| nw-database-technology-selectionnWave-ai/nWave | Skill | 636 | 11d ago | MIT | A | 38 | Claude Code |
| supabasej4flmao/agent-skills | Skill | 46 | 13d ago | MIT | A | 71 | Claude Code, Codex |
| srtd-clit1mmen/srtd | Skill | 105 | 26d ago | MIT | A | 75 | Claude Code |
| supabasemartineserios/thebrana | Skill | 3 | 8d ago | MIT | A | 58 | Claude Code |
| upgrade-people-memorymichelgrolet/people-memory-mcp | Skill | 2 | 22d ago | MIT | A | 94 | Claude Code, Codex |