Agent skill

Validating Database Integrity

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

Process use when you need to ensure database integrity through comprehensive data validation.

MITAuto-check passedData & Analytics

Install Validating Database Integrity

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

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

GitHub CLI
$ gh skill install jeremylongshore/tons-of-skills-marketplace validating-database-integrity --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/validating-database-integrity .claude/skills/validating-database-integrity && 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
validating-database-integrity
GitHub stars
2.8k
Token cost
~1.9k tokens
SKILL.md length
879 words
Files
6 (incl. scripts, references, assets)
Skills in repo
3,342
Repo updated
First seen
Licence
MIT

At a glance

Process use when you need to ensure database integrity through comprehensive data validation.

  • Works in 10 steps: Audit existing data quality by running… → Detect orphaned records (broken… → Validate data format compliance → …
  • You need to ensure database integrity through comprehensive data validation
  • SKILL.md covers Overview, Prerequisites, Instructions and Output, plus 3 more sections
  • Runs Python scripts from its folder

What it does

Validating Database Integrity is an agent skill from jeremylongshore/tons-of-skills-marketplace. 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".

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

It sits in Data & Analytics, covering Data cleaning. 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

  • You need to ensure database integrity through comprehensive data validation
  • With phrases like validate database data
  • Implement data validation rules
  • Enforce data integrity constraints

Example prompts

  • “validate database data”
  • “implement data validation rules”
  • “enforce data integrity constraints”
  • “/validating-database-integrity”

Requirements

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

Workflow steps

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

  1. Audit existing data quality by running validation queries before adding constraints. Check for NULL values in columns that should be…
  2. Detect orphaned records (broken referential integrity): SELECT c.id FROM child_table c LEFT JOIN parent_table p ON c.parent_id = p.id…
  3. Validate data format compliance
  4. Check numeric range violations: SELECT * FROM products WHERE price < 0 OR price > 999999.99 and SELECT * FROM users WHERE age < 0 OR age >…
  5. Identify duplicate records that violate intended uniqueness: SELECT email, COUNT() FROM users GROUP BY email HAVING COUNT() > 1. Determine…
  6. Generate CHECK constraints for validated rules
  7. Create foreign key constraints with appropriate cascade behavior
  8. Implement complex business rule validation using database triggers when CHECK constraints are insufficient
  9. Apply constraints in a safe two-phase approach
  10. Generate a data quality report summarizing: total records per table, violation counts by constraint type, cleanup actions taken…

What it can do on your machine

Read from SKILL.md and the folder at commit 23ea8d4. 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(psql:*)
    • Bash(mysql:*)

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

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

    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):

    • 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

Validating Database Integrity loads about 1.9k tokens when it runs, and up to ~2k if it reads all its reference files. Until then it costs about 92 tokens; SKILL.md has 879 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~92
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
~2k

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 23ea8d4, republished under its MIT licence (© jeremylongshore). 879 words, ~1,949 tokens.

Download SKILL.mdSave it as .claude/skills/validating-database-integrity/SKILL.md (or your agent's skills folder). This skill also uses 5 other files; get the full folder from GitHub.
name
validating-database-integrity
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:*)
compatibility
Designed for Claude Code
version
1.28.0
author
Jeremy Longshore <jeremy@intentsolutions.io>
license
MIT
tags
database, validating-database

Data Validation Engine

Overview

Implement and enforce data integrity rules at the database level using CHECK constraints, triggers, foreign keys, and custom validation functions across PostgreSQL and MySQL.

Prerequisites

  • Database credentials with ALTER TABLE and CREATE FUNCTION permissions
  • psql or mysql CLI for executing validation queries
  • Current schema documentation or access to information_schema for column specifications
  • Business rules document describing valid data ranges, formats, and relationships
  • Backup of production data before applying new constraints (constraints may reject existing invalid data)

