Skip to content
youdede

Database Query Mode Guard

DataHookv1.0.0

Extracts bounded SQL from recognized CLI flags or structured query fields, masks comments and literals, and permits only read-oriented statement forms at a live execution boundary.

Runs on

Scope
$npx @youdede/toolkit add database-query-mode-guard --target claude-code

What it does

Block mutating SQL sent directly to database command and connector tools.

When it fires

  • implementation
  • pre-commit

How it behaves

Block mutating SQL sent directly to database command and connector tools.

It does not inspect migration files or database schema changes.

It does not connect to a database or execute EXPLAIN.

It does not treat stored procedures as read-only without an explicit static contract.

It does not inspect SQL sent from interpreters, scripts, or application code.

Configuration

targets/claude-code/database-query-mode-guard.mjsnode · read-only

Version
1.0.0
Requires
Shell command guard
Licence
RiskThis automatic gate blocks mutating SQL sent directly to database command and connector tools; a false denial can interrupt legitimate work, but it does not execute the blocked action.
Medium
ModeHow it works: fixed rules, model instructions, or both.
Deterministic only
Behaviour
Enforces, blocks on violation
On failure
Denies and blocks
LatencyThe entrypoint handles one intercepted event to block mutating SQL sent directly to database command and connector tools without deferred work.
Immediate
Data retentionWhether data remains after use and who manages its storage.
Not retained

Often used with

All in Data