bi-query

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

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.

agentmods
npx agentmods add skills/deepsqlai/deepsql/bi-query
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.

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. Scan, not verified.
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 $0.00028 $0.00925
Opus 5 $0.00014 $0.00463
Sonnet 5 $0.00006 $0.00185
Haiku 4.5 $0.00003 $0.00093

Measured 2d ago against content hash e7816661beaf, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, 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 2d 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. 2d 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 (23 stars, last pushed 2d ago), licensed Apache-2.0. It adds 28 tokens to every session and 925 once invoked, about $0.0001 per session on Opus 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

Other skills, from other repositories

configure-nightwatch

Configures Laravel Nightwatch data collection, sampling rates, filtering rules, and redaction policies. Use when setting up Nightwatch, managing data volume, protecting sensitive data (PII), or optimizing event collection for production workloads.

coollabsio/coolify · 49 tokens

laravel-actions

Build, refactor, and troubleshoot Laravel Actions using lorisleiva/laravel-actions. Use when implementing reusable action classes (object/controller/job/listener/command), converting service classes/controllers/jobs into actions, orchestrating workflows via faked actions, or debugging action entrypoints and wiring.

coollabsio/coolify · 62 tokens

debugging-output-and-previewing-html-using-ray

Use when user says "send to Ray," "show in Ray," "debug in Ray," "log to Ray," "display in Ray," or wants to visualize data, debug output, or show diagrams in the Ray desktop application.

coollabsio/coolify · 58 tokens

fortify-development

ACTIVATE when the user works on authentication in Laravel. This includes login, registration, password reset, email verification, two-factor authentication (2FA/TOTP/QR codes/recovery codes), passkeys, profile updates, password confirmation, or any auth-related routes and controllers. Activate when the user mentions…

coollabsio/coolify · 199 tokens

pest-testing

Use this skill for Pest PHP testing in Laravel projects only. Trigger whenever any test is being written, edited, fixed, or refactored — including fixing tests that broke after a code change, adding assertions, converting PHPUnit to Pest, adding datasets, and TDD workflows. Always activate when the user asks how to…

coollabsio/coolify · 171 tokens

configuring-horizon

Use this skill whenever the user mentions Horizon by name in a Laravel context. Covers the full Horizon lifecycle: installing Horizon (horizon:install, Sail setup), configuring config/horizon.php (supervisor blocks, queue assignments, balancing strategies, minProcesses/maxProcesses), fixing the dashboard…

coollabsio/coolify · 137 tokens