Terminal.skills
Skills/postgresql
>

postgresql

Assists with designing schemas, writing performant queries, managing indexes, and operating PostgreSQL databases. Use when working with JSONB, full-text search, window functions, CTEs, row-level security, replication, or performance tuning. Trigger words: postgresql, postgres, sql, database, jsonb, rls, window functions, cte.

#postgresql#database#sql#relational#jsonb
terminal-skillsv1.0.0
Works with:claude-codeopenai-codexgemini-clicursor
Source

Usage

$
✓ Installed postgresql v1.0.0

Getting Started

  1. Install the skill using the command above
  2. Open your AI coding agent (Claude Code, Codex, Gemini CLI, or Cursor)
  3. Reference the skill in your prompt
  4. The AI will use the skill's capabilities automatically

Example Prompts

  • "Analyze the sales data in revenue.csv and identify trends"
  • "Create a visualization comparing Q1 vs Q2 performance metrics"

Information

Version
1.0.0
Author
terminal-skills
Category
Data & AI
License
Apache-2.0

Use Cases

Build a Customer Health Scoring System
Build an ML Pipeline for Customer Churn Prediction
Deploy a Full-Stack App with Docker Compose and Nginx
Automate Business Workflows with n8n
Build a Data Pipeline with Airflow and dbt
Build a Full-Stack App with Django and HTMX
Build an Internal Analytics Dashboard with Metabase
Add Instant Search to Your App
Build a Web Scraper for Competitor Price Monitoring
Build a Real-Time Analytics Dashboard
Build an AI-Powered Log Anomaly Detector
Build an Automated Database Migration System
Build a Data Pipeline with Schema Evolution
Build a Distributed Task Queue with Priorities
Build a Dynamic PDF Report Generator
Build Multi-Tenant SaaS with Row-Level Isolation
Build a User Activity Feed with Fanout
Build Event Sourcing for Financial Transactions
Build a GraphQL API with DataLoader and Caching
Build OAuth SSO Integration with Multiple Providers
Build Self-Healing Infrastructure with Health Checks
Build an ML Model Serving Pipeline
Build a Tenant-Aware Job Scheduler
Build an AI Content Moderation Pipeline
Build a Data Export Pipeline with Streaming
Build Database Connection Pooling with Health Checks
Build a Drag-and-Drop Kanban Board
Build an Email Notification System with Templates
Build Secrets Management with Automatic Rotation
Build a Webhook Delivery System with Retries
Build File Upload with Presigned URLs
Build an Idempotent API with Request Deduplication
Build Multi-Region Data Replication
Build a Smart Caching Layer with Invalidation
Automate Infrastructure Compliance with Policy-as-Code
Build an Event-Sourced Fintech Ledger with CQRS
Build a Real-Time Fraud Detection Pipeline
Implement End-to-End Encryption for User Data
Build an Automated Incident Response System
Build a Data Mesh with Self-Serve Analytics
Build an ML Feature Store for Production Recommendations
Build a Cost-Aware Kubernetes Autoscaler
Build an Intelligent Document Processing Pipeline
Build a Real-Time Collaborative Spreadsheet
Build AI-Powered Search with Semantic Ranking
Build an Automated API Versioning and Deprecation System
Build an Automated Data Quality Monitoring System
Migrate a Production Database with Zero Downtime
Build a GDPR-Compliant Data Deletion Pipeline
Build an LLM Gateway with Fallback and Cost Control
Build a Secure File Sharing Platform with Audit Trail
Build AI-Powered Customer Support Triage
Build a Config-Driven Notification System
Build a Multi-Region Deployment with Edge Routing
Build a Payments Reconciliation Engine
Build Real-Time Collaboration with CRDTs
Build a Self-Healing Kubernetes Operator
Build an A/B Testing Platform with Statistical Rigor
Build a Schema Registry for Event-Driven Architecture
Build an Automated Compliance Evidence Collector
Build a Distributed Task Scheduler with Exactly-Once Execution
Build a Headless CMS with Live Preview
Build an Internal Feature Marketplace for Platform Teams
Build a Smart Email Routing and Auto-Response System
Build an AI Document Extraction Pipeline
Build a Data Pipeline Orchestrator with Lineage Tracking
Build a Real-Time Permissions System with Zanzibar
Build an Automated Load Testing Framework
Build an Immutable Audit Log for Regulated Industries
Build a Mobile Push Notification Service
Build Unified Search Across Multiple Data Sources
Build an AI Meeting Summarizer with Action Items
Build Automated Database Schema Migration Testing
Build an Event-Sourced Shopping Cart
Build a Real-Time Fraud Scoring API
Build AI Search Autocomplete with Embeddings
Build Automated Database Backup with Point-in-Time Recovery
Build a Bulk Data Export System
Build a Developer Portal with API Key Management
Build a Distributed Cron Job Scheduler
Build Event-Driven Notification Preferences
Build Event-Sourced Inventory Management
Build GraphQL Subscriptions for a Live Dashboard
Build an Internal Feature Request Voting System
Build a Privacy Consent Management Platform
Build an AI-Powered Customer Segmentation Engine
Build an Automated Incident Response Runbook
Build an Infrastructure Cost Allocation System
Build an Automated Security Scanner for Dependencies
Build a Database Query Performance Analyzer
Build an Event-Driven Notification Orchestrator
Build a Real-Time Collaborative Whiteboard
Build a Webhook Signature Verification System
Build an A/B Testing Platform
Build an AI Agent with Tool Calling
Build AI Structured Data Extraction
Build an API Analytics Dashboard
Build an Audit Trail with Immutable Log
Build a Bulk Import System
Build a Calendar Booking System
Build a Checkout Flow with Stripe
Build a Changelog API with In-App Announcements
Build Container Health Monitoring
Build a Content Moderation Pipeline
Build a CSV Export with Streaming
Build Custom Domain Mapping for SaaS
Build Disaster Recovery with Automated Failover
Build a Drag-and-Drop Kanban Board
Build a Dynamic Sitemap Generator
Build an Email Verification Flow
Build Error Tracking with Source Maps
Build a File Manager with S3
Build Full-Text Search with PostgreSQL
Build a Gamification System with Points and Badges
Build Geolocation-Based Service Routing
Build an In-App Notification Center
Build an LLM Evaluation Pipeline
Build Magic Link Authentication
Build an MCP Server for Internal Tools
Build a Dynamic Pricing Engine
Build an Observability Stack with OpenTelemetry
Build an Order Tracking System
Build Preview Deployments Per Pull Request
Build a Product Recommendation Engine
Build a RAG Pipeline with Vector Search
Build an RBAC Permission System
Build a Rich Text Editor with Collaboration
Build a Session Management System
Build a Slack Bot for Team Automation
Build Stripe Connect Marketplace Payments
Build Soft Delete with Restore and Retention
Build a Subscription Management System
Build a Survey Builder with Analytics
Build a Tax Calculation Engine
Build Tenant Data Isolation for Multi-Tenant SaaS
Build a Threaded Comment System
Build a Two-Factor Authentication System
Build Usage Metering for SaaS Billing
Build a User Onboarding Flow with Progress Tracking
Build a Video Transcoding Pipeline
Build a Waitlist with Referral Boost
Build a Webhook Relay System
Build a Workflow Engine with State Machines
Build a Cookie Consent Manager
Build an E-Signature System
Build a Media Asset Library
Build a Privacy Dashboard for Data Subject Requests
Build a QR Code Generator API
Build a URL Shortener with Analytics
Build a Bot Detection System
Build a Chargeback Protection System
Build a Health Check Endpoint System
Build Multi-Currency Pricing
Build an On-Call Rotation Manager
Build a Performance Budget Monitor
Build an Announcement Banner System
Build an API Playground
Build a Dark Mode Theme System
Build a Digest Email System
Build Feature Tour Onboarding
Build an IP Geolocation Service
Build SMS OTP Verification
Build an Affiliate Tracking System
Build a Coupon and Discount Engine
Build a Leaderboard System
Build a Payment Link Generator
Build a Poll and Voting System
Build a Social Feed System
Build an SSO Provider
Build a Device Management System
Build a Dunning and Failed Payment Recovery System
Build E-Commerce Product Search
Build a Geo-Fencing System
Build an Invite-Only Access System
Build a Dynamic Pricing Engine
Build a Shipping Rate Calculator
Build a Terms Acceptance Tracker
Build a Warehouse Inventory System
Build a Digital Asset Management System
Build a Data Subject Request Handler
Build an OAuth Provider
Build a Proration Billing System
Build an Email Template Builder
Build a Web Push Notification Service
Build a GraphQL Playground
Build an i18n Translation Management System
Build an In-App Messaging System
Build a Sandbox Environment System
Build a Tooltip Guide System
Build an API Key Management System
Build a Config Management Service
Build a Database Migration Runner
Build an Event Sourcing System
Build a Distributed Task Queue
Build a Multi-Step Approval Workflow
Build a Tenant Onboarding Wizard
Build an AI Agent Orchestration Loop
Build a Context Database for AI Agents
Build a Real-Time News Aggregation Dashboard
Build a Voice Synthesis API
Build an AI Workflow Builder
Build a DNS Domain Management System
Build an LLM Prompt Management System
Build a Semantic Search Engine
Build a Streaming Data Pipeline
Build a Video Transcoding Queue
Build an Automated Research Agent
Build a Data Lineage Tracker
Build a Document AI Extraction Pipeline
Build an Edge Function Runtime
Build an Infrastructure Health Monitor
Build an LLM-Powered Stock Analyzer
Build a Prompt Management Platform
Build an RSS Feed Aggregation Service
Build an Auto-Scaling Engine
Build a Database Sharding Layer
Build a Dependency Graph Analyzer
Build a Credential Vault
Build a Dynamic Form Builder
Build a Sitemap Generator
Build a Usage Metering and Billing Engine
Build a File Format Converter API
Build a Markdown Collaborative Editor
Build a Rolling Deployment Engine
Build a Bidirectional Data Sync Engine
Build an Entity Extraction Pipeline
Build a Transactional Outbox Pattern
Build a Tenant Isolation Testing Framework
Build a PDF Merge and Fill Service
Build a Subscription Lifecycle Manager
Build an Embeddable Chat Widget
Build an Inbound Email Processor
Build a Test Data Factory
Build an Admin Impersonation System
Build a Cron Job Dashboard
Build a Custom Domain SSL Provisioner
Build an Outgoing Webhook Builder
Build an API Usage Analytics Dashboard
Build a Content Recommendation Engine
Build a Data Retention Manager
Build an NPS Feedback System
Build a Release Note Widget
Build a Team Permission Matrix
Build a Slow Query Analyzer
Build a Tenant Usage Dashboard
Build an AI Text Classification API
Build a Feature Flag Audit System
Build a Content Calendar System
Build a Worker Pool Manager
Build a Payment Reconciliation Engine
Build a Compliance Audit Checklist System
Build a Media Transcoding Pipeline
Build a Virtual Scroll Table
Build a Content Moderation Queue
Build a Team Invitation System
Build a Changelog RSS Feed
Build a Database Query Profiler
Build an AI Agent Evaluation Framework
Build a Notification Template Engine
Build a Request Tracing System
Build an API Key Rotation Scheduler
Build a Resource Usage Limiter
Build a Database Seed Manager
Build a Config Drift Detector
Build a Webhook Event Log
Build AI-Powered Search Ranking
Build Feature Usage Analytics
Build Smart Notification Batching
Build Automated Backup Verification
Build an API Error Budget Tracker
Build an API Contract Changelog
Build a Customer Data Export System
Build a Deployment Rollback Manager
Build a Scheduled Report Generator
Build an IP Reputation Scoring System
Build an API Sandbox Environment
Build an Event Bus System
Build a Long-Running Task Tracker
Build a User Session Manager
Build a Database Connection Health Monitor
Build a Customer Self-Service Portal
Build a Secrets Scanner
Build a Workflow State Machine
Build a Database Index Advisor
Build Smart Cache Invalidation
Build a Content Versioning System
Build a QR Code Generator Service
Build a Database Read Replica Router
Build a Session Replay System
Build an AI Image Alt Text Generator
Build an AI Prompt Chain Executor
Build an AI Voice Transcription Service
Build a Customer Feedback Analyzer
Build a Dark Launch System
Build GEO-SEO Optimization
Build a Database Archival System
Build a Serverless Function Deployer
Build a Knowledge Graph Builder
Build a Customer Onboarding Checklist
Build an API Health Dashboard
Build a CI/CD Pipeline Orchestrator
Build an API Monetization Platform
Build an Agent Security Framework
Build an IoT Device Dashboard
Build a Social Media Scheduler
Build an Email Deliverability Monitor
Build an SEO Audit Tool
Build a Feature-Rich Discord Bot
Build a Shopify App

