Supabase

From mvanhorn/printing-press-library · View interactive version

Supabase is an AI agent skill from the GitHub repository mvanhorn/printing-press-library. The full Supabase Management API (108 endpoints) plus a local SQLite cache of orgs, projects, functions, branches, and secret names — powering cross-project queries no live API answers in one call, with Auth Admin lookup, PostgREST schema introspection, and Storage usage rollup on top. Trigger phras

How to use this skill

Skill file

Supabase — Printing Press CLI

Prerequisites: Install the CLI

This skill drives the supabase-pp-cli binary. You must verify the CLI is installed before invoking any command from this skill. If it is missing, install it first:

  1. Install via the Printing Press installer:

```bash

npx -y @mvanhorn/printing-press-library install supabase --cli-only

```

  1. Verify: supabase-pp-cli --version
  2. Ensure $GOPATH/bin (or $HOME/go/bin) is on $PATH.

If the npx install fails before this CLI has a public-library category, install Node or use the category-specific Go fallback after publish.

If --version reports "command not found" after install, the install step did not put the binary on $PATH. Do not proceed with skill commands until verification succeeds.

When to Use This CLI

Use this CLI when an agent needs to sweep Management API entities across orgs, run cross-project queries from a local SQLite cache (secrets where-name, functions inventory, branches drift, projects estate), look up Auth users by email (auth-admin lookup), aggregate Storage bucket usage (storage usage), or fetch a per-project PostgREST schema for typed query planning (pgrst schema).

For local Docker + migration workflows (supabase start, supabase db push, supabase gen types), use the official Supabase CLI. For PostgREST row CRUD, Storage object lifecycle (upload/download/sign), Auth Admin user mutations, and Edge Function runtime invocation, use supabase-js — these are documented Known Gaps in this CLI's first release (see README's ## Known Gaps).

Unique Capabilities

These capabilities aren't available in any other tool for this API.

Cross-project rollups

_Use when an agent needs cross-project security posture answers ('which clients have STRIPE_KEY', 'is this secret name leaked anywhere'). The supabase-community MCP cannot answer this without per-project iteration._

```bash

supabase-pp-cli secrets where-name STRIPE_KEY --json

```

