supabase by supabase/agent-skills
npx skills add https://github.com/supabase/agent-skills --skill supabase1. Supabase 更新频繁 — 在实施前务必对照当前文档进行验证。 不要依赖训练数据来了解 Supabase 功能。函数签名、config.toml 设置和 API 约定在不同版本间会发生变化。在实施前,请使用以下文档访问方法查找相关主题。
2. 验证你的工作。 在实施任何修复后,运行一个测试查询来确认更改生效。未经验证的修复是不完整的。
3. 从错误中恢复,不要陷入循环。 如果一个方法在尝试 2-3 次后仍然失败,请停止并重新考虑。尝试不同的方法,查阅文档,更仔细地检查错误,并在可能时查看相关日志。Supabase 的问题并不总是通过重试相同的命令来解决,答案也不总是在日志中,但在继续之前查看日志通常是值得的。
4. 在公开模式中默认启用 RLS。 在任何公开模式(尤其是 public 模式)中的每个表上启用 RLS。这在 Supabase 中至关重要,因为公开模式中的表可以通过 Data API 访问。对于私有模式,建议使用 RLS 作为深度防御。启用 RLS 后,创建与实际访问模型匹配的策略,而不是将每个表都默认为相同的 auth.uid() 模式。
5. 安全检查清单。 在处理任何涉及身份验证、RLS、视图、存储或用户数据的 Supabase 任务时,请运行此清单。这些是 Supabase 特有的安全陷阱,会悄无声息地制造漏洞:
身份验证和会话安全
user_metadata 声明。 在 Supabase 中,raw_user_meta_data 是用户可编辑的,并且可能出现在 auth.jwt() 中,因此将其用于 RLS 策略或任何其他授权逻辑是不安全的。请将授权数据存储在 / 中。广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
raw_app_meta_dataapp_metadataauth.sessions 验证 session_id。app_metadata 或 auth.jwt() 进行授权,请记住,在用户令牌刷新之前,JWT 声明并不总是最新的。API 密钥和客户端暴露
service_role 或密钥。 在前端代码中优先使用可发布密钥。遗留的 anon 密钥仅用于兼容性。在 Next.js 中,任何 NEXT_PUBLIC_ 环境变量都会发送到浏览器。RLS、视图和特权数据库代码
CREATE VIEW ... WITH (security_invoker = true)。在旧版本的 Postgres 中,通过撤销 anon 和 authenticated 角色的访问权限,或将视图放在未公开的模式中来保护视图。security definer 函数放在公开的模式中。 将它们放在私有或未公开的模式中。存储访问控制
对于上述未涵盖的任何安全问题,请获取 Supabase 产品安全索引:https://supabase.com/docs/guides/security/product-security.md
始终通过 --help 发现命令 — 切勿猜测。CLI 结构在不同版本间会发生变化。
supabase --help # 所有顶级命令
supabase <group> --help # 子命令(例如,supabase db --help)
supabase <group> <command> --help # 特定命令的标志
Supabase CLI 已知注意事项:
supabase db query 需要 CLI v2.79.0+ → 使用 MCP execute_sql 或 psql 作为备用方案supabase db advisors 需要 CLI v2.81.3+ → 使用 MCP get_advisors 作为备用方案supabase migration new <name> 创建它。切勿发明迁移文件名或依赖记忆来获取预期格式。版本检查和升级: 运行 supabase --version 进行检查。关于 CLI 更新日志和特定版本的功能,请查阅 CLI 文档 或 GitHub 发布页面。
有关设置说明、服务器 URL 和配置,请参阅 MCP 设置指南。
排查连接问题 — 按顺序执行以下步骤:
检查服务器是否可达: curl -so /dev/null -w "%{http_code}" https://mcp.supabase.com/mcp 预期返回 401(无令牌),这意味着服务器正常运行。超时或“连接被拒绝”意味着服务器可能已关闭。
检查 .mcp.json 配置: 验证项目根目录是否存在有效的 .mcp.json 文件,并且服务器 URL 正确。如果缺失,请创建一个指向 https://mcp.supabase.com/mcp 的文件。
对 MCP 服务器进行身份验证: 如果服务器可达且 .mcp.json 正确,但工具不可见,则用户需要进行身份验证。Supabase MCP 服务器使用 OAuth 2.1 — 告诉用户在他们的代理中触发身份验证流程,在浏览器中完成,然后重新加载会话。
在实施任何 Supabase 功能之前,请查找相关文档。按优先级顺序使用以下方法:
search_docs 工具(首选 — 直接返回相关片段).md 来获取。要进行模式更改,请使用 execute_sql(MCP)或 supabase db query(CLI)。 这些方法直接在数据库上运行 SQL,而不会创建迁移历史记录条目,因此你可以自由迭代,并在准备好时生成一个干净的迁移。
不要使用 apply_migration 来更改本地数据库模式 — 它会在每次调用时写入一个迁移历史记录条目,这意味着你无法迭代,并且 supabase db diff / supabase db pull 会产生空或冲突的差异。如果你使用了它,你将只能停留在第一次尝试时传递的 SQL 上。
准备好提交你的更改到迁移文件时:
supabase db advisors(CLI v2.81.3+)或 MCP get_advisors。修复任何问题。supabase db pull <描述性名称> --local --yessupabase migration list --local每周安装量
1.9K
代码仓库
GitHub 星标数
1.8K
首次出现
2 天前
安全审计
安装于
codex1.9K
opencode1.9K
github-copilot1.9K
kimi-cli1.8K
gemini-cli1.8K
amp1.8K
1. Supabase changes frequently — verify against current docs before implementing. Do not rely on training data for Supabase features. Function signatures, config.toml settings, and API conventions change between versions. Before implementing, look up the relevant topic using the documentation access methods below.
2. Verify your work. After implementing any fix, run a test query to confirm the change works. A fix without verification is incomplete.
3. Recover from errors, don't loop. If an approach fails after 2-3 attempts, stop and reconsider. Try a different method, check documentation, inspect the error more carefully, and review relevant logs when available. Supabase issues are not always solved by retrying the same command, and the answer is not always in the logs, but logs are often worth checking before proceeding.
4. RLS by default in exposed schemas. Enable RLS on every table in any exposed schema, especially public. This is critical in Supabase because tables in exposed schemas can be reachable through the Data API. For private schemas, prefer RLS as defense in depth. After enabling RLS, create policies that match the actual access model rather than defaulting every table to the same auth.uid() pattern.
5. Security checklist. When working on any Supabase task that touches auth, RLS, views, storage, or user data, run through this checklist. These are Supabase-specific security traps that silently create vulnerabilities:
Auth and session security
user_metadata claims in JWT-based authorization decisions. In Supabase, raw_user_meta_data is user-editable and can appear in auth.jwt(), so it is unsafe for RLS policies or any other authorization logic. Store authorization data in raw_app_meta_data / app_metadata instead.session_id against auth.sessions on sensitive operations.app_metadata or auth.jwt() for authorization, remember JWT claims are not always fresh until the user's token is refreshed.API key and client exposure
service_role or secret key in public clients. Prefer publishable keys for frontend code. Legacy anon keys are only for compatibility. In Next.js, any NEXT_PUBLIC_ env var is sent to the browser.RLS, views, and privileged database code
CREATE VIEW ... WITH (security_invoker = true). In older versions of Postgres, protect your views by revoking access from the anon and authenticated roles, or by putting them in an unexposed schema.security definer functions in an exposed schema. Keep them in a private or otherwise unexposed schema.Storage access control
For any security concern not covered above, fetch the Supabase product security index: https://supabase.com/docs/guides/security/product-security.md
Always discover commands via --help — never guess. The CLI structure changes between versions.
supabase --help # All top-level commands
supabase <group> --help # Subcommands (e.g., supabase db --help)
supabase <group> <command> --help # Flags for a specific command
Supabase CLI Known gotchas:
supabase db query requires CLI v2.79.0+ → use MCP execute_sql or psql as fallbacksupabase db advisors requires CLI v2.81.3+ → use MCP get_advisors as fallbacksupabase migration new <name> first. Never invent a migration filename or rely on memory for the expected format.Version check and upgrade: Run supabase --version to check. For CLI changelogs and version-specific features, consult the CLI documentation or GitHub releases.
For setup instructions, server URL, and configuration, see the MCP setup guide.
Troubleshooting connection issues — follow these steps in order:
Check if the server is reachable: curl -so /dev/null -w "%{http_code}" https://mcp.supabase.com/mcp A 401 is expected (no token) and means the server is up. Timeout or "connection refused" means it may be down.
Check.mcp.json configuration: Verify the project root has a valid .mcp.json with the correct server URL. If missing, create one pointing to https://mcp.supabase.com/mcp.
Authenticate the MCP server: If the server is reachable and .mcp.json is correct but tools aren't visible, the user needs to authenticate. The Supabase MCP server uses OAuth 2.1 — tell the user to trigger the auth flow in their agent, complete it in the browser, and reload the session.
Before implementing any Supabase feature, find the relevant documentation. Use these methods in priority order:
search_docs tool (preferred — returns relevant snippets directly).md to the URL path.To make schema changes, useexecute_sql (MCP) or supabase db query (CLI). These run SQL directly on the database without creating migration history entries, so you can iterate freely and generate a clean migration when ready.
Do NOT use apply_migration to change a local database schema — it writes a migration history entry on every call, which means you can't iterate, and supabase db diff / supabase db pull will produce empty or conflicting diffs. If you use it, you'll be stuck with whatever SQL you passed on the first try.
When ready to commit your changes to a migration file:
supabase db advisors (CLI v2.81.3+) or MCP get_advisors. Fix any issues.supabase db pull <descriptive-name> --local --yessupabase migration list --localWeekly Installs
1.9K
Repository
GitHub Stars
1.8K
First Seen
2 days ago
Security Audits
Gen Agent Trust HubPassSocketPassSnykWarn
Installed on
codex1.9K
opencode1.9K
github-copilot1.9K
kimi-cli1.8K
gemini-cli1.8K
amp1.8K
Supabase Postgres 最佳实践指南 - 8大类别性能优化规则与SQL示例
76,000 周安装
Nansen Token CLI:区块链代币深度分析工具 - 价格、持有者、资金流、DEX交易
136 周安装
Three.js游戏3D模型添加指南:使用Meshy AI生成自定义角色与资产
81 周安装
PDF解析器技能:自动化PDF处理与业务工作流优化指南
143 周安装
Anime.js v4 中文指南:轻量级 JavaScript 动画库安装、核心概念与 API 详解
142 周安装
产品驱动增长(PLG)框架:B2B SaaS免费增值模型与增长策略指南
143 周安装
NativeWind v4 Expo 配置指南:React Native Tailwind CSS 样式库集成教程
139 周安装