smart-ask-data

Orchestrates ontology knowledge network queries from schema discovery through SQL execution to summarized results.

2.5k|134|Updated Jun 6, 2025
One-click install
npx skills add https://github.com/UnicomAI/wanwu --skill smart-ask-data
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: smart-ask-data
Source: https://github.com/UnicomAI/wanwu/tree/main/configs/microservice/bff-service/configs/agent-skills/ontology/smart-ask-data
Command: npx skills add https://github.com/UnicomAI/wanwu --skill smart-ask-data

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Answering business metrics and data questions against an ontology knowledge network requires choosing the right knowledge network, discovering object types and fields, generating correct SQL, and executing it safely. This Skill defines a fixed five-step pipeline that coordinates these stages so natural-language data questions produce verifiable SQL and grounded results without hallucinated tables or fabricated numbers.

Core Features & Use Cases

  • Fixed 5-step pipeline: Receive kn_id, discover schema via bkn object-type commands, generate SELECT/WITH SQL at the orchestration LLM layer, execute via dataview query, then summarize with SQL and result data shown together.
  • Schema-first SQL generation: Requires dataview get to fetch three-part meta_table_name before any SQL is written, preventing empty results from bare table names and eliminating field-name hallucination.
  • Strict safety constraints: Only SELECT/WITH statements are allowed, write operations and --raw-sql are rejected, and empty results must be reported honestly rather than filled with invented data.
  • Use Case: A user asks "last month's sales by region"; the Skill resolves the knowledge network, discovers the fact_sales_order and dim_region object types, generates a GROUP BY aggregation query, executes it through the ontology CLI, and returns the SQL plus a results table.

Quick Start

Ask a Chinese data question such as "上个月各区域销售额,按区域汇总" and let the skill resolve the knowledge network, generate the SQL, and return the executed results with the query shown.

Frequently Asked Questions about smart-ask-data

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

FAQPage Schema
How do I query an ontology knowledge network with natural language?

Pass a Chinese data question to the skill, which resolves the kn_id, discovers object types and fields via bkn object-type commands, generates SELECT SQL at the orchestration layer, and executes it with dataview query. The final answer always includes the executed SQL and key result data.

How does the skill prevent SQL hallucination on unknown schemas?

Schema discovery runs before any SQL generation: bkn object-type list/get returns fields and dataview-id, and dataview get returns the three-part meta_table_name. SQL must use only fields and table names from this schema summary, and bare table names are forbidden.

Can the skill execute INSERT, UPDATE, or DELETE statements?

No. Only SELECT and WITH statements are permitted through dataview query --sql, which rejects write operations by default. Using --raw-sql to bypass this restriction is explicitly prohibited.

What happens when a data query returns empty results?

The skill must state that no matching data was found and suggest next steps such as adjusting the time range, changing the metric definition, or switching knowledge networks. Fabricating or inferring data to fill empty results is strictly forbidden.

Does the ontology CLI require an authentication token?

No. This deployment of the ontology CLI requires no token, and commands must not include --token, auth.token, or Authorization headers. The only mandatory credential is the accountId passed as --user-id, injected by the upstream smart-data-analysis skill.

When should I use bkn object-type query instead of SQL?

Use bkn object-type query with a filter JSON for simple single-object-type filtering and pagination that needs no aggregation, GROUP BY, or JOIN. Any requirement involving aggregation or cross-table joins must go through the dataview query SQL path.