rls-performance

rls-performance is a skill for Cursor from YuDefine/nuxt-supabase-starter. It costs 58 tokens per session (2,730 once invoked), scanned A, original, MIT.

A guide for finding and fixing slow database queries when row-level security rules and limited connection pools affect an API.

In plain words
What is it for?
It is for diagnosing slow endpoints, PostgreSQL query plans, row-level security performance, and exhausted database connections.
Why use it?
It helps identify full-table scans, inefficient filters, and connection-pool timeouts using measurements that reflect real user access.

Skill for Cursor

Written for Cursor: installed under .cursor/. Also seen: mentions Codex.

Good fit It is for diagnosing slow endpoints, PostgreSQL query plans, row-level security performance, and exhausted database connections.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/yudefine/nuxt-supabase-starter/rls-performance
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add YuDefine/nuxt-supabase-starter --skill rls-performance
Clone the repo
git clone --depth 1 https://github.com/YuDefine/nuxt-supabase-starter

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for rls-performance

README.md
[![agentmods](https://agentmods.dev/badge/skills/yudefine/nuxt-supabase-starter/rls-performance/github.svg)](https://agentmods.dev/skills/yudefine/nuxt-supabase-starter/rls-performance)
Your own site
<a href="https://agentmods.dev/skills/yudefine/nuxt-supabase-starter/rls-performance"><img src="https://agentmods.dev/badge/skills/yudefine/nuxt-supabase-starter/rls-performance/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for rls-performance

Your own site · 80×15
<a href="https://agentmods.dev/skills/yudefine/nuxt-supabase-starter/rls-performance"><img src="https://agentmods.dev/badge/skills/yudefine/nuxt-supabase-starter/rls-performance.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 58 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,730 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00058 $0.02730
Opus 5 $0.00029 $0.01365
Sonnet 5 $0.00012 $0.00546
Haiku 4.5 $0.00006 $0.00273

Measured yesterday against content hash 920dcd835364, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

rls-performance scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

template/.cursor/skills/rls-performance/SKILL.md · 203 lines

How it starts

The opening of the file, as written. The whole thing — 203 lines — stays where its author put it; the contents beside it link to each section on GitHub.

RLS Performance Playbook

大型專案常累積大量 RLS policy 與 SECURITY DEFINER function,加上 self-hosted LXC 的 connection pool 限制,任何 N+1 或 full scan 都會被放大。本 skill 是遇到效能問題時的操作手冊。

決策原則(「MUST 做 / NEVER 做」)仍在 db-runtime/<variant>/database.mddb-schema/<variant>/database-design.md 規約(依 consumer 的 module variant 投影,三端都送達),本檔提供實際診斷與優化工具

何時開啟本 skill

  • 新增涉及 policy join 的表
  • 修改既有 RLS policy 的 WHERE 條件
  • 新增 server API endpoint 含 pagination / filter
  • 遇到 PGRST003(504 timeout)或 pool 耗盡
  • 使用者抱怨特定頁面 / endpoint 變慢
  • 需要稽核 production 效能或清理無用 index
  • 排查 LXC 連線問題 / Tunnel 斷線

核心原則:policy 改動前先量,改動後驗證,不要憑感覺優化。

EXPLAIN ANALYZE — 正確的 RLS 測量方式

關鍵陷阱:superuser 跑 EXPLAIN 會 bypass RLS,測出來的 plan 跟 production 完全不同。一定要 set local role 模擬目標角色。

-- 1. 模擬目標 role(不是 postgres superuser!)
set local role authenticated;
set local request.jwt.claims to '{"sub": "<user_uuid>", "role": "authenticated"}';

-- 2. 跑實際 query
explain (analyze, buffers, verbose, format text)
select ... from <schema>.<table> where ...;

-- 3. 還原
reset role;

讀 plan 重點

Plan 片段 意義 處理
Seq Scan on xxx 全表掃描 檢查 WHERE 欄位是否有 index
Rows Removed by Filter: > 1000 Index 取太多又濾掉 Composite index 或 partial index
Subquery Scan ... InitPlan (SELECT auth.uid()) 有快取 ✅ 正確模式
Filter: (auth.uid() = user_id) 沒快取 改 subselect (SELECT auth.uid())
Nested Loop + 高 rows Policy 內 per-row JOIN 改 subselect 預先算 ID set
Planning Time > Execution Time Plan cache 沒命中 通常是 schema cache 過期或 prepared statement 問題

Read the full file on GitHub · 203 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday Changed · +2 lines 920dcd835364
  2. 5d ago First seen · 201 lines · 58 tokens per session scan A e436b8b24352

Subscribe to this mod's changes

rls-performance is a skill published in the GitHub repository YuDefine/nuxt-supabase-starter (45 stars, last pushed yesterday), licensed MIT. It adds 58 tokens to every session and 2,730 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

explorer

Build and modify Studio Explorer surfaces, including notebooks, chats, SQL snippets, query cells, and their shared toolbar patterns.

supabase/supabase · 27 tokens

supabase

Use when doing ANY task involving Supabase. Triggers: Supabase products (Database, Auth, Edge Functions, Realtime, Storage, Vectors, Cron, Queues); client libraries and SSR integrations (supabase-js, @supabase/ssr) in Next.js, React, SvelteKit, Astro, Remix; auth issues (login, logout, sessions, JWT, cookies…

supabase/agent-skills · 185 tokens

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…

supabase/agent-skills · 182 tokens

sql-optimizer

Analyzes SQL queries for missing indexes, N+1 patterns, suboptimal joins, and full table scans. Interprets EXPLAIN, detects anti-patterns, rewrites queries. Triggers on: "optimize this query", "slow query", "add indexes", "explain plan", "N+1 query", "why is this query slow".

Mathews-Tom/armory · 78 tokens

nw-database-technology-selection

Database comparison catalogs, RDBMS vs NoSQL selection criteria, CAP/ACID/BASE theory, OLTP vs OLAP, and technology-specific characteristics.

nWave-ai/nWave · 38 tokens

ecto-constraint-debug

Debug Ecto constraint violations - trace triggers, check migrations, find duplicate data. Use when seeing uniqueconstraint, foreignkeyconstraint, or checkconstraint errors.

oliver-kriska/claude-elixir-phoenix · 36 tokens