Setup & Installation
Or with the ClawHub CLI, for registry-managed skill folders outside a full OpenClaw workspace:
What This Skill Does
Runs read-only queries against PostgreSQL or MySQL databases using connection environment variables. Supports SELECT, WITH, and EXPLAIN statements, and can export results to CSV, TSV, or JSON. Blocks any SQL that would modify data.
Enforcing read-only at the skill level prevents accidental data modification when exploring live databases.
When to use it
- Counting rows in a production table without risking writes
- Exporting a user segment to CSV for analysis
- Inspecting table schema before writing a migration
- Sampling recent records to debug an application issue
- Running EXPLAIN on a slow query to check the execution plan
Example Workflow
Here's how your AI assistant might use this skill in practice.
User asks: export all orders from the last 7 days to a CSV file
- 1Identify the target database type (PostgreSQL or MySQL) from context
- 2Construct a SELECT query with a date filter and appropriate LIMIT
- 3Run scripts/db_readonly.sh with --format csv and --out flags
- 4Confirm the output file path and row count to the user
A CSV file at the specified path containing matching order rows
Requirements
Accounts, API keys, or tools you or your AI assistant may need to set up while using this skill.