postgresql
PostgreSQL relational database with JSONB, CTEs, window functions, and extensions. Use for SQL queries.
Best use case
postgresql is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
PostgreSQL relational database with JSONB, CTEs, window functions, and extensions. Use for SQL queries.
Teams using postgresql should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/postgresql/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How postgresql Compares
| Feature / Agent | postgresql | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
PostgreSQL relational database with JSONB, CTEs, window functions, and extensions. Use for SQL queries.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# PostgreSQL
PostgreSQL (Postgres) is a powerful, open-source object-relational database system. It is known for its reliability, feature robustness (JSONB, GIS, Full Text Search), and performance.
## When to Use
- **Primary Database**: The default choice for almost any modern application (Django, Rails, Node).
- **Complex Data**: When you need Relational + JSON (NoSQL) + Geo-spatial (PostGIS) in one DB.
- **Data Integrity**: When strictly typed schemas and ACID compliance are critical.
## Quick Start
```sql
-- JSONB column usage
CREATE TABLE events (
id SERIAL PRIMARY KEY,
data JSONB
);
INSERT INTO events (data) VALUES ('{"type": "login", "user": "alice"}');
-- Query JSON directly (indexing supported)
SELECT * FROM events WHERE data->>'user' = 'alice';
```
## Core Concepts
### JSONB
Binary JSON storage. Faster to process and allows indexing.
```sql
CREATE INDEX idx_data ON events USING GIN (data);
```
### Common Table Expressions (CTEs)
Readable complex queries using `WITH`.
```sql
WITH regional_sales AS (
SELECT region, SUM(amount) AS total_sales
FROM orders
GROUP BY region
)
SELECT * FROM regional_sales WHERE total_sales > (SELECT SUM(total_sales)/10 FROM regional_sales);
```
### MVCC (Multi-Version Concurrency Control)
Postgres handles simultaneous access by keeping multiple versions of a row. Readers don't block writers, and writers don't block readers.
## Best Practices (2025)
**Do**:
- **Use `pgvector`**: For AI/ML vector embeddings storage (Postgres 17+ optimizations).
- **Use `GENERATE_SERIES`**: Great for generating test data or filling gaps in time-series reports.
- **Tune `work_mem`**: Default is low (4MB). Increase specific session `work_mem` for complex complex sort/hash operations.
**Don't**:
- **Don't use `NOT IN` with NULLs**: It often behaves counter-intuitively. Use `NOT EXISTS`.
- **Don't skip VACUUM**: Although autovacuum is good, heavy write loads may need tuning.
## References
- [PostgreSQL Documentation](https://www.postgresql.org/docs/current/)
- [Postgres Weekly](https://postgresweekly.com/)Related Skills
template
Expert [skill-name] assistance covering [feature 1], [feature 2], and [feature 3]. Use when [working with X], [debugging Y], or [implementing Z].
zsh
Zsh shell with oh-my-zsh. Use for terminal shell.
zed
Zed high-performance collaborative editor. Use for fast editing.
xcode
Xcode Apple development IDE with simulators. Use for iOS/macOS development.
webstorm
WebStorm JavaScript IDE with debugging. Use for web development.
webpack
Webpack module bundler with loaders and plugins. Use for bundling.
warp
Warp modern terminal with AI. Use for terminal work.
vscode
Visual Studio Code editor with extensions and debugging. Use for code editing.
vite
Vite fast build tool with HMR. Use for modern frontend builds.
visual-studio
Visual Studio IDE for Windows with debugging and profiling. Use for .NET development.
vim
Vim text editor with motions, macros, and plugins. Use for terminal editing.
turbopack
Turbopack Rust-powered bundler. Use for fast builds.