Instructions

  1. Audit existing data quality by running validation queries before adding constraints. Check for NULL values in columns that should be required: SELECT column_name, COUNT(*) FILTER (WHERE column_name IS NULL) AS null_count, COUNT(*) AS total FROM table_name GROUP BY column_name.

  2. Detect orphaned records (broken referential integrity): SELECT c.id FROM child_table c LEFT JOIN parent_table p ON c.parent_id = p.id WHERE p.id IS NULL. Document all orphaned records for cleanup or archival before adding foreign key constraints.

  3. Validate data format compliance:

    • Email format: SELECT email FROM users WHERE email !~ '^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$'
    • Phone format: SELECT phone FROM contacts WHERE phone !~ '^\+?[1-9]\d{6,14}$'
    • URL format: SELECT url FROM links WHERE url !~ '^https?://.+'
    • Date ranges: SELECT * FROM events WHERE start_date > end_date
  4. Check numeric range violations: SELECT * FROM products WHERE price < 0 OR price > 999999.99 and SELECT * FROM users WHERE age < 0 OR age > 150. Map each column to its valid range based on business rules.

  5. Identify duplicate records that violate intended uniqueness: SELECT email, COUNT(*) FROM users GROUP BY email HAVING COUNT(*) > 1. Determine which duplicate to keep (most recent, most complete) and plan deduplication.

  6. Generate CHECK constraints for validated rules:

    • ALTER TABLE products ADD CONSTRAINT chk_price_positive CHECK (price >= 0)
    • ALTER TABLE users ADD CONSTRAINT chk_email_format CHECK (email ~ '^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$')
    • ALTER TABLE events ADD CONSTRAINT chk_date_order CHECK (start_date <= end_date)
    • ALTER TABLE orders ADD CONSTRAINT chk_status_valid CHECK (status IN ('pending', 'processing', 'shipped', 'delivered', 'cancelled'))
  7. Create foreign key constraints with appropriate cascade behavior:

    • ALTER TABLE orders ADD CONSTRAINT fk_orders_customer FOREIGN KEY (customer_id) REFERENCES customers(id) ON DELETE RESTRICT
    • Use ON DELETE CASCADE for dependent data (order_items when order is deleted)
    • Use ON DELETE SET NULL for optional relationships (assigned_to when user is deactivated)
  8. Implement complex business rule validation using database triggers when CHECK constraints are insufficient:

    • Trigger that prevents order total from exceeding customer credit limit
    • Trigger that enforces at least one admin user per organization
    • Trigger that validates JSON schema for JSONB columns
  9. Apply constraints in a safe two-phase approach:

    • Phase 1: Run validation queries to find all violations. Generate data cleanup scripts. Execute cleanup.
    • Phase 2: Apply constraints with NOT VALID option (PostgreSQL): ALTER TABLE users ADD CONSTRAINT chk_email CHECK (email ~ '...') NOT VALID then ALTER TABLE users VALIDATE CONSTRAINT chk_email (validates existing data without blocking writes).
  10. Generate a data quality report summarizing: total records per table, violation counts by constraint type, cleanup actions taken, constraints applied, and remaining data quality issues requiring manual review.

Output

  • Data quality audit report with violation counts, examples, and severity ratings
  • Data cleanup scripts (SQL) to fix violations before constraint application
  • Constraint DDL scripts with CHECK, FOREIGN KEY, NOT NULL, and UNIQUE constraints
  • Validation triggers for complex business rules beyond simple constraints
  • Ongoing validation queries for periodic data quality monitoring
Show full SKILL.md (343 more words)Show less

Error Handling

ErrorCauseSolution
check constraint violated by existing rowExisting data fails the new constraintRun the validation query first to find violations; clean up data; use NOT VALID option to add constraint without checking existing data, then validate separately
cannot add foreign key: referenced row not foundOrphaned child records reference non-existent parentClean up orphaned records first with DELETE or UPDATE to valid parent; or insert missing parent records
column cannot be made NOT NULL: contains NULL valuesExisting rows have NULL in the target columnBackfill NULLs with UPDATE table SET column = default_value WHERE column IS NULL before adding NOT NULL
Trigger function causes performance regressionComplex validation logic executes on every INSERT/UPDATEOptimize trigger function; use WHEN clause to limit trigger firing; consider CHECK constraints instead of triggers for simple rules
Circular foreign key prevents constraint creationTables reference each other, preventing creation orderUse ALTER TABLE ADD CONSTRAINT after both tables exist; or use DEFERRABLE INITIALLY DEFERRED constraints

Examples

Auditing a legacy database with 50,000 invalid email addresses: Validation query reveals 50,000 of 2M user records have invalid email formats (missing @, double dots, spaces). A cleanup script normalizes common issues (trim whitespace, lowercase) and flags 3,000 unfixable records for manual review. After cleanup, a CHECK constraint with regex validation is applied.

Enforcing referential integrity on a database without foreign keys: An application relied on application-level FK enforcement, resulting in 12,000 orphaned order_items, 800 orphaned payments, and 200 orphaned reviews. Cleanup scripts archive orphaned records to backup tables, then foreign key constraints with ON DELETE CASCADE are added. A nightly validation job monitors for new orphans.

Implementing business rules for a financial application: Constraints enforce: account balance cannot be negative (CHECK (balance >= 0)), transfer amount must be positive (CHECK (amount > 0)), transaction date cannot be in the future (CHECK (transaction_date <= CURRENT_DATE)), and a trigger prevents transfers between accounts owned by different customers unless explicitly authorized.

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 5 other files (scripts, references, assets) in skills/.curated/validating-database-integrity of jeremylongshore/tons-of-skills-marketplace.

  • SKILL.md
  • assets/README.md
  • references/README.md
  • scripts/README.md
  • scripts/configure_validation_rules.py
  • scripts/generate_validation_report.py

Open the folder on GitHubat commit 23ea8d4

Compare with similar skills

Validating Database Integrity 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.

Validating Database Integrity compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Validating Database Integrity this skilljeremylongshore/tons-of-skills-marketplace2.8k—~1.9kAutomated safety check: PassMIT
Question2reportrefraction-ray/xalpha2.7k—~3.2kAutomated safety check: PassMIT
Dingo VerifyMigoXLab/dingo757—~741Automated safety check: NotesApache-2.0
Data Validationplatonai/Browser41.2k—~896Automated safety check: PassApache-2.0
Issues DeduplicationJetBrains/ideavim10k—~1.3kAutomated safety check: PassMIT
Pandas ProJeffallan/claude-skills12k1 repos~1.5kAutomated safety check: PassMIT

