/starlake-skills:semanticfrom starlake-skills
Author semantic model YAML in metadata/semantic for BI tools and AI agents — logical tables, dimensions, facts, metrics, relationships, and verified queries, exportable via `starlake semantic-export`
Ships in starlake-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Define the business semantic layer of a Starlake project. Semantic models live as YAML files in metadata/semantic/ (the folder is created by bootstrap) and describe the warehouse in business terms: logical tables, dimensions, facts, metrics, relationships, and verified queries. They are consumed by the Starlake Cockpit's semantic model editor and by AI/BI agents that translate natural-language questions into SQL.
The format is aligned with the Snowflake semantic model specification (the YAML consumed by Cortex Analyst and convertible to native Snowflake semantic views). For vendor-neutral interchange, the same modeling concepts are standardized as Apache Ossie (Incubating), formerly Open Semantic Interchange (OSI). Starlake exports models to Ossie natively: run starlake semantic-export (see the semantic-export skill), giving every model a portability path to any Ossie-compatible BI tool, query engine, or AI agent.
One model per file in metadata/semantic/<model_name>.yaml:
name: ecommerce_analytics
description: >
E-commerce analytics model for customers, orders, and products.
comments: Optional free-text notes
tables: [...] # logical tables (see below)
relationships: [...] # joins between logical tables
metrics: [...] # model-level metrics (cross-table)
verified_queries: [...]
Each entry in tables: maps a physical table to a business view of it:
tables:
- name: orders
description: >
Order transactions. Join with customers for complete order analysis.
base_table:
database: ANALYTICS_DB
schema: ECOMMERCE # the Starlake domain
table: ORDERS
dimensions:
- name: order_status
description: Current status of the order
synonyms: ["status"]
expr: ORDER_STATUS # physical column or SQL expression
data_type: TEXT
is_enum: true
sample_values: ["Pending", "Shipped", "Delivered"]
- name: order_id
expr: ORDER_ID
data_type: NUMBER
unique: true
time_dimensions:
- name: order_date
description: Date when the order was placed
synonyms: ["purchase date"]
expr: ORDER_DATE
data_type: DATE
facts:
- name: order_total
description: Total order amount including tax
synonyms: ["total", "order amount"]
expr: ORDER_TOTAL
data_type: NUMBER
access_modifier: public_access # or private_access
metrics:
- name: avg_order_value
description: Average order value
synonyms: ["AOV"]
expr: AVG(order_total)
access_modifier: public_access
filters:
- name: recent_orders
description: Orders from the last 30 days
synonyms: ["Last 30 Days"]
expr: order_date >= DATEADD(day, -30, CURRENT_DATE())
primary_key:
columns: [order_id]
Column roles:
is_enum: true; mark identifier columns unique: true.expr may be a computed expression (e.g. QUANTITY * UNIT_PRICE * (1 - DISCOUNT)).SUM, AVG, COUNT) over facts or dimensions. Table-level metrics reference that table's columns; model-level metrics may span tables (e.g. COUNT(DISTINCT customers.customer_id)).Declare joins so consumers never guess them:
relationships:
- name: orders_to_customers
left_table: orders
right_table: customers
relationship_columns:
- left_column: customer_id
right_column: customer_id
join_type: left_outer # inner | left_outer
relationship_type: many_to_one # many_to_one | one_to_one
Derive these from the foreign keys documented in your load schemas (table-dependencies can list them).
Curated question-to-SQL pairs that anchor AI agents and serve as onboarding examples:
verified_queries:
- name: top_customers_by_revenue
question: Who are the top 10 customers by total revenue?
verified_at: 1704067200 # epoch seconds
verified_by: Analytics Team
use_as_onboarding_question: true
sql: |
SELECT c.customer_name, SUM(o.order_total) AS total_revenue
FROM customers c
JOIN orders o ON c.customer_id = o.customer_id
GROUP BY c.customer_name
ORDER BY total_revenue DESC
LIMIT 10
Only include SQL you have actually run against the warehouse: "verified" is a promise, not a label.
expr must resolve. Every expression references physical columns of the base_table (or, in metrics/filters, names defined in the model). A semantic model referencing a renamed column fails silently at query time: re-check after schema changes."AOV", "CLV", "purchase date"). A model without synonyms and descriptions is a schema dump, not a semantic layer.HIDE, SHA256, MD5, AES) in the load schema must not appear as dimensions, and no real values may appear in sample_values. Use access_modifier: private_access for sensitive facts (e.g. cost, margin).sample_values are illustrative, not data: 2-3 representative, non-sensitive values that help query generation.cortex_search_service (per dimension) binds enum search to a Snowflake Cortex service; omit it on other engines. Keep filter/metric SQL portable unless the model is engine-pinned.semantic-export: export models to the Apache Ossie interchange formatbootstrap: creates the metadata/semantic/ foldertable-dependencies: lists foreign keys to derive relationships fromsecure: privacy annotations that dictate what must stay out of the modelyml2ddl / load: the physical schemas the model maps ontoWhat SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
75 skills in this plugin
/acl-dependenciesVisualize access control with `starlake acl-dependencies` — graph which users and groups can access which tables, from the ACL and RLS (row-level security) definitions in your YAML, output as SVG, PNG, or JSON/autoloadInfer schemas from files in the incoming directory and load them into the warehouse in one step with `starlake autoload`. Use for quick starts or new data files with no YAML table definitions yet; generates the table configs automatically./bootstrapCreate a new Starlake project with `starlake bootstrap` — scaffold the standard metadata/load/transform directory structure and starter config from a template (quickstart, simple). Use when initializing or setting up a new project./bq-infoGet BigQuery table information with `starlake bq-info` — schema, row count, size, partitioning, and clustering details for datasets and tables in a GCP project/cnxloadLoad a Parquet, CSV, or JSON file directly into a JDBC database table with `starlake cnxload`. Use to push one file into PostgreSQL, MySQL, or any JDBC target without the full Starlake load pipeline or YAML schemas./col-lineageTrace column-level lineage for one transform task with `starlake col-lineage` — show how each output column derives from its source columns through the SQL, for fine-grained data provenance and impact analysisGenerated from the plugin's indexed repository (starlake-ai/starlake-skills) — no native marketplace selected
npx claudepluginhub p/starlake-ai-starlake-skills