Skip to content
Back to skills

Postgresql Optimization

ASecurity

Write or review PostgreSQL-specific SQL: JSONB, arrays, custom/range/geometric types, indexing, full-text search, window functions, extensions, and RLS. Use for PG-unique features and code review.

  • 6 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 9, 2026
ai-agentsgosqlexpressdatabasesecurityperformance

Security analysis

A100/100

Pro scans all 8 files and shows the line behind each finding

Scanned October 9, 2026

npx -y skills add HigorAlves/orc --skill postgresql-optimization --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Postgresql Optimization?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Postgresql Optimization
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/higoralves-postgresql-optimization/badge)](https://www.skillsdirectory.com/skills/higoralves-postgresql-optimization)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: postgresql-optimization
description: 'Write or review PostgreSQL-specific SQL: JSONB, arrays, custom/range/geometric types, indexing, full-text search, window functions, extensions, and RLS. Use for PG-unique features and code review.'
---

# PostgreSQL Development & Review Assistant

Expert PostgreSQL guidance for ${selection} (or the entire project if no selection). Covers PostgreSQL-specific features, optimization patterns, and the review lens for PG code. This SKILL.md is a thin index — **Read the relevant `references/*.md` file when you need that detail.**

## When to use

Reach for this skill whenever you are writing, optimizing, or reviewing PostgreSQL-specific SQL and want to leverage what makes PostgreSQL special rather than treating it as a generic SQL database:

- Modeling or querying **JSONB**, **arrays**, or **custom/range/geometric types**.
- Designing **indexes** or diagnosing slow queries (EXPLAIN ANALYZE, `pg_stat_statements`).
- **Full-text search**, **window functions**, recursive **CTEs**.
- Choosing and using **extensions** (pg_trgm, pgcrypto, PostGIS, pgvector, TimescaleDB, …).
- **Reviewing** PG code for anti-patterns, schema-design smells, function/trigger issues, and security (RLS, privileges).

## How to work

1. Identify the topic, open the matching reference, apply its patterns to the selection.
2. Prefer PostgreSQL-native operators/types over generic SQL equivalents.
3. Back every access path with the right index type (GIN for JSONB/arrays, GiST for ranges/geometry, BRIN for time-series).
4. For a review pass, start from `references/review-checklist.md`.

## Decision tree

- Semi-structured data, `@>` / `?` queries, GIN indexing → `references/jsonb.md`
- Tag/category lists, ENUMs, domains, ranges, geometry → `references/arrays-and-custom-types.md`
- Slow query, EXPLAIN, index choice, pagination, connection/memory → `references/indexing.md`
- Running totals, rankings, LAG/LEAD, recursive hierarchies → `references/window-functions.md`
- `tsvector` / `tsquery` search and ranking → `references/full-text-search.md`
- Enabling/using extensions, monitoring, VACUUM/ANALYZE → `references/extensions.md`
- Auditing/reviewing PG code (anti-patterns, triggers, RLS, privileges, checklist) → `references/review-checklist.md`

## Topic index

| Topic | What's there | Reference |
|---|---|---|
| JSONB | GIN vs `jsonb_path_ops`, containment/path queries, generated-column extraction, anti-patterns | `references/jsonb.md` |
| Arrays & custom types | Array ops + GIN, ENUM/domain/composite types, range & geometric types, GiST | `references/arrays-and-custom-types.md` |
| Indexing & optimization | EXPLAIN ANALYZE, composite/partial/expression/covering indexes, index-type selection, pagination, monitoring, output format | `references/indexing.md` |
| Window functions & CTEs | Running totals, rankings, LAG/LEAD, recursive CTEs | `references/window-functions.md` |
| Full-text search | `tsvector`/`tsquery`, GIN, ranking, generated search columns | `references/full-text-search.md` |
| Extensions & maintenance | Common extensions, monitoring queries, VACUUM/ANALYZE, tuning tips | `references/extensions.md` |
| Review checklist | Anti-patterns, schema smells, function/trigger review, RLS & privileges, code-quality checklist | `references/review-checklist.md` |

Focus on specific, actionable optimizations that improve query performance, security, and maintainability while leveraging PostgreSQL's advanced features. For schema design specifically, see the `postgresql-table-design` skill.

Files in this skill

  • SKILL.md3.5 KB
  • references/arrays-and-custom-types.md3.3 KB
  • references/extensions.md2.2 KB
  • references/full-text-search.md1.3 KB
  • references/indexing.md3.3 KB
  • references/jsonb.md2.5 KB
  • references/review-checklist.md4.4 KB
  • references/window-functions.md1.5 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…