_Use during deploy review ('which projects deployed stripe-webhook?') or stale-function audits ('which functions haven't redeployed in 90 days?')._

```bash

supabase-pp-cli functions inventory --org acme --json

```

_Use during weekly cleanup to prevent preview-branch sprawl that costs DB resources._

```bash

supabase-pp-cli branches drift --older-than 7d --json

```

_Use for the Monday morning estate review; one screen replaces 12 dashboard tabs._

```bash

supabase-pp-cli projects estate --json

```

_Use for weekly user-growth review across an entire org portfolio._

```bash

supabase-pp-cli auth-admin recent --since 7d --json

```

Service-specific patterns

_The lookup fails closed on zero or duplicate matches, malformed or repeated pages, incomplete traversal, and provider errors; unrelated user records are never printed._

```bash

supabase-pp-cli auth-admin lookup user@example.com --context-table profiles --context-key user_id --json

```

_Use before authoring a typed query so an agent knows the table's column types and constraints without trial-and-error._

```bash

supabase-pp-cli pgrst schema --table profiles --json

```

_Use when an agent needs to answer 'how close are we to the storage ceiling' or 'which bucket is biggest'._

```bash

supabase-pp-cli storage usage --bucket avatars --json

```

Command Reference

branches — Manage branches

oauth — OAuth related endpoints

organizations — Organizations related endpoints

projects — Projects related endpoints

snippets — Manage snippets

supabase-profile — Manage supabase profile

Finding the right command

When you know what you want to do but not which command does it, ask the CLI directly:

supabase-pp-cli which "<capability in your own words>"

which resolves a natural-language capability query to the best matching command from this CLI's curated feature index. Exit code 0 means at least one match; exit code 2 means no confident match — fall back to --help or use a narrower query.

Recipes

Cross-project secret audit

supabase-pp-cli sync && supabase-pp-cli secrets where-name STRIPE_KEY --json

Sync the local store, then list every project across every org holding a secret named STRIPE_KEY — the Monday-morning security sweep in one shell call.

Support ticket triage

supabase-pp-cli auth-admin lookup user@example.com --context-table profiles --context-key user_id --agent --select user.id,user.email,user.last_sign_in_at,context.tier

Traverse Auth Admin with documented pagination, require one exact case-insensitive email match, then join that user's profiles row; --select narrows the exact-match payload to the fields the support workflow needs.

Stale preview branches

supabase-pp-cli branches drift --older-than 14d --json

Surface preview branches older than 14 days that have not been merged or deleted, grouped by parent project — the Tuesday cleanup target list.

Storage ceiling check

supabase-pp-cli storage usage --json | jq '.[] | select(.total_bytes > 100000000)'

List every bucket over 100MB; pipe through jq to filter on byte thresholds.

PostgREST schema before query

supabase-pp-cli pgrst schema --table orders --agent --select tables.columns.name,tables.columns.type,tables.columns.nullable

Get just the column types of the orders table from the Management-API-routed schema endpoint, so an agent can author a typed PostgREST query without trial-and-error.

Auth Setup

Supabase has three credential types across two API hosts. The Management API at api.supabase.com uses a Personal Access Token (SUPABASE_ACCESS_TOKEN, header Authorization: Bearer <PAT>). Project APIs at <ref>.supabase.co use the apikey: header — set SUPABASE_PUBLISHABLE_KEY (or legacy SUPABASE_ANON_KEY) for RLS-respecting calls, or SUPABASE_SERVICE_ROLE_KEY (or new SUPABASE_SECRET_KEY) for server-side calls that bypass RLS and unlock Auth Admin endpoints. Also set SUPABASE_URL=https://<ref>.supabase.co. Edge Functions gotcha: keys go in apikey:, never Authorization: Bearer.

Run supabase-pp-cli doctor to verify setup.

Agent Mode

Add --agent to any command. Expands to: --json --compact --no-input --no-color --yes.

```bash

supabase-pp-cli projects get mock-value --agent --select id,name,status

```

Response envelope

Commands that read from the local store or the API wrap output in a provenance envelope:

{
  "meta": {"source": "live" | "local", "synced_at": "...", "reason": "..."},
  "results": <data>
}

Parse .results for data and .meta.source to know whether it's live or local. A human-readable N results (live) summary is printed to stderr only when stdout is a terminal — piped/agent consumers get pure JSON on stdout.

Agent Feedback

When you (or the agent) notice something off about this CLI, record it:

supabase-pp-cli feedback "the --since flag is inclusive but docs say exclusive"
supabase-pp-cli feedback --stdin < notes.txt
supabase-pp-cli feedback list --json --limit 10

Entries are stored locally at ~/.supabase-pp-cli/feedback.jsonl. They are never POSTed unless SUPABASE_FEEDBACK_ENDPOINT is set AND either --send is passed or SUPABASE_FEEDBACK_AUTO_SEND=true. Default behavior is local-only.

Write what surprised you, not a bug report. Short, specific, one line: that is the part that compounds.

Output Delivery

Every command accepts --deliver <sink>. The output goes to the named sink in addition to (or instead of) stdout, so agents can route command results without hand-piping. Three sinks are supported:

| Sink | Effect |

|------|--------|

| stdout | Default; write to stdout only |

| file:<path> | Atomically write output to <path> (tmp + rename) |

| webhook:<url> | POST the output body to the URL (application/json or application/x-ndjson when --compact) |

Unknown schemes are refused with a structured error naming the supported set. Webhook failures return non-zero and log the URL + HTTP status on stderr.

Named Profiles

A profile is a saved set of flag values, reused across invocations. Use it when a scheduled agent calls the same command every run with the same configuration - HeyGen's "Beacon" pattern.

supabase-pp-cli profile save briefing --json
supabase-pp-cli --profile briefing projects get mock-value
supabase-pp-cli profile list --json
supabase-pp-cli profile show briefing
supabase-pp-cli profile delete briefing --yes

Explicit flags always win over profile values; profile values win over defaults. agent-context lists all available profiles under available_profiles so introspecting agents discover them at runtime.

Exit Codes

| Code | Meaning |

|------|---------|

| 0 | Success |

| 2 | Usage error (wrong arguments) |

| 3 | Resource not found |

| 4 | Authentication required |

| 5 | API error (upstream issue) |

| 7 | Rate limited (wait and retry) |

| 10 | Config error |

Argument Parsing

Parse $ARGUMENTS:

  1. Empty, help, or --help → show supabase-pp-cli --help output
  2. Starts with install → ends with mcp → MCP installation; otherwise → see Prerequisites above
  3. Anything else → Direct Use (execute as CLI command with --agent)

MCP Server Installation

Install the MCP binary from this CLI's published public-library entry or pre-built release, then register it:

claude mcp add supabase-pp-mcp -- supabase-pp-mcp

Verify: claude mcp list

Direct Use

  1. Check if installed: which supabase-pp-cli

If not found, offer to install (see Prerequisites at the top of this skill).

  1. Match the user query to the best command from the Unique Capabilities and Command Reference above.
  2. Execute with the --agent flag:

```bash

supabase-pp-cli <command> [subcommand] [args] --agent

```

  1. If ambiguous, drill into subcommand help: supabase-pp-cli <command> --help.
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.