ktx Analytics Workflow
Drives a disciplined discover-inspect-plan-query-validate loop over ktx-connected databases so analytical answers are correct, not just runnable.
Data & AnalyticsAdvanced★ 1,532⑂ 99AI score 8/10Last updated: Jul 19, 2026
What it does
It gives Claude a standard operating procedure for answering any data question through the ktx MCP tools (discover_data, entity_details, dictionary_search, sl_query, sql_execution, memory_ingest).
- Enforces a 7-step loop — discover → inspect → resolve values → plan → query → validate → capture learnings — so table and column names are never guessed.
- Prefers the semantic layer (measures/dimensions) over raw SQL, keeping metric definitions authoritative.
- The
<sql_craft>section is a long, example-backed catalogue of the errors that produce silently wrong numbers: fan-out joins inflating SUMs, inner-joining a dimension purely for a label and dropping fact rows, parsing text-encoded numerics (1.2K,$1,200,-), the RANGE-frame trap in running totals, integer division on postgres/sqlite/tsql, filtering before a window, macro vs micro averages, and period anchoring on lifecycle timestamps. - Requires the exact output-column contract to be written down before the SQL, plus a final completeness check before answering.
Who it's for
- Teams already running the ktx CLI/MCP against a warehouse (BigQuery, Postgres, Snowflake, SQLite, ...).
- Analysts and analytics engineers who let an LLM write ad-hoc SQL and have been burned by subtly wrong totals.
- Data orgs that want metric definitions and schema gotchas accumulated back into a searchable memory/wiki.
Examples
- "How many orders per region contain a returned item?" — the skill pre-aggregates order lines to one row per qualifying order before joining, so an order with two returned lines isn't counted twice.
- "Each customer's first order, but only since 2024-01-01" — the window is computed over the full partition and filtered in the outer query, so "first" reflects real history.
- "What's total trade volume?" when amounts are stored as
'3M'/'$1,200'/'-'— one early CTE strips symbols, scales K/M/B suffixes and maps sentinels, avoiding a SUM that silently collapses to near-zero.
· · · Install guide · · ·
Install in the Claude app (no terminal)
- Download the ZIP with the button below.
- In Claude, open Settings → Capabilities and turn on 'Code execution and file creation'. (one time)
- Go to Customize → Skills → + → 'Upload a skill' and upload the ZIP.
Install in Claude Code
Let Claude do it — paste this into Claude Code
Install the skill I found on Claude Skill Mart. Copy the packages/cli/src/skills/analytics folder from the GitHub repo Kaelio/ktx into my ~/.claude/skills/ktx-analytics/. When it's done, tell me in one line what this skill can do.
Install with a command instead
git clone https://github.com/Kaelio/ktx.git && mkdir -p ~/.claude/skills && cp -r ktx/packages/cli/src/skills/analytics ~/.claude/skills/ktx-analytics⚠ This is a third-party skill. Check the source repository before installing.
- Prerequisites: the ktx CLI installed and at least one database connection registered with the ktx MCP server. Without a live connection this skill has nothing to call.
- Clone the repository:
git clone https://github.com/Kaelio/ktx.git - Copy the skill folder into your Claude skills directory:
mkdir -p ~/.claude/skills && cp -r ktx/packages/cli/src/skills/analytics ~/.claude/skills/ktx-analytics - Verify that
~/.claude/skills/ktx-analytics/SKILL.mdexists. - In Claude Code, confirm the ktx MCP server is connected (run
/mcp, or ask Claude to callconnection_list). - Restart Claude Code and try a prompt like "how many orders did we get last month?" — the skill triggers automatically for data questions.
View source on GitHub ↗License: Apache-2.0