getnao/nao

add-semantic-layer

Wire a semantic layer into a nao agent so that metric queries are routed through a single source of truth.

소스 보기

사용 방법

  1. 설치 명령을 복사하고 자신의 에이전트 환경에 설치하기 전에 소스 패키지를 확인하세요.
  2. 필요한 도구, 인증 정보, 지원 환경은 원본 문서에서 확인하세요.
  3. 입력과 원하는 산출물을 설명하고 출처와 결과를 대조하세요.
npx skills add https://github.com/getnao/nao --skill add-semantic-layer

시작 전 확인

  • 설치에는 모델 구독, API 한도, 파일 접근 권한이 포함되지 않습니다.
  • 별점 수와 설치 수는 활동 지표이며 독립적인 품질·보안 검증이 아닙니다.
원본 Skill 문서

원본 저장소의 제목, 예시, 코드, 표, 링크, 이미지를 유지해 표시합니다.

add-semantic-layer

Wire a semantic layer in so it becomes the canonical source of truth for metrics. The agent queries it instead of computing metrics from raw tables.

When to add — and when not to

Only add a semantic layer after `nao test` shows the agent struggling with metric reliability. Not before.

  • Increases reliability and stability (one definition per metric).
  • Reduces the scope of answerable questions (anything outside the layer is harder, sometimes impossible).

If failures are concentrated on schema gaps or date logic, a semantic layer doesn't help — fix RULES.md first.

Semantic layer vs metric store: a semantic layer is a file (md/yaml) the agent reads to write its own SQL. A metric store exposes metrics through an API the agent calls (query_metric(...)); the framework converts to SQL. dbt MetricFlow Cloud is a metric store. Snowflake views and nao YAML are semantic layers. Bigger reliability gain with a metric store, bigger scope reduction too.

Step 1 — Pick the tool

OptionTypeWhen
dbt MetricFlowMetric storeAlready running dbt Cloud with the Semantic Layer enabled.
Snowflake views / semanticSemantic layerSnowflake; using curated views or native semantic views.
nao semantic filesSemantic layerNo existing layer. Want a lightweight in-repo YAML.
OtherVariesLooker/LookML, Cube, AtScale, etc.

Path A — dbt MetricFlow (dbt Cloud with Semantic Layer)

Add to .claude/mcp.json:

json
{
	"mcpServers": {
		"dbt-mcp": {
			"command": "uvx",
			"args": ["dbt-mcp"],
			"env": {
				"DBT_HOST": "us1.dbt.com",
				"MULTICELL_ACCOUNT_PREFIX": "your_prefix",
				"DBT_TOKEN": "${DBT_TOKEN}",
				"DBT_PROD_ENV_ID": "your_env_id",
				"DISABLE_SEMANTIC_LAYER": "false",
				"DISABLE_DISCOVERY": "true",
				"DISABLE_SQL": "true",
				"DISABLE_ADMIN_API": "true",
				"DISABLE_REMOTE": "false"
			}
		}
	}
}

Substitute MULTICELL_ACCOUNT_PREFIX, DBT_PROD_ENV_ID, DBT_HOST from the user's dbt Cloud account. Set DBT_TOKEN in their shell, not in the file. Restart the session and verify the MCP connects (list_metrics).

dbt Core (local-only) is not supported here — no metric-store API to route through.

Hand off to write-context-rules: in ## Key Metrics Reference, route each MetricFlow metric through query_metric (e.g. MRR → query via dbt MCP query_metric (semantic layer)). In ## Analysis Process, instruct the agent to use semantic-layer tools for known metrics instead of raw tables.

Path B — Snowflake views / semantic views

json
{
	"mcpServers": {
		"snowflake": {
			"command": "uvx",
			"args": ["mcp-server-snowflake"],
			"env": {
				"SNOWFLAKE_ACCOUNT": "your_account",
				"SNOWFLAKE_USER": "your_user",
				"SNOWFLAKE_PASSWORD": "${SNOWFLAKE_PASSWORD}",
				"SNOWFLAKE_WAREHOUSE": "your_warehouse",
				"SNOWFLAKE_DATABASE": "your_database",
				"SNOWFLAKE_SCHEMA": "your_schema",
				"SNOWFLAKE_ROLE": "your_role"
			}
		}
	}
}

