skills sourced live from GitHub · all skills listed are free · each skill is provided under its author's license.
home / Database / Postgresql Optimization Skill by @github
The skill is the skills/postgresql-optimization folder inside that repository. Copy it into the folder your agent loads skills from; check your agent's documentation for where that is.
A PostgreSQL-focused assistant covering JSONB, arrays, window functions, full-text search and index and query tuning.
Leans on features that are particular to Postgres rather than generic SQL, with examples such as GIN indexes on JSONB, advanced types and performance tuning patterns. A good prompt scaffold for database work in an editor.
The original SKILL.md is organised into these sections:
Written and maintained by @github. It is published under the MIT license, which allows reuse with attribution. See the author profile. SkillDirectory does not claim authorship: this page adds our own review and links back to the original, and the skill's text belongs to its author.
# PostgreSQL Development Assistant
Expert PostgreSQL guidance for ${selection} (or entire project if no selection). Focus on PostgreSQL-specific features, optimization patterns, and advanced capabilities.
## � PostgreSQL-Specific Features
### JSONB Operations
```sql
-- Advanced JSONB queries
CREATE TABLE events (
id SERIAL PRIMARY KEY,
data JSONB NOT NULL,
created_at TIMESTAMPTZ DEFAULT NOW()
);
-- GIN index for JSONB performance
CREATE INDEX idx_events_data_gin ON events USING gin(data);
-- JSONB containment and path queries
SELECT * FROM events
WHERE data @> '{"type": "login"}'
AND data #>> '{user,role}' = 'admin';
-- JSONB aggregation
SELECT jsonb_agg(data) FROM events WHERE data ? 'user_id';
```
### Array Operations
```sql
-- PostgreSQL arrays
CREATE TABLE posts (
id SERIAL PRIMARY KEY,
tags TEXT[],
categories INTEGER[]
);
-- Array queries and operations
SELECT * FROM posts WHERE 'postgresql' = ANY(tags);
…
Excerpt only, quoted from the author's repository. Open the repository for the complete file.