
This teaches Claude when to extract reusable patterns into ktx's semantic layer and how to write them so they stay compact over time. It's loaded only by the post-turn memory agent after a successful query, never by the research agent that does the actual work. The core tension is generalization: you want one revenue measure with query-time filters, not twenty hardcoded variants for every region and time window. The guidance is opinionated about overlay versus standalone sources, when to use segments versus inlining predicates, and matching SQL dialect to the warehouse. If you're building a semantic layer that needs to survive contact with real analysts, the rules about what not to capture are more valuable than the capture mechanics themselves.
$ npx -y skills add kaelio/ktx --skill sl_capture --agent claude-codeInstalls into .claude/skills of the current project.
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.
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:
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).transaction_date >= current_date - interval '90 days'.transaction_date >= dateadd(day, -90, current_timestamp()).Sponsors