Database verification

From vladkesler/initrunner · View interactive version

Database verification is an AI agent skill from the GitHub repository vladkesler/initrunner. Shell-based database connectivity and integrity checks. Verifies that databases are reachable, schemas match expectations, and data integrity constraints hold.

How to use this skill

Skill file

Database verification skill using standard database CLI tools.

When to activate

Use this skill when tests fail with connection errors or timeouts to a

database, when database-related tests exist in the test suite, when

docker-compose or similar configs define database services, or when a

migration has recently been applied and needs verification.

Connectivity checks

Test reachability before running any data queries. Each database has its

own tool:

PostgreSQL

pg_isready -h host -p 5432

Returns exit code 0 if accepting connections. For authenticated check:

psql -h host -p 5432 -U user -d dbname -c "SELECT 1"

Redis

redis-cli -h host -p 6379 ping

Expected response: PONG.

SQLite

sqlite3 /path/to/file.db ".tables"

Returns the list of tables. A missing file or corrupt database produces

an error.

MySQL / MariaDB

mysql -h host -u user -p -e "SELECT 1"

Or check just connectivity:

mysqladmin -h host -u user ping

MongoDB

mongosh --host host --port 27017 --eval "db.runCommand({ ping: 1 })"

Schema verification

After connectivity is confirmed:

  1. Tables exist -- query the information schema or equivalent to list

tables; compare against expected table names.

  1. Columns match -- for each critical table, list columns and types;

verify expected columns are present with correct types.

  1. Indexes present -- check that performance-critical indexes exist

(primary keys, foreign key indexes, unique constraints).

  1. Constraints -- verify NOT NULL, UNIQUE, and foreign key constraints

are in place on the relevant columns.

Data integrity

empty when they should be populated).

to existing rows (no orphaned records).

happen if constraints were added after data).

constraints might be missing.

Migration status

  1. Check for a migration tracking table (alembic_version, schema_migrations,

django_migrations, knex_migrations, etc.).

  1. Read the latest applied migration version or timestamp.
  2. Compare against the latest migration file in the source tree.
  3. Report whether migrations are up to date, behind, or in a dirty state.

Docker database health

When databases run in containers:

docker-compose ps          # check service status
docker exec <container> pg_isready -U postgres
docker logs --tail 20 <container>    # recent errors
docker inspect --format='{{.State.Health.Status}}' <container>

Verify the health check status is "healthy" before proceeding with

further checks.

MUST

clear "cannot connect" message rather than cryptic SQL errors

report "pg_isready not found; install postgresql-client to enable

PostgreSQL connectivity checks" rather than failing silently

MUST NOT

read-only

sensitive portions

first and report clearly if it is missing

LIMIT or COUNT queries instead

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.