Agent skill

Supabase SDK Patterns

by jeremylongshore in jeremylongshore/tons-of-skills-marketplace

A skill your agent uses when implementing Supabase queries, auth, realtime, storage, or RPC calls with @supabase/supabase-js or supabase-py and you need production-ready, type-safe patterns that…

MITAuto-check passedBackend & APIs

Install Supabase SDK Patterns

skills CLI
$ npx skills add jeremylongshore/tons-of-skills-marketplace --skill supabase-sdk-patterns -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install jeremylongshore/tons-of-skills-marketplace supabase-sdk-patterns --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/jeremylongshore/tons-of-skills-marketplace.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/.curated/supabase-sdk-patterns .claude/skills/supabase-sdk-patterns && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
supabase-sdk-patterns
GitHub stars
2.8k
Token cost
~1.6k tokens
SKILL.md length
455 words
Files
7 (incl. references)
Skills in repo
3,342
Repo updated
First seen
Licence
MIT

At a glance

A skill your agent uses when implementing Supabase queries, auth, realtime, storage, or RPC calls with @supabase/supabase-js or supabase-py and you need production-ready, type-safe patterns that…

  • Works in 3 steps: Initialize a typed singleton client → Query, filter, and mutate data → Auth, realtime, and storage
  • Implementing Supabase queries
  • SKILL.md covers Overview, Prerequisites, Instructions and Output, plus 4 more sections
  • Calls supabase; needs SUPABASE_ANON_KEY

What it does

Supabase SDK Patterns is an agent skill from jeremylongshore/tons-of-skills-marketplace. Use when implementing Supabase queries, auth, realtime, storage, or RPC calls with @supabase/supabase-js or supabase-py and you need production-ready, type-safe patterns that always check the { data, error } contract. Trigger with phrases like "supabase SDK patterns", "supabase query", "supabase typescript", "supabase python", "supabase client setup", "supabase realtime", "supabase auth", "supabase storage".

Its SKILL.md is about 1.6k tokens, which your agent loads only when the skill is triggered. The skill folder holds 7 other files, including reference files (for example `references/auth-realtime-storage.md`, `references/errors.md` and `references/examples.md`). Compatibility notes: Designed for Claude Code

It sits in Backend & APIs, covering Type safety. It works with Supabase, Python and TypeScript. The repository describes itself as: Model-agnostic agent-skills platform with a harness-free canonical layer, verified adapters, and the ccpi package manager. Explore at tonsofskills.com. The licence is MIT.

