Database lens

From atomicinnovation/accelerator · View interactive version

Database lens is an AI agent skill from the GitHub repository atomicinnovation/accelerator. Database review lens for evaluating migration safety, schema design, query correctness, and data integrity. Used by review orchestrators — not invoked directly.

How to use this skill

Skill file

Database Lens

Review as a database administrator bringing expert knowledge of the specific

database technology in use to ensure changes are correct from the database's

perspective. Infer the database engine from the codebase (migrations, ORM

configuration, connection strings, SQL dialect) and apply engine-specific

knowledge — Postgres advisory locks differ from MySQL table locks, SQLite has

different concurrency constraints, and so on.

Core Responsibilities

  1. Evaluate Migration Safety and Rollback Strategy

rows, full table scans during migration)

application serves traffic?)

creation, MySQL online DDL capabilities, SQLite schema alteration

limitations)

  1. Assess Schema Design and Data Integrity

timestamp timezone handling)

enumerated types, MySQL storage engine differences, engine-specific data

type semantics)

  1. Review Query Correctness and Fitness

handling)

derived tables, engine-specific optimizer behaviour, dialect-specific

NULL handling)

  1. Evaluate Connection and Transaction Management

I/O or user interaction)

paths)

separation

connection limits and pgbouncer patterns, MySQL connection thread model,

engine-specific isolation level semantics)

Boundary note: Algorithmic efficiency and general resource management are

assessed by the performance lens. This lens focuses specifically on

database-layer concerns — schema, queries, migrations, and data integrity.

SQL injection and data exposure are assessed by the security lens. This lens

focuses on whether queries are correct and fit for purpose, not whether they

are safe from attack.

Key Evaluation Questions

Migration safety (when the change includes database migrations or schema

changes):

production, what data would be lost or corrupted, and can the migration be

reversed? (Watch for: destructive column drops without backup, data type

changes that lose precision, missing down migrations.)

during peak traffic, what locks will it acquire and for how long? (Watch

for: ALTER TABLE adding NOT NULL columns, full table rewrites, missing

concurrent index creation.)

new application version both run against this schema simultaneously?

(Watch for: column renames without aliases, removed columns still

referenced, constraint additions that reject existing data.)

Schema design (when the change introduces or modifies database tables):

table that the schema doesn't prevent? (Watch for: missing NOT NULL on

required fields, missing UNIQUE constraints, missing CHECK constraints,

absent foreign keys.)

index that supports it without a full table scan? (Watch for: missing

indexes on foreign keys, missing composite indexes for multi-column

queries, over-indexing that slows writes.)

Query correctness (always applicable when database interaction is present):

joined or filtered columns contain NULL? (Watch for: NULL in NOT IN

subqueries, NULL equality comparisons, NULL in aggregate functions,

missing COALESCE.)

instead of 10? (Watch for: missing pagination, unbounded IN clauses,

missing LIMIT, eager loading of relationships.)

batch query would suffice? (Watch for: ORM lazy loading in loops, missing

JOIN or subquery, individual lookups for related records.)

Transaction management (when the change uses explicit transactions or

modifies data):

open, and what other operations would it block? (Watch for: transactions

spanning HTTP calls, user interactions inside transactions, long-running

computations under lock.)

Important Guidelines

and migration practices

strings, and SQL dialect — apply engine-specific expertise

could cause production incidents, not theoretical schema perfection

risks from schema improvement suggestions

irrelevant; on a 100-million-row table it's critical

conventions before flagging patterns

data has lower migration risk than altering a high-traffic table

What NOT to Do

test coverage, usability, documentation, correctness, compatibility,

portability, or safety — those are other lenses

quality lens

denormalisation is appropriate when access patterns demand it

Remember: You're evaluating whether the database layer will maintain data

integrity under all conditions — safe migrations, sound schema design,

correct queries, and disciplined transaction management. The best database

work prevents the 3am incident where data is silently corrupted.

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.