srtd-cli
当用户提及“srtd”、“sql模板”、“migrations-templates”、“实时重载sql”、“supabase函数”,在处理supabase/migrations-templates/中的文件时,或在检测到.buildlog.json或srtd.config.json时,或编写Supabase的Postgres函数/视图/触发器时使用此技能。
📖 中文导读:当用户提及“srtd”、“sql模板”、“migrations-templates”、“实时重载sql”、“supabase函数”,在处理supabase/migrations-templates/中的文件时,或在检测到.buildlog.json或srtd.config.json时,或编写Supabase的Postgres函数/视图/触发器时使用此技能。 以下正文为该技能的原始 SKILL.md 内容(英文),上方安装命令可直接使用。
name: srtd-cli description: This skill should be used when the user mentions "srtd", "sql templates", "migrations-templates", "live reload sql", "supabase functions", when working with files in supabase/migrations-templates/, when .buildlog.json or srtd.config.json is detected, or when writing Postgres functions/views/triggers for Supabase.
SRTD - Iterative SQL Template Development
Workflow
Start watch in background immediately:
srtd watch --json
Use run_in_background: true. Monitor with TaskOutput for events: templateApplied (success), templateError (check errorMessage/errorHint).
Templates
Location: supabase/migrations-templates/*.sql. Must be idempotent.
Idempotency patterns:
- Functions/Views:
CREATE OR REPLACE(useDROPonly when changing signature) - Policies:
DROP POLICY IF EXISTSthenCREATE POLICY(not replaceable) - Triggers: Drop BOTH trigger AND function first
Dependencies: -- @depends-on: other.sql at top
WIP: .wip.sql suffix → applies locally, never builds
Commands
srtd apply [--force] [--json] # Apply to local DB (use instead of watch for one-off)
srtd build [--bundle] # Generate migration FILES only (does NOT apply to DB)
srtd clear --reset # Reset state if confused
State
.buildlog.json→ commit (tracks built migrations).buildlog.local.json→ gitignored (local DB state)