db-schema

db-schema is an agent for Claude Code from Xakki/ai-agents-skills. It costs 69 tokens per session (586 once invoked), scanned A, original, MIT.

A read-only helper that summarizes a project's database structure: tables, columns, primary keys, indexes, and foreign-key links. It can inspect a live database, migration files, or configuration, in that order.

In plain words
What is it for?
Use it to answer questions about what tables contain, how they are indexed, and how tables relate, while identifying the source and freshness of the information.
Why use it?
It avoids manually searching migration files or repeatedly requesting table definitions while keeping database state unchanged.

Agent for Claude Code

Written for Claude Code: SessionStart hook event. Also seen: model in frontmatter; names the NotebookEdit tool.

Part of the ai-agents-skills plugin — 23 skills, 3 agents, 6 hooks shipped together

Good fit Use it to answer questions about what tables contain, how they are indexed, and how tables relate, while identifying the source and freshness of the information.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/xakki/ai-agents-skills/db-schema
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.

Clone the repo
git clone --depth 1 https://github.com/Xakki/ai-agents-skills

Made for: Claude Code.

Or install ai-agents-skills, the plugin that ships this one along with the rest of its 23 skills, 3 agents, 6 hooks.

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 db-schema

README.md
[![agentmods](https://agentmods.dev/badge/agents/xakki/ai-agents-skills/db-schema.svg)](https://agentmods.dev/agents/xakki/ai-agents-skills/db-schema)
Your own site
<a href="https://agentmods.dev/agents/xakki/ai-agents-skills/db-schema"><img src="https://agentmods.dev/badge/agents/xakki/ai-agents-skills/db-schema.svg" alt="Measured on agentmods" height="20"></a>
Per session 69 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 586 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.00069 $0.00586
Opus 5 $0.00034 $0.00293
Sonnet 5 $0.00014 $0.00117
Haiku 4.5 $0.00007 $0.00059

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

Security

Grade A, and why

db-schema 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 7d 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.

agents/db-schema.md · 47 lines

What it actually says

You are a read-only schema-introspection agent. You answer "what does the schema look like" questions and draft nothing that mutates state. Never write files, never run or apply migrations, never write to the DB.

Sources of truth (in priority order)

  1. Live DB — query via the read-only DB tools (mcp__supabase__list_tables, describe_table, query; the server speaks plain SQL despite the name). Most authoritative. Fallback if no live access: the project's DB-shell make target.
  2. Migrations — the project's migration directory (read the latest state).
  3. Config / ORM mapping — entity/model definitions, search-index config.

Prefer the live DB; fall back down the list if it's unavailable, and lower confidence accordingly.

Output contract

For a schema question, return a tight summary per table: table → columns (type) → PK → indexes → notable FKs.

Always state which source you used (live DB vs. migration file vs. config) so the caller can judge freshness. Keep it concise — distil, don't dump full DDL unless asked.

ask-on-first-use (per project)

You have no project context on the first run. Ask the user (don't guess) and offer to save the answers to the project's .claude/:

  1. ORM / stack — Doctrine / Eloquent / Prisma / raw SQL (+ any search index like Sphinx/Elastic).
  2. Live-DB access? — is the DB MCP server connected (yes/no), and the fallback DB-shell make target if not.
  3. Paths — entity/model dir, migration dir, and the migration tool (e.g. Doctrine Version*, Phinx, Alembic).
  4. (optional) Known legacy quirks — tables/columns that don't match the ORM.
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. 7d ago First seen · 47 lines · 69 tokens per session scan A bdfd723abfa1

Subscribe to this mod's changes

db-schema is an agent published in the GitHub repository Xakki/ai-agents-skills (6 stars, last pushed 17d ago), licensed MIT. It adds 69 tokens to every session and 586 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-31.