data-integrity-audit

Audits database schemas for missing unique constraints, foreign keys, transactions, and CHECK constraints.

Updated Aug 29, 2026
One-click install
npx skills add https://github.com/1arley/volibear --skill data-integrity-audit-1arley
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: data-integrity-audit
Source: https://github.com/1arley/volibear/tree/main/.opencode/skills/data-integrity-audit
Command: npx skills add https://github.com/1arley/volibear --skill data-integrity-audit-1arley

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Applications often enforce business invariants only in application code, leaving the database unable to prevent impossible states when other writers (jobs, imports, admin tools) or race conditions bypass that validation. This Skill verifies whether the database itself enforces integrity through real constraints. ## Core Features & Use Cases - Constraint Verification: Checks unique constraints, foreign keys with ON DELETE policies, transactions, cascading rules, soft delete handling, enums, and CHECK/NOT NULL constraints against the actual schema DDL. - Attack Pattern Catalog: Provides concrete failure patterns such as unique bypass via race conditions, orphan foreign keys, soft-delete unique collisions, and partial multi-write transactions. - Evidence-Based Reporting: Classifies findings by confidence level (CONFIRMED, HIGH CONFIDENCE, POSSIBLE, SPECULATIVE) and outputs structured audit reports with exact remediation constraints. - Use Case: When reviewing a schema where usernames are checked for uniqueness only in the request handler, use this Skill to confirm the missing unique index and demonstrate how a concurrent writer can insert duplicates. ## Quick Start Audit my database schema and migrations to verify that unique constraints, foreign keys, enums, and CHECK constraints actually prevent impossible states at the database level.

Frequently Asked Questions about data-integrity-audit

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I audit a database for missing unique constraints?▼

Inventory every business invariant requiring uniqueness, then check the actual migration DDL for a unique index rather than relying on application-level checks. Test by attempting a duplicate insert directly against the database or via a concurrent writer to confirm whether the constraint exists.

How to check foreign keys and ON DELETE behavior in a schema?▼

Inspect the migration files for real FOREIGN KEY constraints with explicit ON DELETE policies such as RESTRICT, CASCADE, or SET NULL. Missing or incorrect policies allow orphan rows when parent records are deleted.

Does soft delete break unique constraints?▼

Yes, when a unique index covers the whole column, a soft-deleted row's slug blocks reuse, or reusing it creates visible duplicates. The recommended fix is a partial unique index with a WHERE deleted_at IS NULL clause, if the product reuses identifiers.

Why store enums as CHECK constraints instead of application strings?▼

Free-form strings let other writers such as jobs, imports, or admin tools persist values outside the allowed domain. A database-level CHECK or enum constraint rejects invalid states regardless of which writer performs the insert.

When is a missing database constraint not a bug?▼

When the constraint already exists in production migrations, when the column is semantically non-unique, or when a single validated application path is genuinely the only writer. In those cases the extra constraint is a hardening improvement, not a defect.