code-check-data-integrity

Detects NOT NULL gaps, orphaned children, and destructive migration risks during code review.

22|3|Updated Jul 28, 2024
One-click install
npx skills add https://github.com/webdevcody/go-mailing-list --skill code-check-data-integrity
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: code-check-data-integrity
Source: https://github.com/webdevcody/go-mailing-list/tree/main/.claude/skills/code-check-data-integrity
Command: npx skills add https://github.com/webdevcody/go-mailing-list --skill code-check-data-integrity

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill prevents production data breakage by auditing whether schema, migration, persistence, imports, deletes, or background jobs preserve existing rows, constraints, and related child data.

Core Features & Use Cases

  • NOT NULL & backfill safety checks: Detects new NOT NULL columns added without defaults or backfill steps that would fail on existing data.
  • Orphan and cascade risk analysis: Flags deletes/destroys/removals that can leave orphaned child rows or external side effects (files, cache, webhook subscriptions).
  • Uniqueness enforcement review: Finds cases where code assumes uniqueness but the database schema does not enforce it.
  • Seed/fixture drift detection: Compares fixtures against the updated schema to catch missing/removed required fields.
  • Destructive migration warnings: Highlights irreversible operations like DROP COLUMN/TABLE/TRUNCATE to prompt backup and rollback planning.

Quick Start

Run the code-check-data-integrity scan after you modify a migration, schema, delete/destroy logic, or background job that affects persisted state.

Frequently Asked Questions about code-check-data-integrity

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

FAQPage Schema
How do I check database migrations for NOT NULL columns missing backfill steps?

Checking database migrations for NOT NULL backfill gaps involves scanning schema diffs to detect new columns added without defaults that would fail on existing rows. The review flags missing backfill steps and ranks findings by severity to prevent production data breakage.

What is the best way to prevent orphaned child rows during database deletes?

Preventing orphaned child rows during database deletes requires auditing destroy paths for unhandled cascade behavior. The review flags destructive removals that leave orphaned children or external side effects, providing actionable recommendations for safe cascade behavior and rollback sequencing.

How do I find code that assumes uniqueness but lacks database schema enforcement?

Finding code that assumes uniqueness without database schema enforcement involves reviewing persistence layers for unenforced constraints. The audit detects mismatches between application-level uniqueness assumptions and the actual database schema, ranking these vulnerabilities by severity.

How do I detect seed or fixture drift after a schema update?

Detecting seed or fixture drift after a schema update requires comparing fixture files against the modified schema to catch missing or removed required fields. This validation highlights fixture drift to ensure test data matches current persistence requirements.

When should I scan for destructive and irreversible migration operations?

Scanning for destructive and irreversible migration operations like DROP COLUMN, DROP TABLE, or TRUNCATE is necessary during code review or pre-deploy validation. This highlights destructive migration irreversibility to prompt backups and safe rollback sequencing.

Does this data integrity check work with background jobs and imports?

Yes, this data integrity check works with background jobs and imports by auditing whether persisted state changes preserve existing rows, constraints, and related child data. It applies during code review when diffs indicate mutating or destructive persistence changes.