agentleFS
RitualDev-LabRitualDev-Lab/DBShield/SKILL.md

db-shield

Skill1 starsChanged 5 days agoMITView on GitHub

Safety-first Database Guardrail & Sandboxing MCP Server for AI Coding Agents. Protects relational databases from destructive mutations, drops, locks, and PII leaks.

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 1 is distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When interacting with databases, generating SQL, or executing migrations:

    line 15
  2. Very specific:

    NEVER execute unconstrained UPDATE, DELETE, or DDL statements directly against production or staging databases.

    line 18
  3. Very specific:

    Only execute db_commit using the verified commit_token returned by db_dry_run.

    line 28
  4. Very specific:

    Avoid WHERE 1=1, WHERE 'a'='a', or self-referential conditions (WHERE id = id).

    line 31
  5. Very specific:

    Always validate DDL scripts with db_validate_migration to check for unindexed foreign keys, table locks, and zero-downtime safety plans.

    line 35
  6. Very specific:

    Add DBShield to your agent configuration (mcp.json or .cursor/mcp.json):

    line 64

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

🛡️ DBShield AI Skill

This skill equips autonomous AI coding agents (Antigravity, Claude Code, Cursor, Windsurf, Codex) with safety-first database guardrails, two-phase dry-run execution, virtual schema masking, and real-time PII sanitization.

Directives for AI Agents

When interacting with databases, generating SQL, or executing migrations:

  1. Always Use Two-Phase Mutation (db_dry_run before db_commit):
    • NEVER execute unconstrained UPDATE, DELETE, or DDL statements directly against production or staging databases.
    • First invoke db_dry_run to inspect simulated row impacts and obtain a cryptographic commit token:
      {
        "tool": "db_dry_run",
        "arguments": {
          "query": "UPDATE users SET status = 'active' WHERE id = 42"
        }
      }
    • Only execute db_commit using the verified commit_token returned by db_dry_run.
  2. Never Write Tautological Queries:
    • Avoid WHERE 1=1, WHERE 'a'='a', or self-referential conditions (WHERE id = id).
    • DBShield's AST Tautology Trap intercepts and blocks these queries as critical violations.
  3. Validate Migrations Before Applying:
    • Always validate DDL scripts with db_validate_migration to check for unindexed foreign keys, table locks, and zero-downtime safety plans.
  4. Adhere to Virtual Schema Masking:
    • Internal tables (credentials, api_keys, admin_sessions) and restricted columns are automatically masked from agent introspection. Do not attempt to query system catalogs (information_schema, pg_catalog) to bypass masking.

🚀 CLI Commands & Quickstart

# Launch MCP Server on stdio (for Claude Desktop / Cursor / Antigravity)
npx @ritualdev-lab/dbshield start

# Launch PostgreSQL wire proxy on port 5433
npx @ritualdev-lab/dbshield proxy --port 5433

# Launch live query approval dashboard
npx @ritualdev-lab/dbshield dashboard --port 3100

# Generate SOC 2 compliance audit report
npx @ritualdev-lab/dbshield report --compliance soc2 --audit-pdf audit.pdf

# Auto-configure Claude Desktop
npx @ritualdev-lab/dbshield install-claude

# Auto-configure Cursor IDE
npx @ritualdev-lab/dbshield install-cursor

🛸 Antigravity & MCP Configuration

Add DBShield to your agent configuration (mcp.json or .cursor/mcp.json):

{
  "mcpServers": {
    "dbshield": {
      "command": "npx",
      "args": ["-y", "@ritualdev-lab/dbshield", "start"],
      "env": {
        "DBSHIELD_DIALECT": "sqlite",
        "DBSHIELD_STORAGE": "./dev.db",
        "DBSHIELD_TIER": "BALANCED"
      }
    }
  }
}

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.