What problem does it solve?
Generic SQL generation agents lack domain-specific business knowledge, leading to incorrect SQL when answering natural language data questions. This Skill eliminates that gap by mining atomic, reusable business facts from validated (question, gold_sql) pairs, so future SQL generations are accurate and aligned with your business rules.
Core Features & Use Cases
- Dual extraction modes: Choose fast lite mode (main agent simulates SQL drafting to find knowledge gaps) or strict deep mode (uses a blind gen_sql subagent for iterative validation) based on your accuracy needs.
- Atomic fact mining: Extracts non-derivable business facts including field encodings, mandatory constant filters, implicit join rules, measure definitions, and boundary condition traps from the gap between generated and gold SQL.
- Automated knowledge management: Persists facts to domain-specific
knowledge/*.md files and updates the project AGENTS.md index for seamless access by other agents.
- Use case: A data team building an e-commerce SQL agent can run this Skill on pairs like "What is the monthly retained customer count?" and its correct gold SQL to extract facts like "retained customers require a prior purchase in the same calendar month" and "order status 'completed' is encoded as 2 in the orders.status column".
Quick Start
Run the extract-knowledge skill on your attached (question, gold_sql) pairs to automatically mine and save reusable business knowledge facts to your project's knowledge directory.