ktx-analytics

Answers data questions by querying ktx-connected warehouses through semantic-layer tools and read-only SQL.

1.6k|101|Updated May 10, 2026
One-click install
npx skills add https://github.com/Kaelio/ktx --skill ktx-analytics
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: ktx-analytics
Source: https://github.com/Kaelio/ktx/tree/main/packages/cli/src/skills/analytics
Command: npx skills add https://github.com/Kaelio/ktx --skill ktx-analytics

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Analysts and agents often guess table names, misread column encodings, or write SQL that runs but returns silently wrong numbers. This Skill provides a disciplined workflow for answering data questions against ktx-connected databases, using governed metric definitions and validated SQL instead of guesswork.

Core Features & Use Cases

  • Guided discovery workflow: Calls discover_data first to locate wiki pages, semantic-layer sources, metrics, tables, and columns before writing any SQL.
  • Semantic-layer-first querying: Prefers sl_query over raw SQL so approved measures remain the source of truth, falling back to read-only sql_execution only when needed.
  • SQL correctness rules: Enforces schema sampling, grain verification, fan-out join prevention, deterministic window ordering, full-precision math, and answer-completeness checks.
  • Use Case: A user asks "what's the breakdown of revenue by region last quarter?" The Skill discovers the relevant metric, resolves filter values with dictionary_search, queries the semantic layer, validates the result, and captures durable learnings via memory_ingest.

Quick Start

Ask a data question such as "show me monthly active users by plan tier for the last six months" against your configured ktx connection.

Frequently Asked Questions about ktx-analytics

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

FAQPage Schema
How do I answer data questions with a ktx-connected database?▼

Start by calling discover_data to see available wiki pages, semantic-layer sources, metrics, tables, and columns. Then inspect promising refs, resolve business values with dictionary_search, and query with sl_query or read-only sql_execution.

When should I use the semantic layer versus raw SQL?▼

Prefer sl_query whenever the semantic layer covers the question, since approved measures are the source of truth. Use sql_execution only for questions the semantic layer does not cover, after fetching engine conventions with sql_dialect_notes.

Can this Skill write or modify data in my warehouse?▼

No. The sql_execution tool is strictly read-only and the server rejects write statements. The Skill is designed for analysis, exploration, and metric investigation only.

Why does my SQL query return silently wrong numbers?▼

Common causes include fan-out joins inflating sums, integer division truncating rates, text-encoded numerics sorting lexically, and filtering before window functions. The Skill's sql_craft rules address each of these with sampling, pre-aggregation, casting, and explicit window frames.

How do I handle multiple warehouse connections?▼

Pass connectionId to entity_details, sl_read_source, and sql_execution when intent pins a specific warehouse. Omit it for unscoped discovery calls like discover_data and dictionary_search, and ask the user which warehouse to use when scoping is ambiguous.