PO

postgresql

Advanced SQL helper for PostgreSQL schema design and high-performance query optimization.

Install

mkdir -p .claude/skills/postgresql-ssrjkk && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/19122" && unzip -o skill.zip -d .claude/skills/postgresql-ssrjkk && rm skill.zip

Installs to .claude/skills/postgresql-ssrjkk

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Models relational data, writes optimized queries, and manages PostgreSQL databases with indexes, views, and CTEs. Use for robust data storage.
142 chars✓ has a “when” trigger
Beginner

Key capabilities

  • Create tables with `SERIAL PRIMARY KEY` and `NOT NULL` constraints
  • Add unique constraints to columns like email
  • Create indexes on frequently queried columns
  • Write SQL queries with `LEFT JOIN` and `GROUP BY` clauses
  • Filter grouped results using `HAVING` clauses
  • Order query results by aggregate functions

How it works

The skill provides SQL examples for creating tables, indexes, and performing complex queries to manage relational data within a PostgreSQL database.

Inputs & outputs

You give it
SQL DDL and DML statements
You get back
a PostgreSQL database schema and query results

When to use postgresql

  • Modeling relational data
  • Writing complex SQL joins
  • Creating database indexes
  • Performance tuning queries

About this skill

PostgreSQL

Advanced relational database with powerful querying and indexing.

Quick Start

CREATE TABLE users (
  id SERIAL PRIMARY KEY,
  name VARCHAR(100) NOT NULL,
  email VARCHAR(255) UNIQUE NOT NULL,
  created_at TIMESTAMP DEFAULT NOW()
);

CREATE INDEX idx_users_email ON users(email);

When to Use

  • Structured relational data
  • Complex queries and joins
  • Transactional workloads
  • Analytics with window functions

Step-by-Step

  1. Install PostgreSQL
  2. Create database: CREATE DATABASE mydb;
  3. Design schema with migrations
  4. Optimize with EXPLAIN ANALYZE

Dependencies

# psql client
psql -h localhost -U postgres -d mydb

Examples

SELECT u.name, COUNT(o.id) as order_count
FROM users u
LEFT JOIN orders o ON o.user_id = u.id
GROUP BY u.id
HAVING COUNT(o.id) > 5
ORDER BY order_count DESC;

Resources

Validation

  1. Connection succeeds
  2. Queries return correct results
  3. Indexes improve query performance

When not to use it

  • When unstructured data is being stored
  • When simple key-value storage is sufficient
  • When complex transactional workloads are not a requirement

Prerequisites

psql client

Limitations

  • Requires PostgreSQL to be installed
  • Focuses on relational data structures
  • Does not cover NoSQL database patterns

How it compares

This workflow focuses on specific PostgreSQL features like `SERIAL PRIMARY KEY`, `CREATE INDEX`, and advanced SQL constructs, which are tailored for reliable relational data management compared to generic database operations.

Compared to similar skills

postgresql side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
postgresql (this skill)012dReviewBeginner
sql-optimization-patterns642moNo flagsAdvanced
drizzle-orm321moNo flagsIntermediate
postgres-patterns204moNo flagsIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

Search skills

Search the agent skills registry