patrickcuba/the_data_must_flow/dv-kg-2
Claude Code and agent skill by patrickcuba/the_data_must_flow
- community
- ext:[{"type":"config","description":"Configuration overrides"}]
Checking that the SKILL.md file is still in the repository.
Standalone Knowledge Graph for any Data Vault. Discovers vault topology from Snowflake metadata, deploys KG views for AI-agent discovery and traversal, and optionally generates a data semantic view, Cortex Analyst, and Agent template. No DVOS or manifest required.
Install
npx vskill@latest install patrickcuba/the_data_must_flow/dv-kg-2Semi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
The same SKILL.md was published earlier as patrickcuba/the_data_must_flow/dv-kg-2.
/dv-kg-2 — Standalone Knowledge Graph for Data Vault
Deploy a Knowledge Graph over any existing Data Vault without requiring DVOS, a manifest, or any external framework. This skill:
- Discovers vault topology by scanning Snowflake metadata (INFORMATION_SCHEMA)
- Deploys KG views for AI-agent discovery and graph traversal
- Optionally generates a data semantic view, Cortex Analyst, and Agent template
Premise: Hub = Node, Link = Edge, Satellite = Property. The vault IS the graph.
Phase 1: Discovery
Gate A — Vault Location
Ask (text, header "Vault Location"):
"Which database and schema contain your Data Vault tables? (e.g.ANALYTICS.RAW_VAULT)"
Validate the schema exists:
If zero tables: warn and ask user to verify.
Then ask (options, header "Multi-schema"):
"Do your vault tables span multiple schemas (e.g. hubs in one, sats in another)?"- Single schema — everything is in the schema above- Multiple schemas — I'll need additional schema locations
If multiple: ask for each additional schema and what it contains (hubs/links/sats).
Store as vault_schemas — a list of {database, schema, contains: [hub|link|sat]}.
Gate B — Convention Detection
Run this query against each vault schema:
Apply heuristic pattern matching against the full table list:
Detection rules (try in order):
| Priority | Pattern | Classification | |
|---|---|---|---|
| 1 | Prefix HUB_ (case-insensitive) | Hub | |
| 2 | Prefix H_ | Hub | |
| 3 | Suffix _HUB | Hub | |
| 4 | Prefix LNK_ or LINK_ | Link | |
| 5 | Prefix L_ | Link | |
| 6 | Suffix _LNK or _LINK | Link | |
| 7 | Prefix SAT_ or SATELLITE_ | Satellite | |
| 8 | Prefix S_ | Satellite | |
| 9 | Suffix _SAT | Satellite |
If confident (at least one prefix covers >80% of expected artefact count per type):
Present findings:
"I detected the following naming patterns:- Hubs (N tables): prefixHUB_— e.g. HUB_CUSTOMER, HUB_ACCOUNT, ...- Links (N tables): prefixLNK_— e.g. LNK_CUSTOMER_ACCOUNT, ...- Satellites (N tables): prefixSAT_— e.g. SAT_CUSTOMER_CRM, ...Does this look correct?"
Ask (options, header "Confirm Patterns"):
- Yes, that's correct- Partially correct — let me adjust
If partially correct or no clear pattern detected, ask (text, header "Hub Pattern"):
"What prefix (or suffix) identifies hub tables? Include the underscore. (e.g.HUB_)"
Repeat for link and satellite patterns.
Unclassified tables: Any tables not matching hub/link/sat patterns are reported as "unclassified" and ignored. The user can manually assign them if relevant.
Gate C — Hashkey vs Natural Key Detection
For one representative hub and one representative link, inspect columns:
Detection logic:
- If any column has
DATA_TYPE = 'BINARY'and name containsHASHKEYorHK→ hashkey vault - If no BINARY hashkey columns found → natural-key vault
Store as vault_style: hashkey | natural_key.
For hashkey vaults, also detect the hashkey naming pattern:
DV_HASHKEY_HUB_<name>(DVOS-style)HK_<name>or<name>_HKHASHKEY_<name>
Store as hashkey_pattern for use in association resolution.
Gate D — Hub Business Key Extraction
For each discovered hub, extract business key columns:
Business key identification:
- Skip metadata columns: any column matching these patterns is NOT a BK:
*HASHKEY*,*HK*,DV_*,LOAD_*,RECORD_SOURCE*,*_TIMESTAMP,
*_DATE (when named LOAD_DATE or INSERT_DATE), TENANT*, COLLISION*, LAST_SEEN*, SOURCE*
- Remaining columns (typically VARCHAR/NUMBER) are business keys
Store as hubs[].business_keys: list[str].
Gate E — Association Resolution (Links)
For each discovered link, resolve which hubs it connects using the algorithm in [references/association-resolution.md]. The priority order is:
- Exact hub name match in FK column
- Suffix match (for role-playing links)
- Substring match (longest match wins)
- Same-hub classification (hierarchy/same-as/role-playing)
- User input (for unresolvable columns)
Unresolvable links: If a FK column cannot be resolved, ask the user which hub it references.
Expected automatic resolution rate: ~96% of links in a well-structured vault.
Gate F — Association Resolution (Satellites)
For each discovered satellite, determine its parent (one hub OR one link):
Hashkey vault:
- Inspect the first BINARY/hashkey column after the satellite's own hashkey (if it has one)
or the first BINARY column overall
- Match the embedded name to a discovered hub or link
Natural-key vault:
- Inspect non-metadata columns and find which hub or link's key columns they contain
- A satellite's parent is the entity whose PK/hashkey it carries as its own FK
Name-based fallback:
- Strip the satellite prefix. If the remaining name contains a hub name → that's the parent.
E.g. SAT_CUSTOMER_CRM → contains CUSTOMER → parent is HUB_CUSTOMER
- If remaining name contains a link name → parent is that link.
E.g. SAT_CUSTOMER_ACCOUNT_DETAILS → contains CUSTOMER_ACCOUNT → parent is LNK_CUSTOMER_ACCOUNT
Unresolvable satellites:
If a satellite's parent cannot be determined, ask:
"I couldn't determine the parent for these satellites. Each satellite belongs toexactly ONE parent — either a hub or a link:| Satellite | Columns suggest | Your correction ||-----------|----------------|-----------------|| SAT_MYSTERY_ONE | ? | [hub or link name] || SAT_OTHER_THING | ? | [hub or link name] |"
Gate G — Confirmation
Present the complete discovered graph:
Ask (options, header "Confirm Graph"):
"Does this graph look correct?"- Yes, proceed- I need to make corrections — (then ask what to fix)
After confirmation, inform the user:
"Note: KG_NODE includes enrichment columns (domain, criticality, description, agent_hint)that start NULL. These can be populated later via UPDATE statements or an AI enrichment pass."
Phase 2: KG Deployment
Gate H — Target Location
Ask (text, header "KG Schema"):
"Where should the KG views be deployed? Provide database.schema (will be created if it doesn't exist). Example:ANALYTICS.KG"
Gate I — Deployment Mode
Ask (options, header "Mode"):
"How should I deploy?"- Execute directly — run all DDL against Snowflake now- Generate script — produce a .sql file for you to review and run
Gate J — Execute
Schema setup:
Base views: Generate the 4 base KG views using the SQL templates in [references/base-views.md]:
- KG_NODE — one UNION ALL branch per hub (node_key, entity_label, grain, business_keys, NULL enrichment cols)
- KG_EDGE — one UNION ALL branch per link (edge_key, relationship_label, NULL enrichment cols)
- KG_EDGE_ENDPOINT — one branch per link-participant (edge_key, node_key, role_description)
- KG_PROPERTY — one branch per satellite (property_key, attached_to, attached_to_type)
For hierarchy/same-as links, KG_EDGE_ENDPOINT has both rows pointing to the same hub with different role_description values.
Derived views — SEQUENTIAL EXECUTION (do NOT run in parallel)
Execute the 4 view SQL statements from [references/derived-views.md] ONE AT A TIME, in order. Wait for each to succeed before running the next. The order is:
- KG_NODE_V
- KG_EDGE_V
- KG_ADJACENCY — CRITICAL: The join uses COALESCE to handle NULL role_description:
``sql AND NOT (e1.node_key = e2.node_key AND COALESCE(e1.role_description,'') = COALESCE(e2.role_description,'')) AND COALESCE(e1.node_key,'') || COALESCE(e1.role_description,'') <= COALESCE(e2.node_key,'') || COALESCE(e2.role_description,'') `` Copy this exactly from [references/derived-views.md]. Without COALESCE, NULL comparisons filter out most rows.
- KG_NODE_DEGREE — uses UNION ALL of from_node + to_node (copy from reference)
See [references/derived-views.md] for the full SQL templates.
Script mode: If user chose "Generate script", write all SQL statements to a file at standalone-kg-plugin/output/deploy_kg.sql and present the path. Do not execute.
Verify
After deployment, run:
Present results to confirm expected counts match discovery.
Gate J2 — Enrichment
After verification, note that the KG views have NULL enrichment columns (domain, criticality, description, agent_hint on KG_NODE; purpose, description, agent_hint on KG_EDGE). These improve AI-agent routing but require manual curation or inference.
Ask (options, header "Enrichment"):
"The KG views are deployed but have empty enrichment columns (domain, description, agent_hint).Would you like me to populate these from your vault table COMMENT metadata?"- Yes, infer from table comments — read COMMENT_ON from INFORMATION_SCHEMA and populate- No, leave empty for now — enrichment will be done manually later
If yes: query INFORMATION_SCHEMA.TABLES for COMMENT on each hub/link/satellite, then regenerate the KG_NODE and KG_EDGE views with the comments mapped to description. For domain, infer from the source-system badge in the satellite names (e.g. _CRM_ → crm, _HC_ → healthcare, _INS_ → insurance).
Gate J3 — Data Semantic View
Ask (options, header "Data Semantic View"):
"Would you like me to generate a semantic view over your actual vault data?This creates a queryable model where hubs are entities, satellites provideattributes/facts, and links define the joins between them."- Yes, generate it- No, skip this
If no: skip to Phase 3b.
Gate L — Target
Ask (text, header "Semantic View Location"):
"Where should the data semantic view be deployed? (database.schema.view_name)Example:ANALYTICS.SEMANTIC.VAULT_DATA_MODEL"
Generate Semantic View YAML
Build a semantic view YAML with:
Tables section:
- Each hub becomes a table entry with its business keys as dimensions
- Each satellite becomes a table entry with:
- Parent hashkey/FK as the join key
- All non-metadata columns as dimensions (VARCHAR/DATE) or measures (NUMBER)
- Measures default to
aggregation: sumfor numeric columns
Relationships section:
- Each satellite → its parent hub/link: join on hashkey/FK, one_to_many
- Each link → its participant hubs: join on respective hashkey/FK columns
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingstandalone-skills/dv-kg-2/skills/dv-kg-2/SKILL.md
Popularity
- Repository stars
- 35
- Repository forks
- 7
- 7-day trend score
- 18
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 22 Nov 2026, 5 days ago.
Extension points
configConfiguration overrides
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/patrickcuba/the_data_must_flow/dv-kg-2)