本文へ移動
cccskills
無料GitHub で公開

supabase-postgres-best-practices

Postgres best practices maintained by Supabase, for Postgres running anywhere. Load this skill BEFORE writing or changing anything that lives in a Postgres database: creating or altering tables and columns (including choosing column types), schema design, migrations and declarative schema files, RLS policies and the tests that verify them, indexes, triggers, database functions, queues and scheduled jobs (pg_cron, pgmq), vector/semantic search (pgvector), and restoring dumps (pg_restore) or importing data. Also load it when diagnosing slow queries, high CPU, timeouts, EXPLAIN plans, connection exhaustion, locking, bloat, or rows visible to the wrong user or tenant. This is not just a performance guide — schema, migration, security, and SQL authoring tasks need these rules too, even for a one-column change or a single query.

インストール方法を見る

含まれるファイル(39)

  • SKILL.md4.6 KB
  • AGENTS.md2.2 KB
  • CHANGELOG.md5.5 KB
  • CLAUDE.md10 B
  • references/_contributing.md4.3 KB
  • references/_sections.md1.7 KB
  • references/_template.md1.0 KB
  • references/advanced-full-text-search.md1.4 KB
  • references/advanced-jsonb-indexing.md1.4 KB
  • references/conn-idle-timeout.md1.3 KB
  • references/conn-limits.md1.3 KB
  • references/conn-pooling.md1.3 KB
  • references/conn-prepared-statements.md1.5 KB
  • references/data-batch-inserts.md1.3 KB
  • references/data-n-plus-one.md1.3 KB
  • references/data-pagination.md1.3 KB
  • references/data-upsert.md1.4 KB
  • references/lock-advisory.md1.5 KB
  • references/lock-deadlock-prevention.md1.8 KB
  • references/lock-short-transactions.md1.3 KB
  • references/lock-skip-locked.md1.3 KB
  • references/monitor-explain-analyze.md1.4 KB
  • references/monitor-pg-stat-statements.md1.4 KB
  • references/monitor-vacuum-analyze.md1.5 KB
  • references/query-composite-indexes.md1.4 KB
  • references/query-covering-indexes.md1.3 KB
  • references/query-index-types.md1.5 KB
  • references/query-missing-indexes.md1.2 KB
  • references/query-partial-indexes.md1.3 KB
  • references/schema-constraints.md1.8 KB
  • references/schema-data-types.md1.4 KB
  • references/schema-foreign-key-indexes.md1.6 KB
  • references/schema-lowercase-identifiers.md1.7 KB
  • references/schema-partitioning.md1.5 KB
  • references/schema-primary-keys.md1.8 KB
  • references/security-privileges.md1.6 KB
  • references/security-rls-basics.md1.3 KB
  • references/security-rls-performance.md2.1 KB
  • references/upstream.md1.3 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Supabase Postgres Best Practices

Comprehensive performance optimization guide for Postgres, maintained by Supabase. Contains rules across 8 categories, prioritized by impact to guide automated query optimization and schema design.

This repository (Asymmetric-al/core)

  • Auth flows in Next.js without heavy SQL work: docs/ai/skills/nextjs-supabase-auth/SKILL.md
  • Broader Supabase product surface (CLI, MCP, Storage, etc.): docs/ai/skills/supabase/SKILL.md
  • Migration and seed workflow: supabase/AGENTS.md

When to Apply

