agentleFS
mejbaurbaharmejbaurbahar/software-tester-skills/skills/database-testing/SKILL.md

database-testing

Skill1 starsChanged 52 days agoMITView on GitHub

Use when verifying data integrity, CRUD correctness at the persistence layer, migrations, transactions/concurrency, or query correctness/performance — SQL and NoSQL. Use whenever a bug claim needs to be confirmed against actual stored state, not just UI/API appearance.

6 other projects use a version of this, 1 of them edited.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

4 rules. 0 are common, 4 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 6 edited versions we read keep these.

  • 4

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Constraints: NOT NULL, UNIQUE, CHECK, foreign keys actually enforced — try to violate them directly (not just through the app) to confirm …

    line 18
  2. Distinctive:

    Run the migration against a copy of production-shaped data (realistic volume and edge-case rows), not just an empty dev DB.

    line 26
  3. Distinctive:

    Test the rollback, not just the forward migration — if it can't roll back cleanly, that's a deploy-risk finding worth flagging regardless …

    line 27
  4. Distinctive:

    Check backward compatibility during a rolling deploy: old app code + new schema, and new app code + old schema, for the window where both …

    line 28

“Common” is measured: kept by at least 6 in 10 of the 6 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Database Testing

Why this matters even if you're "just" a UI/API tester

The UI and API can both lie (cached, optimistic-UI, stale). The database is the source of truth. Before filing "data wasn't saved," check the actual row.

Core checks

  • CRUD correctness: create persists all fields with correct types/defaults; read returns exactly what was written (no silent truncation/encoding issues); update touches only intended fields (no accidental overwrite of untouched columns); delete behaves as documented (hard vs soft — check for a deleted_at/is_deleted column before assuming hard delete).
  • Constraints: NOT NULL, UNIQUE, CHECK, foreign keys actually enforced — try to violate them directly (not just through the app) to confirm the DB itself protects integrity, not only application code.
  • Referential integrity: deleting a parent — does it cascade, restrict, or orphan children? Verify it matches the intended business rule, not just "doesn't error."
  • Transactions: multi-step operations either fully commit or fully roll back on failure — kill/interrupt mid-transaction (or simulate via a forced error) and confirm no partial state persists.
  • Concurrency: two simultaneous writes to the same row — last-write-wins silently, or optimistic locking (version column) rejecting the stale write? Test with genuinely concurrent requests, not sequential ones with a sleep.
  • Deadlocks: under concurrent load touching overlapping rows, does the DB/app handle a deadlock by retrying, or does it hang/500?
  • Index correctness: a query that should use an index but does a full table scan is a latent performance bug — check with EXPLAIN/EXPLAIN ANALYZE.

Migration testing

  • Run the migration against a copy of production-shaped data (realistic volume and edge-case rows), not just an empty dev DB.
  • Test the rollback, not just the forward migration — if it can't roll back cleanly, that's a deploy-risk finding worth flagging regardless of whether anyone asked.
  • Check backward compatibility during a rolling deploy: old app code + new schema, and new app code + old schema, for the window where both coexist.
  • For destructive migrations (dropping/renaming columns), confirm nothing else reads the old shape first (grep the codebase, check async workers/reporting jobs).

ETL / data pipeline testing

  • Row counts reconcile source → target (accounting for expected filters/dedup).
  • Data-type and precision fidelity (decimals not silently truncated, timestamps not silently shifted by timezone assumptions).
  • Idempotency — rerunning the same ETL batch shouldn't duplicate rows.
  • Late-arriving / out-of-order data handled per the pipeline's documented ordering guarantee.

NoSQL-specific considerations

  • MongoDB: schema-less means the app enforces shape, not the DB — test documents missing expected fields, and documents from an older schema version still in the collection.
  • Redis: TTL expiry behavior, eviction policy under memory pressure, atomicity of multi-key operations (use transactions/Lua where the app needs it).
  • DynamoDB: partition-key hot-spotting under load, eventual- vs strong-consistency read behavior, GSI propagation lag.
  • Elasticsearch/OpenSearch: index refresh delay (a write may not be immediately searchable — a common source of "flaky" test failures that are actually a real consistency window), mapping/analyzer correctness for search relevance.

CLI / verification commands

  • psql, mysql, mongosh, redis-cli for direct inspection.
  • EXPLAIN ANALYZE <query> (Postgres/MySQL) to verify index usage and cost.
  • Compare row counts/checksums across environments with a scripted diff rather than eyeballing.

Reporting

Include the actual query/command used to verify state as evidence — see [[bug-reporting]]. "Data looks wrong in the UI" is not actionable; the query result that proves it is.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.