Historic SQL Table Digest
Use this skill when the WorkUnit raw file is one tables/<schema>.<name>.json file from the historic-sql adapter.
Required Workflow
- Read the WorkUnit notes first.
- Call
read_raw_file for the single tables/<schema>.<name>.json raw file.
- Read
manifest.json only if the table JSON omits the dialect or the WorkUnit notes are unclear.
- Produce one concise usage narrative for this table from the staged table JSON.
- Call
emit_historic_sql_evidence exactly once with kind: "table_usage".
- Stop after the evidence tool succeeds.
Identifier Verification Protocol
Before writing a wiki page or SL source on any topic:
discover_data({query: "<topic>"}) - see what wikis, SL sources, and raw
tables already exist. Prefer updating existing pages over creating new ones.
Before emitting any schema.table or schema.table.column into a wiki body,
SL source, tables: frontmatter, sl_refs, or emit_unmapped_fallback:
entity_details({connectionId, targets: [{display: "<identifier>"}]}) -
confirm the identifier resolves; inspect native types, FK/PK, and
sampleValues.
- For literal values from the source, such as status codes or plan tiers,
check whether they appear in
entity_details sampleValues for the relevant
column. If sampleValues is short or the sample may have missed real values,
run a sql_execution probe with the same warehouse connection id:
sql_execution({connectionId, sql: "SELECT DISTINCT <col> FROM <ref> LIMIT 50"}).
- If the candidate identifier still does not resolve, do one of:
- Use
sql_execution({connectionId, sql: "SELECT 1 FROM <ref> LIMIT 0"}).
If it errors, the identifier is fictional.
- Wrap the identifier in
[unverified - from <rawPath>] in the wiki body,
citing the exact raw path that mentioned it.
- When recording
emit_unmapped_fallback with no_physical_table, include
the failing probe error in clarification.
- Never copy
<schema>.<table> placeholder strings from these instructions
into output.
Evidence Shape
Call emit_historic_sql_evidence with this shape:
{
"kind": "table_usage",
"table": "public.orders",
"usage": {
"narrative": "Orders are repeatedly queried for paid/refunded lifecycle analysis and customer-level rollups.",
"frequencyTier": "high",
"commonFilters": ["status", "created_at"],
"commonGroupBys": ["status"],
"commonJoins": [{ "table": "public.customers", "on": ["customer_id"] }],
"staleSince": null
}
}
The usage object must match tableUsageOutputSchema.
Interpretation Rules
- Treat
columnsByClause.where as common filters.
- Treat
columnsByClause.groupBy as common group-bys.
- Treat
observedJoins as common joins.
- Use
stats.executionsBucket, stats.distinctUsersBucket, and stats.recencyBucket to choose frequencyTier.
- Use
frequencyTier: "high" only when executions and distinct users are both broad.
- Use
frequencyTier: "mid" for repeated team usage that is not broad enough for high.
- Use
frequencyTier: "low" for low-volume but present usage.
- Use
frequencyTier: "unused" only when the table input explicitly says the table is stale or has no recent templates.
- Keep
narrative short and concrete.
Boundaries
- Do not call wiki_write.
- Do not call sl_write_source.
- Do not call sl_edit_source.
- Do not call context_candidate_write.
- Do not emit more than one table usage evidence object.
- Do not invent columns, joins, or tables that are absent from the staged JSON.
Source: Kaelio/ktx-ai-data-agents-mcp-context-skills — distributed by TomeVault.
1---2name: historic-sql-table-digest3description: Convert one changed historic-SQL table usage bucket into typed table usage evidence for deterministic _schema projection. Use when this capability is needed.4---56# Historic SQL Table Digest78Use this skill when the WorkUnit raw file is one `tables/<schema>.<name>.json` file from the `historic-sql` adapter.910## Required Workflow11121. Read the WorkUnit notes first.132. Call `read_raw_file` for the single `tables/<schema>.<name>.json` raw file.143. Read `manifest.json` only if the table JSON omits the dialect or the WorkUnit notes are unclear.154. Produce one concise usage narrative for this table from the staged table JSON.165. Call `emit_historic_sql_evidence` exactly once with `kind: "table_usage"`.176. Stop after the evidence tool succeeds.1819## Identifier Verification Protocol2021Before writing a wiki page or SL source on any topic:22231. `discover_data({query: "<topic>"})` - see what wikis, SL sources, and raw24 tables already exist. Prefer updating existing pages over creating new ones.2526Before emitting any `schema.table` or `schema.table.column` into a wiki body,27SL source, `tables:` frontmatter, `sl_refs`, or `emit_unmapped_fallback`:28292. `entity_details({connectionId, targets: [{display: "<identifier>"}]})` -30 confirm the identifier resolves; inspect native types, FK/PK, and31 sampleValues.323. For literal values from the source, such as status codes or plan tiers,33 check whether they appear in `entity_details` sampleValues for the relevant34 column. If sampleValues is short or the sample may have missed real values,35 run a `sql_execution` probe with the same warehouse connection id:36 `sql_execution({connectionId, sql: "SELECT DISTINCT <col> FROM <ref> LIMIT 50"})`.374. If the candidate identifier still does not resolve, do one of:38 - Use `sql_execution({connectionId, sql: "SELECT 1 FROM <ref> LIMIT 0"})`.39 If it errors, the identifier is fictional.40 - Wrap the identifier in `[unverified - from <rawPath>]` in the wiki body,41 citing the exact raw path that mentioned it.42 - When recording `emit_unmapped_fallback` with `no_physical_table`, include43 the failing probe error in `clarification`.445. Never copy `<schema>.<table>` placeholder strings from these instructions45 into output.4647## Evidence Shape4849Call `emit_historic_sql_evidence` with this shape:5051```json52{53 "kind": "table_usage",54 "table": "public.orders",55 "usage": {56 "narrative": "Orders are repeatedly queried for paid/refunded lifecycle analysis and customer-level rollups.",57 "frequencyTier": "high",58 "commonFilters": ["status", "created_at"],59 "commonGroupBys": ["status"],60 "commonJoins": [{ "table": "public.customers", "on": ["customer_id"] }],61 "staleSince": null62 }63}64```6566The `usage` object must match `tableUsageOutputSchema`.6768## Interpretation Rules6970- Treat `columnsByClause.where` as common filters.71- Treat `columnsByClause.groupBy` as common group-bys.72- Treat `observedJoins` as common joins.73- Use `stats.executionsBucket`, `stats.distinctUsersBucket`, and `stats.recencyBucket` to choose `frequencyTier`.74- Use `frequencyTier: "high"` only when executions and distinct users are both broad.75- Use `frequencyTier: "mid"` for repeated team usage that is not broad enough for high.76- Use `frequencyTier: "low"` for low-volume but present usage.77- Use `frequencyTier: "unused"` only when the table input explicitly says the table is stale or has no recent templates.78- Keep `narrative` short and concrete.7980## Boundaries8182- Do not call wiki_write.83- Do not call sl_write_source.84- Do not call sl_edit_source.85- Do not call context_candidate_write.86- Do not emit more than one table usage evidence object.87- Do not invent columns, joins, or tables that are absent from the staged JSON.8889---90> Source: [Kaelio/ktx-ai-data-agents-mcp-context-skills](https://github.com/Kaelio/ktx-ai-data-agents-mcp-context-skills) — distributed by [TomeVault](https://tomevault.io).91<!-- tomevault:4.0:skill_md:2026-06-28 -->