Similar skills

  • Question2report

    refraction-ray/xalpha

    Turn a natural-language financial question into a polished, self-contained HTML report.

    2.7k GitHub stars~3.2k tokensUpdated 2 mo ago
    Data & AnalyticsAuto-check passed
  • Dingo Verify

    MigoXLab/dingo

    A skill your agent uses when the user wants to fact-check an article or verify factual claims in a document.

    757 GitHub stars~741 tokensUpdated 9 days ago
    Data & AnalyticsAuto-check: notes
  • Data Validation

    platonai/Browser4

    Validates data against common and custom rules (required fields, formats, ranges).

    1.2k GitHub stars~896 tokensUpdated today
    Data & AnalyticsAuto-check passed
  • Issues Deduplication

    JetBrains/ideavim

    Official

    Handles deduplication of YouTrack issues. An agent skill from JetBrains/ideavim.

    10k GitHub stars~1.3k tokensUpdated today
    Data & AnalyticsAuto-check passed
  • Pandas Pro

    Jeffallan/claude-skills

    Handles pandas DataFrame work: cleaning, merging, groupby aggregation, pivots, time-series resampling and memory tuning, with checks on dtypes, shapes and nulls.

    12k GitHub starsUsed in 1 repo~1.5k tokens
    Data & AnalyticsAuto-check passed
  • Openbb Data Fetcher

    monarchjuno/vibe-investing

    Fetch financial, market, economic, fundamental, news, options, crypto, ETF, index, and macro data through the OpenBB Python interface instead of the OpenBB MCP server.

    299 GitHub stars~2.9k tokensUpdated 5 mo ago
    Data & AnalyticsAuto-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
  • Analyzing Text With NLP

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to perform natural language processing and text analysis using the nlp-text-analyzer plugin.

    2.8k GitHub starsUsed in 1 repo~819 tokens
    Auto-check passed
  • Building Neural Networks

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill allows AI assistant to construct and configure neural network architectures using the neural-network-builder plugin.

    2.8k GitHub starsUsed in 1 repo~1k tokens
    Auto-check passed
  • Detecting Data Anomalies

    jeremylongshore/tons-of-skills-marketplace

    Process identify anomalies and outliers in datasets using machine learning algorithms.

    2.8k GitHub starsUsed in 1 repo~1.4k tokens
    Auto-check passed
  • Explaining Machine Learning Models

    jeremylongshore/tons-of-skills-marketplace

    Build this skill enables AI assistant to provide interpretability and explainability for machine learning models.

    2.8k GitHub starsUsed in 1 repo~1k tokens
    Auto-check passed
  • Optimizing Prompts

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill optimizes prompts for large language models (llms) to reduce token usage, lower costs, and improve performance.

    2.8k GitHub starsUsed in 1 repo~1k tokens
    Auto-check passed

Questions about Validating Database Integrity

What does Validating Database Integrity do?

Process use when you need to ensure database integrity through comprehensive data validation. Validating Database Integrity is an agent skill from jeremylongshore/tons-of-skills-marketplace. Process use when you need to ensure database integrity through comprehensive data validation.

When should I use Validating Database Integrity?

Validating Database Integrity fits situations like: you need to ensure database integrity through comprehensive data validation; with phrases like validate database data; implement data validation rules; enforce data integrity constraints.

How do I install Validating Database Integrity in Claude Code?

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

How do I install Validating Database Integrity in Codex?

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

Can I use Validating Database Integrity 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 validating-database-integrity -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/validating-database-integrity, .gemini/skills/validating-database-integrity, .github/skills/validating-database-integrity and .opencode/skills/validating-database-integrity in your project.

What does Validating Database Integrity need to run?

Going by SKILL.md and its folder, Validating Database Integrity needs Python for the scripts in its folder. Our summary lists: Python 3. Its frontmatter pre-approves these tools: Read, Write, Edit, Grep, Glob, Bash(psql:*), Bash(mysql:*). Compatibility (from SKILL.md): Designed for Claude Code.

Does Validating Database Integrity access the network?

SKILL.md names 1 domain. As links in the text: postgresql.org. This is read from the text; nothing was executed.

Is Validating Database Integrity 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 Validating Database Integrity use?

Validating Database Integrity 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 Validating Database Integrity use?

About 1.9k tokens (SKILL.md is roughly 7.8k 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 17 tokens, read only when the agent opens those files.

What are the alternatives to Validating Database Integrity?

Skills that share tags, products or a category with Validating Database Integrity: Question2report (refraction-ray/xalpha, 2.7k stars), Dingo Verify (MigoXLab/dingo, 757 stars), Data Validation (platonai/Browser4, 1.2k stars) and Issues Deduplication (JetBrains/ideavim, 10k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Validating Database Integrity?

jeremylongshore (a GitHub user) maintains it in jeremylongshore/tons-of-skills-marketplace, which has 2,821 GitHub stars. The repository holds 3,342 skills in this directory. The repository was last updated on October 8, 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.