.cursor/skills/supabase-calls/SKILL.md
Guides Supabase usage in petconnect-app including MCP tool calls, migrations, RLS, and API layer conventions. Use when working with Supabase, executing SQL, applying migrations, list_tables, execute_sql, RLS policies, or database schema changes.
npx skillsauth add Aafff623/pet-adoption-app supabase-callsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
VITE_SUPABASE_URL、VITE_SUPABASE_ANON_KEYlib/api/*.ts 封装所有 Supabase 调用,UI 不直接访问数据库mjyjrdwmcvrmbovbxgtr(MCP 调用时必传)所有 MCP 工具调用需传入 project_id: "mjyjrdwmcvrmbovbxgtr"。
| 场景 | 工具 | 说明 |
|------|------|------|
| DDL(建表、改列、策略) | apply_migration | name 用 snake_case,query 为完整 SQL |
| DML / SELECT | execute_sql | 调试、数据校验 |
| 查看表结构 | list_tables | schemas 默认 ["public"] |
| 查看迁移状态 | list_migrations | 无额外参数 |
| 生成 TS 类型 | generate_typescript_types | Schema 变更后调用 |
| 验证连接 | list_projects | 无参数 |
{
"project_id": "mjyjrdwmcvrmbovbxgtr",
"name": "add_deleted_at_to_chat_messages",
"query": "ALTER TABLE public.chat_messages ADD COLUMN IF NOT EXISTS deleted_at TIMESTAMPTZ DEFAULT NULL;"
}
{
"project_id": "mjyjrdwmcvrmbovbxgtr",
"query": "SELECT id, nickname FROM profiles LIMIT 5;"
}
supabase/*.sqladd_xxx_to_yyy.sql、storage_policies.sql 等apply_migration 或 Supabase SQL Editor 执行generate_typescript_types 同步类型lib/api/* 与 types/index.ts 以匹配新 schemaservice_role 不进入客户端{user_id}/{timestamp}.{ext} 限制用户只能操作自己的目录user_id, created_at)userId, createdAt)generate_typescript_types,或手动维护 types/index.ts参考 lib/api/profile.ts:
AvatarUploadError)userMessage)supabase.channel().on('postgres_changes', ...) 订阅eq('conversation_id', id))避免全表订阅channel.unsubscribe() 释放连接示例(lib/api/messages.ts):
supabase.channel(`chat:${conversationId}`)
.on('postgres_changes', {
event: 'INSERT',
schema: 'public',
table: 'chat_messages',
filter: `conversation_id=eq.${conversationId}`,
}, callback)
.subscribe();
Schema 变更前:
supabase/*.sqlservice_role 暴露Schema 变更后:
apply_migration 或 SQL Editorgenerate_typescript_typestools
项目仓库瘦身与规范。Use when cleaning repo, optimizing .gitignore, removing large files, or organizing project structure. 约定:脚本仅用 PowerShell / npm 跨平台命令,不生成 .sh 文件。
development
Generates professional README files by synthesizing standard-readme, Best-README-Template, Google styleguide, and GitHub best practices. Use when creating or redesigning README.md, documenting projects, or when the user asks for README templates or best practices.
development
专业处理 README 与部署文档。Use when writing README, deployment guides, environment variable docs, or project structure documentation. 约定:README 必须包含环境变量表、获取 API Key 的链接、部署步骤、项目结构。
testing
Safely slim down projects by removing redundant files and dependencies while ensuring delivery readiness and functionality. Use when the user asks for project slimming, cleanup, reducing project size, or preparing for delivery after testing.