Agent skill · AI & Agents

sl_capture

How to capture new reusable patterns into ktx's semantic layer - when a measure, segment, or join belongs in the catalog and how to write it generically so it stays small and useful over time. Loaded by the post-turn memory-agent only. The research agent does not write to the SL.

Kaeliogithub.com/KaelioGitHub ↗
claude-codecodexApache-2.0
Install
npx skills add Kaelio/ktx --skill sl_capture --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 1
SKILL.md size: 18 KB
Bundled scripts: none
Path: packages/cli/src/skills/sl_capture/SKILL.md
Open the folder on GitHub →
Where it comes from
Source: Kaelio/ktx
Stars: 1,526 · +15 this week
Language: TypeScript
Read our review of the source →

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

Review
written from the skill's own SKILL.md · Aug 5, 2026

What it does

Guides the agent to capture current-turn reusable patterns (business metrics, derived views, join patterns, computed dimensions) into the semantic layer so future queries can reuse them instead of rediscovering them. It instructs that only patterns produced by the current turn should be captured and stored, and that the semantic layer should stay small and generic over time.

How it works

  • Emphasizes that, for each reusable pattern identified in the turn, you should capture it into the semantic layer so it can be referenced later instead of re-deriving it.
  • Specifies that the knowledge base should reference the correct SQL dialect for expressions (BigQuery, Postgres/Redshift, Snowflake) and provides examples of syntax differences and validation steps.
  • Recommends ensuring that captured patterns are generic rather than hardcoded constants where possible (e.g., prefer a generic total_revenue measure with query-time filters over region-specific hardcoded variants).
  • Encourages lifting repeated predicates into named segments and referencing them from measures to avoid duplication.
  • Includes guidance on overlaying vs standalone sources and cautions about not clobbering inherited manifest data when using overlays.
  • Notes workflow steps including using sl_discover, sl_read_source, sl_edit_source, sl_write_source, and sl_validate to manage changes.

When to use it

  • Use when a current turn produces a reusable pattern that should be captured for future querying.
  • Use to decide if a pattern belongs in the semantic layer or should remain as a temporary artifact.
  • Apply when generalization rules indicate a pattern can be expressed as a generic measure, segment, or flag rather than a constant or single-use SQL.

What it can touch

  • It references the semantic layer artifacts such as measures, segments, and computed dimensions, and relies on SL tools like sl_edit_source, sl_write_source, sl_validate, and related commands to modify or create overlays.
  • It enforces dialect-aware expressions and ensures validations run after edits.

Caveats

  • It explicitly states that the research agent does not write to the semantic layer, and that only the post-turn memory-agent should load these changes.
  • It requires careful handling to keep the SL small and generic, avoiding anti-patterns like embedding date anchors or value lists directly in measure expressions.
  • It requires the use of overlays rather than standalone SQL when there is an existing manifest, to avoid shadowing the manifest.
  • It requires following the provided generalized patterns and anti-patterns, and to replace prior measures when refining answers.
From the SKILL.md

# Semantic Layer - Capture This skill covers **when** and **how** to capture new patterns into the semantic layer. For schema reference and query grammar, load the `sl` skill first. When the current turn produces a reusable pattern (business metric, derived view, join pattern, computed dimension), capture it so future queries can reach for it instead of rediscovering it. ## SQL dialect The user-facing prompt includes a `Warehouse:` line under the SL Sources index (e.g. `Warehouse: BIGQUERY`). All `expr` strings - measure expressions, segment predicates, computed-column SQL - execute on that warehouse and must use its syntax. Date arithmetic in particular varies by dialect: - **BigQuery**: `transaction_date >= TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 90 DAY)` (when the column is `TIMESTAMP`); `event_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 90 DAY)` (when `DATE`). - **Postgres / Redshift**: `transaction_date >= current_date - interval '90 days'`. - **Snowflake**: `transaction_date >= dateadd(day, -90, current_timestamp())`. Match the column's manifest type (`type: time` → TIMESTAMP/DATETIME on the warehouse) - comparing TIMESTAMP to a DATE-arithmetic result fails on BigQuery. Aft

What's inside
Steps it walks through
  1. SQL dialect
  2. What's worth capturing
  3. Generalization rules
  4. Slim standalone sources via inheritscolumnsfrom
  5. Refinement - replace, don't append
  6. Edit SL vs document in wiki
  7. Identifier Verification Protocol
  8. Tool sequence
  9. Editing patterns
  10. Worked example - additive overlay
  11. Worked example - refinement (replace)
  12. Worked example - new join
  13. Rules recap
More from ktx
All skills →
About this skill
What does the sl_capture skill do?

How to capture new reusable patterns into ktx's semantic layer - when a measure, segment, or join belongs in the catalog and how to write it generically so it stays small and useful over time. Loaded by the post-turn memory-agent only. The research agent does not write to the SL.

How do I install it?

Run `npx skills add Kaelio/ktx --skill sl_capture --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From Kaelio/ktx, a repository with 1,526 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going