extract-knowledge

Extract atomic business knowledge facts from validated question and gold SQL pairs.

1.5k|222|Updated Jul 4, 2025
One-click install
npx skills add https://github.com/Datus-ai/Datus-agent --skill extract-knowledge-datus-ai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: extract-knowledge
Source: https://github.com/Datus-ai/Datus-agent/tree/main/datus/resources/skills/extract-knowledge
Command: npx skills add https://github.com/Datus-ai/Datus-agent --skill extract-knowledge-datus-ai

SYSTEM DOCUMENTATION & REQUIREMENTS

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.

Frequently Asked Questions about extract-knowledge

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I extract business rules from gold SQL pairs to improve LLM SQL accuracy?

Extracting business rules from gold SQL pairs involves mining atomic facts like field encodings and implicit join rules by diffing generated SQL against validated queries, then persisting them to domain knowledge files to improve future LLM-generated SQL accuracy.

What is atomic fact mining for domain-specific SQL agents?

Atomic fact mining for domain-specific SQL agents is the extraction of non-derivable business facts like mandatory constant filters and measure definitions from validated natural language and gold SQL pairs to surface gaps in generic SQL generation knowledge.

What's the difference between lite mode and deep mode for knowledge extraction?

Lite mode uses the main agent to simulate SQL drafting and self-diff for knowledge gaps, while deep mode uses a blind SQL generation subagent for iterative validation, providing stricter fact extraction when higher accuracy is required.

How do I capture implicit join rules and field encodings for a data engineering workflow?

Capture implicit join rules and field encodings by running knowledge extraction on validated question and gold SQL pairs, which identifies these non-derivable business facts and persists them to domain-specific markdown knowledge files for agent access.

Can I persist extracted business knowledge facts for other agents to access?

Yes, you can persist extracted business knowledge facts. The process saves mined facts to domain-specific knowledge markdown files and updates the project AGENTS.md index, ensuring other SQL generation agents can seamlessly access the business rules.