Loading...
Loading...
Compare original and translation side by side
This skill is safe for use in any project. It never runs reset/break loops or destructive commands. Those exist only in the supabase-debug-playground teaching harness and are not part of this skill.
本技能可安全用于任何项目。 它绝不会执行重置/中断循环或破坏性命令。 这类命令仅存在于supabase-debug-playground教学工具中,不属于本技能的范畴。
supabase/supabase/supabase db resetservice_rolesupabase db resetservice_roleautoApprove--yesautoApprove--yesSUPABASE_ANON_KEYSUPABASE_SERVICE_ROLE_KEYservice_roleeyJ.env.env.localSUPABASE_ANON_KEYSUPABASE_URLhttps://xyz.supabase.coSUPABASE_ANON_KEYSUPABASE_SERVICE_ROLE_KEYservice_roleeyJ.env.env.localSUPABASE_ANON_KEYSUPABASE_URLhttps://xyz.supabase.colocalSUPABASE_URLhttp://localhost:*supabase statusstagingproduction*.supabase.coSUPABASE_URLsupabase statussupabase projects listlocalSELECTsupabase functions logscurlgit diffsupabase gen types typescript --localstagingproduction.envsupabase/config.tomlsupabase/SUPABASE_URLsupabase statuslocalSUPABASE_URLhttp://localhost:*supabase statusstagingproduction*.supabase.coSUPABASE_URLsupabase statussupabase projects listlocalSELECTsupabase functions logscurlgit diffsupabase gen types typescript --localstagingproduction.envsupabase/config.tomlsupabase/SUPABASE_URLsupabase status| Operation | Required evidence |
|---|---|
| Returned row with |
| Row count or returned rows confirming the change |
| RLS policy change | Output of |
| Edge function deploy | HTTP response payload containing |
| Migration | |
| Schema type regen | |
Prefer: return=minimal.select()// Bad
"Insert successful."
// Good
{ id: 42, created_at: "2026-02-28T20:14:22Z" }
// (then) "Insert confirmed — row id 42 returned."| 操作 | 所需证据 |
|---|---|
| 返回包含 |
| 确认更改的行数或返回的行 |
| RLS策略更改 | |
| Edge Function部署 | 包含 |
| 迁移 | |
| Schema类型重新生成 | |
Prefer: return=minimal.select()// 错误示例
"插入成功。"
// 正确示例
{ id: 42, created_at: "2026-02-28T20:14:22Z" }
// (随后) "插入已确认——返回行id为42。"service_roleservice_roleservice_roleSELECTservice_roleservice_roleservice_roleservice_roleSELECTservice_roleservice_roleservice_roleerror.codeerror.messageerror.hintsupabase statuspg_policieserror.codeerror.messageerror.hintsupabase statuspg_policiessupabase/functions/**supabase/migrations/**supabase/types.gen.tstypes.gen.tsindex.tssupabase/supabase/functions/**supabase/migrations/**supabase/types.gen.tstypes.gen.tsindex.tssupabase/.envsupabase/config.tomlsupabase/SUPABASE_URL.envsupabase statussupabase projects listsupabase/localhttp://localhost.envsupabase/.envSUPABASE_URLsupabase status.envsupabase/config.tomlsupabase/SUPABASE_URL.envsupabase statussupabase projects listsupabase/.envhttp://localhostsupabase/.envSUPABASE_URLsupabase statussupabase-jssupabase.rpc().from(...).insert().update().delete()CREATE FUNCTIONCREATE POLICYALTER TABLEsupabase functions deploysupabase gen typessupabase/functions/supabase/migrations/supabase/seed.sqlsupabase db *supabase-jssupabase.rpc().from(...).insert().update().delete()CREATE FUNCTIONCREATE POLICYALTER TABLEsupabase functions deploysupabase gen typessupabase/functions/supabase/migrations/supabase/seed.sqlsupabase db *| Pattern | Trigger | Passes when |
|---|---|---|
| 1 — Edge function (local) | Change to a function running via | HTTP 200 + |
| 2 — Edge function (production) | | HTTP 200 + |
| 3 — RPC | | No error + response contains expected fields |
| 4 — CRUD / Insert | Any | Non-null array with |
| 5 — RLS | | All 3 roles pass: unauthed blocked + authed allowed + service_role allowed |
| 6 — Schema migration | Migration adding, removing, or renaming a column | |
| 模式 | 触发条件 | 验证通过条件 |
|---|---|---|
| 1 — Edge Function(本地) | 修改通过 | HTTP 200 + |
| 2 — Edge Function(生产) | 向真实项目执行 | HTTP 200 + |
| 3 — RPC | | 无错误 + 响应包含预期字段 |
| 4 — CRUD / 插入 | 通过supabase-js执行的任何插入、更新或删除操作 | 返回非空数组且包含带 |
| 5 — RLS | | 三种角色验证均通过:未认证用户被拦截 + 已认证用户被允许 + service_role被允许 |
| 6 — Schema迁移 | 添加、删除或重命名列的迁移 | |
supabase functions servehttp://localhost:54321/functions/v1/<name>ok: truerequest_idrequest_idDeno.env.get(...)undefinedsupabase functions servesupabase functions logsok: truerequest_idsupabase functions servehttp://localhost:54321/functions/v1/<name>ok: truerequest_idrequest_idDeno.env.get(...)undefinedsupabase functions servesupabase functions logsok: truerequest_idsupabase functions deploy <name>$SUPABASE_URL/functions/v1/<name>Authorization: Bearer $SUPABASE_ANON_KEYok: truerequest_idhttps://supabase.com/dashboard/project/<PROJECT_REF>/functions/<name>/logsok: truerequest_idsupabase functions deploy <name>$SUPABASE_URL/functions/v1/<name>Authorization: Bearer $SUPABASE_ANON_KEYok: truerequest_idhttps://supabase.com/dashboard/project/<PROJECT_REF>/functions/<name>/logsok: truerequest_idCREATE OR REPLACE FUNCTIONsupabase.rpc('<function_name>', { ...args })errorerror.codeerror.codeerror.messageerror.hint42703SELECT pg_get_functiondef('<schema>.<function_name>(<arg_types>)'::regprocedure);CREATE OR REPLACE FUNCTIONsupabase.rpc('<function_name>', { ...args })errorerror.codeerror.codeerror.messageerror.hint42703SELECT pg_get_functiondef('<schema>.<function_name>(<arg_types>)'::regprocedure);.select().throwOnError()dataid.insert().select()Prefer: return=minimal{ data: null, error: null }const { data } = await supabase
.from("table")
.insert({ ...values })
.select()
.throwOnError();
// data is a non-null array if the insert succeededid.select().throwOnError()dataid.select().insert()Prefer: return=minimal{ data: null, error: null }const { data } = await supabase
.from("table")
.insert({ ...values })
.select()
.throwOnError();
// 插入成功时,data为非空数组idCREATE POLICYDROP POLICYALTER TABLE ... ENABLE ROW LEVEL SECURITY42501-- See all policies on a table
SELECT policyname, cmd, qual, with_check
FROM pg_policies WHERE tablename = '<table>';
-- Confirm RLS is enabled
SELECT relname, relrowsecurity FROM pg_class WHERE relname = '<table>';service_roleBYPASSRLSCREATE POLICYDROP POLICYALTER TABLE ... ENABLE ROW LEVEL SECURITY42501-- 查看表的所有策略
SELECT policyname, cmd, qual, with_check
FROM pg_policies WHERE tablename = '<table>';
-- 确认RLS已启用
SELECT relname, relrowsecurity FROM pg_class WHERE relname = '<table>';service_roleBYPASSRLSsupabase gen types typescript --local > supabase/types.gen.tsgit diff supabase/types.gen.tsSELECT column_name, data_type, is_nullable
FROM information_schema.columns
WHERE table_schema = 'public' AND table_name = '<table>'
ORDER BY ordinal_position;types.gen.tssupabase gen types typescript --local > supabase/types.gen.ts && git diff --exit-code supabase/types.gen.tstypes.gen.tssupabase gen types typescript --local > supabase/types.gen.tsgit diff supabase/types.gen.tsSELECT column_name, data_type, is_nullable
FROM information_schema.columns
WHERE table_schema = 'public' AND table_name = '<table>'
ORDER BY ordinal_position;types.gen.tssupabase gen types typescript --local > supabase/types.gen.ts && git diff --exit-code supabase/types.gen.tstypes.gen.ts