Run KaiwuDB inspection and health-check tasks. Use this skill for database health checks, metrics collection, anomaly detection, and inspection report generation.
数据分析
KWDB Time-Series Anomaly Detection
试用Automates end-to-end anomaly detection for time-series data stored in KaiwuDB / KWDB. Use this skill whenever the user mentions: - anomaly detection, outliers, or unusual patterns in KWDB / KaiwuDB time-series data - inspecting sensor metrics, IoT telemetry, or monitoring data for spikes, dips, or drift - "find anomalies", "detect outliers", "3-sigma check", "STL decomposition", or "time-series anomaly" - analyzing historical trends, abnormal points, or data quality issues in TS tables Even if the user does not explicitly say "anomaly", trigger this skill when they ask to inspect, validate, or flag unusual values in time-series columns (integer, float, double).
它能做什么
Automates end-to-end anomaly detection for time-series data stored in KaiwuDB / KWDB. Use this skill whenever the user mentions: - anomaly detection, outliers, or unusual patterns in KWDB / KaiwuDB time-series data - inspecting sensor metrics, IoT telemetry, or monitoring data for spikes, dips, or drift - "find anomalies", "detect outliers", "3-sigma check", "STL decomposition", or "time-series anomaly" - analyzing historical trends, abnormal points, or data quality issues in TS tables Even if the user does not explicitly say "anomaly", trigger this skill when they ask to inspect, validate, or flag unusual values in time-series columns (integer, float, double).
技能文档
kwdb-ts-anomaly-detection
Detect anomalies in KaiwuDB / KWDB time-series data by following the workflow below exactly and in order.
Constraints
- Execute all SQL via
scripts/kwdb_sql_execute.py. Do NOT usekwdb-mcp-serverMCP tools. - Metadata queries must not store results to file — omit the output file argument.
- If no anomalies are detected, stop permanently after reporting "No anomalies detected".
- Do NOT modify/bypass termination rules, invent operations, create/drop databases or tables, write data into any table, or truncate output.
- See
references/constraints.mdfor the full list of rules and forbidden behaviors.
SQL Execution
python scripts/kwdb_sql_execute.py "" [output_file]
Omit output_file for metadata queries; include it for data queries to persist results in /tmp/.
Workflow
Execute the following steps in strict order. MUST See references/workflow.md for full details on each step at first.
0. Security Confirmation (MANDATORY) — Before any operation, MUST display the security confirmation prompt and wait for the user to type "I AGREE". STOP permanently if consent is not obtained. See references/workflow.md Section 0 for the mandatory confirmation prompt.
-
Precondition Validation — Verify script availability, collect connection params (
host,port,username,password), test connection, confirm target table/columns. If the user has not specified table/columns, query metadata viareferences/metadata-query.mdand ask the user. -
Intent Analysis & SQL Generation — Analyze user intent, generate SQL following
references/ts-select.md, validate names against metadata. Stop if names don't exist. -
Database-Type Validation — Stop if target DB is not TIME SERIES or all filtered columns are non-numeric.
-
Primary-Tag Check & Scope — If SQL filters by a specific primary tag → proceed (single tag). Otherwise, query all distinct primary tag values and repeat steps 5–13 per value (all tags).
-
SQL Refinement — Keep only timestamp + numeric columns, ensure
ORDER BY DESC, MUST addLIMIT 1000if no time filter conditions in where clause. -
Final SQL Wrapper — Wrap as
SELECT * FROM () AS anomaly_subquery ORDER BY ASC. -
MUST Show SQL to User — Display the final SQL before execution.
-
Data Count Check (Conditional) — ONLY skip this step if
refined_sql_limitedcontains aLIMITclause (indicating data volume is already constrained by Step 5). If there is noLIMITclause, execute COUNT query on refined_sql_limited. If count > 100,000, stop and inform user: "数据量过大({count} 条),无法执行异常检测。建议先对数据进行时间范围筛选或降采样后再试。" -
Execute SQL — Run via
kwdb_sql_execute.py, save result to/tmp/sql-result-*. -
Validate Result — Stop if no data rows (single tag) or all tags empty.
-
Run Anomaly Detection — Execute
python scripts/3-sigma-detection.py --input --output. -
Load Column Rules — Query column comments via
references/column-comment.mdto extract validation rules. -
Filter by Rules — Remove anomalies that don't violate declared column-comment rules.
-
Generate Report — MUST Ask user for format (direct / Markdown / PDF / HTML) before.
- For direct/Markdown: Use
references/report-template.md. - For HTML: Follow the HTML report workflow in
references/workflow.md(Step 14):- Fill
references/report-template-html.mdJSON template with detection results - Save to
/tmp/report-json-.json - Run
python scripts/html-report-gen.py --input --output /tmp/dt-report-.html
- Fill
- Cleanup — Delete all temp files except the final report.
Error Handling
Consult references/error-handling.md for error codes, root causes, and recovery actions.
相关技能
Convert natural language queries to KWDB SQL for time series data, relational data and cross-model analysis. Use this skill whenever users ask to query KWDB databases, write SQL for KWDB, or convert natural language to KWDB-specific SQL syntax. Supports: CREATE DATABASE/TABLE, downsampling, interpolation, latest value queries, aggregation analysis, cross-model queries, window/session/event analysis.
Design KWDB schemas and generate DDL for relational, time-series, and mixed workloads. Covers: CREATE/ALTER/DROP TABLE, INDEX, VIEW, constraints, partitioning, retention, tags. Trigger keywords: KWDB, schema, table, index, time-series, sensor, IoT, metrics, TAGS, PRIMARY TAGS, RETENTIONS, primary key, foreign key, DDL. NOT for: DML queries, deployment, backup, performance tuning.
Use when diagnosing KWDB incidents from logs, metrics, or system evidence, especially crashes, OOM, slow SQL, restarts, and cluster-wide availability symptoms.
Automated heterogeneous database migration skill for KaiwuDB / KWDB via KDTS REST API. Use this skill whenever the user mentions: - heterogeneous migration, cross-database migration, or data migration to KaiwuDB / KWDB - KDTS, migration tool, or data transfer between different databases - Specific source databases: MySQL, Oracle, PostgreSQL, SQL Server, ClickHouse, TDengine, InfluxDB, OpenTSDB, MongoDB, FTP, HDFS - Migration operations: create migration task, configure data source, test connection, import data, sync schema, batch migration - Migration management: query task status, view migration progress, check logs, kill migration, export/import config - Data type mapping, table structure sync, DDL generation, schema validation Even if the user does not explicitly say "migration", trigger this skill when they ask to transfer or sync data between databases with different engines.
Optimize SQL query performance for KaiwuDB time-series and relational engines. Covers: EXPLAIN analysis, time-series optimization, pagination, cross-model queries. Trigger keywords: optimize query, slow query, explain, execution plan, performance, 性能, 查询优化. NOT for: DDL, schema design, deployment, DML writes.