Skip to content

DB Readonly

Verified

Run safe read-only queries against MySQL or PostgreSQL for data inspection, reporting, and troubleshooting. Use when the user asks to read tables, inspect schema, count rows, sample data, or export query results without modifying data.

430 downloads
$ Add to .claude/skills/

About This Skill

# db-readonly

Use this skill for database read tasks only.

What this skill does

  • Connect to PostgreSQL or MySQL using connection env vars
  • Execute SELECT / WITH / EXPLAIN queries only
  • Optionally save output to CSV/TSV/JSON
  • Block risky SQL (`INSERT`, `UPDATE`, `DELETE`, `DROP`, `ALTER`, etc.)

Connection env vars

PostgreSQL

  • `PGHOST`
  • `PGPORT` (optional, default 5432)
  • `PGDATABASE`
  • `PGUSER`
  • `PGPASSWORD`

MySQL

  • `MYSQL_HOST`
  • `MYSQL_PORT` (optional, default 3306)
  • `MYSQL_DATABASE`
  • `MYSQL_USER`
  • `MYSQL_PASSWORD`

Run

Use script:

  • `scripts/db_readonly.sh postgres "SELECT now();"`
  • `scripts/db_readonly.sh mysql "SELECT NOW();"`

Export example:

  • `scripts/db_readonly.sh postgres "SELECT * FROM users LIMIT 100" --format csv --out /tmp/users.csv`

Safety rules

  1. Refuse non-read SQL.
  2. Prefer `LIMIT` for exploratory queries.
  3. When user asks for updates/deletes/schema changes, ask explicit confirmation and do not run via this skill.
  4. Avoid printing secrets from env vars.

Reference

  • Query cookbook: `references/query-cookbook.md`

Use Cases

  • Query production databases safely with enforced read-only access controls
  • Run analytics queries against live data without risk of accidental writes
  • Investigate data issues in production by exploring tables and relationships
  • Generate reports from production data with guaranteed no-mutation safety
  • Enable AI agents to answer data questions without write access to production

Pros & Cons

Pros

  • +Read-only enforcement prevents accidental data modification in production
  • +Enables safe production database access for AI agents and junior developers
  • +Reduces the risk surface of giving database access to automated systems

Cons

  • -Read-only limitation means you cannot fix data issues — only identify them
  • -Only available on claude-code and openclaw platforms
  • -Complex queries on production may impact performance without query limits

FAQ

What does DB Readonly do?
Run safe read-only queries against MySQL or PostgreSQL for data inspection, reporting, and troubleshooting. Use when the user asks to read tables, inspect schema, count rows, sample data, or export query results without modifying data.
What platforms support DB Readonly?
DB Readonly is available on Claude Code, OpenClaw.
What are the use cases for DB Readonly?
Query production databases safely with enforced read-only access controls. Run analytics queries against live data without risk of accidental writes. Investigate data issues in production by exploring tables and relationships.

100+ free AI tools

Writing, PDF, image, and developer tools — all in your browser.

Next Step

Use the skill detail page to evaluate fit and install steps. For a direct browser workflow, move into a focused tool route instead of staying in broader support surfaces.