postgresql-query
Execute SQL queries, manage schemas, and perform data operations using PostgreSQL at {{POSTGRES_HOST}}:{{POSTGRES_PORT}}.
Best use case
postgresql-query is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Execute SQL queries, manage schemas, and perform data operations using PostgreSQL at {{POSTGRES_HOST}}:{{POSTGRES_PORT}}.
Teams using postgresql-query 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-query/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How postgresql-query Compares
| Feature / Agent | postgresql-query | 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?
Execute SQL queries, manage schemas, and perform data operations using PostgreSQL at {{POSTGRES_HOST}}:{{POSTGRES_PORT}}.
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 Query
PostgreSQL is available at `{{POSTGRES_HOST}}:{{POSTGRES_PORT}}` within the Docker network.
## Running SQL Queries
```bash
# Execute a query
PGPASSWORD=$POSTGRES_PASSWORD psql -h {{POSTGRES_HOST}} -p {{POSTGRES_PORT}} -U {{POSTGRES_USER}} -d {{POSTGRES_DB}} \
-c "SELECT * FROM users LIMIT 10;"
# Execute from a SQL file
PGPASSWORD=$POSTGRES_PASSWORD psql -h {{POSTGRES_HOST}} -p {{POSTGRES_PORT}} -U {{POSTGRES_USER}} -d {{POSTGRES_DB}} \
-f /data/queries/report.sql
```
## Creating Tables
```bash
PGPASSWORD=$POSTGRES_PASSWORD psql -h {{POSTGRES_HOST}} -p {{POSTGRES_PORT}} -U {{POSTGRES_USER}} -d {{POSTGRES_DB}} -c "
CREATE TABLE IF NOT EXISTS documents (
id SERIAL PRIMARY KEY,
title TEXT NOT NULL,
content TEXT,
embedding vector(384),
created_at TIMESTAMPTZ DEFAULT NOW()
);"
```
## Importing and Exporting Data
```bash
# Export to CSV
PGPASSWORD=$POSTGRES_PASSWORD psql -h {{POSTGRES_HOST}} -p {{POSTGRES_PORT}} -U {{POSTGRES_USER}} -d {{POSTGRES_DB}} \
-c "\COPY (SELECT * FROM users) TO '/data/output/users.csv' WITH CSV HEADER"
# Import from CSV
PGPASSWORD=$POSTGRES_PASSWORD psql -h {{POSTGRES_HOST}} -p {{POSTGRES_PORT}} -U {{POSTGRES_USER}} -d {{POSTGRES_DB}} \
-c "\COPY users FROM '/data/input/users.csv' WITH CSV HEADER"
```
## Tips for AI Agents
- Always use parameterized queries to prevent SQL injection.
- Use `\dt` to list tables, `\d table_name` to describe a table schema.
- Use transactions (`BEGIN; ... COMMIT;`) for multi-step operations.
- Use `EXPLAIN ANALYZE` to understand query performance.
- The pgvector extension enables vector similarity search.Related Skills
supabase-query
Interact with Supabase for database, auth, and storage
prometheus-query
Query metrics and set up alerts using Prometheus at {{PROMETHEUS_HOST}}:{{PROMETHEUS_PORT}}.
llamaindex-query
Build data-connected LLM applications with LlamaIndex
graphql-query
Query GraphQL APIs using curl.
gemini-cli-query
Query Google Gemini models via the Gemini CLI.
youtube-growth
Act as an expert YouTube Strategy Consultant. Apply the Creator Unlock N.I.C.E.R. Framework for conducting channel audits, niche validation, and data-backed video ideation/thumbnail generation.
xyops-automate
Build and manage automation pipelines using xyOps at {{XYOPS_HOST}}:{{XYOPS_PORT}}.
xml-parse
Parse and transform XML/HTML documents using command-line tools in the shared volume at {{SHARED_VOLUME}}.
woodpecker-ci
Lightweight container-native CI/CD with Woodpecker
whisper-transcribe
Transcribe audio and video files to text using the Whisper speech-to-text API at {{WHISPER_HOST}}:{{WHISPER_PORT}}.
web-interface-guidelines
Checklist for reviewing UI code for compliance with comprehensive web interface, accessibility, performance, and content guidelines — based on Vercel's Web Interface Guidelines.
web-design-reviewer
Inspect web interfaces for layout, responsive, accessibility, and visual issues, then apply targeted source code fixes and re-verify results.