sl

Query pre-defined business metrics through a YAML semantic layer catalog.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Data agents often write incorrect SQL because they lack knowledge of approved metric definitions, joinable columns, and business logic. This Skill provides a structured semantic layer catalog of sources, measures, joins, and segments so agents can query metrics like ARR, churn, retention, and LTV accurately without hand-writing fragile SQL.

Core Features & Use Cases

  • Schema Reference: Defines three source flavors in YAML - overlays that enrich manifest-backed tables, standalone table sources, and standalone SQL sources - with columns, grain, joins, measures, and segments.
  • Structured Querying via sl_query: Generates correct SQL from a structured query, automatically handling join path resolution, fanout prevention, aggregation correctness, and WHERE/HAVING filter classification.
  • Use Case: Ask for monthly ARR filtered to paid, non-refunded subscriptions. The Skill resolves the measure subscriptions.arr, applies the paid_non_refunded segment, groups by month, and produces correct SQL without manual join or aggregation logic.

Quick Start

Use the sl skill to query monthly ARR from the subscriptions source filtered to paid non-refunded orders.

Frequently Asked Questions about sl

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

FAQPage Schema
How do I query pre-defined metrics with sl_query?

Pass a structured JSON query with measures, dimensions, filters, and segments to sl_query. The engine resolves join paths automatically, classifies filters as WHERE or HAVING, and generates correct SQL without you specifying a base table.

When should I use sl_query instead of raw SQL?

Prefer sl_query when a pre-defined measure exists, when the question spans multiple sources requiring joins, or when asking for standard metrics like revenue or churn. Use raw sql_execution only for multi-step CTEs or one-off explorations.

What are the three types of semantic layer sources?

Overlay sources enrich manifest-backed tables with measures and computed columns, standalone table sources own their schema with source_type table, and standalone SQL sources derive schema from a frozen SQL query with source_type sql.

Can this skill write new metrics to the semantic layer?

No. This skill only reads and queries the semantic layer. Capturing new patterns is handled by the separate sl_capture skill, which runs in the memory-agent in capture mode.

Why does an sl_query fail with a path-not-found error?

The error occurs when no join path exists between the referenced sources in the catalog. Use discover_data or sl_discover to check which sources are connected through declared joins before combining them in one query.