Documentation

Overview

PostgreSQL is an advanced relational database with features that often eliminate the need for separate tools: JSONB for semi-structured data, built-in full-text search, window functions for analytics, recursive CTEs for hierarchical queries, row-level security for multi-tenant isolation, and streaming replication for high availability. It supports partitioning, multiple index types (B-tree, GIN, GiST, BRIN), and connection pooling via PgBouncer.

Instructions

  • When designing schemas, use UUID primary keys with gen_random_uuid(), TIMESTAMP WITH TIME ZONE for all timestamps, appropriate constraints (CHECK, UNIQUE, foreign keys with ON DELETE), and partitioning for time-series data.
  • When working with JSON, use JSONB for truly dynamic data with GIN indexes for containment queries, but prefer proper columns for known fields since they provide better validation and performance.
  • When optimizing queries, add indexes based on EXPLAIN ANALYZE output rather than guesswork, use partial indexes for filtered queries, expression indexes for computed values, and covering indexes with INCLUDE for index-only scans.
  • When building full-text search, create tsvector generated columns with GIN indexes, use ts_rank() for relevance scoring, and choose the appropriate language configuration for stemming.
  • When implementing multi-tenancy, use row-level security (RLS) policies for database-level isolation rather than application-level checks, setting the user context via current_setting().
  • When managing production databases, use PgBouncer for connection pooling, monitor with pg_stat_statements, run VACUUM ANALYZE after bulk operations, and set up streaming replication with Patroni for high availability.

