data-integrity-guards

Validate data across API, form, database, and logging layers.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/krwhynot/crispy-crm --skill data-integrity-guards
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: data-integrity-guards
Source: https://github.com/krwhynot/crispy-crm/tree/main/.claude/skills/data-integrity-guards
Command: npx skills add https://github.com/krwhynot/crispy-crm --skill data-integrity-guards

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Implements a four-layer validation pattern (API boundary, form state, database, and instrumentation) to prevent data corruption and ensure consistent behavior across the system.

Core Features & Use Cases

  • Layered validation: Zod-based API boundary validation, form defaults via schema, and strict object handling.
  • Database guards: RLS policies and soft-delete strategy to preserve data integrity and auditability.
  • Instrumentation: Diagnostic logging to aid debugging across layers.

Quick Start

Implement cross-layer validation for a resource by aligning API boundary validation, form defaults, DB rules, and instrumentation, then verify end-to-end integrity with tests.

Frequently Asked Questions about data-integrity-guards

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

FAQPage Schema
How do I validate data across multiple layers to prevent integrity breaches?

Multi-layer validation prevents data corruption by applying validation at the API boundary using Zod strictObject and coercion, deriving form defaults from schemas, enforcing database guards with RLS policies, and instrumenting logs for forensic analysis across all layers.

Can I use Zod with RLS and soft deletes for complete data protection?

Yes. Zod handles API boundary validation with strict schemas and input coercion, while RLS policies and soft-delete strategies enforce database-level guards. Together they create defense-in-depth protection ensuring data consistency and auditability.

What's the best way to implement form defaults derived from validation schemas?

Generate form defaults directly from your Zod schema definitions so the form state remains aligned with validation rules. This ensures consistency between API validation, form behavior, and database constraints.

How do RLS policies and soft deletes work together for data integrity?

RLS policies control row-level access at the database layer, while soft deletes preserve deleted records for auditability instead of removing them. Combined, they enforce access control and maintain a complete audit trail without data loss.

Why use structured logging for validation across layers?

Structured logging provides diagnostic instrumentation for debugging validation failures across API, form, and database layers. It creates a forensic record enabling you to trace data integrity issues and verify end-to-end validation behavior.

Do I need allowlisting in addition to Zod validation?

Yes. Allowlists complement Zod validation by restricting accepted values at the API boundary, reducing the attack surface and ensuring only expected data enters your system before further schema validation.