set-up-a-database

set-up-a-database is a skill for Claude Code from oscarsterling/clelp-skills. It costs 23 tokens per session (2,413 once invoked), scanned A, original, MIT.

A security checklist for setting up Supabase database tables, access rules, functions, permissions, and migrations. Supabase is a hosted service for building applications with PostgreSQL databases.

In plain words
What is it for?
It is for planning access, writing safer database migrations, checking row-level policies, and testing tables, stored procedures, and file storage operations.
Why use it?
It helps prevent database users or application callers from gaining access they should not have, and helps reviewers check the exact changes being made.

Skill for Claude Code

Written for Claude Code: when-to-use in frontmatter.

Good fit It is for planning access, writing safer database migrations, checking row-level policies, and testing tables, stored procedures, and file storage operations.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/oscarsterling/clelp-skills/set-up-a-database
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 oscarsterling/clelp-skills --skill set-up-a-database
Clone the repo
git clone --depth 1 https://github.com/oscarsterling/clelp-skills

Made for: Claude Code.

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 set-up-a-database

README.md
[![agentmods](https://agentmods.dev/badge/skills/oscarsterling/clelp-skills/set-up-a-database/github.svg)](https://agentmods.dev/skills/oscarsterling/clelp-skills/set-up-a-database)
Your own site
<a href="https://agentmods.dev/skills/oscarsterling/clelp-skills/set-up-a-database"><img src="https://agentmods.dev/badge/skills/oscarsterling/clelp-skills/set-up-a-database/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 set-up-a-database

Your own site · 80×15
<a href="https://agentmods.dev/skills/oscarsterling/clelp-skills/set-up-a-database"><img src="https://agentmods.dev/badge/skills/oscarsterling/clelp-skills/set-up-a-database.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 23 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,413 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.
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.00023 $0.02413
Opus 5.5 $0.00009 $0.00965
Sonnet 5.5 $0.00005 $0.00483
Haiku 4.5 $0.00002 $0.00241

Measured 14d ago against content hash da3fa8b5fff1, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

set-up-a-database 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 14d ago.

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.

set-up-a-database/SKILL.md · 82 lines

How it starts

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

Set up a database

Tested on PostgreSQL 17 with a non-superuser postgres migration role. The audit and probe are a worked example for notes; extend them with a behavioral check for every relation, RPC, and storage operation the migration changes.

Phase 0: Scope

  • List exposed schemas, changed objects, roles, and intended grants. Without it: an overlooked API path can stay open.
  • Record the exact SQL bytes and security review sign-off. Without it: review can cover different code.

Phase 1: Design access

  • Name each table's anon readers, signed-in owners, and server-only writers. Without it: roles gain unintended access.
  • Put each trust boundary in its own table. Without it: one broad policy can expose data across boundaries.
  • Use owner_id uuid not null default auth.uid() for owned rows. Without it: writes can lack a trustworthy owner.
  • Authorize from server-set app_metadata or your own tables, never user_metadata or raw_user_meta_data; any expression outside a simple owner pin needs review; signed-in anonymous users also have the authenticated role. Without it: callers can claim privileges they do not own.
  • Keep service-role keys out of clients and route server-only writes through that role. Without it: public callers can impersonate the server.
  • Keep private schemas out of the exposed schema list. Without it: helpers become API endpoints.
  • Check that child rows cannot reference another owner's parent. Without it: a valid child owner can attach data to another user's object.
  • Cap caller-supplied text and jsonb sizes. Without it: unbounded input can exhaust resources.

Phase 2: Write migration and prepare rollback

Copy examples/good-migration.sql to one migration file, for example migrations/<timestamp>_notes.sql. Review, hash, stage, and apply that exact path. Write examples/rollback.sql before applying.

  • Prepare recovery: write examples/rollback.sql before applying. Without it: a failed deployment has no reviewed reversal.
  • Enable RLS in the same migration as every exposed table creation. Without it: rows are exposed before protection exists.
  • Inventory existing policies before adding one; permissive policies combine with OR. Without it: a new policy can bypass an older restriction.
  • Inspect and reconcile effective table privileges, including those inherited through role membership; revoke broad privileges from public, anon, and authenticated, then grant only needed operations. Without it: inherited and PUBLIC grants bypass intended access.
  • Limit INSERT and UPDATE grants to safe columns when callers must not set or change id, created_at, owner_id, or role fields. Without it: table-wide UPDATE lets callers rewrite privileged fields.
  • Pin owned-row SELECT, INSERT, UPDATE, and DELETE policies to (select auth.uid()) = owner_id, including both UPDATE expressions. Without it: users can read or change another owner's rows.
  • Never use with check (true) or using (true) for exposed writes; give each policy an explicit TO role. Without it: a policy with no TO clause applies to public, and callers can claim another owner.
  • Prefer SECURITY INVOKER; put definers outside exposed schemas, pin search_path = '', and qualify object names. Without it: privileged code can resolve attacker-controlled names.
  • Have every SECURITY DEFINER function callable by signed-in users check auth.uid() itself. Without it: the function may perform privileged work for the wrong user.
  • Inspect and reconcile an existing function's ACL before granting EXECUTE; CREATE OR REPLACE preserves grants, and revoking from public and anon alone does not exclude other roles. Without it: an old grant can keep the function callable.
  • Revoke EXECUTE on each callable function from public and anon, then grant the intended role. Without it: function access is broader than designed.
  • Harden defaults with alter default privileges for role postgres revoke execute on functions from public; and alter default privileges for role postgres in schema public revoke execute on functions from anon, authenticated;, plus table write defaults. Without it: new functions may inherit PUBLIC EXECUTE or direct exposed-role grants.
  • Use with (security_invoker = true) for views on Postgres 15 or later, and inspect every view and table they read, including those in non-exposed schemas. Without it: an invoker view can still expose an owner-rights view or unprotected table below it.
  • Review every function called by an exposed view, including calls through nested views; inspect what its body reads and whether it runs as invoker or definer. Without it: the view audit cannot follow a function body, which reads with caller rights for invokers or owner rights for definers.
  • Keep materialized views and foreign tables outside exposed schemas or revoke exposed SELECT. Without it: materialized views cannot use security_invoker, and RLS cannot filter these reads.
  • Install extensions into a schema the API does not expose, for example create extension ... schema extensions, never public. Without it: extension functions such as http or dblink become callable endpoints.
  • Keep user-data buckets private; pin the first folder to auth.uid() in SELECT, INSERT, UPDATE USING and WITH CHECK, and DELETE policies on storage.objects. Without it: a public bucket exposes files, and a SELECT policy checking only bucket_id = '...' lets every signed-in user read every user's files.
  • Never revoke on or drop a schema this migration did not create; inventory an existing schema's ACL first. Without it: a feature migration can break unrelated objects.
  • Take a backup and test restoring it before Apply. Without it: a backup may be unusable when recovery is needed.
  • Review rollback effects and get the data owner's approval before a data-bearing drop. Without it: recovery can destroy data.

Read the full file on GitHub · 82 lines

Files

What ships with it

8 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 14d ago First seen · 82 lines · 23 tokens per session scan A da3fa8b5fff1

Subscribe to this mod's changes

set-up-a-database is a skill published in the GitHub repository oscarsterling/clelp-skills (0 stars, last pushed 6d ago), licensed MIT. It adds 23 tokens to every session and 2,413 once invoked, about $0.0001 per session on Opus 5.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-10-04.

Related

Other skills, from other repositories

alloydb-basics

Manages clusters, instances, and backups for AlloyDB for PostgreSQL, and integrates with AlloyDB Model Context Protocol (MCP) tools for automated database operations. Use when creating, configuring, or administering AlloyDB databases. Do NOT use for general PostgreSQL instances (e.g. Cloud SQL) or other GCP databases.

google/skills · 72 tokens

postgresql-table-design

Use this skill when designing or reviewing a PostgreSQL-specific schema. Covers best-practices, data types, indexing, constraints, performance patterns, and advanced features.

wshobson/agents · 37 tokens

db-repair

Auto-fix gbrain's Postgres access so the brain stays available. When any gbrain command or MCP tool result carries a GBRAINDBACCESS marker (or an operator reports the brain database is down), run the hardcoded gbrain db-repair ladder: diagnose, apply the safe tier, verify. The action is ALWAYS the hardcoded command …

garrytan/gbrain · 96 tokens

volcengine-rds-postgresql

A tool for operating PostgreSQL databases hosted by Volcano Engine's managed database service. PostgreSQL is a relational database used to store structured application data.

bytedance/agentkit-samples · 63 tokens

dsql

Build with Aurora DSQL — manage schemas, execute queries, handle migrations, diagnose query plans, diagnose cluster performance, load data, and develop applications with a serverless, distributed SQL database. Covers IAM auth, multi-tenant patterns, MySQL-to-DSQL and PostgreSQL-to-DSQL schema conversion, foreign key…

awslabs/agent-plugins · 246 tokens

analyzing-insights-across-teams

Analyze PostHog insights, dashboards, or teams beyond the current project by querying the prod Postgres replicas synced into the dogfood data warehouse (US project 2, "PostHog App + Website"). Use when asked to analyze insights across all teams or projects, another team's insights, or fleet-wide insight/dashboard…

PostHog/posthog-foss · 115 tokens