AI Enriched Database Docs for Humans & Coding Agents
Agents need more than just a schema dump. Improve SQL query accuracy by 63% with a DB.md.
$ npx dbctx@latest $DATABASE_URL # <-- generates DB.md// WHY?
Research shows AI-generated SQL fails 42% of the time without proper semantic schema context.
// DATABASE SUPPORT
// WHAT IT OFFERS
A Semantic Documentation Agent
dbctx's looks at the database holistically to infer use-cases, business logic and detailed descriptions of your db object.
More Than Just Structure
dbctx also looks at random anonymized samples of your non-sensitive data to make better assumptions about your DB's objects.
AI Friendly Documentation
DB.md is designed to be easily parsable by coding agents like Claude Code or chatbots like ChatGPT.
Auto Discovers Phantom Foreign Keys
dbctx's documentation agent finds references in your schema even if you don't have foreign key constraints baked into your migrations.
Auto-categorization
It categorizes tables, views and types into "subsystems" for a richer semantic story capturing the relationships between each system.
Stale Table Detection COMING SOON
Automatically detects stale tables no longer being used and excludes them.
Example Query Generation COMING SOON
More context to agents and humans by generating example questions and their answers, agentically.
Web Research & OSS Docs COMING SOON
Better holistic understanding of the database, by grounding via agentic web research and OSS documentation lookup.
// HOW TO USE
- Run dbctx in your app's root directory dbctx generates a DB.md file in your current directory.
- Add instructions to use DB.md to your CLAUDE.md or AGENTS.md.
- Enjoy 63% better query accuracy.
// AGENT SUPPORT
// USE CASES
Coding agents like Claude Code or Cursor can read the DB.md file to provide context when writing queries for your application.
Coding agents like Claude Code or Cursor can read the DB.md file to provide context when writing queries for your application.