SuperAPI AI Directory

smart-data-analysis

Data & analytics

View repository

Updated 10-15 23:48

About this skill

Smart Data Analysis (Main Entry)

This skill is the sole front door for the data analyst and is responsible fororchestration and routing, and does not directly replace the table finding and data querying sub-processes.

Sub-skill references:

Core Responsibilities

  1. Identify whether it is a data-related request (data assets, data retrieval, metrics, tables/views, governance responsibilities, knowledge networks).
  2. Route to the following based on user intent:
    • smart-search-tables: find tables/find views/find fields/find responsibilities
    • smart-ask-data: data querying (text2sql, returns SQL + data)
  3. Align and pass context:kn_id, time range, filter conditions, business definitions.
  4. Give a clear explanation for requests beyond the capability boundaries of data querying/table finding; do not fabricate results.

Hard Constraints

  • The knowledge network source is based on SOUL.md .
  • smart-search-tables and smart-ask-data used by kn_id must come from SOUL.md declared configuration.
  • It is not allowed to directly enter sub-skill execution before completing the routing decision.
  • After a data querying hit, SQL and result data must be output; it must not be expanded into subjective analytical conclusions.
  • First execute the gatekeeping mechanism (environment detection, constraint detection, intent routing), then enter the sub-skill.
  • Progress output must follow the unified hard constraints in the "Progress Display Specification (Must Be Executed)".
  • Must be executed strictly according to the orchestration process and consecutive step numbering; no skipping steps, merging steps, reversing order, or bypassing gatekeeping.
  • Fabricating or tampering with the process is prohibited: do not fabricate executed steps, do not falsify step results, and do not arbitrarily modify process definitions and execution records.
  • If any step fails, the process must be stopped immediately and the real failure reason returned; in a failed state, subsequent steps must not continue.
  • Session reuse constraint: if in the same session the preceding context has already completed and passed Step 1 and Step 2, repeated detection may be skipped; but the progress "Step 1 verified and passed, Step 2 verified and passed" must first be output before entering Step 3.

Gatekeeping Mechanism (Must Be Executed First)

1) Environment Detection

Goal: confirm that the current environment can execute KWeaver commands.

  • Check whether kweaver is installed and available (e.g., whether kweaver --version can return normally).
  • If not installed or unavailable: immediately inform the user to install/repair first, then stop subsequent routing.
  • If it has already been confirmed as passed in the preceding context of the same session: repeated detection may be skipped, and Step 1 "verified and passed (reusing preceding result)" may be output.

2) Configuration Check

Goal: ensure that this skill's runtime configuration is available (including knowledge network configuration, kn_id context) and complete constraint injection.

  • Check whether a knowledge network configuration exists:SOUL.md can be read and contains available kn_id declarations.
  • If there is no knowledge network configuration: first prompt the user to supplement the configuration, then stop subsequent routing.
  • From SOUL.md Confirm the kn_id and context (time, filters, definitions) available for this request.
  • Verify whether kn_id actually exists in the platform and is accessible; if kn_id does not exist or is unavailable, you must prompt the user to firstconfigure or create a knowledge network(and supply a valid kn_id) before continuing.
  • Check whether the current session already contains this skill's constraints (source SOUL.md, KN must be declared, data queries return only SQL + data, etc.).
  • If not present: inject the constraints first, then continue execution.
  • After injection, remember them in the session; reuse them preferentially in subsequent turns of the same session, and do not inject them repeatedly.
  • If it has already been confirmed as passed earlier in the same session: you may skip the repeated check and output step 2 as "Already verified (reusing earlier result)".

3) Intent routing

Goal: route based on the user's question.

  • Clarification of ambiguous questions (mandatory): if the same question can fall into multiple intents among "data query / data discovery / other", or the key information is insufficient to uniquely determine the route, you must first ask the user a clarifying question; before the user confirms, you must not enter any sub-process.
  • Data query(how much, details, summary, statistics) → route to smart-ask-data
  • Data discovery(find tables, find fields, find views, find responsibilities) → route to smart-search-tables
  • Other(out of scope / non-data task) → return a scope explanation or switch to ordinary conversation; do not force entry into a sub-skill

4) Sub-process linkage (consecutive numbering)

Goal: connect the main entry gate with sub-process gates, avoiding duplicate numbering and skipped numbers.

  • The main entry is fixed to execute through step 4 (complete routing).
  • When routing to smart-ask-data , continue executing its steps 5-12.
  • When routing to smart-search-tables , continue executing its steps 5-10.
  • If a sub-process references "step N", the consecutive numbering system shall prevail.

Progress display specification (mandatory)

  • The main entry and sub-processes shall uniformly use "consecutive step numbering" to display progress.
  • Each time a step is completed, output the progress immediately; do not output it only in the final summary.
  • The progress output must include: process name, currently completed step, and next step plan.
  • If the current step has not yet output progress,you must not proceed to the next step。
  • If a missing step, skipped step, or step failure is found, you muststop the process immediatelyand explain the reason; do not continue execution.
  • At the end of a sub-process, you must output the "process complete" format (e.g.:[smart-search-tables] 进度:已完成第 10 步(总结结果);流程完成)。

Recommended template:

