warehouse-sql
Skill157 starsChanged 7 months agoMITView on GitHub
Review and run read-only natural-language SQL against a customer data warehouse with cached schema introspection and explicit write grants.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- Lukehle/closelooptheir own version, first seen Aug 25, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- Lukehle/closeloop★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository88 other files it gives its agents.
- AGENTS.mdAGENTS.md
- skills/llm-wiki/templates/AGENTS.mdAGENTS.md
- templates/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- 1passwordSkill
- agentic-tpmSkill
- airtableSkill
- alexaSkill
- apple-calendarSkill
- apple-musicSkill
- apple-passwordsSkill
- bahnSkill
- blinkSkill
- bookingSkill
- brand-voiceSkill
- byd-batterySkill
- channel-catchupSkill
- code-reviewSkill
- code-simplificationSkill
- current-timeSkill
- diagramSkill
- discordSkill
- distil-pii-redactorSkill
- docxSkill
- download-platform-invoicesSkill
- excalidrawSkill
- fastbillSkill
- fax-sendSkill
- feature-planningSkill
- firecrawlSkill
- froniusSkill
- ga4Skill
- gh-issuesSkill
- github-pr-workflowSkill
- gogSkill
- google-adsSkill
- google-workspaceSkill
- gwsSkill
- handoff-linksSkill
- hermes3000-writingSkill
- hetzner-cloudSkill
- hetzner-dnsSkill
- hetzner-storage-boxSkill
- heygenSkill
- homematicSkill
- hubspotSkill
- hueSkill
- human-distillSkill
- hybridclaw-helpSkill
- image-generationSkill
- iss-positionSkill
- langfuseSkill
- lexware-officeSkill
- llm-wikiSkill
- mailchimpSkill
- manim-videoSkill
- microsoft-365Skill
- miroSkill
- mittwaldSkill
- notionSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
9 rules. About 0 are common, 6 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 24
Use this skill when the user asks natural-language questions of a data warehouse, analytics database, or TPC-H-style reporting dataset.
- Distinctive: line 34
read-only execution by default
- Distinctive: line 35
write detection and explicit per-skill grant checks before any mutation
- Very specific: line 94
Use --cache-dir for tests or customer-specific workspaces.
- Very specific: line 112
Default posture is read-only.
- Distinctive: line 118
Do not set or reveal the write grant in chat.
- Distinctive: line 128
read-only unless the explicit write grant path is used
- Distinctive: line 150
Run the offline TPC-H-style scenarios:
- Very specific: line 170
Use --scenario-id <id> to isolate one scenario while iterating.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 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.
Files
Warehouse SQL
Use this skill when the user asks natural-language questions of a data warehouse, analytics database, or TPC-H-style reporting dataset.
Scope
- schema introspection for SQLite eval databases and pluggable Postgres, ClickHouse, BigQuery, and Snowflake backends
- cached schema summaries with explicit refresh commands for scheduled runs
- reproducible TPC-H-style evaluation cases for generated SQL
- deterministic SQL safety review before execution
- read-only execution by default
- write detection and explicit per-skill grant checks before any mutation
Default Workflow
- Refresh or read cached schema before asking the model to draft SQL:
python3 skills/warehouse-sql/scripts/warehouse_sql.py --format json schema --backend sqlite --database ./warehouse.db - Have the model draft SQL using the cached schema, then review it before execution:
For review-only commands, passpython3 skills/warehouse-sql/scripts/warehouse_sql.py --format json review "SELECT c_name FROM customer LIMIT 10"--model-reviewwith the original question to invoke HybridClaw's OpenAI-compatible gateway for the business-meaning review:python3 skills/warehouse-sql/scripts/warehouse_sql.py --format json review --model-review --question "Show the first 10 customers" "SELECT c_name FROM customer LIMIT 10" - Return the SQL to the user before execution when the user asks for review, when the query is broad, or when the result could expose sensitive business data.
- Execute only after the SQL review passes and include the original question:
python3 skills/warehouse-sql/scripts/warehouse_sql.py --format json query --backend sqlite --database ./warehouse.db --execute --question "Show the first 10 customers" "SELECT c_name FROM customer LIMIT 10"query --executealways invokes model review before running SQL. Configure model review withHYBRIDCLAW_GATEWAY_URL/GATEWAY_BASE_URLandHYBRIDCLAW_WAREHOUSE_SQL_MODEL_REVIEW_TOKEN,HYBRIDCLAW_GATEWAY_TOKEN, orGATEWAY_API_TOKEN. Execution requires--questionso the model can check whether the SQL answers the user's request.
Backend Contract
Supported backend names:
sqlite— executable through Python stdlib; used by the bundled eval suitepostgres—psycopgdriver, or a connector commandclickhouse—clickhouse-connectdriver, or a connector commandbigquery—google-cloud-bigquerydriver, or a connector commandsnowflake—snowflake-connector-pythondriver, or a connector command
For non-SQLite warehouses, install the backend driver package in the skill
runtime or provide --backend-command / HYBRIDCLAW_WAREHOUSE_SQL_<BACKEND>_COMMAND.
Connector commands read SQL on stdin and emit a JSON row array, {"rows": [...]}
or CSV with headers. Do not invent credentials.
BigQuery schema introspection requires --bigquery-dataset or
HYBRIDCLAW_WAREHOUSE_SQL_BIGQUERY_DATASET. Set
--bigquery-project / HYBRIDCLAW_WAREHOUSE_SQL_BIGQUERY_PROJECT when the
dataset is not in the default project.
Schema Cache
The helper writes schema cache files outside the repo by default at:
~/.hybridclaw/warehouse-sql/schema-cacheUse --cache-dir for tests or customer-specific workspaces. Use --refresh to
force re-introspection. Use schedule-refresh to register the refresh with the
HybridClaw gateway scheduler:
python3 skills/warehouse-sql/scripts/warehouse_sql.py --format json schedule-refresh --backend postgres --profile analytics --every "0 */6 * * *"Scheduled refreshes default to last-channel delivery. Use
--delivery-kind channel --delivery-to <channel-id> only when the target
channel id is known.
Set HYBRIDCLAW_GATEWAY_TOKEN or GATEWAY_API_TOKEN in the environment for
production scheduler registration. --gateway-token is supported for tests, but
tokens passed as CLI arguments can be visible in process listings.
Read/Write Rules
- Default posture is read-only.
SELECT,WITH, andEXPLAINare allowed. - Mutating SQL is blocked unless all of these are true:
- the user explicitly requested a write
- the command includes
--allow-write - the environment contains
HYBRIDCLAW_WAREHOUSE_SQL_WRITE_GRANT --write-grantexactly matches that environment value
- Do not set or reveal the write grant in chat. Treat it like an operator capability, not a user-facing token.
- Even with a write grant, explain the mutation and ask for confirmation before running it unless the user already gave a concrete write instruction.
SQL Review Rules
Before execution, check:
- single statement only
- read-only unless the explicit write grant path is used
- selected columns are narrow enough for the task
LIMITis present for exploratory row reads- joins use known keys from the schema cache
- date and tenant filters are present when the question implies scope
The helper emits a review object with safety status and findings. Treat that
as a deterministic guardrail. Pass --model-review on review-only commands to
have the helper invoke the configured OpenAI-compatible model endpoint and add
that verdict to review.modelReview; query --execute invokes model review
automatically. Execution is blocked unless both the deterministic guardrail and
model review pass.
Model review defaults to HYBRIDCLAW_GATEWAY_URL / GATEWAY_BASE_URL plus
/v1/chat/completions and model auxiliary/eval_judge, with authentication from
HYBRIDCLAW_WAREHOUSE_SQL_MODEL_REVIEW_TOKEN, HYBRIDCLAW_GATEWAY_TOKEN, or
GATEWAY_API_TOKEN. Use --model-review-url, --model-review-model,
--schema-cache, and --question to make the review explicit in tests or
operator workflows.
Eval Suite
Run the offline TPC-H-style scenarios:
python3 skills/warehouse-sql/scripts/warehouse_sql.py --format json eval-scenariosThe fixture at evals/tpch_tiny.sql contains a tiny public-schema-compatible
dataset using TPC-H-style tables (customer, orders, lineitem, supplier,
part, nation). It is an offline deterministic fixture for SQL generation
coverage, not a TPC-H benchmark run. The scenario file at
evals/tpch_scenarios.json verifies read-only review and execution against
deterministic answers.
To measure model SQL generation against the same deterministic fixture, run the model-backed planner:
python3 skills/warehouse-sql/scripts/warehouse_sql.py --format json eval-scenarios --model-planner --model-review-model gpt-5Use --scenario-id <id> to isolate one scenario while iterating.
Validation
Run:
python3 skills/skill-creator/scripts/quick_validate.py skills/warehouse-sql
python3 skills/warehouse-sql/scripts/warehouse_sql.py --help
python3 skills/warehouse-sql/scripts/warehouse_sql.py --format json eval-scenariosDoes 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
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.

