Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIDeepSeekDeepSeekMuseMuse+22 more

    Live DB Import Guardrail: Validate Before Write

    1

    A pre-flight verification sequence to prevent importing or restoring data into the wrong database.

    $9.99

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned

    Live DB Import Guardrail: Validate Before Write

    Example session with this skill installed

    I am about to import this spreadsheet into our live database. Run your guardrail checks and tell me what to confirm before I click import.

    • Read your context and instructions
    • Compiled the live db import
    • Generated the data export

    I will now initiate the pre-flight guardrail sequence for your database import. We will not proceed with any data writes until all verification steps are confirmed.

    Database Import Guardrail: Q3_Transactions_Final.csv

    Check CategoryRequirementCurrent Status
    Active TargetName of the database currently open in your clientPENDING (Please state the name)
    Source FileQ3_Transactions_Final.csvVerified
    Source ScopePeriod: Q3 (July-Sept); Total Records: [Count needed]PENDING
    Backup ProofLocation and timestamp of backup made todayPENDING
    ValidationFirst record in file matches target schemaPENDING

    Step 1: Target Verification

    Please look at your database client window right now. What is the

    exact name of the database that is currently active?

    Step 2: Source Details

    Open the Q3_Transactions_Final.csv file.

    1. What is the total row count?
    2. What is the date of the first transaction in the file?
    3. What is the sum total of the 'Amount' column?

    Step 3: Backup Confirmation

    Do not rely on scheduled nightly backups. Please run a manual export/backup of the target database now. Provide the filename and storage path once complete.

    Next steps

    1. Provide the Active Database Name and the backup file path.
    2. Confirm the record count and total sum from the CSV.
    3. Once confirmed, we will identify the first record to be created for a final "sanity check" before clicking Import.

    Q3_Transactions_Final.csv

    CSV · data export

    Generated

    Example file from a real run - the skill writes it into your workspace.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    Stop Bad CSV Batches From Corrupting Live Database Tables

    One shifted CSV column, one duplicate primary key, or one unconfirmed write against a production database can corrupt customer records in seconds. This 3-layer skill forces AI coding agents and automation scripts through 4 hard gates before modifying a single live row: Environment Lock -> Schema/Type/Key Validation -> Automatic SHA-256 Snapshot -> Transactional Dry-Run & Row-Diff.

    Built 100% on Python 3's built-in standard library (sqlite3, csv, json, shutil, hashlib, datetime, pathlib, argparse) — zero pip install, zero external dependencies, instant 60-second local verification.

    What's Inside

    • 4-Gate Import SOP (SKILL.md): Forces Environment Verification -> Schema/Type/Key Validation -> Automatic Snapshot -> Transactional Dry-Run & Row-Diff before touching live tables.
    • Import Contract & Test Fixtures (schemas/ + examples/):
      • schemas/import_contract.schema.json (JSON Schema Draft 2020-12) for column types (int, float, str, email), primary keys, numeric bounds, allowed enums, and max allowed row-change %.
      • examples/import_contract.json, examples/demo_dirty.csv (shifted column, bad numeric types, invalid email, missing required field, duplicate primary key), and examples/demo_clean.csv (valid inserts + updates) for instant local testing.
    • Hard Guardrail Scripts (scripts/):
      • scripts/init_demo_db.py — generates a deterministic local SQLite database (examples/demo_live.sqlite) with 5 baseline rows in under 1 second.
      • scripts/db_import_guardrail.py — pure Python 3 stdlib validator that blocks unconfirmed LIVE/PROD writes (exit 1), creates timestamped pre-import snapshots with SHA-256 verification, prints exact INSERT/UPDATE/UNCHANGED row diffs, and supports --json output.
    • Verification Walkthrough: Real terminal FAIL/BLOCKED/PASS logs below proving 0 live rows are altered whenever bad data or an unconfirmed live target is caught.

    Who This Is For & Prerequisites

    Best fit for:

    • Solo builders, data engineers, and backend developers using Claude Code, Cursor, or Codex CLI to automate recurring CSV imports.
    • Ops teams running SQLite-backed internal tools, pipelines, or staging/production sync scripts who want a hard deterministic gate before committing writes.

    Prerequisites:

    • Python 3.10+ (standard library only — sqlite3 is included with Python).
    • No database server, Docker container, or third-party packages required to run the included demo.

    60-Second Quick-Start

    Run directly from the skill folder:

    # 1. Create deterministic demo SQLite database (5 baseline rows)
    python scripts/init_demo_db.py
    
    # 2. Run dirty CSV batch -> BLOCKED with 6 violations (exit 1, 0 live rows modified)
    python scripts/db_import_guardrail.py --db examples/demo_live.sqlite --csv examples/demo_dirty.csv --contract examples/import_contract.json
    
    # 3. Attempt live env without explicit unlock -> BLOCKED by Gate 1 (exit 1)
    python scripts/db_import_guardrail.py --db examples/demo_live.sqlite --csv examples/demo_clean.csv --contract examples/import_contract.json --env live
    
    # 4. Run clean batch with explicit live confirmation + automatic snapshot -> PASS (exit 0)
    python scripts/db_import_guardrail.py --db examples/demo_live.sqlite --csv examples/demo_clean.csv --contract examples/import_contract.json --env live --confirm-live --apply
    

    Real Terminal Proof

    1. Gate 2 FAIL — Dirty CSV Blocked (exit 1, 0 Live Rows Modified)

    $ python scripts/db_import_guardrail.py --db examples/demo_live.sqlite --csv examples/demo_dirty.csv --contract examples/import_contract.json
    === LIVE DB IMPORT GUARDRAIL (DRY-RUN | env=staging) ===
    Gate 1 (Env Lock)   : PASS
    Gate 2 (Validation) : FAIL
    Gate 3 (Snapshot)   : PENDING
    Gate 4 (Transaction): PENDING
    ----------------------------------------------------------------
    [FAIL] Row 3: duplicate primary key customer_id=1002 (first seen at row 2)
    [FAIL] Row 4 column 'monthly_spend': expected float, got 'not_a_number'
    [FAIL] Row 4 column 'seats': expected int, got 'three'
    [FAIL] Row 5 column 'email': invalid email format 'bob-missing-at-domain'
    [FAIL] Row 5 column 'plan_tier': missing required value
    [FAIL] Row 6: column count mismatch (expected 5, got 6 -- possible shifted columns)
    ----------------------------------------------------------------
    [BLOCKED] 6 violation(s) caught -- 0 live rows modified.
    EXIT=1
    

    2. Gate 1 BLOCKED — Unconfirmed live Target Rejected (exit 1, 0 Live Rows Modified)

    $ python scripts/db_import_guardrail.py --db examples/demo_live.sqlite --csv examples/demo_clean.csv --contract examples/import_contract.json --env live
    === LIVE DB IMPORT GUARDRAIL (DRY-RUN | env=live) ===
    Gate 1 (Env Lock)   : BLOCKED
    Gate 2 (Validation) : PENDING
    Gate 3 (Snapshot)   : PENDING
    Gate 4 (Transaction): PENDING
    ----------------------------------------------------------------
    [FAIL] Environment 'live' is locked. Pass --confirm-live to authorize inspection or write.
    ----------------------------------------------------------------
    [BLOCKED] 1 violation(s) caught -- 0 live rows modified.
    EXIT=1
    

    3. Gates 1–4 PASS — Clean Batch Applied With Verified Pre-Import Snapshot (exit 0)

    $ python scripts/db_import_guardrail.py --db examples/demo_live.sqlite --csv examples/demo_clean.csv --contract examples/import_contract.json --env live --confirm-live --apply
    === LIVE DB IMPORT GUARDRAIL (APPLY | env=live) ===
    Gate 1 (Env Lock)   : PASS
    Gate 2 (Validation) : PASS
    Gate 3 (Snapshot)   : PASS
    Gate 4 (Transaction): PASS (committed)
    ----------------------------------------------------------------
    Row Diff: INSERT=1 | UPDATE=2 | UNCHANGED=1 | Baseline=5 | Delta=60.0% (max 80.0%)
    Snapshot: examples\snapshots\demo_live_20261127_102215Z.sqlite
    SHA-256 : d38eee5ad63f0259bb04f2926af4d6db09ca6104b39ac1547807f99d30a91396
    ----------------------------------------------------------------
    [PASS] Import guardrail cleared -- 3 live row(s) modified.
    EXIT=0
    

    MCP Search Keywords

    live database import guardrail, sqlite csv import validator, database preflight check, schema validation, duplicate primary key check, pre-import snapshot backup, transactional dry-run, row diff, production write lock, python stdlib, zero dependencies, json schema, claude code skill, cursor skill, codex cli

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Data & Databases.

    Requires user to provide the name of the active database. Does not automate backup creation. Scope is limited to pre-flight and post-flight verification.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scan

    Security scan passed today

    Software
    Python

    Permissions

    Read Files
    Listed2 days ago
    Updatedtoday

    What's inside

    Frequently Asked Questions

    This skill acts as a mandatory 'pre-flight checklist' for AI agents, requiring them to verify database names, backup timestamps, and data integrity before executing any import command to prevent accidental overwrites.

    The skill is platform-agnostic and can be integrated with any AI agent capable of interacting with SQL databases, CRMs, or spreadsheets via CLI, API, or UI automation.

    You receive the structured logic and verification sequence designed for AI agents, along with a deployment guide to integrate these guardrails into your existing agentic workflows.

    No, the skill is designed to verify that a backup has been made; it does not perform the backup itself to ensure it doesn't interfere with your specific infrastructure or security policies.

    Integration is straightforward: you simply import the guardrail logic into your agent's system instructions or toolset to force the verification sequence before any data-altering action.

    It includes a 'read-back' confirmation where the agent must explicitly state the active environment and source metadata for your approval, preventing it from proceeding based on outdated or assumed context.

    New in Data & Databases