memstack-security-rls-guardian

memstack-security-rls-guardian is a skill for Claude Code, Codex from cwinvestments/memstack. It costs 84 tokens per session (3,300 once invoked), scanned A, original, MIT.

A database-security helper for Supabase and PostgreSQL projects that enforces Row Level Security whenever tables are created or changed. Row Level Security controls which users can see or modify individual database rows.

In plain words
What is it for?
Use it while creating or altering tables, editing migration files, or designing a database schema, with policy patterns, migration templates, pre-commit checks, and audit queries.
Why use it?
It helps prevent a new table from being deployed without access policies. It keeps protection alongside table-creation and migration work instead of relying on a later audit.

Skill for Claude CodeCodex

Part of the memstack plugin — 86 skills, 2 commands, 5 hooks shipped together

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.

agentmods
npx agentmods add skills/cwinvestments/memstack/rls-guardian
Any agent
npx skills add cwinvestments/memstack --skill rls-guardian
Clone the repo
git clone --depth 1 https://github.com/cwinvestments/memstack

Made for: Claude Code, Codex.

Or install memstack, the plugin that ships this one along with the rest of its 86 skills, 2 commands, 5 hooks.

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 memstack-security-rls-guardian

README.md
[![agentmods](https://agentmods.dev/badge/skills/cwinvestments/memstack/rls-guardian.svg)](https://agentmods.dev/skills/cwinvestments/memstack/rls-guardian)
Your own site
<a href="https://agentmods.dev/skills/cwinvestments/memstack/rls-guardian"><img src="https://agentmods.dev/badge/skills/cwinvestments/memstack/rls-guardian.svg" alt="Measured on agentmods" height="20"></a>
Per session 84 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,300 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00084 $0.03300
Opus 5 $0.00042 $0.01650
Sonnet 5 $0.00017 $0.00660
Haiku 4.5 $0.00008 $0.00330

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

Security

Grade A, and why

memstack-security-rls-guardian 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.

skills/security/rls-guardian/SKILL.md · 431 lines

How it starts

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

RLS Guardian: Enforcing Row Level Security...

Enforces Row Level Security on every Supabase table creation, ensuring no table goes live without proper access policies. Provides 4 policy patterns, migration templates, pre-commit checks, and audit queries to find unprotected tables.

Activation

When this skill activates, output:

RLS Guardian: Enforcing Row Level Security...

Then execute the protocol below.

Context Guard

Context Status
User writes CREATE TABLE or ALTER TABLE SQL ACTIVE
User creates or edits a migration file ACTIVE
User says "new table", "database schema", "add table" ACTIVE
User says "RLS", "row level security", "table policies" ACTIVE
User asks for a general RLS audit of existing tables DORMANT: use RLS Checker
User asks a general SQL query unrelated to schema DORMANT: do not activate

Common Mistakes

Mistake Why It's Wrong
"Create table now, add RLS later" Every minute without RLS is a window where all rows are accessible to any authenticated user. RLS must be in the same migration.
"Enable RLS but no policies" ALTER TABLE ENABLE ROW LEVEL SECURITY with no policies blocks ALL access including the service role via API. Users get empty results, devs panic.
"Only add a SELECT policy" SELECT-only leaves INSERT, UPDATE, DELETE wide open. All 4 operations need explicit policies.
"Use true as the policy expression" USING (true) makes the table world-readable. Only valid for genuinely public data (e.g. blog posts). Never for user data.
"Forget the service role" Supabase service role bypasses RLS by design. But if you switch to anon key on the frontend, every table without policies is exposed.

Protocol

Step 1: Classify the Table

Before writing any policy, classify the table's access pattern:

Pattern Description Example Tables
User-scoped Each row belongs to one user via user_id profiles, settings, api_keys, notifications
Org-scoped Rows belong to an organization; users access via membership projects, invoices, team_settings
Public-read Anyone can read, only owners can write blog_posts, public_profiles, product_listings
Junction Many-to-many relationship linking two entities team_members, project_collaborators
System Internal tables not accessed by end users migrations, cron_jobs, audit_logs

Read the full file on GitHub · 431 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 a588d5777cba
  2. 2d ago First seen · 431 lines · 84 tokens per session scan A 66c18b462b89

Subscribe to this mod's changes

memstack-security-rls-guardian is a skill published in the GitHub repository cwinvestments/memstack (419 stars, last pushed today), licensed MIT. It adds 84 tokens to every session and 3,300 once invoked, about $0.0004 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

postgres-database-migration

Use this skill for planning, testing, and safely executing PostgreSQL schema migrations — especially when working with production data or shared databases. Trigger when user asks to: Test a schema migration before applying it to production Add, remove, or rename columns safely on a live table Change a column's data…

timescale/pg-aiguide · 220 tokens

setup-timescaledb-hypertables

Use this skill when creating database schemas or tables for Timescale, TimescaleDB, TigerData, or Tiger Cloud, especially for time-series, IoT, metrics, events, or log data. Use this to improve the performance of any insert-heavy table. Trigger when user asks to: Create or design SQL schemas/tables AND…

timescale/pg-aiguide · 219 tokens

design-postgis-tables

Comprehensive PostGIS spatial table design reference covering geometry types, coordinate systems, spatial indexing, and performance patterns for location-based applications.

timescale/pg-aiguide · 31 tokens

migrate-postgres-tables-to-hypertables

Use this skill to migrate identified PostgreSQL tables to Timescale/TimescaleDB hypertables with optimal configuration and validation. Trigger when user asks to: Migrate or convert PostgreSQL tables to hypertables Execute hypertable migration with minimal downtime Plan blue-green migration for large tables Validate…

timescale/pg-aiguide · 181 tokens

pgvector-semantic-search

Use this skill for setting up vector similarity search with pgvector for AI/ML embeddings, RAG applications, or semantic search. Trigger when user asks to: Store or search vector embeddings in PostgreSQL Set up semantic search, similarity search, or nearest neighbor search Create HNSW or IVFFlat indexes for vectors…

timescale/pg-aiguide · 190 tokens

find-hypertable-candidates

Use this skill to analyze an existing PostgreSQL database and identify which tables should be converted to Timescale/TimescaleDB hypertables. Trigger when user asks to: Analyze database tables for hypertable conversion potential Identify time-series or event tables in an existing schema Evaluate if a table would…

timescale/pg-aiguide · 184 tokens