Claude Code Postgres — Data skill for Claude Code
Query a real PostgreSQL database in plain English from the terminal with Claude Code, safely: read-only role first, read the SQL, honest about what leaves your machine.
How to install Claude Code Postgres
This entry records only its repository, not the path inside it, so there is no
exact command to give. Open kyle-chalmers/claude-code-postgres and copy the folder into
~/.claude/skills/, or the file into ~/.claude/agents/.
What Claude Code Postgres does
Query a real PostgreSQL database in plain English from the terminal with Claude Code, safely: read-only role first, read the SQL, honest about what leaves your machine. Companion to the video.
Alternatives in Data
- Claude Code Usage Monitor — by Maciek-roboblog - A real-time terminal-based tool for monitoring Claude Code token usage 7k ★
- 06 Ink React Terminal UI — Prompt 06: Verify and Fix the Ink/React Terminal UI Pipeline 2.3k ★
- Knowledge Pipeline — Terminal-vibe sunum + LLM-Wiki skill'i. Ham sohbetleri, şemayla disipline edilen büyüyen bir wiki'ye dönüştürm 149 ★
README
Claude Code + PostgreSQL: query your database in plain English, safely
Point [Claude Code](https://www.anthropic.com/claude-code) at a real PostgreSQL database, ask questions in plain English, and read the answers, without ever giving the agent the power to change a single row or read a raw personal record. The safe version puts the guardrails at the database:
- Create a read-only role first so the agent cannot write to, drop, or delete your data. The database enforces it, not the model's good behavior.
- Put a curated, PII-safe schema in front of it (see Connect to PII safely) so it analyzes real data without ever reading raw personal values: hash what it must join on, drop the rest.
- Read the SQL it writes before it runs. A strong model rarely produces broken SQL; the quieter failure is correct SQL that answers the wrong question.
- Be honest about what leaves your machine. When the database is in the cloud the SQL runs on the provider's server (your local
psqlonly sends the query text and receives rows), and your question, the schema, and the result rows go on to a separate model API.

This repo is the companion to the video. It gives you a small sample database, the exact read-only role commands, and the prompts to try, so you can reproduce the whole thing in a few minutes.
Channel: [Kyle Chalmers Data Plus AI](https://www.youtube.com/@kylechalmersdataai)
How it connects (official-first)
`psql` is PostgreSQL's official, first-party command-line client. It ships with Postgres, so there is nothing third-party between Claude Code and your database, even when that database is a managed cloud one (Neon, Supabase, Amazon RDS or Aurora, Google Cloud SQL, Azure Database for PostgreSQL, Render, Railw
Related Skills
DB LLM Skills
A globally-installed engine for letting an LLM access PostgreSQL safely: read-only role provisioning, a pg_cat
Openfoia
Local-first FOIA automation with AI-powered document analysis. Your data never leaves your machine. 🔒🇺🇸
Explain SQL
Review one SQL query via guided intake - validation, clause-by-clause breakdown, business layer, scorecard, ri
Data Pipeline Commentary Agent
An AI automation built with n8n and the Claude API: it watches a PostgreSQL table and a folder for new data, a
Text To SQL Agent
An AI agent that turns plain-English questions into validated SQL, executes them, and returns the answer which
AI Stock Analyst
Turn a plain-English request ("compare Apple and Microsoft YTD") into a validated stock chart — a CrewAI multi
Related Agents
Text Slop Cleaner
This agent should be invoked to remove machine sounding text and unnecessary comments. This includes rewriting
DB Postgres Expert
Expert PostgreSQL DBA for pure PostgreSQL environments. Use for database design, query optimization, indexing
Postgres Optimizer
Use this agent when you need expert PostgreSQL database optimization,