bi-query

bi-query is a skill for Claude Code, Codex from DeepSQLAI/deepsql. It costs 28 tokens per session (925 once invoked), scanned A, original, Apache-2.0.

A read-only workflow for answering business questions with SQL against a DeepSQL database. It first uses database context and schema information to ground the query in the actual tables and business rules.

In plain words
What is it for?
Use it for questions such as bookings last week, revenue by region, or top customers. It resolves the database connection, checks relevant context, writes one query, reviews its plan when needed, runs it, and reports the result.
Why use it?
It reduces errors such as using the wrong columns, including cancelled records, or running unsafe multi-statement SQL when answering questions about stored data.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it for questions such as bookings last week, revenue by region, or top customers. It resolves the database connection, checks relevant context, writes one query, reviews its plan when needed, runs it, and reports the result.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/deepsqlai/deepsql/bi-query
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add DeepSQLAI/deepsql --skill bi-query
Clone the repo
git clone --depth 1 https://github.com/DeepSQLAI/deepsql

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for bi-query

README.md
[![agentmods](https://agentmods.dev/badge/skills/deepsqlai/deepsql/bi-query/github.svg)](https://agentmods.dev/skills/deepsqlai/deepsql/bi-query)
Your own site
<a href="https://agentmods.dev/skills/deepsqlai/deepsql/bi-query"><img src="https://agentmods.dev/badge/skills/deepsqlai/deepsql/bi-query/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for bi-query

Your own site · 80×15
<a href="https://agentmods.dev/skills/deepsqlai/deepsql/bi-query"><img src="https://agentmods.dev/badge/skills/deepsqlai/deepsql/bi-query.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 28 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 925 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00028 $0.00925
Opus 5.5 $0.00011 $0.00370
Sonnet 5.5 $0.00006 $0.00185
Haiku 4.5 $0.00003 $0.00093

Measured 3mo ago against content hash e7816661beaf, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

bi-query scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

agent/skills/bi-query/SKILL.md · 41 lines

How it starts

The opening of the file, as written. The whole thing — 41 lines — stays where its author put it; the contents beside it link to each section on GitHub.

BI Query

Use when the user asks a question whose answer is in the data ("how many bookings last week?", "revenue by region", "top 10 customers"). The output is a number/table, not schema advice.

Procedure

  1. Resolve the connection. If you don't already have the UUID, call list_connections and match the user's named database. Pass the UUID to every later call.

  2. Ground. Call get_brain_context(connectionId, "<the user's question>"). Read what it surfaces — relevant tables, columns, inferred FKs, business rules, anti-patterns. Do not skip this even if you think you know the table.

  3. Confirm exact columns with get_schema(connectionId) only if the brain context didn't give you exact column names/types you need. Don't query information_schema.

  4. Write ONE statement. Table-qualify every column. Apply every relevant business rule (e.g. cancelled/soft-delete filters) without being asked. Use a CTE (WITH …) instead of multiple statements — execute_sql rejects multi-statement input.

  5. Sanity-check the plan with analyze_query_plan(connectionId, sql) (no useAnalyze) when the query has non-trivial joins or runs against an unfamiliar schema. It's cheap and catches bad joins before you show the user a wrong number.

  6. Run it with execute_sql(connectionId, sql, limit=…). Remember: default 100 rows, max 1000. For a total, SELECT COUNT(*) rather than counting a truncated result set.

  7. Answer only. Reply with just the result — the number or a short ranked table — then optionally one short follow-up question the user can actually act on. Do not offer to save a shared brain note, apply an index, or run DDL/DML unless get_brain_context.callerCapabilities says they can. Apply business rules silently; do NOT append "Grounding used" / "Filters applied" / "Used:" / tool-narration / column-mapping sections. Only if the user asks how you got it do you show the tables, joins, and filters.

Guardrails

  • Read-only only. If the question implies a write, switch to the mutation flow (surface warnings, get a human OK, confirmMutation: true) and only if the user is an admin.
  • If get_brain_context returns nothing useful, do not guess a table from memory. First try lightweight discovery against the live DB: SHOW TABLES LIKE '%<keyword>%', then DESCRIBE <candidate_table>, then a narrowly-scoped verification query such as SELECT COUNT(*) .... Ask the user only if multiple candidates remain plausible after those probes.
  • If schema/object metadata is too large or get_database_objects times out, prefer targeted read-only probes over broad catalog dumps.
  • When the user asks for a chart or ranking and brain context is thin, first identify the fact table and dimension join path with small probes, then run the final aggregation. Example pattern used successfully in analytics_db: CUSTOMER_ORDERS.customer_id -> CUSTOMERS.id for city-level booking rollups, and PRICE_BREAKDOWN.booking_id -> CUSTOMER_ORDERS.id -> CUSTOMERS.id for customer-level room-price averages.
  • If the user says "active customers" or similar status language, check brain context for status-source rules before using a status column. In analytics_db, PRODUCT_PRICING.property_status is the correct source and CUSTOMERS.onboarding_status is specifically the wrong one.
  • For chart requests in chat-only environments, still run the real aggregation query first. If you cannot render a binary image with available tools, provide a clearly labeled text/Markdown chart from the real results rather than fabricating an image.
  • Never present a truncated (limit-capped) result as a total.

Read the full file on GitHub · 41 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3mo ago First seen · 41 lines · 28 tokens per session scan A e7816661beaf

Subscribe to this mod's changes

bi-query is a skill published in the GitHub repository DeepSQLAI/deepsql (41 stars, last pushed 5d ago), licensed Apache-2.0. It adds 28 tokens to every session and 925 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

bi-query compared with skills from other repositories

bi-query next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
bi-queryDeepSQLAI/deepsqlSkill415d agoApache-2.0A28Claude Code, Codex
sql-expertpersonamanagmentlayer/pclSkill461mo agoApache-2.0A66Claude Code
datasetsAryan-Jhaveri/mcp-statcanSkill823d agoMITA67Claude Code, Codex
graphjin-evaldosco/graphjinSkill3.2kyesterdayApache-2.0A27Claude Code, Codex
planetscaleericrisco/rsc-harnessSkill6825d agoMITA87Claude Code, Codex
output-dev-credentialsgrowthxai/outputSkill4454d agoApache-2.0A36Claude Code
changebibinprathap/VeritasGraphSkill327yesterdayMITA27Claude Code