Skip to content
Back to skills

Db Readonly

ASecurity

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.

  • 21 stars
  • 0 votes
  • 2 copies
  • 23 views
  • Added September 7, 2026
databasessqldatabase

Security analysis

A100/100

Pro scans all 3 files and shows the line behind each finding

Scanned September 7, 2026

npx -y skills add modbender/skill-library-mcp --skill db-readonly --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Db Readonly?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Db Readonly
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/modbender-db-readonly/badge)](https://www.skillsdirectory.com/skills/modbender-db-readonly)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: db-readonly
description: 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.
---

# 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`

Files in this skill

  • SKILL.md1.4 KB
  • references/query-cookbook.md906 B
  • scripts/db_readonly.sh2.9 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in databases →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.