Context
- Databases: !
cat packages/python/cli/databases.yml - Local Supabase status: !
pnpm db status 2>&1 | head -10
Query script
The query tool lives at ${CLAUDE_SKILL_DIR}/../db/scripts/query.ts. Run it with:
node --experimental-strip-types ${CLAUDE_SKILL_DIR}/../db/scripts/query.ts [flags] "<sql>"
Flags:
--env local|dev|preview|prod(default: local)--db core|admin(default: core)--format table|json|csv(default: table)
Note: do NOT pass --readonly. This skill is for mutations.
Credentials
Same as /db. See that skill for credential resolution order and SSM instructions.
Schema reference
Generated Supabase types with full table schemas, enums, and function signatures:
- Core DB:
packages/typescript/databases/core/database.types.ts - Admin DB:
packages/typescript/databases/admin/database.types.ts
Read the relevant file when you need column names, types, enums, or relationships.
Rules
- NEVER target prod. Refuse all prod mutations. Production changes go through migrations deployed via the pipeline (dev -> preview -> prod). See AGENTS.md "Production is Sacred."
- Confirm before executing on any remote environment (dev, preview). Show the SQL and target environment, then ask the user to confirm.
- Default to
--env localunless the user specifies otherwise. - For DDL (CREATE, ALTER, DROP), prefer
pnpm db diff --executefor tracked migrations. Only use raw DDL for local experimentation. - Show the SQL you intend to run before running it.
Task
Run the user's mutation. Always show the SQL and target before executing. For remote envs, require explicit confirmation.
$ARGUMENTS