buchananwill/ue-claude-scaffold/postgres-schema-indexing
Claude Code and agent skill by buchananwill/ue-claude-scaffold
Trust tier 2
- community
Source check pending
Checking that the SKILL.md file is still in the repository.
PostgreSQL data types, index strategies, schema constraints, and diagnostic queries. Based on Supabase best practices.
Install
npx vskill@latest install buchananwill/ue-claude-scaffold/postgres-schema-indexingSKILL.md
The same SKILL.md was published earlier as buchananwill/ue-claude-scaffold/postgres-schema-indexing.
PostgreSQL Schema and Indexing
Data types, index strategies, and schema design for PostgreSQL.
When to Activate
- Designing database schemas
- Choosing data types for columns
- Adding or reviewing indexes
- Troubleshooting slow queries
Data Type Reference
| Use Case | Correct Type | Avoid | |
|---|---|---|---|
| IDs | bigint (or UUIDv7) | int, random UUID as PK | |
| Strings | text | varchar(255) without reason | |
| Timestamps | timestamptz | timestamp (no timezone) | |
| Money | numeric(12,2) | float, real, double precision | |
| Flags | boolean | varchar, int |
Index Cheat Sheet
| Query Pattern | Index Type | Example | |
|---|---|---|---|
WHERE col = value | B-tree (default) | CREATE INDEX idx ON t (col) | |
WHERE col > value | B-tree | CREATE INDEX idx ON t (col) | |
WHERE a = x AND b > y | Composite | CREATE INDEX idx ON t (a, b) | |
WHERE jsonb @> '{}' | GIN | CREATE INDEX idx ON t USING gin (col) | |
WHERE tsv @@ query | GIN (full-text) | CREATE INDEX idx ON t USING gin (col) | |
| Time-series ranges | BRIN | CREATE INDEX idx ON t USING brin (col) |
Index Patterns
Composite index order -- equality columns first, then range:
Covering index -- avoids table lookup:
Partial index -- smaller, faster:
Schema Constraints
- Always define PK, FK with
ON DELETEbehavior,NOT NULLwhere appropriate,CHECKconstraints - Use
lowercase_snake_caseidentifiers (no quoted mixed-case) - Always index foreign keys -- no exceptions
- Index columns referenced in RLS policies
Queue Processing Pattern
Diagnostic Queries
Anti-Patterns
SELECT *in production code- Random UUIDs as primary keys (use UUIDv7 or IDENTITY)
- OFFSET pagination on large tables (use cursor pagination)
- Unparameterized queries (SQL injection risk)
GRANT ALLto application users
Based on Supabase best practices (MIT License)
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/postgres-schema-indexing/SKILL.md
Popularity
- 7-day trend score
- 5
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/buchananwill/ue-claude-scaffold/postgres-schema-indexing)