Claude Skill MartBrowse skillsQuick linesLearn by videoTerminal guideWhat is a Skill?
Back to list

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 & AnalyticsAdvanced1,566101AI score 8/10Last updated: Jul 19, 2026

What it does

  • Reads a bounded SQL template shard (patterns-input/part-0001.json or legacy patterns-input.json) and identifies recurring analytical intents spanning two or more tables.
  • Packages each intent into a typed pattern evidence object (slug, title, narrative, definitionSql, tablesInvolved, slRefs, constituentTemplateIds) via emit_historic_sql_evidence.
  • Enforces a strict identifier-verification protocol: discover_data to reuse existing wikis/sources, entity_details to confirm schemas, tables, columns and both sides of every join key, and sql_execution probes for literal values not present in sampleValues.
  • Unresolvable identifiers must be marked [unverified - from <rawPath>] or logged with the failing probe error in emit_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_agent pipeline 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

  1. Order lifecycle pattern: merge several templates joining orders and customers into one order-lifecycle-analysis pattern and emit it once.
  2. Join key verification: before describing c.id = o.customer_id, resolve both columns through entity_details and inspect FK/PK plus sample values.
  3. 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)
  1. Download the ZIP with the button below.
  2. In Claude, open Settings → Capabilities and turn on 'Code execution and file creation'. (one time)
  3. Go to Customize → Skills → + → 'Upload a skill' and upload the ZIP.
Download 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.

  1. Clone the repository: git clone https://github.com/Kaelio/ktx.git
  2. Create the skill folder: mkdir -p ~/.claude/skills/historic_sql_patterns
  3. Copy the files: cp -r ktx/packages/cli/src/skills/historic_sql_patterns/* ~/.claude/skills/historic_sql_patterns/
  4. Confirm ~/.claude/skills/historic_sql_patterns/SKILL.md exists.
  5. Restart Claude Code and check that historic_sql_patterns shows up in your skill list.
  6. Note: the skill only functions where ktx CLI tools such as read_raw_file, entity_details and emit_historic_sql_evidence are available, so set up the ktx pipeline as well.
View source on GitHubLicense: Apache-2.0