{"id":"live-database-ingest","name":"live_database_ingest","summary":"ライブデータベーススキーマスナップショットからセマンティックレイヤーや知識の更新をキャプチャします。","body":"# Live Database Ingest\n\nUse this skill when the ingest work unit contains raw files under\n`raw-sources/<connectionId>/live-database/<syncId>/`.\n\n## Workflow\n\n1. Read the table JSON file listed in the work unit.\n2. Read `connection.json` to understand the snapshot metadata.\n3. Read `foreign-keys.json` when the table has a foreign key or when joins are\n   needed for the semantic-layer source.\n4. Create or update one semantic-layer source for the table with\n   `sl_write_source`.\n5. Use the physical table name from the raw JSON as the source `table` field.\n6. Preserve database comments as `descriptions.db` on tables and columns.\n7. Add joins only when the foreign key index names both sides.\n8. Write wiki pages only for durable business meaning that is present in table\n   or column comments.\n9. Run `sl_validate` for the table source before the work unit completes.\n\nSample values come from the scan record; do not invent values not present in\nrelationship-profile.json.\n\n## Identifier Verification Protocol\n\nBefore writing a wiki page or SL source on any topic:\n\n1. `discover_data({query: \"<topic>\"})` - see what wikis, SL sources, and raw\n   tables already exist. Prefer updating existing pages over creating new ones.\n\nBefore emitting any `schema.table` or `schema.table.column` into a wiki body,\nSL source, `tables:` frontmatter, `sl_refs`, or `emit_unmapped_fallback`:\n\n2. `entity_details({connectionId, targets: [{display: \"<identifier>\"}]})` -\n   confirm the identifier resolves; inspect native types, FK/PK, and\n   sampleValues.\n3. For literal values from the source, such as status codes or plan tiers,\n   check whether they appear in `entity_details` sampleValues for the relevant\n   column. If sampleValues is short or the sample may have missed real values,\n   run a `sql_execution` probe with the same warehouse connection id:\n   `sql_execution({connectionId, sql: \"SELECT DISTINCT <col> FROM <ref> LIMIT 50\"})`.\n4. If the candidate identifier still does not resolve, do one of:\n   - Use `sql_execution({connectionId, sql: \"SELECT 1 FROM <ref> LIMIT 0\"})`.\n     If it errors, the identifier is fictional.\n   - Wrap the identifier in `[unverified - from <rawPath>]` in the wiki body,\n     citing the exact raw path that mentioned it.\n   - When recording `emit_unmapped_fallback` with `no_physical_table`, include\n     the failing probe error in `clarification`.\n5. Never copy `<schema>.<table>` placeholder strings from these instructions\n   into output.\n\n## Source shape\n\nFor a raw table with this shape:\n\n```json\n{\n  \"name\": \"orders\",\n  \"db\": \"public\",\n  \"columns\": [\n    { \"name\": \"id\", \"type\": \"integer\", \"nullable\": false, \"primaryKey\": true }\n  ]\n}\n```\n\nWrite a semantic-layer source with this shape:\n\n```yaml\nname: orders\ntable: public.orders\ngrain: id\ncolumns:\n  - name: id\n    type: number\n```\n\nUse `string`, `number`, `time`, or `boolean` for column types. When a database\ntype is ambiguous, use `string`.\n\n## Boundaries\n\nThe raw snapshot is structural evidence. Do not invent measures, segments,\nbusiness definitions, or joins that are not present in the snapshot files.","author":"@Kaelio","ownerProfile":null,"authorContacts":null,"sourceUrl":"https://github.com/Kaelio/ktx/tree/main/packages/cli/src/skills/live_database_ingest","license":"Apache-2.0","category":"writing","lang":"en","tokens":746,"stars":0,"calls30d":1,"claimed":false,"visibility":"public","origin":"crawler","version":"0.1.0","createdAt":"2026-08-22","updatedAt":"2026-08-22","files":[],"requires":{"mcp":[],"tools":[]},"safety":{"flags":[],"scannedAt":"2026-08-22","hasScripts":false,"networkEndpoints":[]}}