For native semantic views (Cortex Analyst), use the Cortex MCP variant with SEMANTIC_VIEW set. Verify package + env-var names against the latest docs — auth options (key pair / OAuth / password) vary.

Identify the semantic surface (curated views like analytics.metrics.* or native semantic views). Hand off to write-context-rules: in ## Key Metrics Reference, route each metric to its view, never the underlying tables.

Path C — Other (no obvious MCP)

Search the MCP registry, the tool's docs, and the user's installed MCPs. If a fit exists, configure it following the pattern from paths A-B. If not: fall back to Path D (nao semantic files) or build a thin MCP wrapper.

Path D — nao semantic files

For users with no existing semantic layer. One file: `semantics/semantic.yaml` holding all dimensions and metrics together. Use templates/semantic.yaml.

Walk through dimensions first (slice axes: date, plan, country — capture name, type, description, and allowed values for categoricals), then top metrics (capture name, definition, source table + column + aggregation, grain, dimensions, filters).

Hand off to write-context-rules: in ## Key Metrics Reference, point every metric at semantics/semantic.yaml.

Validate

  1. Confirm every metric the user cares about now has a routing rule in RULES.md.
  2. nao chat one of their top questions; confirm the agent uses the semantic layer.
  3. nao test and compare to the pre-semantic-layer baseline pass rate. Reliability is the only reason to do this — measure it.

Recommend next step

  • No tests yet → create-context-tests.
  • Reliability dropped → audit-context.
  • Otherwise → write-context-rules to refine other sections.

Guardrails

  • Only after tests show metric failures. Cite them when the user asks "should we add one?"
  • One semantic layer at a time. Two competing layers create MECE violations.
  • Don't write `RULES.md` directly. Hand off to write-context-rules.
  • Don't store credentials in `.claude/mcp.json`. Use ${ENV_VAR}. Add the file to .gitignore if anything sensitive lands there.
  • Don't invent metrics for Path D. Only encode what the user defines.

Templates

  • templates/semantic.yaml — single-file schema for Path D.

관련 작업

같은 저장소의 Skills

더 많은 Skills

모든 Skills
getnao
커뮤니티

audit-context

Diagnose the health of a nao context at any stage of its lifecycle. Use when the user wants a structured review of what's been synced, how RULES.md compares to the target structure, whether every table is documented, whether the data model is MECE, whether tests exist and what their failures reveal, and whether context files are bloated. Outputs a structured audit report with ranked recommendations. Do not use for first-time setup (setup-context) or routine rule writing (write-context-rules).

설치 수
2
GitHub Stars
1.9천
업데이트
10월 20일
getnao
커뮤니티

build-custom-charts

Create or update browser-rendered custom nao chart modules in agent/charts.

설치 수
2
GitHub Stars
1.9천
업데이트
10월 20일
getnao
커뮤니티

create-context-tests

Generate a test suite of natural-language → SQL pairs that becomes the quality benchmark for a nao agent, then run it via nao test. Use when the user wants to start measuring agent reliability, extend an existing test suite, or add tests for new metrics. Tests are the only honest answer to "is the context working?". Do not use for writing rules (write-context-rules) or diagnosing failures (audit-context).

설치 수
2
GitHub Stars
1.9천
업데이트
10월 20일
getnao
커뮤니티

deploy-context

Wire a nao project's context folder to a remote nao instance (Cloud or self-hosted) so every push to main automatically runs nao deploy via GitHub Actions. Use when the user has a working local nao project versioned in Git and wants their team's deployed instance to always reflect the latest committed context. Covers nao deploy usage, the GitHub Actions workflow, organization API keys, GitHub Secrets, .naoignore, environment-variable references in naoconfig.yaml, and create-vs-update behavior. D

설치 수
2
GitHub Stars
1.9천
업데이트
10월 20일