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 agentmods add commands/yudefine/nuxt-supabase-starter/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/commands/yudefine/nuxt-supabase-starter/db-migration)<a href="https://agentmods.dev/commands/yudefine/nuxt-supabase-starter/db-migration"><img src="https://agentmods.dev/badge/commands/yudefine/nuxt-supabase-starter/db-migration.svg" alt="Measured on agentmods" 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.00012 | $0.01387 |
| Opus 5 | $0.00006 | $0.00694 |
| Sonnet 5 | $0.00002 | $0.00277 |
| Haiku 4.5 | $0.00001 | $0.00139 |
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 2d 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 — 146 lines — stays where its author put it; the contents beside it link to each section on GitHub.
User Input
$ARGUMENTS
Outline
建立新的 Supabase migration,確保符合 CLAUDE.md 中的所有規範。
Step 1: 確認需求
詢問使用者要建立什麼樣的 migration:
- 新增表格?
- 修改欄位?
- 建立函式?
- 新增 RLS 政策?
Step 2: 建立 Migration 檔案
使用 Supabase CLI 建立 migration(禁止手動建立 .sql 檔案):
supabase migration new <description_in_snake_case>
Step 3: 撰寫 Migration 內容
根據需求撰寫 SQL,必須遵守以下規範:
函式規範(CRITICAL)
-- ✅ 正確: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。
# 從 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)
if [ "$USE_DB_WRAPPER" = yes ]; then
# 遠端 / existing-server:走 pnpm db:*(wrapper 會擋本機 Docker;db:reset 內部跑 db:types 寫到 $TYPES)
pnpm db:reset
pnpm db:lint # 安全檢查(必須零警告)
pnpm typecheck
else
# 本機 Docker(this-machine;沒有 pnpm db:reset wrapper)
supabase db reset
supabase db lint --level 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.
- 2d ago Changed 7af1b73d0d3c
- 6d ago First seen · 146 lines · 12 tokens per session scan A c65b8e219708
db-migration is a command published in the GitHub repository YuDefine/nuxt-supabase-starter (45 stars, last pushed today), licensed MIT. It adds 12 tokens to every session and 1,387 once invoked, about $0.0001 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.
Other commands, from other repositories
validate-auth-schema
Check that the Drizzle schema in db/schema/ still satisfies what Better Auth expects. Better Auth derives its required tables from the enabled plugins, so the generated JSON — not the upstream docs — is the source of truth.
dataform-new-table
Create new Dataform table using TDD workflow.
sqlanvil-new-table
Create a new sqlanvil (Postgres/Supabase) table using TDD.
checklist
Generate a custom checklist for the current feature based on user requirements.
clarify
Identify underspecified areas in the current feature spec by asking up to 5 highly targeted clarification questions and encoding answers back into the spec.
specify
Create or update the feature specification from a natural language feature description.