ask-database

ask-database is a skill for Claude Code, Codex from spencerpauly/skills-repo. It costs 61 tokens per session (620 once invoked), scanned A, original, MIT.

A way to answer questions about information stored in a connected database by translating plain language into a read-only SQL query.

In plain words
What is it for?
It helps answer questions about counts, users, subscriptions, orders, and other stored records by reading the schema and running limited SELECT queries.
Why use it?
It removes the need to write SQL manually and prevents changes to the database.

Skill for Claude CodeCodex

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

Good fit It helps answer questions about counts, users, subscriptions, orders, and other stored records by reading the schema and running limited SELECT queries.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/spencerpauly/skills-repo/ask-database
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 spencerpauly/skills-repo --skill ask-database
Clone the repo
git clone --depth 1 https://github.com/spencerpauly/skills-repo

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 ask-database

README.md
[![agentmods](https://agentmods.dev/badge/skills/spencerpauly/skills-repo/ask-database/github.svg)](https://agentmods.dev/skills/spencerpauly/skills-repo/ask-database)
Your own site
<a href="https://agentmods.dev/skills/spencerpauly/skills-repo/ask-database"><img src="https://agentmods.dev/badge/skills/spencerpauly/skills-repo/ask-database/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 ask-database

Your own site · 80×15
<a href="https://agentmods.dev/skills/spencerpauly/skills-repo/ask-database"><img src="https://agentmods.dev/badge/skills/spencerpauly/skills-repo/ask-database.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 61 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 620 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.
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.00061 $0.00620
Opus 5 $0.00030 $0.00310
Sonnet 5 $0.00012 $0.00124
Haiku 4.5 $0.00006 $0.00062

Measured 12d ago against content hash 1914289b9ed4, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

ask-database 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 12d 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.

skills/ask-database/SKILL.md · 59 lines

How it starts

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

Ask Database

Translate a question into SQL, run it through QueryBear's read-only gateway, and return the answer in plain language.

When to use

  • The user asks a question whose answer is stored in their database: "how many active subscriptions do we have", "which users haven't logged in in 30 days", "what's the median order value last week".
  • The user pastes a SQL question or asks "can you run this query".

QueryBear is read-only — never propose this skill for INSERT/UPDATE/DELETE/DDL. Mutations will be rejected by the gateway.

Steps

  1. Pick a connection.

    • If the user has only one database, skip discovery and call get_schema and run_query with no connection argument.
    • If they have multiple and you don't know which, call list_connections once and ask the user to pick (or infer from context: "production" vs "staging").
  2. Read the schema once per task with get_schema. Note the relevant tables and column types before writing SQL. Don't guess column names.

  3. Write a focused SELECT.

    • Always include a LIMIT — usually 100 — unless the user explicitly asks for everything.
    • Aggregate when the question is a count, sum, average, or distribution.
    • Prefer one query that answers the question over five exploratory queries.
  4. Run it via run_query. If QueryBear rejects the query (blocked column, blocked table, row-limit hit, timeout), surface the error message verbatim — don't paraphrase or guess around it.

  5. Translate the result back to English. Lead with the answer. Show the underlying SQL underneath in a code block so the user can audit it. If the result is a list of more than ~10 rows, summarize patterns and offer to drill in.

Output format

**Answer:** <one sentence with the number/list/whatever>

```sql
<the query you ran>
col col
... ...

## Don't

- Don't try to mutate. QueryBear blocks it; even attempting wastes a turn.
- Don't `SELECT *` on a wide table without a `LIMIT`.
- Don't guess column names. Re-read the schema if you're unsure.
- Don't return a 500-row table inline. Summarize and offer the full export.

Read the full file on GitHub · 59 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. 12d ago First seen · 59 lines · 61 tokens per session scan A 1914289b9ed4

Subscribe to this mod's changes

ask-database is a skill published in the GitHub repository spencerpauly/skills-repo (25 stars, last pushed 2mo ago), licensed MIT. It adds 61 tokens to every session and 620 once invoked, about $0.0003 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

create-pr

Creates a GitHub PR with a Linear-ticket-prefixed title and a decision-led, narrative description for Prisma 8. Use when the user wants to create a pull request, open a PR, or submit changes for review.

prisma/orm · 48 tokens

schema-exploration

Lists tables, describes columns and data types, identifies foreign key relationships, and maps entity relationships in a database. Use when the user asks about database schema, table structure, column types, what tables exist, ERD, foreign keys, or how entities relate.

langchain-ai/deepagents · 57 tokens

ha-data-stores

Map of Hope Agent's local data stores and safe read-only query workflow. Use when the user asks where Hope Agent stores data, wants to inspect sessions/messages/memory/logs/background jobs/knowledge indexes/settings, asks the model to query local app data, or debugging requires checking persisted state. Trigger…

shiwenwen/hope-agent · 115 tokens

nornicdb-cypher-queries

Pick fast, predictable Cypher query shapes in NornicDB — point lookups, batch retrieval, pagination, search, traversal, batched UNWIND/MERGE writes, cleanup, multi-tenant isolation. Use when writing or reviewing Cypher whose latency or throughput matters; maps user intent to the executor's hot-path query templates.

orneryd/NornicDB · 79 tokens

supabase

Supabase / PostgREST Row-Level-Security playbook — pull the anon (or leaked servicerole) key out of the frontend JS, map tables from the auto-generated OpenAPI spec, test anonymous RLS READ disclosures (PII/secret leaks), and anonymous RLS WRITE abuse (insert/update/delete — e.g. forging…

PentesterFlow/agent · 120 tokens

volcengine-rds-postgresql

A tool for operating PostgreSQL databases hosted by Volcano Engine's managed database service. PostgreSQL is a relational database used to store structured application data.

bytedance/agentkit-samples · 63 tokens