@m2015agg/supabase-skill 0.7.0 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +129 -248
- package/dist/commands/update.js +6 -1
- package/dist/commands/update.js.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
# @m2015agg/supabase-skill
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@m2015agg/supabase-skill)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
|
|
6
|
+
**The Supabase MCP replacement.** One npm package that teaches AI agents (Claude Code, Codex, Cursor) how to use the Supabase CLI, caches your entire database schema locally with row counts and table sizes, and pre-approves read-only commands so your agent stops asking permission for every lookup.
|
|
4
7
|
|
|
5
8
|
No MCP server. No context window bloat. No running processes. No permission prompts for reads.
|
|
6
9
|
|
|
@@ -18,22 +21,12 @@ If you're using Claude Code (or any AI agent) with Supabase, you're burning toke
|
|
|
18
21
|
|
|
19
22
|
**Replace the MCP with CLI instructions.** The Supabase CLI already does everything the MCP does. Your agent just doesn't know about it.
|
|
20
23
|
|
|
21
|
-
**Cache the schema locally.** One API call snapshots your entire database into a local SQLite + markdown cache. Your agent reads local files (~80 tokens) instead of running SQL queries (~1,247 tokens average).
|
|
24
|
+
**Cache the schema locally.** One API call snapshots your entire database into a local SQLite + FTS5 + markdown cache — with row counts and table sizes. Your agent reads local files (~80 tokens) instead of running SQL queries (~1,247 tokens average).
|
|
22
25
|
|
|
23
26
|
**Pre-approve read commands.** 23 read-only commands (schema lookups, migration list, inspect, etc.) are auto-approved in Claude Code. Write commands (migration up, deploy, delete) still require your approval.
|
|
24
27
|
|
|
25
28
|
**Result: ~95% token reduction on schema exploration, zero permission prompts for reads, multi-environment support (dev/stage/prod) in one session.**
|
|
26
29
|
|
|
27
|
-
This package:
|
|
28
|
-
- **Guided install wizard** — checks/installs Supabase CLI, logs you in, discovers projects + branches, fetches API keys, configures environments
|
|
29
|
-
- **Schema snapshot** — caches your entire database schema locally (SQLite + FTS5 + markdown) so your agent never runs SQL to explore tables again
|
|
30
|
-
- **Full DB admin skill doc** — teaches your agent every Supabase command: CRUD via REST API, migrations, DDL, inspect, storage, edge functions, branches, backups
|
|
31
|
-
- **Security model** — API keys in `.env` only (never in CLAUDE.md), gitignored, mode 600
|
|
32
|
-
- **Pre-approved permissions** — 23 read-only commands auto-approved in Claude Code, write commands still require approval
|
|
33
|
-
- **Nightly auto-refresh** — cron job keeps schema snapshot current
|
|
34
|
-
|
|
35
|
-
Two commands. Zero prompts after install.
|
|
36
|
-
|
|
37
30
|
## Install
|
|
38
31
|
|
|
39
32
|
```bash
|
|
@@ -48,7 +41,7 @@ npm install -g @m2015agg/supabase-skill
|
|
|
48
41
|
supabase-skill install
|
|
49
42
|
```
|
|
50
43
|
|
|
51
|
-
Interactive wizard
|
|
44
|
+
Interactive wizard:
|
|
52
45
|
1. Check/install Supabase CLI (minimum v2.67.0)
|
|
53
46
|
2. Check/trigger login (opens browser if needed)
|
|
54
47
|
3. Discover projects + branches (auto-detects preview branches)
|
|
@@ -82,143 +75,112 @@ $ supabase-skill install
|
|
|
82
75
|
Database schema name (default: public) → my_schema
|
|
83
76
|
|
|
84
77
|
Step 4/5: Fetching API keys
|
|
85
|
-
PROD
|
|
86
|
-
STAGE
|
|
78
|
+
PROD ... ✓ anon + service_role keys saved
|
|
79
|
+
STAGE ... ✓ anon + service_role keys saved
|
|
87
80
|
|
|
88
|
-
Step 5/5: Writing configuration
|
|
89
|
-
✓ Config, CLAUDE.md, shell profile
|
|
90
|
-
|
|
91
|
-
Next: cd into your project and run `supabase-skill init`
|
|
81
|
+
Step 5/5: Writing configuration ✓
|
|
92
82
|
```
|
|
93
83
|
|
|
94
|
-
### 2. Per-Project Setup
|
|
84
|
+
### 2. Per-Project Setup
|
|
95
85
|
|
|
96
86
|
```bash
|
|
97
87
|
cd your-project
|
|
98
88
|
supabase-skill init
|
|
99
89
|
```
|
|
100
90
|
|
|
101
|
-
Runs 5 steps automatically —
|
|
91
|
+
Runs 5 steps automatically — zero prompts:
|
|
102
92
|
1. **CLAUDE.md** — skill doc with environment routing (no secrets)
|
|
103
93
|
2. **.env** — API keys per environment (gitignored, mode 600)
|
|
104
|
-
3. **Schema snapshot** — SQLite + markdown cache
|
|
105
|
-
4. **Claude permissions** — 23 read-only commands pre-approved
|
|
94
|
+
3. **Schema snapshot** — SQLite + markdown cache with row counts + table sizes
|
|
95
|
+
4. **Claude permissions** — 23 read-only commands pre-approved
|
|
106
96
|
5. **Nightly cron** — auto-refresh schema at 3am
|
|
97
|
+
6. **`/supabase` walkthrough** — Claude Code skill for guided database tour
|
|
107
98
|
|
|
108
|
-
Or do both in one shot
|
|
99
|
+
Or do both in one shot:
|
|
109
100
|
|
|
110
101
|
```bash
|
|
111
102
|
supabase-skill install --init
|
|
112
103
|
```
|
|
113
104
|
|
|
114
|
-
### 3.
|
|
105
|
+
### 3. First Session
|
|
106
|
+
|
|
107
|
+
Type `/supabase` in Claude Code for a guided walkthrough of your database. Claude will show your environments, schema overview, explore tables, and teach you what commands are available.
|
|
108
|
+
|
|
109
|
+
### 4. Validate Setup
|
|
115
110
|
|
|
116
|
-
|
|
111
|
+
```bash
|
|
112
|
+
supabase-skill doctor
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
✓ Supabase CLI — v2.78.1
|
|
117
|
+
✓ Logged in
|
|
118
|
+
✓ Config — 2 environment(s): prod, stage
|
|
119
|
+
✓ API keys [prod] — anon + service_role present
|
|
120
|
+
✓ API keys [stage] — anon + service_role present
|
|
121
|
+
✓ Schema — my_schema
|
|
122
|
+
✓ Project linked — tsrqponmlkjihgfedcba
|
|
123
|
+
✓ CLAUDE.md — skill doc installed
|
|
124
|
+
✓ .env — has Supabase keys
|
|
125
|
+
✓ Snapshot — 0h ago
|
|
126
|
+
✓ Permissions — 23 commands approved
|
|
127
|
+
✓ Cron — nightly at 03:00
|
|
128
|
+
|
|
129
|
+
12 passed, 0 failed, 0 warnings
|
|
130
|
+
```
|
|
117
131
|
|
|
118
132
|
## Commands
|
|
119
133
|
|
|
120
134
|
### User Commands (you run these)
|
|
121
135
|
|
|
122
|
-
| Command |
|
|
123
|
-
|
|
124
|
-
| `supabase-skill install` |
|
|
125
|
-
| `supabase-skill install --init` |
|
|
126
|
-
| `supabase-skill init` | Per
|
|
127
|
-
| `supabase-skill
|
|
128
|
-
| `supabase-skill
|
|
136
|
+
| Command | What it does |
|
|
137
|
+
|---------|-------------|
|
|
138
|
+
| `supabase-skill install` | Global wizard: CLI, login, envs, keys, CLAUDE.md |
|
|
139
|
+
| `supabase-skill install --init` | Global + project setup in one shot |
|
|
140
|
+
| `supabase-skill init` | Per-project: .env + CLAUDE.md + snapshot + approve + cron + walkthrough |
|
|
141
|
+
| `supabase-skill doctor` | Health check: 12-point validation of entire setup |
|
|
142
|
+
| `supabase-skill update` | Self-update to latest npm version |
|
|
143
|
+
| `supabase-skill update --check` | Check for updates without installing |
|
|
144
|
+
| `supabase-skill envs` | Show configured environments |
|
|
145
|
+
| `supabase-skill diff` | Compare live schema vs local snapshot (find drift) |
|
|
146
|
+
| `supabase-skill graph` | Mermaid ER diagram of all table relationships |
|
|
147
|
+
| `supabase-skill cron --status` | Check nightly refresh |
|
|
129
148
|
| `supabase-skill uninstall` | Remove from current project |
|
|
130
149
|
| `supabase-skill uninstall --global` | Remove from global CLAUDE.md |
|
|
150
|
+
| `supabase-skill approve --remove` | Remove Claude permissions |
|
|
131
151
|
|
|
132
152
|
### Agent Commands (Claude uses these — pre-approved, no prompts)
|
|
133
153
|
|
|
134
154
|
| Command | What it does |
|
|
135
155
|
|---------|-------------|
|
|
136
|
-
| `supabase-skill context <query>` | Full context: columns, FKs, related tables (2 levels), functions |
|
|
137
|
-
| `supabase-skill table <name>` | Single table deep dive with relationships
|
|
138
|
-
| `supabase-skill columns [name]` | Search columns
|
|
156
|
+
| `supabase-skill context <query>` | Full context: columns, FKs, related tables (2 levels), functions, row counts, sizes |
|
|
157
|
+
| `supabase-skill table <name>` | Single table deep dive with relationships, sizes, related summaries |
|
|
158
|
+
| `supabase-skill columns [name]` | Search columns: `--type`, `--fk`, `--pk`, `--nullable`, `--table` |
|
|
139
159
|
| `supabase-skill search <query>` | FTS5-powered search across tables, columns, functions, FKs |
|
|
140
160
|
| `supabase-skill snapshot` | Refresh schema cache (auto-runs after DDL changes) |
|
|
141
161
|
| `supabase inspect db *` | 12 database inspection commands (table-stats, locks, etc.) |
|
|
142
162
|
| `supabase migration list` | Compare local vs remote migrations |
|
|
143
163
|
|
|
144
|
-
## What It Writes to CLAUDE.md
|
|
145
|
-
|
|
146
|
-
The skill doc is injected between `<!-- supabase-skill:start -->` and `<!-- supabase-skill:end -->` markers. This means:
|
|
147
|
-
|
|
148
|
-
- **Idempotent**: Run `install` or `init` multiple times — it updates in place, never duplicates
|
|
149
|
-
- **Clean removal**: `uninstall` removes exactly the marked section, nothing else
|
|
150
|
-
- **Non-destructive**: Your existing CLAUDE.md content is preserved
|
|
151
|
-
|
|
152
|
-
### The Skill Doc
|
|
153
|
-
|
|
154
|
-
Here's exactly what gets written (with your project refs filled in):
|
|
155
|
-
|
|
156
|
-
```markdown
|
|
157
|
-
## supabase-cli (Supabase Database & Infrastructure)
|
|
158
|
-
|
|
159
|
-
Requires: `supabase` CLI installed, logged in via `supabase login`.
|
|
160
|
-
All commands support `-o json` for structured output.
|
|
161
|
-
|
|
162
|
-
### Environments
|
|
163
|
-
- **PROD**: `abcdefghijklmnopqrst` (My App Production) — ⚠️ NEVER modify without explicit approval
|
|
164
|
-
- **STAGE**: `tsrqponmlkjihgfedcba` (My App Staging)
|
|
165
|
-
- **Default**: Use STAGE for testing. PROD requires explicit approval.
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
It covers **20 sections** — every Supabase CLI capability plus REST API operations:
|
|
169
|
-
|
|
170
|
-
| Section | What it teaches the agent |
|
|
171
|
-
|---------|-------------------------|
|
|
172
|
-
| **CLI Flag Reference** | Which commands use `--linked` vs `--project-ref` (agents get this wrong constantly) |
|
|
173
|
-
| **Environment Routing** | "stage" → correct ref, "prod" → correct ref + approval required |
|
|
174
|
-
| **Data Operations (REST API)** | Full CRUD: SELECT with 12 filter operators, INSERT, UPDATE, UPSERT, DELETE, COUNT |
|
|
175
|
-
| **Migrations** | `new`, `list`, `up`, `down`, `repair`, `squash`, `fetch` |
|
|
176
|
-
| **DDL via Migrations** | CREATE/ALTER/DROP TABLE, VIEW, INDEX, FUNCTION, RLS policies, triggers, enums |
|
|
177
|
-
| **Schema Management** | `db diff`, `dump`, `pull`, `push`, `lint` |
|
|
178
|
-
| **Database Inspection** | All 12 `inspect db` commands + `inspect report` |
|
|
179
|
-
| **Storage** | `ls`, `cp`, `rm`, `mv` (with `--experimental` flag) |
|
|
180
|
-
| **Edge Functions** | `list`, `deploy`, `delete`, `new`, `download`, `serve` |
|
|
181
|
-
| **Branches** | `list`, `create`, `delete`, `get`, `pause`, `unpause` |
|
|
182
|
-
| **Backups** | `list`, `restore` (PITR) |
|
|
183
|
-
| **Project Management** | `projects list/api-keys`, `secrets list/set`, `postgres-config` |
|
|
184
|
-
| **Code Generation** | `gen types` (TypeScript from schema) |
|
|
185
|
-
| **Schema Snapshot** | All `supabase-skill` query commands for local schema exploration |
|
|
186
|
-
| **Safety Rules** | Never mutate prod without approval, always specify ref, test on stage first |
|
|
187
|
-
|
|
188
|
-
### Security Model
|
|
189
|
-
|
|
190
|
-
| What | Where | Visible to agent? |
|
|
191
|
-
|------|-------|-------------------|
|
|
192
|
-
| Project refs (not secrets) | CLAUDE.md | Yes — agent needs these for `--project-ref` |
|
|
193
|
-
| Environment routing | CLAUDE.md | Yes — agent needs to know "stage" → which ref |
|
|
194
|
-
| API keys (anon + service_role) | `.env` only | Only when agent runs `source .env` |
|
|
195
|
-
| Config with keys | `~/.config/supabase-skill/config.json` | No — mode 600, only used by `init` |
|
|
196
|
-
| Schema snapshot | `.supabase-schema/` | Yes — that's the whole point |
|
|
197
|
-
|
|
198
|
-
**Rule**: Secrets never go in CLAUDE.md. Agent reads `.env` when it needs direct API access.
|
|
199
|
-
|
|
200
164
|
## Schema Snapshot (CodeGraph for Your Database)
|
|
201
165
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
### Create a Snapshot
|
|
166
|
+
Instead of your agent running SQL against `information_schema` every time (burning ~1,247 tokens per query), `snapshot` caches everything locally.
|
|
205
167
|
|
|
206
168
|
```bash
|
|
207
169
|
supabase-skill snapshot
|
|
208
170
|
```
|
|
209
171
|
|
|
210
|
-
One API call
|
|
172
|
+
One API call + one inspect command → full local cache:
|
|
211
173
|
|
|
212
174
|
```
|
|
213
175
|
.supabase-schema/
|
|
214
|
-
├──
|
|
176
|
+
├── schema.db # SQLite + FTS5 (fast structured queries)
|
|
177
|
+
├── index.md # All tables with row counts + sizes
|
|
215
178
|
├── tables/
|
|
216
179
|
│ ├── episodes.md # Columns, types, PKs, FKs, defaults, notes
|
|
217
180
|
│ ├── subscriptions.md
|
|
218
|
-
│ ├── users.md
|
|
219
181
|
│ └── ... (one file per table + view)
|
|
220
|
-
├── relationships.json # Every FK mapping
|
|
221
|
-
└── functions.md # All RPC functions with
|
|
182
|
+
├── relationships.json # Every FK mapping
|
|
183
|
+
└── functions.md # All RPC functions with parameters
|
|
222
184
|
```
|
|
223
185
|
|
|
224
186
|
### What a Table File Looks Like
|
|
@@ -226,202 +188,121 @@ One API call fetches the full OpenAPI spec from PostgREST, then splits it into s
|
|
|
226
188
|
```markdown
|
|
227
189
|
# episodes
|
|
228
190
|
|
|
229
|
-
15 columns | 1 PK | 2 FK
|
|
191
|
+
15 columns | 1 PK | 2 FK | ~397 rows | 4216 kB
|
|
230
192
|
|
|
231
193
|
| Column | Type | Nullable | Default | FK |
|
|
232
194
|
|--------|------|----------|---------|-----|
|
|
233
195
|
| id **PK** | uuid | NOT NULL | gen_random_uuid() | |
|
|
234
196
|
| subscription_id | uuid | NOT NULL | | → subscriptions.id |
|
|
235
197
|
| status | text | nullable | new | |
|
|
236
|
-
| audio_url | text | nullable | | |
|
|
237
198
|
| metadata_id | uuid | nullable | | → episode_metadata.id |
|
|
238
199
|
...
|
|
239
|
-
|
|
240
|
-
## Notes
|
|
241
|
-
- **processing_metadata**: Stores additional processing information and AI analysis results
|
|
242
200
|
```
|
|
243
201
|
|
|
244
|
-
###
|
|
202
|
+
### Context — Smart Query (Like CodeGraph)
|
|
245
203
|
|
|
246
204
|
```bash
|
|
247
|
-
# Find everything related to "episode"
|
|
248
|
-
supabase-skill search episode
|
|
249
|
-
|
|
250
|
-
# Output:
|
|
251
|
-
# TABLES: episodes, episode_chunks, episode_metadata, ...
|
|
252
|
-
# COLUMNS: ai_sections.episode_id (uuid), segments.episode_id (uuid), ...
|
|
253
|
-
# FUNCTIONS: browse_episodes, episode_semantic_search, ...
|
|
254
|
-
# FKS: episodes.subscription_id → subscriptions.id, ...
|
|
255
|
-
|
|
256
|
-
# JSON output for programmatic use
|
|
257
|
-
supabase-skill search subscription --json
|
|
258
|
-
```
|
|
259
|
-
|
|
260
|
-
### Context — The Smart Query (Like CodeGraph's `codegraph_context`)
|
|
261
|
-
|
|
262
|
-
```bash
|
|
263
|
-
# "What's the full picture for episodes?"
|
|
264
205
|
supabase-skill context episodes
|
|
265
206
|
```
|
|
266
207
|
|
|
267
|
-
Returns
|
|
268
|
-
- Full column listing with types, PKs, FKs, defaults
|
|
269
|
-
- All related tables (2 levels deep via FK chains)
|
|
270
|
-
- Which direction: "references" vs "referenced by"
|
|
271
|
-
- Related RPC functions
|
|
272
|
-
- Column notes/descriptions
|
|
208
|
+
Returns columns, FKs, related tables 2 levels deep, RPC functions, row counts, and sizes — all from local cache.
|
|
273
209
|
|
|
274
|
-
|
|
275
|
-
# Deeper FK traversal
|
|
276
|
-
supabase-skill context episodes --depth 3
|
|
277
|
-
|
|
278
|
-
# Topic-based (matches any table/column containing the term)
|
|
279
|
-
supabase-skill context subscription
|
|
280
|
-
supabase-skill context chat
|
|
281
|
-
```
|
|
282
|
-
|
|
283
|
-
### Table — Single Table Deep Dive
|
|
210
|
+
### Columns — Cross-Database Search
|
|
284
211
|
|
|
285
212
|
```bash
|
|
286
|
-
supabase-skill
|
|
213
|
+
supabase-skill columns --type jsonb # all jsonb columns
|
|
214
|
+
supabase-skill columns --fk --table episode # FK columns in episode tables
|
|
215
|
+
supabase-skill columns --pk # all primary keys
|
|
216
|
+
supabase-skill columns status # find "status" columns
|
|
287
217
|
```
|
|
288
218
|
|
|
289
|
-
|
|
290
|
-
- Outgoing FKs ("this table references")
|
|
291
|
-
- Incoming FKs ("referenced by")
|
|
292
|
-
- Related RPC functions (name-matched)
|
|
293
|
-
- Related table summaries (column counts for each FK target)
|
|
294
|
-
|
|
295
|
-
### Columns — Cross-Database Column Search
|
|
296
|
-
|
|
297
|
-
Stop running `SELECT column_name FROM information_schema.columns WHERE...` every time.
|
|
219
|
+
### Diff — Detect Schema Drift
|
|
298
220
|
|
|
299
221
|
```bash
|
|
300
|
-
|
|
301
|
-
supabase-skill columns --type jsonb
|
|
302
|
-
|
|
303
|
-
# All foreign key columns in episode-related tables
|
|
304
|
-
supabase-skill columns --fk --table episode
|
|
305
|
-
|
|
306
|
-
# All primary keys
|
|
307
|
-
supabase-skill columns --pk
|
|
308
|
-
|
|
309
|
-
# All NOT NULL columns with defaults
|
|
310
|
-
supabase-skill columns --not-null --has-default
|
|
311
|
-
|
|
312
|
-
# Find all "status" columns and their types
|
|
313
|
-
supabase-skill columns status
|
|
314
|
-
|
|
315
|
-
# Combine: all uuid columns that are foreign keys
|
|
316
|
-
supabase-skill columns --type uuid --fk
|
|
317
|
-
```
|
|
318
|
-
|
|
319
|
-
### How Agents Use It
|
|
320
|
-
|
|
321
|
-
Instead of:
|
|
322
|
-
```
|
|
323
|
-
Agent: "Let me query the database to understand the schema..."
|
|
324
|
-
→ runs SQL against information_schema (3-5 seconds, eats context)
|
|
325
|
-
→ parses results
|
|
326
|
-
→ stores in conversation memory
|
|
222
|
+
supabase-skill diff
|
|
327
223
|
```
|
|
328
224
|
|
|
329
|
-
|
|
330
|
-
```
|
|
331
|
-
Agent: reads .supabase-schema/tables/episodes.md (instant, 20 lines)
|
|
332
|
-
Agent: reads .supabase-schema/relationships.json (instant, FK map)
|
|
333
|
-
```
|
|
334
|
-
|
|
335
|
-
The snapshot is **markdown** (not JSON) so Claude reads it naturally with zero parsing overhead. Add `.supabase-schema/` to your `.gitignore` and refresh with `supabase-skill snapshot` whenever your schema changes.
|
|
225
|
+
Compares live database against local snapshot. Shows tables/columns/functions added or removed since last snapshot.
|
|
336
226
|
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
Generate the skill doc for different AI agent platforms:
|
|
227
|
+
### Graph — Mermaid ER Diagram
|
|
340
228
|
|
|
341
229
|
```bash
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
# OpenAI Codex (AGENTS.md)
|
|
346
|
-
supabase-skill docs --format agents
|
|
347
|
-
|
|
348
|
-
# Cursor (.cursorrules)
|
|
349
|
-
supabase-skill docs --format cursor
|
|
230
|
+
supabase-skill graph
|
|
231
|
+
```
|
|
350
232
|
|
|
351
|
-
|
|
352
|
-
supabase-skill docs --format skill
|
|
233
|
+
Outputs a mermaid erDiagram of all table relationships. Paste into docs, Notion, or let Claude read it.
|
|
353
234
|
|
|
354
|
-
|
|
355
|
-
|
|
235
|
+
```mermaid
|
|
236
|
+
erDiagram
|
|
237
|
+
episodes }o--|| subscriptions : "subscription_id -> id"
|
|
238
|
+
episodes }o--|| episode_metadata : "metadata_id -> id"
|
|
239
|
+
segments }o--|| episodes : "episode_id -> id"
|
|
240
|
+
episode_chunks }o--|| episodes : "episode_id -> id"
|
|
356
241
|
```
|
|
357
242
|
|
|
358
|
-
##
|
|
359
|
-
|
|
360
|
-
Stored at `~/.config/supabase-skill/config.json`:
|
|
361
|
-
|
|
362
|
-
```json
|
|
363
|
-
{
|
|
364
|
-
"environments": {
|
|
365
|
-
"prod": { "ref": "abcdefghijklmnopqrst", "name": "My App Production" },
|
|
366
|
-
"stage": { "ref": "tsrqponmlkjihgfedcba", "name": "My App Staging" }
|
|
367
|
-
},
|
|
368
|
-
"defaultEnv": "stage",
|
|
369
|
-
"safetyRules": {
|
|
370
|
-
"prodRequiresApproval": true,
|
|
371
|
-
"alwaysSpecifyRef": true
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
```
|
|
243
|
+
## The Skill Doc (20 Sections)
|
|
375
244
|
|
|
376
|
-
|
|
245
|
+
What gets written to CLAUDE.md — every Supabase CLI capability:
|
|
377
246
|
|
|
378
|
-
|
|
247
|
+
| Section | What it teaches the agent |
|
|
248
|
+
|---------|-------------------------|
|
|
249
|
+
| **CLI Flag Reference** | Which commands use `--linked` vs `--project-ref` |
|
|
250
|
+
| **Environment Routing** | "stage" → correct ref, "prod" → approval required |
|
|
251
|
+
| **Data Operations (REST API)** | Full CRUD: SELECT with 12 filter operators, INSERT, UPDATE, UPSERT, DELETE, COUNT |
|
|
252
|
+
| **Migrations** | `new`, `list`, `up`, `down`, `repair`, `squash`, `fetch` |
|
|
253
|
+
| **DDL via Migrations** | CREATE/ALTER/DROP TABLE, VIEW, INDEX, FUNCTION, RLS, triggers, enums |
|
|
254
|
+
| **Schema Management** | `db diff`, `dump`, `pull`, `push`, `lint` |
|
|
255
|
+
| **Database Inspection** | All 12 `inspect db` commands + `inspect report` |
|
|
256
|
+
| **Storage** | `ls`, `cp`, `rm`, `mv` (with `--experimental`) |
|
|
257
|
+
| **Edge Functions** | `list`, `deploy`, `delete`, `new`, `download`, `serve` |
|
|
258
|
+
| **Branches** | `list`, `create`, `delete`, `get`, `pause`, `unpause` |
|
|
259
|
+
| **Backups** | `list`, `restore` (PITR) |
|
|
260
|
+
| **Project Management** | `projects list/api-keys`, `secrets`, `postgres-config` |
|
|
261
|
+
| **Code Generation** | `gen types` (TypeScript from schema) |
|
|
262
|
+
| **Schema Snapshot** | All local query commands |
|
|
263
|
+
| **Auto-Refresh** | Freshness check + nightly cron |
|
|
264
|
+
| **Safety Rules** | Never mutate prod without approval, test on stage first |
|
|
379
265
|
|
|
380
|
-
|
|
266
|
+
## Security Model
|
|
381
267
|
|
|
382
|
-
|
|
|
383
|
-
|
|
384
|
-
|
|
|
385
|
-
|
|
|
386
|
-
|
|
|
387
|
-
|
|
|
388
|
-
|
|
|
389
|
-
| Heaviest single query result | **~22,282 tokens** |
|
|
268
|
+
| What | Where | Visible to agent? |
|
|
269
|
+
|------|-------|-------------------|
|
|
270
|
+
| Project refs | CLAUDE.md | Yes — needed for `--project-ref` |
|
|
271
|
+
| Environment routing | CLAUDE.md | Yes — "stage" → which ref |
|
|
272
|
+
| API keys (anon + service_role) | `.env` only | Only via `source .env` |
|
|
273
|
+
| Config with keys | `~/.config/supabase-skill/config.json` | No — mode 600 |
|
|
274
|
+
| Schema snapshot | `.supabase-schema/` | Yes — the whole point |
|
|
390
275
|
|
|
391
|
-
|
|
276
|
+
**Secrets never go in CLAUDE.md.** Agent reads `.env` when it needs direct API access.
|
|
392
277
|
|
|
393
|
-
|
|
394
|
-
|---------|-------|--------|------|
|
|
395
|
-
| Support AI Console planning | 56 | ~81,000 | Exploring tables for agent access |
|
|
396
|
-
| Study Mode migration design | 41 | ~74,000 | Designing new tables + FKs |
|
|
397
|
-
| Schema exploration | 43 | ~53,000 | General schema discovery |
|
|
398
|
-
| Building supabase-skill | 24 | ~33,000 | This tool, ironically |
|
|
278
|
+
## Real-World Token Savings
|
|
399
279
|
|
|
400
|
-
|
|
280
|
+
Measured across 14 Claude Code conversations on a production Supabase project (80 tables, 48 RPCs, 86 FKs):
|
|
401
281
|
|
|
402
|
-
|
|
|
403
|
-
|
|
282
|
+
| Metric | Before | After | Savings |
|
|
283
|
+
|--------|--------|-------|---------|
|
|
404
284
|
| "What columns does episodes have?" | ~1,200 tokens | ~80 tokens | **93%** |
|
|
405
285
|
| "Find all jsonb columns" | ~3,000 tokens | ~200 tokens | **93%** |
|
|
406
286
|
| "What references episodes?" | ~2,000 tokens | ~150 tokens | **92%** |
|
|
407
287
|
| "Show me the full schema" | ~22,000 tokens | ~500 tokens | **98%** |
|
|
288
|
+
| **Total across 14 conversations** | **~330,000 tokens** | **~15,000 tokens** | **~95%** |
|
|
408
289
|
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
And that's just one project. The savings compound across every conversation, every day, for every developer on the team.
|
|
290
|
+
At Opus rates ($15/M): **$4.70 saved** just from the conversations we measured.
|
|
412
291
|
|
|
413
292
|
## Why CLIs Beat MCP for Agents
|
|
414
293
|
|
|
415
|
-
| | MCP Server |
|
|
294
|
+
| | MCP Server | supabase-skill |
|
|
416
295
|
|---|---|---|
|
|
417
|
-
| **Context overhead** | 30-40%
|
|
418
|
-
| **Schema exploration** | ~1,247 tokens per query
|
|
419
|
-
| **Multi-environment** | One database per server
|
|
420
|
-
| **Runtime** | Server process
|
|
421
|
-
| **
|
|
422
|
-
| **
|
|
423
|
-
| **Composability** | None | Pipe
|
|
424
|
-
| **
|
|
296
|
+
| **Context overhead** | 30-40% consumed by schema | Zero |
|
|
297
|
+
| **Schema exploration** | ~1,247 tokens per query | ~80-200 tokens per file read |
|
|
298
|
+
| **Multi-environment** | One database per server | `--project-ref` switches instantly |
|
|
299
|
+
| **Runtime** | Server process in background | No process — `exec` calls |
|
|
300
|
+
| **Permission prompts** | Every command | 23 read commands pre-approved |
|
|
301
|
+
| **Schema freshness** | Always live (expensive) | Cached + nightly cron |
|
|
302
|
+
| **Composability** | None | Pipe with `jq`, `grep`, etc. |
|
|
303
|
+
| **Health check** | None | `doctor` validates 12 checks |
|
|
304
|
+
| **Schema drift** | None | `diff` detects changes |
|
|
305
|
+
| **ER diagrams** | None | `graph` outputs mermaid |
|
|
425
306
|
|
|
426
307
|
## Requirements
|
|
427
308
|
|
package/dist/commands/update.js
CHANGED
|
@@ -52,7 +52,12 @@ export function updateCommand() {
|
|
|
52
52
|
timeout: 60000,
|
|
53
53
|
stdio: "inherit",
|
|
54
54
|
});
|
|
55
|
-
write(`\n ✓ Updated to v${latest}\n
|
|
55
|
+
write(`\n ✓ Updated to v${latest}\n`);
|
|
56
|
+
write("\n Run `supabase-skill init` in your project directories to update:\n");
|
|
57
|
+
write(" - CLAUDE.md skill doc\n");
|
|
58
|
+
write(" - /supabase walkthrough skill\n");
|
|
59
|
+
write(" - Claude Code permissions\n");
|
|
60
|
+
write(" - Schema snapshot\n\n");
|
|
56
61
|
}
|
|
57
62
|
catch {
|
|
58
63
|
write(" ✗ Update failed. Try: npm install -g @m2015agg/supabase-skill@latest\n\n");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../src/commands/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,SAAS,KAAK,CAAC,GAAW;IACxB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AAC5B,CAAC;AAED,SAAS,iBAAiB;IACxB,IAAI,CAAC;QACH,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QAC1D,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,EAAE,oBAAoB,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;QACrF,OAAO,GAAG,CAAC,OAAO,CAAC;IACrB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAA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AM,CAAC;YACP,KAAK,CAAC,wCAAwC,CAAC,CAAC;YAChD,OAAO;QACT,CAAC;QAED,IAAI,MAAM,KAAK,OAAO,EAAE,CAAC;YACvB,KAAK,CAAC,yBAAyB,OAAO,OAAO,CAAC,CAAC;YAC/C,OAAO;QACT,CAAC;QAED,KAAK,CAAC,IAAI,MAAM,cAAc,CAAC,CAAC;QAEhC,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,KAAK,CAAC,iDAAiD,MAAM,MAAM,CAAC,CAAC;YACrE,OAAO;QACT,CAAC;QAED,KAAK,CAAC,eAAe,OAAO,OAAO,MAAM,OAAO,CAAC,CAAC;QAClD,IAAI,CAAC;YACH,QAAQ,CAAC,qDAAqD,EAAE;gBAC9D,QAAQ,EAAE,OAAO;gBACjB,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,SAAS;aACjB,CAAC,CAAC;YACH,KAAK,CAAC,qBAAqB,MAAM,IAAI,CAAC,CAAC;YACvC,KAAK,CAAC,wEAAwE,CAAC,CAAC;YAChF,KAAK,CAAC,6BAA6B,CAAC,CAAC;YACrC,KAAK,CAAC,qCAAqC,CAAC,CAAC;YAC7C,KAAK,CAAC,iCAAiC,CAAC,CAAC;YACzC,KAAK,CAAC,2BAA2B,CAAC,CAAC;QACrC,CAAC;QAAC,MAAM,CAAC;YACP,KAAK,CAAC,4EAA4E,CAAC,CAAC;QACtF,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -20,7 +20,7 @@ const program = new Command();
|
|
|
20
20
|
program
|
|
21
21
|
.name("supabase-skill")
|
|
22
22
|
.description("Supabase CLI skill for AI agents. Installs comprehensive CLI instructions into CLAUDE.md with multi-environment support.")
|
|
23
|
-
.version("0.7.
|
|
23
|
+
.version("0.7.2");
|
|
24
24
|
program.addCommand(installCommand());
|
|
25
25
|
program.addCommand(initCommand());
|
|
26
26
|
program.addCommand(docsCommand());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@m2015agg/supabase-skill",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"description": "Supabase CLI skill for AI agents. Installs comprehensive CLI instructions into CLAUDE.md, AGENTS.md, or .cursorrules with multi-environment support.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|