When your agent uses it

  • Implementing Supabase queries
  • RPC calls with @supabase/supabase-js
  • Supabase-py and you need production-ready
  • Type-safe patterns that always check the { data

Example prompts

  • “supabase SDK patterns”
  • “supabase query”
  • “supabase typescript”
  • “/supabase-sdk-patterns”

Requirements

  • Python 3
  • A credential in SUPABASE_ANON_KEY
  • Compatibility (from SKILL.md): Designed for Claude Code
  • Pre-approved tools (allowed-tools): Read, Write, Edit, Grep

Workflow steps

3 steps, taken from the step headings in SKILL.md.

  1. Initialize a typed singleton client
  2. Query, filter, and mutate data
  3. Auth, realtime, and storage

What it can do on your machine

Read from SKILL.md and the folder at commit 80f86df. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Write
    • Edit
    • Grep

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • supabase

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • supabase.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names these keys or tokens, usually read from environment variables:

    • SUPABASE_ANON_KEY

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    Designed for Claude Code

    From compatibility in the SKILL.md frontmatter.

Context cost

Supabase SDK Patterns loads about 1.6k tokens when it runs, and up to ~4.4k if it reads all its reference files. Until then it costs about 108 tokens; SKILL.md has 455 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~108
When it runs · the whole SKILL.md, loaded when a task matches
~1.6k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~4.4k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from jeremylongshore/tons-of-skills-marketplace at commit 80f86df, republished under its MIT licence (© jeremylongshore). 455 words, ~1,583 tokens.

Download SKILL.mdSave it as .claude/skills/supabase-sdk-patterns/SKILL.md (or your agent's skills folder). This skill also uses 6 other files; get the full folder from GitHub.
name
supabase-sdk-patterns
description
Use when implementing Supabase queries, auth, realtime, storage, or RPC calls with @supabase/supabase-js or supabase-py and you need production-ready, type-safe patterns that always check the { data, error } contract. Trigger with phrases like "supabase SDK patterns", "supabase query", "supabase typescript", "supabase python", "supabase client setup", "supabase realtime", "supabase auth", "supabase storage".
allowed-tools
Read, Write, Edit, Grep
compatibility
Designed for Claude Code
version
1.54.0
license
MIT
author
Jeremy Longshore <jeremy@intentsolutions.io>
tags
saas, supabase, typescript, python, sdk, patterns

Supabase SDK Patterns

Overview

Production patterns for @supabase/supabase-js v2 and supabase-py, where every call returns { data, error } and success is never assumed. Covers client initialization, CRUD with filters, auth, realtime, storage, and RPC, with Python equivalents for the query patterns.

Prerequisites

  • Supabase project with URL and anon key (or service role key for server-side)
  • @supabase/supabase-js v2 installed (TypeScript) or supabase pip package (Python)
  • TypeScript projects: generated database types via supabase gen types typescript

Instructions

Step 1: Initialize a typed singleton client

Create one client instance and reuse it. Never call createClient per-request — a singleton preserves the auth session and connection pool.

typescript
// lib/supabase.ts
import { createClient } from '@supabase/supabase-js'
import type { Database } from './database.types'

let supabase: ReturnType<typeof createClient<Database>>

export function getSupabase() {
  if (!supabase) {
    supabase = createClient<Database>(
      process.env.SUPABASE_URL!,
      process.env.SUPABASE_ANON_KEY!,
      {
        auth: { autoRefreshToken: true, persistSession: true },
        db: { schema: 'public' },
        global: { headers: { 'x-app-name': 'my-app' } },
      }
    )
  }
  return supabase
}

Python equivalent:

python
from supabase import create_client, Client

_client: Client | None = None

def get_supabase() -> Client:
    global _client
    if _client is None:
        _client = create_client(
            os.environ["SUPABASE_URL"],
            os.environ["SUPABASE_ANON_KEY"],
        )
    return _client
Step 2: Query, filter, and mutate data

Destructure { data, error } and check error before touching data. Chain filters onto .from(table).select(...); use .select().single() after an insert/upsert to return the affected row. Skeleton:

typescript
const { data, error } = await getSupabase()
  .from('users')
  .select('id, name, email')
  .eq('active', true)
  .order('name')
  .limit(10)

if (error) throw error

For the full CRUD set (insert-with-select, upsert on conflict, update, delete, RPC), the complete 12-filter reference table, and the Python equivalents, see queries and filters.

Step 3: Auth, realtime, and storage

Auth, realtime channels, and storage all follow the same { data, error } contract. Auth exposes signUp / signInWithPassword / getSession / onAuthStateChange; realtime subscribes to postgres_changes on a channel and requires removeChannel cleanup; storage does upload / download / getPublicUrl / createSignedUrl per bucket. Full walkthroughs with code for each: see auth, realtime, and storage.

Output

Applying these patterns yields:

  • Type-safe singleton client with Database generics
  • CRUD operations using the full filter chain (eq, gt, in, ilike, etc.)
  • Insert-with-select and upsert patterns that return the affected row
  • Auth flows for sign-up, sign-in, session management, and state listeners
  • Realtime subscriptions with row-level filtering and cleanup
  • Storage upload/download with signed URLs for private buckets
  • Python equivalents for the query patterns
Show full SKILL.md (179 more words)Show less

Error Handling

Every Supabase call returns { data, error }. Never skip the error check.

typescript
const { data, error } = await getSupabase().from('users').select('*')

if (error) {
  // error is a PostgrestError with these fields:
  //   error.message  — human-readable description
  //   error.code     — Postgres error code (e.g., '23505')
  //   error.details  — additional context
  //   error.hint     — suggested fix from Postgres
  console.error(`Query failed [${error.code}]: ${error.message}`)
  throw error
}

// Only safe to use data after the error check
Error CodeMeaningWhat to Do
PGRST116No rows found (.single())Return null or 404, don't throw
23505Unique-constraint violation (Postgres duplicate key)Use .upsert() or show conflict error
42501RLS policy violation (Postgres insufficient privilege)Check auth state and RLS policies
PGRST000Connection errorRetry with exponential backoff
42P01Table does not existVerify table name and run migrations
23503Foreign key violationEnsure referenced row exists first
42703Column does not existCheck column name, regenerate types

Examples

The recommended production shape is a typed service layer that wraps the client so callers never touch raw queries, plus a pagination helper that returns a page of rows and the total count in one round trip. Both full, copy-ready implementations are in service patterns.

Resources

Next Steps

For database schema design, see supabase-schema-from-requirements. For auth deep-dive with RLS policies, see supabase-install-auth. For realtime architecture patterns, see supabase-auth-storage-realtime-core.

© jeremylongshore, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 6 other files (references) in skills/.curated/supabase-sdk-patterns of jeremylongshore/tons-of-skills-marketplace.

  • SKILL.md
  • references/auth-realtime-storage.md
  • references/errors.md
  • references/examples.md
  • references/implementation.md
  • references/queries-and-filters.md
  • references/service-patterns.md

Open the folder on GitHubat commit 80f86df

Compare with similar skills

Supabase SDK Patterns next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Supabase SDK Patterns compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Supabase SDK Patterns this skilljeremylongshore/tons-of-skills-marketplace2.8k—~1.6kAutomated safety check: PassMIT
Strict Programming Practicescode-yeongyu/oh-my-openagent70k—~9.5kAutomated safety check: PassCustom licence
Implement Type Annotationsambient-code/agentready154—~231Automated safety check: PassMIT
Land TS MonoUKGovernmentBEIS/inspect_ai3k—~3kAutomated safety check: PassMIT
near-kit for NEAR Protocolinternet-court/internet-court-skill6.5k1 repos~2kAutomated safety check: PassCustom licence
Supabase JSfcakyon/claude-codex-settings1.2k—~1.6kAutomated safety check: PassMIT

Similar skills

  • Strict Programming Practices

    code-yeongyu/oh-my-openagent

    Applies strict, type-first coding rules for Python, Rust, TypeScript and Go, loading the matching language reference before the agent writes or edits any code.

    70k GitHub stars~9.5k tokensUpdated today
    DevelopmentAuto-check passed
  • Implement Type Annotations

    ambient-code/agentready

    Add comprehensive type hints to Python/TypeScript code to improve IDE support, catch errors early, and enable better AI code understanding

    154 GitHub stars~231 tokensUpdated 8 days ago
    DevelopmentAuto-check passed
  • Land TS Mono

    UKGovernmentBEIS/inspect_ai

    Land a PR that requires a coordinated ts-mono submodule change.

    3k GitHub stars~3k tokensUpdated today
    Backend & APIsAuto-check passed
  • near-kit for NEAR Protocol

    internet-court/internet-court-skill

    Covers the near-kit TypeScript library for NEAR: reading contracts, sending tokens, transaction building, typed contracts, wallets, React hooks and sandbox testing.

    6.5k GitHub starsUsed in 1 repo~2k tokens
    Backend & APIsAuto-check passed
  • Supabase JS

    fcakyon/claude-codex-settings

    This skill should be used when user asks to "use supabase-js", "query Supabase database", "supabase auth", "supabase storage", "supabase realtime", "supabase edge functions", or works with the…

    1.2k GitHub stars~1.6k tokensUpdated yesterday
    Backend & APIsAuto-check passed
  • Koapp Typescript

    AxiosLeo/node-koapp

    Write type-safe @axiosleo/koapp code in TypeScript - typed contexts (KoaContext, ContextFromSpec, RequiredContext, SocketContext, WebSocketContext), Router generics, ContextHandler middlewares…

    145 GitHub stars~2.6k tokensUpdated 23 days ago
    Backend & APIsAuto-check passed

More from jeremylongshore/tons-of-skills-marketplace

All 3,342 skills in this repo
  • Performing Security Code Review

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to conduct a security-focused code review using the security-agent plugin.

    2.8k GitHub starsUsed in 2 repos~1.3k tokens
    Auto-check: notes
  • Adapting Transfer Learning Models

    jeremylongshore/tons-of-skills-marketplace

    Build this skill automates the adaptation of pre-trained machine learning models using transfer learning techniques.

    2.8k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Agent Context Loader

    jeremylongshore/tons-of-skills-marketplace

    Execute proactive auto-loading: automatically detects and loads agents.md files.

    2.8k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Aggregating Performance Metrics

    jeremylongshore/tons-of-skills-marketplace

    Aggregate and centralize performance metrics from applications, systems, databases, caches, and services.

    2.8k GitHub stars~1.2k tokensUpdated today
    Auto-check passed
  • Analyzing Capacity Planning

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to analyze capacity requirements and plan for future growth.

    2.8k GitHub stars~947 tokensUpdated today
    Auto-check passed
  • Analyzing Database Indexes

    jeremylongshore/tons-of-skills-marketplace

    Process use when you need to work with database indexing. An agent skill from jeremylongshore/tons-of-skills-marketplace.

    2.8k GitHub stars~2k tokensUpdated today
    Auto-check passed

Questions about Supabase SDK Patterns

What does Supabase SDK Patterns do?

A skill your agent uses when implementing Supabase queries, auth, realtime, storage, or RPC calls with @supabase/supabase-js or supabase-py and you need production-ready, type-safe patterns that…. Supabase SDK Patterns is an agent skill from jeremylongshore/tons-of-skills-marketplace. Use when implementing Supabase queries, auth, realtime, storage, or RPC calls with @supabase/supabase-js or supabase-py and you need production-ready, type-safe patterns that always check the { data, error } contract.

When should I use Supabase SDK Patterns?

Supabase SDK Patterns fits situations like: implementing Supabase queries; RPC calls with @supabase/supabase-js; supabase-py and you need production-ready; type-safe patterns that always check the { data.

How do I install Supabase SDK Patterns in Claude Code?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill supabase-sdk-patterns -a claude-code`. Or copy the skill folder (skills/.curated/supabase-sdk-patterns in jeremylongshore/tons-of-skills-marketplace) into .claude/skills/supabase-sdk-patterns in your project. Claude Code loads it when a task matches its description.

How do I install Supabase SDK Patterns in Codex?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill supabase-sdk-patterns -a codex`. Or copy the skill folder (skills/.curated/supabase-sdk-patterns in jeremylongshore/tons-of-skills-marketplace) into .agents/skills/supabase-sdk-patterns in your project. Codex loads it when a task matches its description.

Can I use Supabase SDK Patterns in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill supabase-sdk-patterns -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/supabase-sdk-patterns, .gemini/skills/supabase-sdk-patterns, .github/skills/supabase-sdk-patterns and .opencode/skills/supabase-sdk-patterns in your project.

What does Supabase SDK Patterns need to run?

Going by SKILL.md and its folder, Supabase SDK Patterns needs the command-line tools its instructions call (supabase) and credentials named SUPABASE_ANON_KEY. Our summary lists: Python 3; A credential in SUPABASE_ANON_KEY. Its frontmatter pre-approves these tools: Read, Write, Edit, Grep. Compatibility (from SKILL.md): Designed for Claude Code.

Does Supabase SDK Patterns access the network?

SKILL.md names 1 domain. As links in the text: supabase.com. This is read from the text; nothing was executed.

Is Supabase SDK Patterns safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Supabase SDK Patterns use?

Supabase SDK Patterns is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Supabase SDK Patterns use?

About 1.6k tokens (SKILL.md is roughly 6.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 2.8k tokens, read only when the agent opens those files.

What are the alternatives to Supabase SDK Patterns?

Skills that share tags, products or a category with Supabase SDK Patterns: Strict Programming Practices (code-yeongyu/oh-my-openagent, 70k stars), Implement Type Annotations (ambient-code/agentready, 154 stars), Land TS Mono (UKGovernmentBEIS/inspect_ai, 3k stars) and near-kit for NEAR Protocol (internet-court/internet-court-skill, 6.5k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Supabase SDK Patterns?

jeremylongshore (a GitHub user) maintains it in jeremylongshore/tons-of-skills-marketplace, which has 2,825 GitHub stars. The repository holds 3,342 skills in this directory. The repository was last updated on October 9, 2026.

Source: jeremylongshore/tons-of-skills-marketplace on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.