Agent skill

Managing Database Tests

by jeremylongshore in jeremylongshore/tons-of-skills-marketplace

Test database testing including fixtures, transactions, and rollback management.

MITAuto-check passedDatabases

Install Managing Database Tests

skills CLI
$ npx skills add jeremylongshore/tons-of-skills-marketplace --skill managing-database-tests -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install jeremylongshore/tons-of-skills-marketplace managing-database-tests --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/jeremylongshore/tons-of-skills-marketplace.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/.curated/managing-database-tests .claude/skills/managing-database-tests && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
managing-database-tests
GitHub stars
2.8k
Token cost
~1.9k tokens
SKILL.md length
607 words
Files
9 (incl. scripts, references, assets)
Skills in repo
3,342
Repo updated
First seen
Licence
MIT

At a glance

Test database testing including fixtures, transactions, and rollback management.

  • Works in 7 steps: Set up the test database infrastructure → Run database migrations against the test… → Implement test isolation strategy… → …
  • Performing specialized testing
  • SKILL.md covers Overview, Prerequisites, Instructions and Output, plus 3 more sections
  • Runs Python scripts from its folder; calls npx and docker

What it does

Managing Database Tests is an agent skill from jeremylongshore/tons-of-skills-marketplace. Test database testing including fixtures, transactions, and rollback management. Use when performing specialized testing. Trigger with phrases like "test the database", "run database tests", or "validate data integrity".

Its SKILL.md is about 1.9k tokens, which your agent loads only when the skill is triggered. The skill folder holds 11 other files, including scripts, reference files and assets (for example `assets/README.md`, `assets/database_schema_definition.json` and `assets/docker-compose.yml`). Compatibility notes: Designed for Claude Code

It sits in Databases, covering ORMs and data access. It works with Prisma, SQLite and Docker. The repository describes itself as: Model-agnostic agent-skills platform with a harness-free canonical layer, verified adapters, and the ccpi package manager. Explore at tonsofskills.com. The licence is MIT.

When your agent uses it

  • Performing specialized testing
  • With phrases like test the database
  • Run database tests
  • Validate data integrity

Example prompts

  • “test the database”
  • “run database tests”
  • “validate data integrity”
  • “/managing-database-tests”

Requirements

  • Python 3
  • Node.js
  • Docker
  • Compatibility (from SKILL.md): Designed for Claude Code
  • Pre-approved tools (allowed-tools): Read, Write, Edit, Grep, Glob, Bash(test:db-*)

Workflow steps

7 steps, taken from the first numbered list in SKILL.md.

  1. Set up the test database infrastructure
  2. Run database migrations against the test database
  3. Implement test isolation strategy (choose one)
  4. Create database fixture utilities
  5. Write database-specific test cases
  6. Test database query performance
  7. Validate migration safety

What it can do on your machine

Read from SKILL.md and the folder at commit cfae287. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Write
    • Edit
    • Grep
    • Glob
    • Bash(test:db-*)

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 2 files in scripts/ (Python), which the agent can run.

    Shell commands in SKILL.md call:

    • npx
    • docker

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • prisma.io
    • docs.sqlalchemy.org
    • knexjs.org
    • postgresql.org

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    Designed for Claude Code

    From compatibility in the SKILL.md frontmatter.

Context cost

Managing Database Tests loads about 1.9k tokens when it runs, and up to ~1.9k if it reads all its reference files. Until then it costs about 61 tokens; SKILL.md has 607 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~61
When it runs · the whole SKILL.md, loaded when a task matches
~1.9k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~1.9k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from jeremylongshore/tons-of-skills-marketplace at commit cfae287, republished under its MIT licence (© jeremylongshore). 607 words, ~1,883 tokens.