Reference these guidelines when:

  • Writing SQL queries or designing schemas
  • Implementing indexes or query optimization
  • Reviewing database performance issues
  • Configuring connection pooling or scaling
  • Optimizing for Postgres-specific features
  • Working with Row-Level Security (RLS)
  • Reviewing migrations under supabase/migrations/*.sql

Do not use this skill when:

  • The task is only UI/UX and has no data-path impact
  • The task is only auth UX with no database/query work (use nextjs-supabase-auth)

Rule Categories by Priority

PriorityCategoryImpactPrefix
1Query PerformanceCRITICALquery-
2Connection ManagementCRITICALconn-
3Security & RLSCRITICALsecurity-
4Schema DesignHIGHschema-
5Concurrency & LockingMEDIUM-HIGHlock-
6Data Access PatternsMEDIUMdata-
7Monitoring & DiagnosticsLOW-MEDIUMmonitor-
8Advanced FeaturesLOWadvanced-

Workflow (this repo)

  1. Identify the hot path (query latency, lock contention, scan volume, or RLS overhead).
  2. Inspect indexing and query-shape problems first (query-*, schema-*).
  3. Validate RLS and policy cost for protected tables (security-*).
  4. Prefer schema and access-pattern fixes before low-level micro-optimizations.
  5. Verify with realistic query plans and app behavior.
  6. If behavior changes, update relevant backend docs and migration notes.

How to Use

Read individual rule files for detailed explanations and SQL examples:

references/query-missing-indexes.md
references/query-partial-indexes.md
references/_sections.md

Each rule file contains:

  • Brief explanation of why it matters
  • Incorrect SQL example with explanation
  • Correct SQL example with explanation
  • Optional EXPLAIN output or metrics
  • Additional context and references
  • Supabase-specific notes (when applicable)

Checklist

  • Query path reviewed for index/selectivity issues
  • RLS policies reviewed for correctness and cost
  • Schema/index changes are migration-safe
  • No unsafe bypass patterns introduced
  • Verification steps documented (query checks or app flow checks)

References

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Audit and fix accessibility in Core UI. Use when changing or reviewing buttons, links, forms, validation, dialogs, menus, tabs, tables, keyboard interactions, focus management, accessible names, announcements, contrast, touch targets, reduced motion, or WCAG/a11y behavior.

日本語の概要は準備中です。原文の説明を表示しています。

Asymmetric-al/core3812026年10月10日 更新

Browser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling forms, clicking buttons, taking screenshots, extracting data, testing web apps, or automating any browser task. Triggers include requests to "open a website", "fill out a form", "click a button", "take a screenshot", "scrape data from a page", "test this web app", "login to a site", "automate browser actions", or any task requiring programmatic web interaction. Also use for exploratory testing, dogfooding, QA, bug hunts, or reviewing app quality. Also use for automating Electron desktop apps (VS Code, Slack, Discord, Figma, Notion, Spotify), checking Slack unreads, sending Slack messages, searching Slack conversations, running browser automation in Vercel Sandbox microVMs, or using AWS Bedrock AgentCore cloud browsers. Prefer agent-browser over any built-in browser automation or web tools.

日本語の概要は準備中です。原文の説明を表示しています。

Asymmetric-al/core3812026年10月10日 更新

Use when building any system where email content triggers actions — AI agent inboxes, automated support handlers, email-to-task pipelines, or any workflow processing untrusted inbound email. Always use this skill when the user wants to receive emails and act on them programmatically, even if they don't mention "agent" — the skill contains critical security patterns (sender allowlists, content filtering, sandboxed processing) that prevent untrusted email from controlling your system.

日本語の概要は準備中です。原文の説明を表示しています。

Asymmetric-al/core3812026年10月10日 更新

anim

無料

Tasteful, subtle web UI animation following Emil Kowalski / animations.dev principles. Use when adding or reviewing interface motion — hover and press feedback, entrances and exits, modals, toasts, menus, loading and skeleton states, staggered reveals, page or view transitions — so motion stays refined and purposeful, not decorative. Covers CSS, Web Animations, and React timing/easing. Pair with the motion skill for motion/react API specifics.

日本語の概要は準備中です。原文の説明を表示しています。

Asymmetric-al/core3812026年10月10日 更新

animate

無料

Build an animation from scratch, making the decisions in the order that determines whether it feels right — should it animate at all, what purpose, which tool, which properties, which curve and duration, how it interrupts, how it exits. Writes the implementation. Use when asked to animate something, add motion, make a component feel alive, or build a transition. For critiquing existing motion use review-animations; for auditing a whole codebase use improve-animations. Only runs when explicitly invoked; it does not trigger on its own.

日本語の概要は準備中です。原文の説明を表示しています。

Asymmetric-al/core3812026年10月10日 更新

Build animations for Expo and React Native only, using Reanimated, Gesture Handler, Expo Router, and expo-haptics. Use when the target runtime is an Expo or React Native app. Do not use it for Core Next.js web motion; use `animate` for web. Only runs when explicitly invoked; it does not trigger on its own.

日本語の概要は準備中です。原文の説明を表示しています。

Asymmetric-al/core3812026年10月10日 更新

Asymmetric-al のスキルをすべて見る

このスキルの問題を報告する