postgresql-optimization

postgresql-optimization is a skill for Claude Code from HigorAlves/orc. It costs 50 tokens per session (834 once invoked), scanned A, original, MIT.

A PostgreSQL development and review guide for database-specific SQL features such as JSONB, arrays, full-text search, window functions, and row-level security. SQL is the language used to query relational databases.

In plain words
What is it for?
Use it to write, optimize, or review PostgreSQL queries, indexes, extensions, functions, triggers, and access controls.
Why use it?
It helps choose PostgreSQL-native solutions, diagnose slow queries, and spot database, security, and query-design problems.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the orc plugin — 84 skills, 31 commands, 14 agents, 6 hooks shipped together

Good fit Use it to write, optimize, or review PostgreSQL queries, indexes, extensions, functions, triggers, and access controls.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/higoralves/orc/postgresql-optimization
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 HigorAlves/orc --skill postgresql-optimization
Clone the repo
git clone --depth 1 https://github.com/HigorAlves/orc

Made for: Claude Code.

Or install orc, the plugin that ships this one along with the rest of its 84 skills, 31 commands, 14 agents, 6 hooks.

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 postgresql-optimization

README.md
[![agentmods](https://agentmods.dev/badge/skills/higoralves/orc/postgresql-optimization/github.svg)](https://agentmods.dev/skills/higoralves/orc/postgresql-optimization)
Your own site
<a href="https://agentmods.dev/skills/higoralves/orc/postgresql-optimization"><img src="https://agentmods.dev/badge/skills/higoralves/orc/postgresql-optimization/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 postgresql-optimization

Your own site · 80×15
<a href="https://agentmods.dev/skills/higoralves/orc/postgresql-optimization"><img src="https://agentmods.dev/badge/skills/higoralves/orc/postgresql-optimization.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 50 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 834 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.00050 $0.00834
Opus 5.5 $0.00020 $0.00334
Sonnet 5.5 $0.00010 $0.00167
Haiku 4.5 $0.00005 $0.00083

Measured 1mo ago against content hash 095897649c13, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

postgresql-optimization 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 1mo 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.

orc/skills/postgresql-optimization/SKILL.md · 50 lines

How it starts

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

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

Read the full file on GitHub · 50 lines

Files

What ships with it

7 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. 1mo ago First seen · 50 lines · 50 tokens per session scan A 095897649c13

Subscribe to this mod's changes

postgresql-optimization is a skill published in the GitHub repository HigorAlves/orc (6 stars, last pushed 10d ago), licensed MIT. It adds 50 tokens to every session and 834 once invoked, about $0.0002 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-09-03.

Related

Other skills, from other repositories

optimize

Analyze and suggest performance improvements for code, queries, or systems.

FlorianBruniaux/claude-code-ultimate-guide · 15 tokens

sql-optimization-patterns

Master SQL query optimization, indexing strategies, and EXPLAIN analysis to dramatically improve database performance and eliminate slow queries. Use when debugging slow queries, designing database schemas, or optimizing application performance.

HermeticOrmus/LibreUIUX-Claude-Code · 44 tokens

deep-debug-sync

Deep root-cause analysis for data sync bugs in the Cortex stack — REX SOAP sync, Shopify product/inventory sync, and any pipeline where data flows between external systems and the local PostgreSQL database. Use this skill when the user reports wrong data after a sync ("wrong supplier", "missing products", "inventory…

anotherben/claude-harness · 154 tokens

postgres-patterns

PostgreSQL database patterns for query optimization, schema design, indexing, and security. Quick reference for common patterns, index types, data types, and anti-pattern detection. Based on Supabase best practices.

affaan-m/ECC · 45 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

five-whys

Finds the root cause of a bug, failure or recurring problem by asking "why" until the answer is a cause you can fix. Use when the user asks why something keeps happening, or wants the root cause rather than a quick fix.

wesammustafa/Claude-Code-Everything-You-Need-to-Know · 53 tokens