database-scout

SkillDatabases & data

Lets your agent explore SQL databases by listing tables, inspecting schemas, previewing data, and running read-only queries.

Available today. Use it from your connected AI after setup.

Connect ahel once, and every AI you use reads what you have installed.

Then ask your AI: use the database-scout skill

About this capability

Explore SQLite and PostgreSQL databases: list tables, inspect schemas (columns/types/constraints), preview data, generate Mermaid ER diagrams, and run safe read-only queries. Triggered by requests to explore a database, view table structures, describe tables, generate diagrams, or query data, and by

What this skill tells your AI

The instructions your AI receives, as published by zebbern/claude-code-guide in skills/database-scout/SKILL.md and read by ahel’s review.

Read-only exploration tool for SQLite / PostgreSQL databases — inspect table schemas, preview data, generate ER diagrams, and run safe queries.

Feature Overview

FeatureDescription
List all tablesShow tables and views in the database, with row counts
Inspect table schemaColumn names, types, constraints (PK/FK/NOT NULL), indexes, defaults
Data previewView the first N rows of a table
ER diagram generationOutput Mermaid erDiagram syntax, ready to render
Safe read-only queriesOnly SELECT/WITH/EXPLAIN allowed; write operations are blocked

Security Mechanisms

  • Connection-level read-only: SQLite opens with ?mode=ro URI; PostgreSQL uses SET SESSION READ ONLY
  • SQL whitelist: Only statements starting with SELECT / WITH / EXPLAIN / PRAGMA / SHOW are allowed
  • Dangerous keyword blocking: INSERT, UPDATE, DELETE, DROP, ALTER, CREATE, and 30+ other keywords are blocked
  • Multi-statement blocking: Semicolon-separated multiple SQL statements are rejected (prevents injection)
  • Identifier escaping: Table names are double-quote escaped to prevent SQL injection

Quick Start

# List all tables in a SQLite database
python3 scripts/db_explorer.py --db-path data.db list-tables

# Inspect table schema
python3 scripts/db_explorer.py --db-path data.db describe users

# Preview data (default 20 rows)
python3 scripts/db_explorer.py --db-path data.db preview orders --limit 10

# Generate Mermaid ER diagram
python3 scripts/db_explorer.py --db-path data.db er-diagram

# Run a read-only query
python3 scripts/db_explorer.py --db-path data.db query "SELECT name, age FROM users WHERE age > 18 LIMIT 10"

PostgreSQL

# Connect to PostgreSQL
python3 scripts/db_explorer.py --db-type postgres --dsn "host=localhost dbname=mydb user=reader" list-tables

# Inspect table schema
python3 scripts/db_explorer.py --db-type postgres --dsn "host=localhost dbname=mydb user=reader" describe orders

Detailed Usage

Parameters

ParameterRequiredDefaultDescription
--db-typeNosqliteDatabase type: sqlite or postgres
--db-pathYes (for SQLite)Path to the SQLite database file
--dsnYes (for PostgreSQL)PostgreSQL connection string

Subcommands

CommandDescriptionExample
list-tablesList all tables/viewslist-tables
describe <table>Show detailed table schemadescribe users
preview <table> [--limit N / -n N]Preview the first N rowspreview orders --limit 5
er-diagramGenerate Mermaid ER diagramer-diagram
query "<sql>"Run a read-only SQL queryquery "SELECT count(*) FROM users"

Output Examples

list-tables

[
  {"name": "users", "type": "table", "row_count": 1500},
  {"name": "orders", "type": "table", "row_count": 8200},
  {"name": "user_stats", "type": "view", "row_count": 1500}
]

describe

{
  "table": "orders",
  "row_count": 8200,
  "columns": [
    {"cid": 0, "name": "id", "type": "INTEGER", "notnull": true, "default": null, "primary_key": true},
    {"cid": 1, "name": "user_id", "type": "INTEGER", "notnull": true, "default": null, "primary_key": false},
    {"cid": 2, "name": "amount", "type": "REAL", "notnull": false, "default": "0.0", "primary_key": false}
  ],
  "foreign_keys": [
    {"from": "user_id", "to_table": "users", "to_column": "id"}
  ],
  "indexes": [
    {"name": "idx_orders_user_id", "unique": false, "columns": ["user_id"]}
  ]
}

er-diagram (Mermaid)

erDiagram
    users {
        INTEGER id PK
        TEXT name
        TEXT email
        INTEGER age
    }
    orders {
        INTEGER id PK
        INTEGER user_id FK
        REAL amount
        TEXT created_at
    }
    users ||--o{ orders : "user_id"

Dependencies

  • Python 3.8+ (sqlite3 is a built-in module)
  • PostgreSQL support requires: pip install psycopg2-binary

Signals

GitHub stars
5k
Forks
463
Last commit
Sep 2026

ahel review

  • K1binfo
    installs-packages
  • K1binfo
    installs-packages (in scripts/db_explorer.py)

Automated review, not a security audit. Ruleset v1+k2.

Advanced
Catalog kind
skill
Gateway key
database-scout
Source
github.com/zebbern/claude-code-guide