Semantic View Skill
CLI Reference
Use the cortex agent-studio CLI for ALL semantic view operations:
| Command |
Purpose |
cortex agent-studio sv-generate --json-proto '<json>' |
Create YAML from tables/SQL |
cortex agent-studio sv-read --fqn DB.SCHEMA.NAME |
Read semantic view from Snowflake |
cortex agent-studio sv-read --source workspace --file-path <path> |
Read from workspace file |
cortex agent-studio sv-write --yaml-content '<yaml>' --source-object DB.SCHEMA.NAME |
Save YAML to workspace (auto-generates path). Use --file-path <FILE_NAME>.sv.yaml if file path from system reminder/user input |
cortex agent-studio sv-deploy --file-path <path> --fqn DB.SCHEMA.NAME |
Deploy YAML to Snowflake |
cortex agent-studio sv-edit --file-path <path> --operations '<json>' |
Edit YAML in place (combines semantic_model_edit + extract + sv-write) |
cortex agent-studio backend --tool suggest_relationships --file-path <path> --parameters '<json>' |
AI relationship suggestions |
cortex agent-studio backend --tool tableau_analyze --parameters '<json>' |
Analyze Tableau file structure |
cortex agent-studio backend --tool tableau_export --parameters '<json>' |
Convert Tableau file to YAML |
cortex agent-studio backend --tool pbi_analyze --parameters '<json>' |
Analyze Power BI file structure (.pbit/.pbix) |
cortex agent-studio backend --tool pbi_export --parameters '<json>' |
Convert Power BI file to YAML |
cortex agent-studio backend --tool osi_write_model --parameters '<json>' |
Register an OSI YAML model directly in Snowflake |
Forbidden: Do NOT use read, write, edit, multi_edit, or bash tools on semantic view YAML files. These bypass cortex_project/ tracking.
⚠️ First Step: Load References
For description tasks, load:
Read: semantic-view/reference/description_guidelines.md
Workflow Routing
Canonical create phrases — always route to creation/SKILL.md, never treat as ambiguous:
- "Help me create a semantic view"
- "Help me create a semantic model" / "Help me create an analyst model"
- "Help me build / set up / make a semantic view"
User Request → Route to Sub-Skill
│
├─ Create new view → creation/SKILL.md
├─ Edit existing view (user knows what to change) → edit/SKILL.md
├─ Upload/deploy YAML → upload/SKILL.md
├─ Download/export → download/SKILL.md
├─ Generate descriptions → generate_description/SKILL.md
├─ Validate semantic view YAML; validate VQRs only if the user asks → validate/SKILL.md
├─ Audit (best practices, heuristics) → audit/SKILL.md
├─ Suggest relationships → suggest_relationships/SKILL.md
├─ VQR suggestions → vqr_suggestions/SKILL.md
├─ Suggest/recommend metrics, filters, or facts → filters_and_metrics_suggestions/SKILL.md
├─ Manage VQRs (add/remove, expand/truncate, spot-validate SQL) → vqr_management/SKILL.md
├─ Run automated/agentic optimization (start, poll, cancel, list past runs) → agentic_optimization/SKILL.md
├─ Apply an advanced modeling pattern: compare a metric to the same period last year/month (YoY, MoM, SPLY); build rolling averages, YTD/QTD/MTD totals, or lag-N comparisons; model an SCD2 lookup with `valid_from`/`valid_to` or attribute an event to the dim row active at event time (ASOF); track snapshot facts that must not sum across time (balance / inventory / headcount); model an accumulating snapshot funnel across multiple milestone dates; route a metric down a specific FK when a fact has two FKs to the same dim (multi-path USING); reuse the same physical dim under multiple roles (role-playing dims); add cross-entity totals or ratios (`% of total`, `net = gross − returns`); split shared dims across multiple fact tables (multi-fact); expose a `PRIVATE` fact used only inside the SV to derive a tier or other dimension; join on a key that doesn't exist as a physical column (computed FK); steer Cortex Analyst with verified queries / `AI_SQL_GENERATION` / `AI_QUESTION_CATEGORIZATION` metadata; or diagnose a fan trap / "multi-path relationship not supported" / numbers that look inflated → patterns/SKILL.md
├─ Import Tableau file → import_tableau/SKILL.md
├─ Import Power BI file → import_powerbi/SKILL.md
├─ Import OSI (Ossie) YAML model → import_osi/SKILL.md
│
└─ Unclear → Ask:
"Would you like to:
1. Create a new semantic view
2. Edit an existing view
3. Upload/deploy a YAML file
4. Download an existing view
5. Generate descriptions
6. Audit for quality issues
7. Validate the semantic view (YAML); validate verified queries only if they ask
8. Suggest relationships
9. Get VQR suggestions from usage or query history
10. Get filter & metric suggestions from query history
11. Add, remove, or convert verified query SQL
12. Run agentic optimization (automated AI optimization job)
13. Import a Tableau workbook
14. Import a Power BI file
15. Import an OSI (Ossie) YAML model"
Edit vs suggest vs VQR vs agentic vs pattern:
- User names a specific change ("add metric X", "rename column Y") →
edit/SKILL.md
- User asks for ideas ("suggest / recommend metrics, filters, or facts", "what should I add?") →
filters_and_metrics_suggestions/SKILL.md
- User wants to add, remove, or rewrite a verified query ("expand this query", "truncate VQR") →
vqr_management/SKILL.md
- User wants to validate the YAML before deploy, or explicitly asks to bulk-validate VQRs →
validate/SKILL.md
- User wants to start an automated AI optimization job, check whether one finished, cancel a running job, or list past optimization runs →
agentic_optimization/SKILL.md
- User describes an advanced modeling intent — compare to same period last year/month (YoY, MoM, SPLY), build a rolling / YTD / lag-N metric, model an SCD2 lookup with
valid_from/valid_to or ASOF join, track a snapshot fact that must not sum across time, model an accumulating funnel across milestone dates, route a metric through a specific FK when a fact has two FKs to one dim, add a cross-entity derived metric (% of total, net = gross − returns), expose a PRIVATE fact, join on a computed (non-physical) key, steer Cortex Analyst with verified-queries / AI_SQL_GENERATION metadata, or diagnose a fan trap / "multi-path relationship not supported" / inflated-numbers symptom → patterns/SKILL.md
- User asks to import a
.twb / .twbx / .tds / .tdsx workbook → import_tableau/SKILL.md
- User asks to import a
.pbit / .pbix file → import_powerbi/SKILL.md
- User asks to import an OSI YAML model (
.osi.yaml, mentions "open semantic interchange" or "ossie", or provides OSI YAML inline) → import_osi/SKILL.md
Sub-Skills
| Sub-Skill |
Purpose |
| creation/SKILL.md |
Generate new semantic views from tables/SQL |
| edit/SKILL.md |
Modify existing views (add/remove/rename) |
| upload/SKILL.md |
Deploy YAML to Snowflake |
| download/SKILL.md |
Export views from Snowflake to workspace |
| generate_description/SKILL.md |
AI-powered descriptions for components |
| audit/SKILL.md |
Quality checks (best practices, duplicates, inconsistencies) |
| validate/SKILL.md |
SYSTEM$WRITE_SEMANTIC_MODEL_YAML(..., TRUE) YAML check; VQR validate_verified_queries only when the user requests it |
| suggest_relationships/SKILL.md |
AI-powered relationship suggestions |
| vqr_suggestions/SKILL.md |
VQR suggestions from query history or CA usage |
| filters_and_metrics_suggestions/SKILL.md |
Filter, metric, and fact suggestions from query history |
| vqr_management/SKILL.md |
Add/remove VQRs; expand/truncate SQL; spot-validate SQL strings |
| agentic_optimization/SKILL.md |
Run / poll / cancel / list automated SYSTEM$CORTEX_ANALYST_*_AGENTIC_OPTIMIZATION jobs and apply approved suggestions |
| patterns/SKILL.md |
14-pattern catalog of advanced SV modeling intents — period-over-period comparisons (YoY/MoM/SPLY), rolling/YTD/lag-N metrics, SCD2/ASOF temporal joins, snapshot facts that must not sum across time, accumulating funnels, multi-path metrics, role-playing dimensions, cross-entity derived metrics, multi-fact layouts, PRIVATE facts, computed-FK joins, AI metadata steering Cortex Analyst, and a six-scenario structural-diagnostic catalog (fan trap, multi-path errors, wrong cardinality, etc.). Each pattern ships a tight DDL/YAML snippet plus gotchas, applied via cortex agent-studio CLI for YAML-supported patterns and snowflake_sql_execute for DDL-only ones |
| import_tableau/SKILL.md |
Import Tableau .twb/.twbx/.tds/.tdsx files |
| import_powerbi/SKILL.md |
Import Power BI .pbit/.pbix files |
| import_osi/SKILL.md |
Import OSI (Ossie) YAML models via osi_write_model |
References
| File |
Purpose |
| reference/description_guidelines.md |
Description quality standards |
| reference/tableau_tool_reference.md |
Tableau import API reference |
| reference/pbi_tool_reference.md |
Power BI import API reference |
| reference/osi_tool_reference.md |
OSI osi_write_model API reference |
Rules
- Never generate SQL queries - wait for user to provide them
- Load the appropriate sub-skill before performing operations
- Never deploy without explicit user approval
1---2name: semantic-view3description: "Create, edit, upload, download, audit, validate, and manage Cortex Analyst semantic views. Prefer this router for semantic view work in Snowflake: create/edit/deploy YAML, descriptions, audits, relationship or VQR suggestions, filter/metric suggestions, validate semantic view YAML (and VQRs only when the user asks for VQR validation), import Tableau workbooks (.twb/.twbx/.tds/.tdsx), import Power BI files (.pbit/.pbix), import OSI (Open Semantic Interchange, also known as Ossie) YAML models, run agentic optimization, or manage VQRs (add/remove/expand/truncate). Also when users say 'analyst model' or 'semantic YAML' instead of 'semantic view'."4parent_skill: agent-studio5metadata:6 source: https://skillmd.com/skills/s-14-h/semantic-view7---89# Semantic View Skill1011## CLI Reference1213Use the `cortex agent-studio` CLI for ALL semantic view operations:1415| Command | Purpose |16|---------|---------|17| `cortex agent-studio sv-generate --json-proto '<json>'` | Create YAML from tables/SQL |18| `cortex agent-studio sv-read --fqn DB.SCHEMA.NAME` | Read semantic view from Snowflake |19| `cortex agent-studio sv-read --source workspace --file-path <path>` | Read from workspace file |20| `cortex agent-studio sv-write --yaml-content '<yaml>' --source-object DB.SCHEMA.NAME` | Save YAML to workspace (auto-generates path). Use `--file-path <FILE_NAME>.sv.yaml` if file path from system reminder/user input |21| `cortex agent-studio sv-deploy --file-path <path> --fqn DB.SCHEMA.NAME` | Deploy YAML to Snowflake |22| `cortex agent-studio sv-edit --file-path <path> --operations '<json>'` | Edit YAML in place (combines semantic_model_edit + extract + sv-write) |23| `cortex agent-studio backend --tool suggest_relationships --file-path <path> --parameters '<json>'` | AI relationship suggestions |24| `cortex agent-studio backend --tool tableau_analyze --parameters '<json>'` | Analyze Tableau file structure |25| `cortex agent-studio backend --tool tableau_export --parameters '<json>'` | Convert Tableau file to YAML |26| `cortex agent-studio backend --tool pbi_analyze --parameters '<json>'` | Analyze Power BI file structure (.pbit/.pbix) |27| `cortex agent-studio backend --tool pbi_export --parameters '<json>'` | Convert Power BI file to YAML |28| `cortex agent-studio backend --tool osi_write_model --parameters '<json>'` | Register an OSI YAML model directly in Snowflake |2930**Forbidden:** Do NOT use `read`, `write`, `edit`, `multi_edit`, or `bash` tools on semantic view YAML files. These bypass `cortex_project/` tracking.3132## ⚠️ First Step: Load References3334For description tasks, load:35```36Read: semantic-view/reference/description_guidelines.md37```3839## Workflow Routing4041**Canonical create phrases — always route to `creation/SKILL.md`, never treat as ambiguous:**42- "Help me create a semantic view"43- "Help me create a semantic model" / "Help me create an analyst model"44- "Help me build / set up / make a semantic view"4546```47User Request → Route to Sub-Skill48│49├─ Create new view → creation/SKILL.md50├─ Edit existing view (user knows what to change) → edit/SKILL.md51├─ Upload/deploy YAML → upload/SKILL.md52├─ Download/export → download/SKILL.md53├─ Generate descriptions → generate_description/SKILL.md54├─ Validate semantic view YAML; validate VQRs only if the user asks → validate/SKILL.md55├─ Audit (best practices, heuristics) → audit/SKILL.md5657├─ Suggest relationships → suggest_relationships/SKILL.md58├─ VQR suggestions → vqr_suggestions/SKILL.md59├─ Suggest/recommend metrics, filters, or facts → filters_and_metrics_suggestions/SKILL.md60├─ Manage VQRs (add/remove, expand/truncate, spot-validate SQL) → vqr_management/SKILL.md61├─ Run automated/agentic optimization (start, poll, cancel, list past runs) → agentic_optimization/SKILL.md62├─ Apply an advanced modeling pattern: compare a metric to the same period last year/month (YoY, MoM, SPLY); build rolling averages, YTD/QTD/MTD totals, or lag-N comparisons; model an SCD2 lookup with `valid_from`/`valid_to` or attribute an event to the dim row active at event time (ASOF); track snapshot facts that must not sum across time (balance / inventory / headcount); model an accumulating snapshot funnel across multiple milestone dates; route a metric down a specific FK when a fact has two FKs to the same dim (multi-path USING); reuse the same physical dim under multiple roles (role-playing dims); add cross-entity totals or ratios (`% of total`, `net = gross − returns`); split shared dims across multiple fact tables (multi-fact); expose a `PRIVATE` fact used only inside the SV to derive a tier or other dimension; join on a key that doesn't exist as a physical column (computed FK); steer Cortex Analyst with verified queries / `AI_SQL_GENERATION` / `AI_QUESTION_CATEGORIZATION` metadata; or diagnose a fan trap / "multi-path relationship not supported" / numbers that look inflated → patterns/SKILL.md63├─ Import Tableau file → import_tableau/SKILL.md64├─ Import Power BI file → import_powerbi/SKILL.md65├─ Import OSI (Ossie) YAML model → import_osi/SKILL.md66│67└─ Unclear → Ask:68 "Would you like to:69 1. Create a new semantic view70 2. Edit an existing view71 3. Upload/deploy a YAML file72 4. Download an existing view73 5. Generate descriptions74 6. Audit for quality issues75 7. Validate the semantic view (YAML); validate verified queries only if they ask76 8. Suggest relationships77 9. Get VQR suggestions from usage or query history78 10. Get filter & metric suggestions from query history79 11. Add, remove, or convert verified query SQL80 12. Run agentic optimization (automated AI optimization job)81 13. Import a Tableau workbook82 14. Import a Power BI file83 15. Import an OSI (Ossie) YAML model"84```8586**Edit vs suggest vs VQR vs agentic vs pattern:**87- User names a specific change ("add metric X", "rename column Y") → `edit/SKILL.md`88- User asks for ideas ("suggest / recommend metrics, filters, or facts", "what should I add?") → `filters_and_metrics_suggestions/SKILL.md`89- User wants to add, remove, or rewrite a verified query ("expand this query", "truncate VQR") → `vqr_management/SKILL.md`90- User wants to validate the YAML before deploy, or explicitly asks to bulk-validate VQRs → `validate/SKILL.md`91- User wants to start an automated AI optimization job, check whether one finished, cancel a running job, or list past optimization runs → `agentic_optimization/SKILL.md`92- User describes an advanced modeling intent — compare to same period last year/month (YoY, MoM, SPLY), build a rolling / YTD / lag-N metric, model an SCD2 lookup with `valid_from`/`valid_to` or ASOF join, track a snapshot fact that must not sum across time, model an accumulating funnel across milestone dates, route a metric through a specific FK when a fact has two FKs to one dim, add a cross-entity derived metric (`% of total`, `net = gross − returns`), expose a `PRIVATE` fact, join on a computed (non-physical) key, steer Cortex Analyst with verified-queries / `AI_SQL_GENERATION` metadata, or diagnose a fan trap / "multi-path relationship not supported" / inflated-numbers symptom → `patterns/SKILL.md`93- User asks to import a `.twb / .twbx / .tds / .tdsx` workbook → `import_tableau/SKILL.md`94- User asks to import a `.pbit / .pbix` file → `import_powerbi/SKILL.md`95- User asks to import an OSI YAML model (`.osi.yaml`, mentions "open semantic interchange" or "ossie", or provides OSI YAML inline) → `import_osi/SKILL.md`9697## Sub-Skills9899| Sub-Skill | Purpose |100|-----------|---------|101| [creation/SKILL.md](creation/SKILL.md) | Generate new semantic views from tables/SQL |102| [edit/SKILL.md](edit/SKILL.md) | Modify existing views (add/remove/rename) |103| [upload/SKILL.md](upload/SKILL.md) | Deploy YAML to Snowflake |104| [download/SKILL.md](download/SKILL.md) | Export views from Snowflake to workspace |105| [generate_description/SKILL.md](generate_description/SKILL.md) | AI-powered descriptions for components |106| [audit/SKILL.md](audit/SKILL.md) | Quality checks (best practices, duplicates, inconsistencies) |107| [validate/SKILL.md](validate/SKILL.md) | `SYSTEM$WRITE_SEMANTIC_MODEL_YAML(..., TRUE)` YAML check; VQR `validate_verified_queries` only when the user requests it |108| [suggest_relationships/SKILL.md](suggest_relationships/SKILL.md) | AI-powered relationship suggestions |109| [vqr_suggestions/SKILL.md](vqr_suggestions/SKILL.md) | VQR suggestions from query history or CA usage |110| [filters_and_metrics_suggestions/SKILL.md](filters_and_metrics_suggestions/SKILL.md) | Filter, metric, and fact suggestions from query history |111| [vqr_management/SKILL.md](vqr_management/SKILL.md) | Add/remove VQRs; expand/truncate SQL; spot-validate SQL strings |112| [agentic_optimization/SKILL.md](agentic_optimization/SKILL.md) | Run / poll / cancel / list automated `SYSTEM$CORTEX_ANALYST_*_AGENTIC_OPTIMIZATION` jobs and apply approved suggestions |113| [patterns/SKILL.md](patterns/SKILL.md) | 14-pattern catalog of advanced SV modeling intents — period-over-period comparisons (YoY/MoM/SPLY), rolling/YTD/lag-N metrics, SCD2/ASOF temporal joins, snapshot facts that must not sum across time, accumulating funnels, multi-path metrics, role-playing dimensions, cross-entity derived metrics, multi-fact layouts, `PRIVATE` facts, computed-FK joins, AI metadata steering Cortex Analyst, and a six-scenario structural-diagnostic catalog (fan trap, multi-path errors, wrong cardinality, etc.). Each pattern ships a tight DDL/YAML snippet plus gotchas, applied via `cortex agent-studio` CLI for YAML-supported patterns and `snowflake_sql_execute` for DDL-only ones |114| [import_tableau/SKILL.md](import_tableau/SKILL.md) | Import Tableau .twb/.twbx/.tds/.tdsx files |115| [import_powerbi/SKILL.md](import_powerbi/SKILL.md) | Import Power BI .pbit/.pbix files |116| [import_osi/SKILL.md](import_osi/SKILL.md) | Import OSI (Ossie) YAML models via `osi_write_model` |117118## References119120| File | Purpose |121|------|---------|122| [reference/description_guidelines.md](reference/description_guidelines.md) | Description quality standards |123| [reference/tableau_tool_reference.md](reference/tableau_tool_reference.md) | Tableau import API reference |124| [reference/pbi_tool_reference.md](reference/pbi_tool_reference.md) | Power BI import API reference |125| [reference/osi_tool_reference.md](reference/osi_tool_reference.md) | OSI `osi_write_model` API reference |126127## Rules1281291. **Never generate SQL queries** - wait for user to provide them1302. **Load the appropriate sub-skill** before performing operations1313. **Never deploy without explicit user approval**