Sponsored byOutsenseAI that finds your next clients
SponsorGROUOutbound, LinkedIn content and leads for B2B teamsSponsorOutsenseAI that finds your next clientsAd+Your tool hereSeen by people installing AI tools@Weekly picksThe best new tools, one email a week

postgres-readonly-queries

Skill by sickn33

Runs safe, read-only SQL queries against configured PostgreSQL databases, with support for multiple connections and write protection. Built for people who want an AI assistant to explore schemas and query data without changing it.

  • Score 89
  • 50k stars
  • MIT
  • Updated
Works withClaude CodeClaude apps Antigravity CLI

Install postgres-readonly-queries

Built from the published package, never by AI.

git clone --depth 1 https://github.com/sickn33/agentic-awesome-skills /tmp/agentic-awesome-skills && mkdir -p ~/.claude/skills && cp -r /tmp/agentic-awesome-skills/skills/postgres-readonly-queries ~/.claude/skills/postgres-readonly-queries

Run in your terminal. Claude Code loads skills from ~/.claude/skills automatically.

Step-by-step: install postgres-readonly-queries in Claude Code

Skills can run scripts on your machine. Some need an API key: check the README.

About

postgres-readonly-queries is an agent skill that lets an AI assistant run read-only SQL queries against PostgreSQL databases. Databases are defined in a connections.json file. A Python script (scripts/query.py) lists configured databases, shows tables and schemas, and runs queries with an optional row limit. The skill picks a database by matching the user's request to each database's description.

Safety measures include a read-only PostgreSQL session, conservative keyword and semicolon checks that reject multiple statements, a 30-second statement timeout, a display cap of 10,000 rows, and error messages that do not leak passwords. The source says these checks are not a SQL parser or an authorization boundary, so it recommends a database role with read-only permissions as the main control. It is aimed at users who need controlled access to PostgreSQL data from an AI assistant.

Written from the project's SKILL.md and checked against it.

What it can do

  • Run read-only queriesExecutes a single SQL statement against a chosen configured PostgreSQL database.
  • List configured databasesShows the database names and descriptions defined in the connections file (--list).
  • List tablesLists the tables in a selected database (--tables).
  • Show schemaDisplays the schema of a selected database (--schema).
  • Limit resultsCaps the number of rows returned with the --limit option.
  • Select database by intentMatches the user's request to a database description to choose the right connection.
  • Multiple connectionsSupports several named database connections in one configuration file.

What you need

  • Python 3.8 or later
  • psycopg2-binary Python package
  • PostgreSQL database credentials

Try asking

  • Use postgres-readonly-queries to list the tables in the production database.
  • Show the schema of the analytics database and summarize the main tables.
  • Query the last 100 orders from the sales database with a limit of 100.

Good to know

  • Keyword and semicolon checks are conservative and are not a SQL parser or authorization boundary.
  • Read-only protections cannot override database server policy, triggers, extensions, or an over-privileged account.
  • Query results can contain personal, confidential, or regulated data.
  • Display output is capped at 10,000 rows, but the client or server may still buffer a much larger result.

Security check

A

No download-and-run commands, hidden instructions or signs of sending keys out were found.

Checked automatically: skills/postgres-readonly-queries/SKILL.md, skills/postgres-readonly-queries/scripts/query.py. This looks for known risky patterns and is not a full audit. How grades work

Inside the skill

  • README.md2 KB
  • SKILL.md5 KB
  • connections.example.json939 B
  • requirements.txt26 B
  • scripts/query.py9 KB

Alternatives to postgres-readonly-queries

All alternatives →
hugging-face-datasetssickn33
94

Creates, configures and manages datasets on the Hugging Face Hub, including SQL-based querying and transformation. Built for people who edit dataset content and metadata directly, alongside the HF MCP server.

AAA Skill 50k
db-repairgarrytan
94

Diagnoses and repairs gbrain's Postgres access when a command or MCP result shows a GBRAIN_DB_ACCESS marker, or when the operator reports the brain database is down. It runs the hardcoded gbrain db-repair ladder and verifies the result with a re-probe.

AAA Skill 34k
alloydb-basicsgoogle
94

Manages clusters, instances, and backups for AlloyDB for PostgreSQL. Built for creating, configuring, and administering AlloyDB databases, not general PostgreSQL or Cloud SQL instances.

AAA Skill 26k
clickhouse-logs-queriessupabase
94

Writes, reviews and migrates Supabase logs queries against the ClickHouse logs table served by the logs.all.otel endpoint. Built for developers who write Logs Explorer SQL or convert older BigQuery logs queries.

AAA Skill 116k
fix-slow-queriespaperclipai
94

Diagnoses and fixes slow Paperclip PostgreSQL queries using Cloud and Neon evidence, local benchmarks, regression tests, and a pull request with passing checks. Built for engineers working on Paperclip.

AAA Skill 119k
prisma-8prisma
94

Guides AI assistants through Prisma 8 projects built on @prisma/orm-postgres, @prisma/orm-sqlite, or @prisma/orm-mongo. It covers data contracts, migrations, typed queries and runtime setup for developers on Prisma 8.

AAA Skill 48k

Compare with hugging-face-datasets, db-repair or alloydb-basics

postgres-readonly-queries: common questions

Can this skill change data in my PostgreSQL database?

The source says it uses a read-only session and rejects multiple statements. It also says these protections reduce accidental writes but cannot override server policy or an over-privileged account, so a read-only database role is the primary control.

Is EXPLAIN ANALYZE safe to run with this skill?

No. The source says EXPLAIN ANALYZE actually executes its query, so it should be treated as a real execution.

How are database credentials handled?

The source says the connections file holds credentials and should be kept out of version control with restricted file permissions. It also says error messages do not leak passwords.

How do I install postgres-readonly-queries?

Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.

Is postgres-readonly-queries free?

The code is published under the MIT licence. The service it connects to may have its own pricing.

Is postgres-readonly-queries safe to use?

It scores 89 of 100. Grades: maintenance A, licence A, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.

What are alternatives to postgres-readonly-queries?

Similar skills: hugging-face-datasets, db-repair, alloydb-basics, clickhouse-logs-queries.

postgres-readonly-queries Install

Add to stack

Loading.