Agent SkillsKaelio/ktx › live_database_ingest

live_database_ingest

GitHub

从实时数据库快照捕获语义层和知识更新。读取原始表、连接及外键元数据,创建或更新语义层源,验证标识符并生成Wiki页面,最后执行校验以确保数据准确性与一致性。

packages/cli/src/skills/live_database_ingest/SKILL.md Kaelio/ktx

触发场景

工作单元包含 raw-sources/<connectionId>/live-database/<syncId>/ 下的原始文件 需要从实时数据库模式快照中提取语义层结构

安装

npx skills add Kaelio/ktx --skill live_database_ingest -g -y
更多选项

非标准路径

npx skills add https://github.com/Kaelio/ktx/tree/main/packages/cli/src/skills/live_database_ingest -g -y

不安装直接使用

npx skills use Kaelio/ktx@live_database_ingest

指定 Agent (Claude Code)

npx skills add Kaelio/ktx --skill live_database_ingest -a claude-code -g -y

安装 repo 全部 skill

npx skills add Kaelio/ktx --all -g -y

预览 repo 内 skill

npx skills add Kaelio/ktx --list

SKILL.md

Frontmatter
{
    "name": "live_database_ingest",
    "callers": [
        "memory_agent"
    ],
    "description": "Capture semantic-layer and knowledge updates from a live database schema snapshot."
}

Live Database Ingest

Use this skill when the ingest work unit contains raw files under raw-sources/<connectionId>/live-database/<syncId>/.

Workflow

  1. Read the table JSON file listed in the work unit.
  2. Read connection.json to understand the snapshot metadata.
  3. Read foreign-keys.json when the table has a foreign key or when joins are needed for the semantic-layer source.
  4. Create or update one semantic-layer source for the table with sl_write_source.
  5. Use the physical table name from the raw JSON as the source table field.
  6. Preserve database comments as descriptions.db on tables and columns.
  7. Add joins only when the foreign key index names both sides.
  8. Write wiki pages only for durable business meaning that is present in table or column comments.
  9. Run sl_validate for the table source before the work unit completes.

Sample values come from the scan record; do not invent values not present in relationship-profile.json.

Identifier Verification Protocol

Before writing a wiki page or SL source on any topic:

  1. 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:

  1. entity_details({connectionId, targets: [{display: "<identifier>"}]}) - confirm the identifier resolves; inspect native types, FK/PK, and sampleValues.
  2. 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"}).
  3. 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.
  4. Never copy <schema>.<table> placeholder strings from these instructions into output.

Source shape

For a raw table with this shape:

{
  "name": "orders",
  "db": "public",
  "columns": [
    { "name": "id", "type": "integer", "nullable": false, "primaryKey": true }
  ]
}

Write a semantic-layer source with this shape:

name: orders
table: public.orders
grain: id
columns:
  - name: id
    type: number

Use string, number, time, or boolean for column types. When a database type is ambiguous, use string.

Boundaries

The raw snapshot is structural evidence. Do not invent measures, segments, business definitions, or joins that are not present in the snapshot files.

版本历史

  • a6dd8cf 当前 2026-07-05 19:49

同 Skill 集合

packages/cli/src/skills/analytics/SKILL.md
packages/cli/src/skills/dbt_ingest/SKILL.md
packages/cli/src/skills/gdrive_synthesize/SKILL.md
packages/cli/src/skills/historic_sql_patterns/SKILL.md
packages/cli/src/skills/historic_sql_table_digest/SKILL.md
packages/cli/src/skills/ingest_triage/SKILL.md
packages/cli/src/skills/looker_ingest/SKILL.md
packages/cli/src/skills/lookml_ingest/SKILL.md
packages/cli/src/skills/metabase_ingest/SKILL.md
packages/cli/src/skills/notion_synthesize/SKILL.md
packages/cli/src/skills/sigma_ingest/SKILL.md
packages/cli/src/skills/sl_capture/SKILL.md
packages/cli/src/skills/sl/SKILL.md
packages/cli/src/skills/wiki_capture/SKILL.md
skills/ktx/SKILL.md

元信息

文件数
0
版本
a6dd8cf
Hash
a6c2fa0d
收录时间
2026-07-05 19:49

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-07-13 21:32
浙ICP备14020137号-1 $访客地图$