postgres-hotel-partitioning

postgres-hotel-partitioning is a skill for Claude Code from shennawardana23/skillme. It costs 91 tokens per session (1,098 once invoked), scanned A, original, Apache-2.0.

A set of rules for querying PostgreSQL tables split into separate partitions by hotel ID. It explains why every query must identify the relevant hotel so PostgreSQL can use only the needed partition.

In plain words
What is it for?
Use it when writing or reviewing SQL, Go database code, or migrations involving hotel-partitioned PostgreSQL tables.
Why use it?
It helps prevent queries from scanning data for every hotel and reduces the risk of missing a required tenant boundary.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: positional $N argument.

Part of the skillme plugin — 148 skills, 2 commands shipped together

Good fit Use it when writing or reviewing SQL, Go database code, or migrations involving hotel-partitioned PostgreSQL tables.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/shennawardana23/skillme/postgres-hotel-partitioning
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 shennawardana23/skillme --skill postgres-hotel-partitioning
Clone the repo
git clone --depth 1 https://github.com/shennawardana23/skillme

Made for: Claude Code.

Or install skillme, the plugin that ships this one along with the rest of its 148 skills, 2 commands.

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 postgres-hotel-partitioning

README.md
[![agentmods](https://agentmods.dev/badge/skills/shennawardana23/skillme/postgres-hotel-partitioning/github.svg)](https://agentmods.dev/skills/shennawardana23/skillme/postgres-hotel-partitioning)
Your own site
<a href="https://agentmods.dev/skills/shennawardana23/skillme/postgres-hotel-partitioning"><img src="https://agentmods.dev/badge/skills/shennawardana23/skillme/postgres-hotel-partitioning/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 postgres-hotel-partitioning

Your own site · 80×15
<a href="https://agentmods.dev/skills/shennawardana23/skillme/postgres-hotel-partitioning"><img src="https://agentmods.dev/badge/skills/shennawardana23/skillme/postgres-hotel-partitioning.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 91 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,098 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.00091 $0.01098
Opus 5.5 $0.00036 $0.00439
Sonnet 5.5 $0.00018 $0.00220
Haiku 4.5 $0.00009 $0.00110

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

Security

Grade A, and why

postgres-hotel-partitioning 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/postgres-hotel-partitioning/SKILL.md · 113 lines

How it starts

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

PostgreSQL Hotel-Partitioned Tables

Many tables in this organization's PostgreSQL databases are partitioned by hotel_id (declarative PARTITION BY LIST (hotel_id)). PostgreSQL's planner only prunes partitions it can prove are irrelevant from the query's WHERE clause at plan time — a query missing an explicit hotel_id predicate scans every partition, not just the one relevant to the request. This is the single most common correctness-and-performance bug against these tables: apply the checks below to every query, join, and migration.

The core rule

Every query against a partitioned-by-hotel_id table must include hotel_id = $N (or hotel_id = ANY($N) for a known, bounded set) directly in its WHERE clause — not buried inside a subquery the planner can't push down, not applied only in application code after fetching rows.

// BAD: no hotel_id predicate — scans every hotel's partition to find status matches.
const q = `SELECT * FROM reservations WHERE status = $1`

// GOOD: hotel_id is explicit, sits alongside the other predicate.
const q = `SELECT * FROM reservations WHERE hotel_id = $1 AND status = $2`

Always bind hotel_id as a parameter ($1, :hotel_id), never interpolate it or any other value into the query string with fmt.Sprintf — that is a SQL-injection vector independent of the partitioning concern.

Joins across partitioned tables

A join between two tables partitioned by hotel_id must filter hotel_id on both sides (or rely on the same bound parameter for both), otherwise the planner cannot prune either side:

-- GOOD: hotel_id constrained on both tables in the join.
SELECT r.id, g.name
FROM reservations r
JOIN guests g ON g.id = r.guest_id AND g.hotel_id = r.hotel_id
WHERE r.hotel_id = $1 AND r.status = $2;

Go query helpers

Prefer a thin wrapper that makes hotelID a required, typed parameter so it cannot be forgotten at the call site — push the constraint into the function signature rather than trusting every call site to remember it:

Read the full file on GitHub · 113 lines

Files

What ships with it

2 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 · 113 lines · 91 tokens per session scan A dccad457d8c1

Subscribe to this mod's changes

postgres-hotel-partitioning is a skill published in the GitHub repository shennawardana23/skillme (3 stars, last pushed 9d ago), licensed Apache-2.0. It adds 91 tokens to every session and 1,098 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-09-03.

Related

Other skills, from other repositories

postgresql-development-cloudbase

Use when building, debugging, or evaluating CloudBase PostgreSQL / CloudBase PG / PG mode apps, including Postgres schema setup, queryPgDatabase/managePgDatabase, JS SDK v3 app.rdb() CRUD/RPC, PG HTTP API fallback, RLS-style permissions, username-password auth, and Web CMS/admin CRUD flows backed by CloudBase PG.

sutchan/Agent-Skills-Hub · 77 tokens

timescaledb

MANDATORY when working with time-series data, hypertables, continuous aggregates, or compression - enforces TimescaleDB 2.24.0 best practices including lightning-fast recompression, UUIDv7 continuous aggregates, and Direct Compress.

troykelly/claude-skills · 50 tokens

database-architecture

MANDATORY when designing schemas, writing migrations, creating indexes, or making architectural database decisions - enforces PostgreSQL 18 best practices including AIO, UUIDv7, temporal constraints, and modern indexing strategies.

troykelly/claude-skills · 45 tokens

postgis

MANDATORY when working with geographic data, spatial queries, geometry operations, or location-based features - enforces PostGIS 3.6.1 best practices including STCoverageClean, SFCGAL 3D functions, and bigint topology.

troykelly/claude-skills · 52 tokens

postgres-rls

MANDATORY when touching auth tables, tenant isolation, RLS policies, or multi-tenant database code - enforces Row Level Security best practices and catches common bypass vulnerabilities.

troykelly/claude-skills · 38 tokens

alloydb-basics

Manages clusters, instances, and backups for AlloyDB for PostgreSQL, and integrates with AlloyDB Model Context Protocol (MCP) tools for automated database operations. Use when creating, configuring, or administering AlloyDB databases. Do NOT use for general PostgreSQL instances (e.g. Cloud SQL) or other GCP databases.

google/skills · 72 tokens