# Sl

Ktx's semantic layer - a structured catalog of sources (tables/views), measures, joins...

- Repository: https://github.com/Kaelio/ktx (1627 stars)
- Category: AI and agents
- License: Apache-2.0
- Last updated: 2026-10-22
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add Kaelio/ktx --skill sl -g -a claude-code -y`
Codex: `npx skills add Kaelio/ktx --skill sl -g -a codex -y`
Cursor: `npx skills add Kaelio/ktx --skill sl -g -a cursor -y`
Gemini CLI: `npx skills add Kaelio/ktx --skill sl -g -a gemini-cli -y`

## Description

ktx's semantic layer - a structured catalog of sources (tables/views), measures, joins, and segments expressed as YAML. Covers the schema and how to query it via `sl_query`. Use when the task involves querying pre-defined metrics (ARR, churn, retention, LTV, MAU) or reading SL source YAML to understand the catalog. Capture is handled by the `sl_capture` skill (memory-agent only).

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Semantic Layer

ktx's semantic layer (SL) is a structured catalog. Each **source** represents a table, a SQL view, or an overlay that enriches a manifest-backed table with measures, computed columns, joins, and named segments. The catalog is the single source of truth for reusable business metrics.

This skill covers two parts:
- **Part 1** - Schema reference (what an SL source looks like).
- **Part 2** - Querying via `sl_query`.

Capture (when and how to add new patterns to the SL) is a separate concern handled by the memory-agent - see the `sl_capture` skill if you are running in capture mode. The research agent **reads** and **queries** the SL via the tools described here; it does not write to it.

For capture-time identifier verification, load `sl_capture`. Synthesis writer
skills must verify warehouse identifiers with `discover_data`,
`entity_details`, and `sql_execution` before emitting table or column names.

---

## Part 1 - Schema reference

An SL source is a YAML file under `semantic-layer/<connectionId>/`. The file's `name:` field is the source's identity, it mirrors the warehouse identifier verbatim (e.g. Snowflake's uppercase `SIGNED_UP`); the filename is only a derived label. Always address sources by name through the `sl_*` tools, never by file path. There are three flavors:

### Overlay sources

Enrich a manifest-backed table with measures, computed columns, joins, and segments. No `table` or `sql` field. The base table's columns and grain are inherited from the manifest.

The rest: https://github.com/Kaelio/ktx/blob/HEAD/packages/cli/src/skills/sl/SKILL.md
