geethasagarb

Query Guard — Data skill for Claude Code

Data community

Stops risky SQL and dbt commands in Bash and asks you before they run.

How to install Query Guard

This entry records only its repository, not the path inside it, so there is no exact command to give. Open geethasagarb/query-guard and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Query Guard does

Stops risky SQL and dbt commands in Bash and asks you before they run. A Claude Code mod.

Alternatives in Data

  • Query Token Info — Search tokens and fetch metadata, real-time market data, and K-Line candlestick charts by keyword or contract 483 ★
  • Database Query 337 ★
  • Dbt Migration — Migrate SQL projects to dbt 276 ★

README

Query Guard

[![Tests](https://github.com/geethasagarb/query-guard/actions/workflows/test.yml/badge.svg)](https://github.com/geethasagarb/query-guard/actions/workflows/test.yml)

Query Guard is a Claude Code mod. It stops risky database commands and asks you before they run.

![Query Guard holding a DELETE without a WHERE clause](docs/demo.gif)

Illustrated demo of Query Guard

I built this because one bad `DELETE` can wipe a table. I let Claude run database commands for me, and I wanted a pause before the ones I can't undo.

Why it exists

Coding agents run shell commands. Database clients are shell commands too. Claude can type `DELETE FROM customers` and forget the `WHERE`. It can also point `psql` at the wrong host. Either mistake can destroy data in a second. It has already happened: in [this reported incident](https://claudeissues.com/issue/13325-claude-opus-4-5-executed-destructive-sql-update-deleting-55-000-records-without), Claude ran an `UPDATE` through a Supabase MCP tool that cleared fields on about 55,000 rows, with no backup to restore from. That route is exactly what v0.2 aims to cover.

Claude Code already shows you each command before it runs. But a long command is easy to skim. After many approvals, you stop reading closely.

Query Guard reads each database command first. If the command looks destructive, Query Guard holds it. If it points at production, Query Guard holds it too. Then it shows you the target and the current row count. The command waits until you choose.

What it catches

Query Guard checks Bash commands that run `sqlite3`, `psql`, `mysql`, `snowsql`, the `databricks` CLI, or `dbt`.

Rule Example that Query Guard holds
DROP TABLE, DROP DATABASE, DROP SCHEMA psql -c "DROP TABLE users"
TRUNCATE snowsql -q "TRUNCATE TABLE orders"
DELETE without WHERE sqlite3 demo.db "DELETE FROM customers"
UPDATE without WHERE mysql -e "UPDATE users SET active = 0"