Guide · Agent skill
How to use the PostgreSQL Patterns Reference agent skill
Updated · written with AI from the project's own documentation and checked against our catalogue data
The postgres-patterns skill is a quick-reference guide to PostgreSQL good practices, written in Spanish and based on Supabase guidance. Once it is installed, your agent can use it when you ask for SQL, table design, or help with a slow query. This page explains what the skill does, how to install it, how to trigger it, and what to check before running anything it suggests.
Quick start
- 1Download the ZIP. Download the postgres-patterns ZIP file from this page.
- 2Unzip into a skills folder. Unzip it into ~/.claude/skills/ for personal use, or into .claude/skills/ inside a project.
- 3Or upload in the Claude apps. In the Claude apps, open Settings, go to Capabilities, then Skills, and upload the ZIP.
- 4Make a specific request. Describe your database task in plain words, naming PostgreSQL and the goal, such as a schema, index or slow query.
- 5Review the SQL. Read any ALTER SYSTEM, REVOKE or other server-wide statement before running it.
- 6Run on a safe copy. Test the suggested changes on a non-production database before applying them to shared data.
What the postgres-patterns skill makes the agent do
An agent skill is a folder of instructions that an AI agent loads when a task matches it. This one contains a single file, SKILL.md, with reference tables and snippets for PostgreSQL. It covers query optimization, schema design, indexing and security.
When the skill is active, the agent can suggest index types for common query patterns (B-tree, composite, GIN, BRIN, covering and partial indexes), choose data types such as bigint IDs, timestamptz timestamps and numeric(10,2) for money, use cursor-based pagination instead of OFFSET, and wrap auth.uid() in a SELECT inside row level security policies. It also has snippets for finding foreign keys without an index, listing slow queries, and spotting tables with many dead rows.
Install the postgres-patterns skill
Download the ZIP file for the skill from this page. Then install it using one of these two methods.
For Claude Code, unzip the file into your personal skills folder ~/.claude/skills/, or into a project folder at .claude/skills/ inside the project. For the Claude apps, open Settings, go to Capabilities, and upload the skill under Skills.
- Personal use across projects: unzip into ~/.claude/skills/
- One project only: unzip into .claude/skills/ in that project
- Claude apps: Settings → Capabilities → Skills, then upload the ZIP
Trigger the skill with natural requests
You do not need a special command. The skill is meant to be used when your request touches on the situations it lists: writing SQL or migrations, designing a schema, diagnosing a slow query, implementing Row Level Security, or configuring connection pooling.
Name the database and the goal in plain words. The more specific your request, the more useful the recommendation will be.
- Design a PostgreSQL table for orders with a status and a created_at, and tell me which indexes to add.
- Review this migration for PostgreSQL data type choices, such as IDs and money columns.
- This query on products is slow. Check it for common causes and suggest an index.
- Write an RLS policy so users only see rows where user_id matches their auth.uid().
Examples of what the skill can produce
For a query that filters on status and then on a date, the skill points to a composite index with the equality column first: CREATE INDEX idx ON orders (status, created_at). For a users table where you often read name and created_at by email, it shows a covering index using INCLUDE.
For a feed that loads the next page of products, it recommends cursor-based pagination rather than OFFSET, because OFFSET gets slower as the number of skipped rows grows.
SELECT * FROM products WHERE id > $last_id ORDER BY id LIMIT 20;Check what you need before you run anything
The skill itself does not need a database to be read, but the SQL it contains assumes PostgreSQL. The slow-query snippet reads from pg_stat_statements, so that extension must be installed on your server. The agent only needs database access if you ask it to run queries for you.
The skill does not run scripts and does not use the network, according to its listing. The configuration template, however, contains statements that change server-wide settings and permissions, such as ALTER SYSTEM and REVOKE. Review them before running them against a shared or production database.
- PostgreSQL database (the examples assume PostgreSQL)
- pg_stat_statements extension for the slow-query snippet
- Database access only if you ask the agent to run queries
Use the skill safely and get better results
Treat every ALTER SYSTEM or REVOKE statement as a change to be reviewed, not something to paste in. Run changes in a test environment first, and ask the agent to explain the effect of each statement. The file notes that the connection limits should be adjusted to your RAM.
For deep tuning of a complex workload, the skill points to a separate agent called database-reviewer, which gives a fuller review workflow. Use the skill for quick checks and conventions, and that agent for detailed analysis.
- Give the agent your PostgreSQL version and your table sizes when asking about indexes.
- Ask for the reason behind a recommendation so you can judge it.
- Run the diagnostic queries on a copy of the data first when possible.
What people use it for
- Designing a new table with sensible ID, text, timestamp and money column types
- Choosing between B-tree, GIN and BRIN indexes for a given query
- Converting OFFSET pagination to cursor-based pagination
- Writing row level security policies for a Supabase-style app
- Listing foreign keys that lack an index, or finding slow queries with pg_stat_statements
Frequently asked questions
How do I install the postgres-patterns skill?
Download the ZIP from this page and unzip it into ~/.claude/skills/ for personal use, or into .claude/skills/ inside a project. In the Claude apps, you can instead upload the ZIP under Settings, then Capabilities, then Skills.
Is the postgres-patterns skill free?
The skill is listed under the MIT licence. The source notes it is based on Agent Skills from the Supabase team, and that credit is included in the file.
What do I need to use this skill?
You need a PostgreSQL database, since the SQL assumes PostgreSQL. The slow-query snippet needs the pg_stat_statements extension, and the agent needs database access only if you ask it to run queries.
Does the skill run scripts or use the internet?
According to its listing, the skill runs no scripts and uses no network. It is a reference file the agent reads, but the SQL it contains can still change server settings if you run it, so review it first.
Can I use this skill with MySQL or SQL Server?
No. It is written for PostgreSQL, and the syntax and features of MySQL and SQL Server differ. Use a skill or guide written for that database instead.
Is this skill enough for tuning a complex production database?
Not on its own. The file itself points to the database-reviewer agent for detailed guidance on complex workloads. Use this skill for quick conventions and checklists, and review production changes carefully.
New agent skills, repos and AI tools — every week
The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.
Our verdict
Choose postgres-patterns if you write or review PostgreSQL schemas, migrations or queries, or if your team uses Supabase and wants shared database conventions. Skip it for MySQL or SQL Server, for deep tuning of complex workloads, or if you plan to run its server-wide ALTER SYSTEM and REVOKE statements on a production database without review.
Download the skill