[smart-data-analysis] 进度:已完成第 N 步(步骤名称);下一步:第 N+1 步(步骤名称)

When steps 1/2 reuse an earlier result, you may use:

[smart-data-analysis] 进度:已完成第 1 步(环境检测,已校验通过-复用前文结果);下一步:第 2 步(配置检查)
[smart-data-analysis] 进度:已完成第 2 步(配置检查,已校验通过-复用前文结果);下一步:第 3 步(意图路由)

After entering a sub-process, continue using the same template:

[smart-ask-data] 进度:已完成第 N 步(步骤名称);下一步:第 N+1 步(步骤名称)
[smart-search-tables] 进度:已完成第 N 步(步骤名称);下一步:第 N+1 步(步骤名称)

Standard progress output example list

A. Main entry (steps 1-4)

[smart-data-analysis] 进度:已完成第 1 步(环境检测);下一步:第 2 步(配置检查)
[smart-data-analysis] 进度:已完成第 2 步(配置检查与确认 kn_id 上下文);下一步:第 3 步(意图路由)
[smart-data-analysis] 进度:已完成第 3 步(意图路由);下一步:第 4 步(路由到子流程)
[smart-data-analysis] 进度:已完成第 4 步(路由到子流程);下一步:进入子流程第 5 步

When reusing a previously verified result:

[smart-data-analysis] 进度:已完成第 1 步(环境检测,已校验通过-复用前文结果);下一步:第 2 步(配置检查)
[smart-data-analysis] 进度:已完成第 2 步(配置检查,已校验通过-复用前文结果);下一步:第 3 步(意图路由)
[smart-data-analysis] 进度:已完成第 3 步(意图路由);下一步:第 4 步(路由到子流程)
[smart-data-analysis] 进度:已完成第 4 步(路由到子流程);下一步:进入子流程第 5 步

B. Data query branch (smart-ask-data, steps 5-12)

[smart-ask-data] 进度:已完成第 5 步(检查知识网络);下一步:第 6 步(配置知识网络)
[smart-ask-data] 进度:已完成第 6 步(配置知识网络);下一步:第 7 步(寻找候选表)
[smart-ask-data] 进度:已完成第 7 步(寻找候选表);下一步:第 8 步(获取候选表详情)
[smart-ask-data] 进度:已完成第 8 步(获取候选表详情);下一步:第 9 步(生成查询 SQL)
[smart-ask-data] 进度:已完成第 9 步(生成查询 SQL);下一步:第 10 步(执行查询接口)
[smart-ask-data] 进度:已完成第 10 步(执行查询接口);下一步:第 11 步(画图需求分支)
[smart-ask-data] 进度:已完成第 11 步(画图需求分支);下一步:第 12 步(总结结果)
[smart-ask-data] 进度:已完成第 12 步(总结结果);流程完成

C. Data discovery branch (smart-search-tables, steps 5-10)

[smart-search-tables] 进度:已完成第 5 步(确认知识网络);下一步:第 6 步(配置知识网络)
[smart-search-tables] 进度:已完成第 6 步(配置知识网络);下一步:第 7 步(查询数据)
[smart-search-tables] 进度:已完成第 7 步(查询数据);下一步:第 8 步(筛选视图)
[smart-search-tables] 进度:已完成第 8 步(筛选视图);下一步:第 9 步(查询职责信息)
[smart-search-tables] 进度:已完成第 9 步(查询职责信息);下一步:第 10 步(总结结果)
[smart-search-tables] 进度:已完成第 10 步(总结结果);流程完成

Routing rules

1) Table discovery branch (smart-search-tables)

Enter this branch when the user's goal is to locate data assets, for example:

  • "Which table is a certain metric in"
  • "Is there an enterprise basic information view"
  • "Which department maintains this field?"

Delivery format: candidate tables/views/fields/responsibility information; does not directly replace query results.

2) Data query branch (smart-ask-data)

This branch is entered when the user's goal is to query specific data, for example:

  • "Query the number of newly added enterprises in the last 30 days"
  • "Count enterprises by region"
  • "Query a certain enterprise's address/status"

Delivery format: SQL + query results + minimal specification notes (time, filters, data source).

3) Out-of-scope scenarios

If the user's request is purely business interpretation, attribution suggestions, chart generation, secondary code processing, etc., it does not belong to this repository's data query pipeline; the boundary must be clearly communicated and the user guided to narrow it down to "finding tables" or "data queries expressible in SQL."

Execution checklist

总入口进度:
- [ ] 1. 环境检测:确认 kweaver 可用
- [ ] 2. 配置检查:检查 SOUL.md 知识网络配置,确认 kn_id 与上下文,并注入本 skill 约束(仅首次)
- [ ] 3. 意图路由:问数 / 找数 / 其他
- [ ] 4. 路由到子流程并衔接连续编号(问数 5-12 / 找数 5-10)

Typical invocation

/smart-data-analysis 查企业基本信息相关表
/smart-data-analysis 查询近30天个体工商户数量
/smart-data-analysis 用 d71o5e1e8q1nr9l7mb80 查询快讯传媒有限公司住址

Notes

  • This skill is responsible for "orchestration and routing," not for being the final executor.
  • When a sub-process fails, the real reason should be returned (permissions, missing specifications, no match, etc.); do not fabricate answers across branches.