Historic SQL Pattern Extractor
A ktx-specific skill that mines historic SQL query shards for recurring cross-table analytical intents and emits verified pattern evidence.
Data & AnalyticsAdvanced★ 1,566⑂ 101AI score 8/10Last updated: Jul 19, 2026
What it does
- Reads a bounded SQL template shard (
patterns-input/part-0001.jsonor legacypatterns-input.json) and identifies recurring analytical intents spanning two or more tables. - Packages each intent into a typed
patternevidence object (slug,title,narrative,definitionSql,tablesInvolved,slRefs,constituentTemplateIds) viaemit_historic_sql_evidence. - Enforces a strict identifier-verification protocol:
discover_datato reuse existing wikis/sources,entity_detailsto confirm schemas, tables, columns and both sides of every join key, andsql_executionprobes for literal values not present in sampleValues. - Unresolvable identifiers must be marked
[unverified - from <rawPath>]or logged with the failing probe error inemit_unmapped_fallback. - Clear boundaries: no
wiki_write, no SL source writes/edits, no single-table pattern pages, no copying credentials or unredacted literals.
Who it's for
- Teams running ktx's
memory_agentpipeline to auto-build warehouse knowledge wikis. - Data platform engineers documenting frequently used join/aggregation patterns from query history.
- Anyone who needs an LLM workflow that refuses to invent table and column names.
Examples
- Order lifecycle pattern: merge several templates joining
ordersandcustomersinto oneorder-lifecycle-analysispattern and emit it once. - Join key verification: before describing
c.id = o.customer_id, resolve both columns throughentity_detailsand inspect FK/PK plus sample values. - Fictional identifier guard: if a candidate table won't resolve, run
SELECT 1 FROM <ref> LIMIT 0; an error means the identifier is fictional and the error text goes into the fallback record.
· · · Install guide · · ·
Try it now, no install
Paste this into Claude to use the skill without installing anything.
Read the instructions in this file and follow them to help me: https://raw.githubusercontent.com/Kaelio/ktx/HEAD/packages/cli/src/skills/historic_sql_patterns/SKILL.md What I want: (describe your task here)
If Claude can't open the link, open it yourself and paste the contents instead.
↓ If it works for you, download the ZIP below and install it. Then it runs on its own — no pasting each time.
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/historic_sql_patterns folder from the GitHub repo Kaelio/ktx into my ~/.claude/skills/historic-sql-patterns/. 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/historic_sql_patterns && cp -r ktx/packages/cli/src/skills/historic_sql_patterns/* ~/.claude/skills/historic_sql_patterns/⚠ This is a third-party skill. Check the source repository before installing.
- Clone the repository:
git clone https://github.com/Kaelio/ktx.git - Create the skill folder:
mkdir -p ~/.claude/skills/historic_sql_patterns - Copy the files:
cp -r ktx/packages/cli/src/skills/historic_sql_patterns/* ~/.claude/skills/historic_sql_patterns/ - Confirm
~/.claude/skills/historic_sql_patterns/SKILL.mdexists. - Restart Claude Code and check that
historic_sql_patternsshows up in your skill list. - Note: the skill only functions where ktx CLI tools such as
read_raw_file,entity_detailsandemit_historic_sql_evidenceare available, so set up the ktx pipeline as well.
View source on GitHub ↗License: Apache-2.0