validating-database-integrity
Process use when you need to ensure database integrity through comprehensive data validation. This skill validates data types, ranges, formats, referential integrity, and business rules. Trigger with phrases like "validate database data", "implement data validation rules", "enforce data integrity constraints", or "validate data formats".
- License 许可
- MIT
- 最近更新
- 2026-11-15
- Stars
- ★ 2.0k
- Forks
- 233
01 前言 Front Matter
- name
- validating-database-integrity
- author
- Jeremy Longshore <jeremy@intentsolutions.io>
- license
- MIT
- version
- 1.0.0
- description
- Process use when you need to ensure database integrity through comprehensive data validation. This skill validates data types, ranges, formats, referential integrity, and business rules. Trigger with phrases like "validate database data", "implement data validation rules", "enforce data integrity constraints", or "validate data formats".
- allowed-tools
- Read, Write, Edit, Grep, Glob, Bash(psql:*), Bash(mysql:*)
02 资源文件 6
- 资产文件assets/README.md483 B
- 参考文档references/README.md475 B
- 脚本scripts/configure_validation_rules.py14.5 KB
- 脚本scripts/generate_validation_report.py14.3 KB
- 脚本scripts/README.md514 B
- 脚本scripts/validate_data.py14.4 KB
03 SKILL.md 正文
Data Validation Engine
This skill provides automated assistance for data validation engine tasks.
Prerequisites
Before using this skill, ensure:
- Database connection credentials are available
- Appropriate database permissions for schema modifications
- Backup of production databases before applying constraints
- Understanding of existing data that may violate new constraints
- Access to database documentation for column specifications
Instructions
Step 1: Analyze Validation Requirements
- Review database schema and identify columns requiring validation
- Determine validation types needed (data type, range, format, referential)
- Document existing data patterns that may conflict with new rules
- Prioritize validation rules by business criticality
Step 2: Define Validation Rules
- Create validation rule definitions for each column
- Specify data types, constraints, and acceptable ranges
- Define regular expressions for format validation
- Map foreign key relationships for referential integrity
- Document business rule logic for complex validations
Step 3: Implement Database Constraints
- Generate SQL constraints for data type validation
- Add CHECK constraints for range and format validation
- Create foreign key constraints for referential integrity
- Implement triggers for complex business rule validation
- Test constraints with valid and invalid sample data
Step 4: Validate Existing Data
- Query existing data to identify constraint violations
- Generate reports of data that would fail new constraints
- Create data cleanup scripts to fix violations
- Execute cleanup scripts in staging environment first
- Re-validate cleaned data before applying constraints
Step 5: Apply Validation Rules
- Apply constraints to staging database first
- Monitor for any application errors or failures
- Validate that legitimate operations still function
- Apply constraints to production database during maintenance window
- Monitor database logs for constraint violation attempts
Output
This skill produces:
Database Constraints: SQL DDL statements with CHECK, FOREIGN KEY, and NOT NULL constraints
Validation Reports: Analysis of existing data showing constraint violations with counts and examples
Data Cleanup Scripts: SQL UPDATE/DELETE statements to fix existing data that violates new constraints
Test Results: Documentation of constraint testing with valid/invalid data samples and outcomes
Implementation Log: Timestamped record of constraint application with success/failure status
Error Handling
Constraint Violation Errors:
- Review existing data that violates the constraint
- Create data cleanup scripts to fix violations
- Re-run constraint application after cleanup
- Document exceptions that require manual review
Permission Errors:
- Verify database user has ALTER TABLE privileges
- Request elevated permissions from database administrator
- Use separate admin connection for schema changes
- Document permission requirements for future deployments
Circular Dependency Errors:
- Map all foreign key relationships before implementation
- Apply constraints in dependency order (referenced tables first)
- Use ALTER TABLE ADD CONSTRAINT for deferred constraint creation
- Consider disabling foreign key checks temporarily during bulk operations
Performance Degradation:
- Analyze constraint checking overhead with EXPLAIN ANALYZE
- Add appropriate indexes to support constraint validation
- Consider batch validation for large data updates
- Monitor query performance after constraint implementation
Resources
Database-Specific Constraint Syntax:
- PostgreSQL:
{baseDir}/docs/postgresql-constraints.md - MySQL:
{baseDir}/docs/mysql-constraints.md - SQL Server:
{baseDir}/docs/sqlserver-constraints.md
Validation Rule Templates: {baseDir}/templates/validation-rules/
- Email format validation
- Phone number validation
- Date range validation
- Numeric range validation
- Custom business rules
Testing Guidelines: {baseDir}/docs/validation-testing.md
Constraint Performance Analysis: {baseDir}/docs/constraint-performance.md
Data Cleanup Procedures: {baseDir}/docs/data-cleanup-procedures.md
Overview
This skill provides automated assistance for the described functionality.
Examples
Example usage patterns will be demonstrated in context.
04 同仓库更多 Skills
web-artifacts-builder
Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use for complex artifacts requiring state management, routing, or shadcn/ui components - not for simple single-file HTML/JSX artifacts.
webapp-testing
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.
neuropixels-analysis
Neuropixels neural recording analysis. Load SpikeGLX/OpenEphys data, preprocess, motion correction, Kilosort4 spike sorting, quality metrics, Allen/IBL curation, AI-assisted visual analysis, for Neuropixels 1.0/2.0 extracellular electrophysiology. Use when working with neural recordings, spike sorting, extracellular electrophysiology, or when the user mentions Neuropixels, SpikeGLX, Open Ephys, Kilosort, quality metrics, or unit curation.
skill-creator
Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized knowledge, workflows, or tool integrations.
notebooklm
Use this skill to query your Google NotebookLM notebooks directly from Claude Code for source-grounded, citation-backed answers from Gemini. Browser automation, library management, persistent auth. Drastically reduced hallucinations through document-only responses.
slack-gif-creator
Knowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."