Examples

Example 1: Design a multi-tenant SaaS database with RLS

User request: "Set up a PostgreSQL database with row-level security for multi-tenant isolation"

Actions:

  1. Create tables with a tenant_id column and UUID primary keys
  2. Enable RLS with ALTER TABLE ... ENABLE ROW LEVEL SECURITY
  3. Create policies using current_setting('app.tenant_id') for per-request isolation
  4. Set up connection pooling with PgBouncer and configure app.tenant_id per connection

Output: A multi-tenant database where tenant data is isolated at the database level, preventing cross-tenant data leaks.

Example 2: Add full-text search to a content platform

User request: "Implement search across articles with relevance ranking and highlighting"

Actions:

  1. Add a search_vector generated column using to_tsvector('english', title || ' ' || body)
  2. Create a GIN index on the search vector column
  3. Build a search query using @@ with plainto_tsquery() and rank results with ts_rank()
  4. Add ts_headline() for highlighting matched terms in results

Output: A fast full-text search with relevance ranking, highlighting, and GIN index-backed performance.

Guidelines

  • Use UUID primary keys to avoid sequential ID enumeration and merge conflicts.
  • Use TIMESTAMP WITH TIME ZONE for all timestamps; never use TIMESTAMP which loses timezone context.
  • Add indexes based on EXPLAIN ANALYZE output, not guesswork; measure before optimizing.
  • Use connection pooling (PgBouncer) for applications with more than 20 connections since PostgreSQL forks a process per connection.
  • Use RLS for multi-tenant applications since database-level isolation is more reliable than application-level checks.
  • Use JSONB for truly dynamic data, not as a replacement for proper columns.
  • Run VACUUM ANALYZE after bulk operations since stale statistics lead to bad query plans.