Overview
PostgreSQL Database is the postgres skill from sanjay3290/ai-skills, a collection of portable Agent Skills that work in Claude Code, Gemini CLI, Cursor, Codex CLI, Goose, and other clients that follow the Agent Skills standard. It lets an agent run read-only SQL against one or more configured PostgreSQL databases through a small Python script, so you can ask questions about your data in plain language without giving the agent write access.
Key Features
- Multiple connections with descriptions. Each database in
connections.jsonhas adescriptionfield ("users, orders, transactions"). The agent matches your question to that text to pick the right database, and runs--listand asks you when intent is unclear. - Defense in depth. The session is opened in PostgreSQL
readonly=Truemode, and queries are also validated: onlySELECT,SHOW,EXPLAIN, andWITHare allowed, and multiple statements in one call are rejected. - Guard rails. A 30-second statement timeout, a 10,000-row cap per query, a 100-character column width cap, and error messages that do not echo credentials.
- Configurable SSL via
sslmode(disablethroughverify-full).
Quick Start
- Install the collection. In Claude Code:
/plugin marketplace add sanjay3290/ai-skills, then/plugin install ai-skills@ai-skills. - Install the Python dependency:
pip install -r requirements.txt(psycopg2-binary, Python 3.8+). - Create
connections.jsonin the skill folder or at~/.config/claude/postgres-connections.json, thenchmod 600it because it holds passwords. - Ask the agent, or call the script directly:
python3 scripts/query.py --list
python3 scripts/query.py --db production --tables
python3 scripts/query.py --db production --schema
python3 scripts/query.py --db production --query "SELECT * FROM orders" --limit 100
Use Cases
- Exploring an unfamiliar schema before writing a migration or feature.
- Answering ad hoc analytics questions against a replica.
- Checking what data exists while debugging, without leaving the terminal.
Limitations
- Credentials sit in a plain JSON file; use a dedicated read-only database user and restrict file permissions.
- Only PostgreSQL. The same repository ships separate
mysqlandmssqlskills. - Read-only by design, so it cannot run migrations or fix data.
FAQ
Can the agent modify my data with this skill?
No. The connection is opened read-only and the script rejects anything other than SELECT, SHOW, EXPLAIN, and WITH statements.
Where does the skill look for connection settings?
In connections.json inside the skill directory, or in ~/.config/claude/postgres-connections.json.
Alternatives
- Supabase and Neon are hosted Postgres platforms with their own agent tooling.
- MySQL if your data lives in MySQL instead; the same repository offers a matching
mysqlskill.
Source: postgres skill on GitHub. More in Skills and the database tag.
Comments
No comments yet. Be the first to comment!
Related Tools
Related Insights

Anthropic Subagent: The Multi-Agent Architecture Revolution
Deep dive into Anthropic multi-agent architecture design. Learn how Subagents break through context window limitations, achieve 90% performance improvements, and real-world applications in Claude Code.
How to pick an AI coding CLI for your repo
Match Claude Code, Codex CLI, OpenCode, Pi, omp, DeepSeek Harness, and Grok Build to the work you actually run. Docs rechecked 2026-10-06.
Skills + Hooks + Plugins: How Anthropic Redefined AI Coding Tool Extensibility
An in-depth analysis of Claude Code's trinity architecture of Skills, Hooks, and Plugins. Explore why this design is more advanced than GitHub Copilot and Cursor, and how it redefines AI coding tool extensibility through open standards.