# Database Testing

Database schema validation, data integrity testing, migration testing, transaction...

- Repository: https://github.com/proffesor-for-testing/agentic-qe (521 stars)
- Category: Testing
- License: MIT
- Last updated: 2026-11-01
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add proffesor-for-testing/agentic-qe --skill database-testing -g -a claude-code -y`
Codex: `npx skills add proffesor-for-testing/agentic-qe --skill database-testing -g -a codex -y`
Cursor: `npx skills add proffesor-for-testing/agentic-qe --skill database-testing -g -a cursor -y`
Gemini CLI: `npx skills add proffesor-for-testing/agentic-qe --skill database-testing -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add proffesor-for-testing/agentic-qe`

## Description

Database schema validation, data integrity testing, migration testing, transaction isolation, and query performance. Use when testing data persistence, ensuring referential integrity, or validating database migrations.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Database Testing

<default_to_action>
When testing database operations:
1. VALIDATE schema (tables, columns, constraints exist as expected)
2. TEST data integrity (unique, foreign key, check constraints)
3. VERIFY migrations (forward works, rollback works, data preserved)
4. CHECK transaction isolation (ACID properties, concurrent access)
5. MEASURE query performance (indexes used, execution time)

**Quick DB Testing Checklist:**
- Schema matches specification
- Unique constraints prevent duplicates
- Foreign keys prevent orphaned records
- Migrations are reversible
- Transactions roll back on error

**Critical Success Factors:**
- Database bugs cause data loss/corruption (catastrophic)
- Test migrations in staging before production
- Transaction tests catch concurrency bugs
</default_to_action>

## Quick Reference Card

### When to Use
- New table/schema creation
- Migration development
- Data integrity validation
- Query performance optimization

### Database Test Types
| Type | Focus | When |
|------|-------|------|
| **Schema** | Structure correct | Table creation |
| **Integrity** | Constraints work | Data operations |
| **Migration** | Up/down work | Schema changes |
| **Transaction** | ACID properties | Concurrent access |
| **Performance** | Query speed | Optimization |

---

## Schema Testing

```javascript
test('users table has correct schema', async () => {
  const schema = await db.raw(`
    SELECT column_name, data_type, is_nullable
    FROM information_schema.columns
    WHERE table_name = 'users'
  `);

  expect(schema).toContainEqual({
    column_name: 'id',
    data_type: 'integer',
    is_nullable: 'NO'
  });

  expect(schema).toContainEqual({
    column_name: 'email',
    data_type: 'character varying',
    is_nullable: 'NO'
  });
});
```

---

## Data Integrity Testing

```javascript
test('email must be unique', async () => {
  await db.users.create({ email: 'test@example.com' });

The rest: https://github.com/proffesor-for-testing/agentic-qe/blob/HEAD/.claude/skills/database-testing/SKILL.md
