postgresql-indexing

postgresql-indexing is a skill for Claude Code from prowler-cloud/prowler. It costs 108 tokens per session (3,486 once invoked), scanned A, original, Apache-2.0.

A guide to adding and checking indexes in PostgreSQL, the database system used to store application data. Indexes are extra data structures that can help the database find rows faster.

In plain words
What is it for?
It helps developers design indexes, optimize queries, work with partitioned tables, and safely create, remove, rebuild, or validate indexes.
Why use it?
It helps avoid slow queries, wasted storage, blocked production tables, and indexes that the database cannot use effectively. It also covers checking changes with EXPLAIN ANALYZE and maintaining tables afterward.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Good fit It helps developers design indexes, optimize queries, work with partitioned tables, and safely create, remove, rebuild, or validate indexes.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/prowler-cloud/prowler/postgresql-indexing
About the project

Prowler is an open-source cloud security platform that checks cloud environments for security issues and compliance with standards such as CIS, NIST, and GDPR. Security teams use it to assess configurations, prioritize findings, produce reports, and guide remediation.

prowler-cloud/prowler · 15,392 stars · on GitHub · prowler.com

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 prowler-cloud/prowler --skill postgresql-indexing
Clone the repo
git clone --depth 1 https://github.com/prowler-cloud/prowler

Made for: Claude Code.

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-indexing

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/prowler-cloud/prowler/postgresql-indexing"><img src="https://agentmods.dev/badge/skills/prowler-cloud/prowler/postgresql-indexing.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 108 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,486 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. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00108 $0.03486
Opus 5.5 $0.00043 $0.01394
Sonnet 5.5 $0.00022 $0.00697
Haiku 4.5 $0.00011 $0.00349

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

Security

Grade A, and why

postgresql-indexing 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.

skills/postgresql-indexing/SKILL.md · 393 lines

How it starts

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

When to use

  • Creating or modifying PostgreSQL indexes
  • Analyzing query plans with EXPLAIN
  • Debugging slow queries or missing index usage
  • Dropping, reindexing, or validating indexes
  • Working with indexes on partitioned tables (findings, resource_finding_mappings)
  • Running VACUUM or ANALYZE after index changes

Index design

Partial indexes: constant columns go in WHERE, not in the key

When a column has a fixed value for the query (e.g., state = 'completed'), put it in the WHERE clause of the index, not in the indexed columns. Otherwise the planner cannot exploit the ordering of the other columns.

-- Bad: state in the key wastes space and breaks ordering
CREATE INDEX idx_scans_tenant_state ON scans (tenant_id, state, inserted_at DESC);

-- Good: state as a filter, planner uses tenant_id + inserted_at ordering
CREATE INDEX idx_scans_tenant_ins_completed ON scans (tenant_id, inserted_at DESC)
    WHERE state = 'completed';

Column order matters

Put high-selectivity columns first (columns that filter out the most rows). For composite indexes, the leftmost column must appear in the query's WHERE clause for the index to be used.

Validating index effectiveness

Always EXPLAIN (ANALYZE, BUFFERS) after adding indexes

Never assume an index is being used. Run EXPLAIN (ANALYZE, BUFFERS) to confirm.

EXPLAIN (ANALYZE, BUFFERS)
SELECT *
FROM users
WHERE email = '[email protected]';

RLS changes the plan

Tenant tables have RLS policies (api/rls.py) that add tenant_id = current_setting('api.tenant_id')::uuid to every query run as the API user, and return nothing when the setting is missing. Analyze plans the way the API runs them:

-- As the RLS-constrained API user (not the admin/owner role, which bypasses RLS)
BEGIN;
SELECT set_config('api.tenant_id', '95383b24-da01-44b5-a713-0d9920d554db', true);
EXPLAIN (ANALYZE, BUFFERS) SELECT ... FROM findings WHERE ...;
ROLLBACK;

To see the SQL the ORM generates, print str(queryset.query) or use queryset.explain(analyze=True) inside rls_transaction(tenant_id). This is why most Prowler indexes start with tenant_id.

Read the full file on GitHub · 393 lines

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 Changed · -1 lines f8ddfa94b6c3
  2. 3mo ago First seen · 394 lines · 108 tokens per session scan A c3d4813593bf

Subscribe to this mod's changes

postgresql-indexing is a skill published in the GitHub repository prowler-cloud/prowler (15,392 stars, last pushed today), licensed Apache-2.0. It adds 108 tokens to every session and 3,486 once invoked, about $0.0004 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-08-30.

Related

postgresql-indexing compared with skills from other repositories

postgresql-indexing next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
postgresql-indexingprowler-cloud/prowlerSkill15ktodayApache-2.0A108Claude Code
database-rds-devopsaws/tools-for-devops-agentSkill159todayApache-2.0A75Claude Code, Codex
database-migration-service-expertiseaws/tools-for-devops-agentSkill159todayApache-2.0A99Claude Code, Codex
cis-aws-database-3.11CyberStrikeus/CyberStrikeSkill4.0ktodayAGPL-3.0A17Claude Code, Codex
crm-production-investigation-guidelinesaws/tools-for-devops-agentSkill159todayApache-2.0A62Claude Code, Codex
write-error-divergencePlamenTSV/plamenSkill3212mo agoMITA32Claude Code, Codex
triage-issuesgoogleapis/mcp-toolboxSkill17ktodayApache-2.0A164Claude Code, Codex