Download SKILL.mdSave it as .claude/skills/managing-database-tests/SKILL.md (or your agent's skills folder). This skill also uses 8 other files; get the full folder from GitHub.
name
managing-database-tests
description
Test database testing including fixtures, transactions, and rollback management. Use when performing specialized testing. Trigger with phrases like "test the database", "run database tests", or "validate data integrity".
allowed-tools
Read, Write, Edit, Grep, Glob, Bash(test:db-*)
compatibility
Designed for Claude Code
version
1.26.0
author
Jeremy Longshore <jeremy@intentsolutions.io>
license
MIT
tags
testing, database, database-tests

Database Test Manager

Overview

Manage database testing including fixture loading, transaction-based test isolation, migration validation, query performance testing, and data integrity checks. Supports PostgreSQL, MySQL, MongoDB, SQLite (in-memory), and Redis with ORM-agnostic patterns for Prisma, TypeORM, SQLAlchemy, Knex, and Drizzle.

Prerequisites

  • Database instance available for testing (Docker container, in-memory SQLite, or dedicated test server)
  • Database client library and ORM installed (Prisma, TypeORM, Knex, SQLAlchemy, etc.)
  • Migration files up to date and tested independently
  • Test database connection string configured in environment (distinct from development/production)
  • Database seed data scripts for baseline test state

Instructions

  1. Set up the test database infrastructure:
    • Use Docker to spin up a dedicated test database: docker run -d -p 5433:5432 --name test-db postgres:16-alpine.
    • Or use SQLite in-memory mode for fast unit tests: sqlite::memory:.
    • Or use Testcontainers for ephemeral database per test suite.
    • Verify the test database is isolated from development data.
  2. Run database migrations against the test database:
    • Execute npx prisma migrate deploy or npx knex migrate:latest --env test.
    • Verify all migrations apply cleanly to an empty database.
    • Test rollback: run migrate:rollback and verify schema reverts correctly.
  3. Implement test isolation strategy (choose one):
    • Transaction rollback: Wrap each test in a transaction; roll back after assertions. Fastest option.
    • Truncation: Truncate all tables in beforeEach. Simpler but slower.
    • Database recreation: Drop and recreate the database before each test suite. Slowest, most thorough.
  4. Create database fixture utilities:
    • Factory functions that insert records and return the created entity with its database-generated ID.
    • Seed functions for standard test scenarios (empty state, populated state, edge cases).
    • Cleanup utilities that handle foreign key ordering for truncation.
  5. Write database-specific test cases:
    • CRUD operations: Insert, query, update, delete records and verify database state.
    • Constraint validation: Attempt invalid inserts (null on NOT NULL, duplicate on UNIQUE) and verify rejection.
    • Referential integrity: Verify cascading deletes, foreign key enforcement, and orphan prevention.
    • Index performance: Verify queries use expected indexes with EXPLAIN ANALYZE.
    • Transaction isolation: Test concurrent updates and verify conflict handling.
  6. Test database query performance:
    • Run EXPLAIN ANALYZE on critical queries and assert expected index usage.
    • Benchmark query execution time with representative data volumes.
    • Flag queries doing sequential scans on large tables.
  7. Validate migration safety:
    • Test each migration can run on a populated database without data loss.
    • Verify backward compatibility (old code works with new schema during rollout).
    • Check migration execution time is acceptable for production deployment.
Show full SKILL.md (213 more words)Show less

Output

  • Database test files organized by entity in tests/database/ or tests/models/
  • Fixture and factory utility files in tests/helpers/ or tests/factories/
  • Migration test scripts validating up/down migrations
  • Query performance benchmarks with EXPLAIN ANALYZE output
  • Test database Docker Compose configuration

Error Handling

ErrorCauseSolution
Foreign key constraint violation during cleanupTruncation order does not respect foreign key dependenciesTruncate tables in reverse dependency order; or disable FK checks during cleanup (SET CONSTRAINTS ALL DEFERRED)
Connection pool exhaustedToo many test workers opening separate connectionsUse a single shared connection for tests; limit pool size; close connections in afterAll
Migration fails on test databaseSchema drift between development and test databasesDrop and recreate test database; run all migrations from scratch; verify migration checksums
Transaction rollback does not clean upORM auto-commits or test creates a new connection outside the transactionInject the transaction connection into all ORM operations; disable auto-commit in test config
Slow test suite due to database I/OToo many INSERT/DELETE operations per testUse in-memory SQLite for unit tests; batch seed data; use transaction rollback instead of truncation

Examples

Jest with Prisma transaction rollback:

typescript
import { PrismaClient } from '@prisma/client';

const prisma = new PrismaClient();

describe('UserRepository', () => {
  afterAll(async () => { await prisma.$disconnect(); });

  it('creates and retrieves a user', async () => {
    await prisma.$transaction(async (tx) => {
      const created = await tx.user.create({
        data: { name: 'Alice', email: 'alice@test.com' },
      });
      const found = await tx.user.findUnique({ where: { id: created.id } });
      expect(found).toMatchObject({ name: 'Alice', email: 'alice@test.com' });
      // Transaction rolls back automatically when we throw
      throw new Error('ROLLBACK');
    }).catch((e) => {
      if (e.message !== 'ROLLBACK') throw e;
    });
  });
});

pytest with database fixture and rollback:

python
import pytest
from sqlalchemy import create_engine
from sqlalchemy.orm import Session

@pytest.fixture
def db_session():
    engine = create_engine("postgresql://test:test@localhost:5433/testdb")  # 5433 = configured value
    connection = engine.connect()
    transaction = connection.begin()
    session = Session(bind=connection)
    yield session
    session.close()
    transaction.rollback()
    connection.close()

def test_insert_and_query_user(db_session):
    db_session.execute(
        text("INSERT INTO users (name, email) VALUES (:n, :e)"),
        {"n": "Alice", "e": "alice@test.com"}
    )
    result = db_session.execute(text("SELECT name FROM users WHERE email = :e"),
                                 {"e": "alice@test.com"}).fetchone()
    assert result[0] == "Alice"

Migration validation test:

typescript
describe('Database Migrations', () => {
  it('applies all migrations to empty database', async () => {
    const result = await exec('npx prisma migrate deploy');
    expect(result.exitCode).toBe(0);
  });

  it('migration is idempotent', async () => {
    await exec('npx prisma migrate deploy');
    const result = await exec('npx prisma migrate deploy');
    expect(result.exitCode).toBe(0); // Second run should succeed (no-op)
  });
});

Resources

© jeremylongshore, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 8 other files (scripts, references, assets) in skills/.curated/managing-database-tests of jeremylongshore/tons-of-skills-marketplace.

  • SKILL.md
  • assets/README.md
  • assets/database_schema_definition.json
  • assets/docker-compose.yml
  • assets/example_migration_script.sql
  • assets/test_data_schema_template.json
  • references/README.md
  • scripts/README.md
  • scripts/generate_test_data.py

Open the folder on GitHubat commit cfae287

Compare with similar skills

Managing Database Tests next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Managing Database Tests compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Managing Database Tests this skilljeremylongshore/tons-of-skills-marketplace2.8k—~1.9kAutomated safety check: PassMIT
Better Drizzlealmeidazs/better-drizzle349—~1.7kAutomated safety check: PassApache-2.0
Prisma Database Setupcurvenote/curvenote1703 repos~1.4kAutomated safety check: PassMIT
Create Auth Skilldeadlock-mod-manager/deadlock-mod-manager4784 repos~3.4kAutomated safety check: PassGPL-3.0
Drizzle Migrationsbretzel-app/crumbs1271 repos~2.6kAutomated safety check: PassMIT
Database Expertcin12211/orca-q224—~2.8kAutomated safety check: PassMIT

Similar skills

  • Better Drizzle

    almeidazs/better-drizzle

    Write, review, and debug code that uses better-drizzle, the typed repository layer over Drizzle ORM 1.x (better(db), client.users.findMany, paginate, cursor, upsertMany, relation include/connect…

    349 GitHub stars~1.7k tokensUpdated yesterday
    DatabasesAuto-check passed
  • Prisma Database Setup

    curvenote/curvenote

    Guides for configuring Prisma with different database providers (PostgreSQL, MySQL, SQLite, MongoDB, etc.).

    170 GitHub starsUsed in 3 repos~1.4k tokens
    DatabasesAuto-check passed
  • Create Auth Skill

    deadlock-mod-manager/deadlock-mod-manager

    Scaffold and implement authentication in TypeScript/JavaScript apps using Better Auth.

    478 GitHub starsUsed in 4 repos~3.4k tokens
    DatabasesAuto-check passed
  • Drizzle Migrations

    bretzel-app/crumbs

    Drizzle ORM schema management and SQLite migrations — adding tables, modifying columns, creating indexes, generating and running migrations, Drizzle query patterns.

    127 GitHub starsUsed in 1 repo~2.6k tokens
    DatabasesAuto-check passed
  • Database Expert

    cin12211/orca-q

    Database performance optimization, schema design, query analysis, and connection management across PostgreSQL, MySQL, MongoDB, and SQLite with ORM integration.

    224 GitHub stars~2.8k tokensUpdated 18 days ago
    DatabasesAuto-check passed
  • Official

    Routes Prisma 8 tasks such as contracts, migrations, queries and upgrades to the right reference files for projects on the contract-first @prisma/orm packages.

    48k GitHub stars~3.8k tokensUpdated today
    DatabasesAuto-check: notes

More from jeremylongshore/tons-of-skills-marketplace

All 3,342 skills in this repo
  • Performing Security Code Review

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to conduct a security-focused code review using the security-agent plugin.

    2.8k GitHub starsUsed in 2 repos~1.3k tokens
    Auto-check: notes
  • Adapting Transfer Learning Models

    jeremylongshore/tons-of-skills-marketplace

    Build this skill automates the adaptation of pre-trained machine learning models using transfer learning techniques.

    2.8k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Agent Context Loader

    jeremylongshore/tons-of-skills-marketplace

    Execute proactive auto-loading: automatically detects and loads agents.md files.

    2.8k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Aggregating Performance Metrics

    jeremylongshore/tons-of-skills-marketplace

    Aggregate and centralize performance metrics from applications, systems, databases, caches, and services.

    2.8k GitHub stars~1.2k tokensUpdated today
    Auto-check passed
  • Analyzing Capacity Planning

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to analyze capacity requirements and plan for future growth.

    2.8k GitHub stars~947 tokensUpdated today
    Auto-check passed
  • Analyzing Database Indexes

    jeremylongshore/tons-of-skills-marketplace

    Process use when you need to work with database indexing. An agent skill from jeremylongshore/tons-of-skills-marketplace.

    2.8k GitHub stars~2k tokensUpdated today
    Auto-check passed

Categories

Questions about Managing Database Tests

What does Managing Database Tests do?

Test database testing including fixtures, transactions, and rollback management. Managing Database Tests is an agent skill from jeremylongshore/tons-of-skills-marketplace. Test database testing including fixtures, transactions, and rollback management.

When should I use Managing Database Tests?

Managing Database Tests fits situations like: performing specialized testing; with phrases like test the database; run database tests; validate data integrity.

How do I install Managing Database Tests in Claude Code?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill managing-database-tests -a claude-code`. Or copy the skill folder (skills/.curated/managing-database-tests in jeremylongshore/tons-of-skills-marketplace) into .claude/skills/managing-database-tests in your project. Claude Code loads it when a task matches its description.

How do I install Managing Database Tests in Codex?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill managing-database-tests -a codex`. Or copy the skill folder (skills/.curated/managing-database-tests in jeremylongshore/tons-of-skills-marketplace) into .agents/skills/managing-database-tests in your project. Codex loads it when a task matches its description.

Can I use Managing Database Tests in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill managing-database-tests -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/managing-database-tests, .gemini/skills/managing-database-tests, .github/skills/managing-database-tests and .opencode/skills/managing-database-tests in your project.

What does Managing Database Tests need to run?

Going by SKILL.md and its folder, Managing Database Tests needs Python for the scripts in its folder and the command-line tools its instructions call (npx and docker). Our summary lists: Python 3; Node.js; Docker. Its frontmatter pre-approves these tools: Read, Write, Edit, Grep, Glob, Bash(test:db-*). Compatibility (from SKILL.md): Designed for Claude Code.

Does Managing Database Tests access the network?

SKILL.md names 4 domains. As links in the text: prisma.io, docs.sqlalchemy.org, knexjs.org and postgresql.org. This is read from the text; nothing was executed.

Is Managing Database Tests safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Managing Database Tests use?

Managing Database Tests is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Managing Database Tests use?

About 1.9k tokens (SKILL.md is roughly 7.5k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 16 tokens, read only when the agent opens those files.

What are the alternatives to Managing Database Tests?

Skills that share tags, products or a category with Managing Database Tests: Better Drizzle (almeidazs/better-drizzle, 349 stars), Prisma Database Setup (curvenote/curvenote, 170 stars), Create Auth Skill (deadlock-mod-manager/deadlock-mod-manager, 478 stars) and Drizzle Migrations (bretzel-app/crumbs, 127 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Managing Database Tests?

jeremylongshore (a GitHub user) maintains it in jeremylongshore/tons-of-skills-marketplace, which has 2,827 GitHub stars. The repository holds 3,342 skills in this directory. The repository was last updated on October 10, 2026.

Source: jeremylongshore/tons-of-skills-marketplace on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.