introspect
Installation
SKILL.md
introspect (Tier-1 — live read-only)
Tier 0 reads files. Many checks need runtime truth a file cannot give: real index usage, FK-without-index joins, table/row sizes, RLS state, extensions, engine version, autovacuum/wraparound state. introspect is the only path to that, and it is read-only by contract. See references/data-tiers.md.
Connection path (prefer MCP)
- DB MCP server (preferred) — cleaner permission boundary. Use only read-class tools whose names match
*query*/*read*/*list*/*describe*/*schema*. A generic write-capablequerytool is routed through the same read-only validator below; a PreToolUse hook onmcp__.*backs this up. List available tools first; never call a tool that mutates. - Else a least-privilege read-only connection string read from
$DATABASE_URLin the environment — never echoed, never written into a finding.redactSecrets()scrubs any credential that reaches a finding, report, or log. - Neither available → emit
status: needs_apion every dependent check with the reason and the minimal grant needed. Never silently pass and never fabricate row counts, sizes, or plans.
Read-only contract (enforced before any query)
SET default_transaction_read_only = on;- a bounded
statement_timeout(e.g.SET statement_timeout = '15s';). - only
SELECT/EXPLAIN(noANALYZEwrite side effects beyond plan) / catalog reads. Reject anything else.
Catalogs read (no row data)
- Postgres:
version(),information_schema,pg_catalog,pg_class,pg_index,pg_indexes,pg_constraint,pg_policies,pg_extension. Tier-2 addspg_stat_user_indexes/pg_stat_user_tables,pg_stat_statements,age(datfrozenxid). - MySQL/MariaDB:
information_schema(TABLES, STATISTICS, KEY_COLUMN_USAGE),SHOW ENGINE INNODB STATUS(read). - Mongo:
db.stats(),$indexStats,$collStats(Tier-2). - Cassandra:
system_schema,nodetool tablehistograms(Tier-2).