/dogsled-core:dogsled-author-model-spec-vqfrom dogsled-core
Authors a Model Spec verified query (VQ) — a natural-language-to-SQL pairing that the query planner treats as ground truth. Covers {ref} tokens, optional parameters, and connection pinning.
Ships in dogsled-core. 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.
Use this skill when a user wants to record a canonical SQL answer to a natural-language question — typically because the query planner keeps producing inconsistent or wrong SQL for that question and the team wants to pin a verified version as ground truth.
VQs are metadata entities: they don't produce DDL. The compiler
parses them, validates their {ref} tokens, and emits them as JSON
alongside SQL when --include-metadata is set. The host application reads them
out of the verified_queries table for NL → SQL retrieval.
Place each VQ in its own file under the project's vqs/ directory
(configurable via vqs_dir in model-spec.yml, defaults to vqs/). One VQ
per file.
spec_version: '0.2'
type: vq
name: <identifier> # must match identifierRegex; required
description: Optional longer explanation
nlq: What was the natural-language question? # required; short (~one sentence)
sql: | # required; SQL with {ref} tokens
SELECT customer_id, SUM(order_total) AS revenue
FROM {fct_orders}
GROUP BY customer_id
parameters: # optional; runtime-bound parameters
- name: start_date
type: date
required: true # default true
description: Inclusive lower bound on order_date
- name: limit
type: integer
required: false
default: 10
connection: <integration_handle> # optional; pin VQ to one warehouse
tags: # optional
- revenue
- shop-demo
Required: spec_version, type, name, nlq, sql.
{ref} token rulesVQ SQL uses {ref} tokens that the compiler resolves to qualified
identifiers. Two forms:
| Token | Resolves to |
|---|---|
{model_name} | The Model Spec model identifier (e.g. {fct_orders}) |
{connection.source_name} | A Model Spec source identifier (e.g. {ecom.raw_orders}) |
validateMetadataReferences (run as part of dogsled model validate)
asserts every token resolves. Tokens inside single-quoted strings,
double-quoted identifiers, -- line comments, and /* ... */ block
comments are correctly ignored by the tokenizer.
Parameter types: string, integer, number, boolean,
timestamp, date. type is advisory — the caller binds parameters
at query time and decides coercion.
nlq: as a short user-facing
sentence (≤ ~10 words is typical). The agent matches against this
when retrieving.{ref} token. Prefer model refs ({fct_orders}) over
source refs ({ecom.raw_orders}) so the VQ travels with the
curated layer.QUALIFY, BigQuery FOR SYSTEM_TIME), set
connection: <handle> so the agent doesn't try to run it
elsewhere.revenue, customer-360, finance).dogsled model validate --integration <handle> —
surfaces unresolved {ref} tokens and connection-handle
mismatches.spec_version: '0.2'
type: vq
name: top_customers_by_revenue
description: Canonical top-N customers query for the shop demo.
nlq: Who are our top customers by revenue?
sql: |
SELECT
customer_id,
customer_email,
SUM(order_total) AS revenue
FROM {fct_orders}
WHERE order_date >= {start_date}
GROUP BY customer_id, customer_email
ORDER BY revenue DESC
LIMIT {limit}
parameters:
- name: start_date
type: date
description: Inclusive lower bound on order_date
required: true
- name: limit
type: integer
description: How many customers to return
required: false
default: 10
tags:
- revenue
- shop-demo
vq.sql is tokenized for {ref} extraction only — the SQL itself
is not parsed. Syntax errors, unknown columns, and cross-dialect
incompatibility slip through and surface at query time.connection: <handle> pinning constrains which warehouse the VQ
runs against, but does not cross-check that {ref} tokens
belong to that connection. A VQ pinned to bigquery can reference
a Snowflake-rooted model and still pass validation.default values are typed as string | number | boolean | null. Complex defaults (arrays, objects) are not supported.dogsled-author-model-spec-model — author the underlying model the VQ queries.dogsled-author-model-spec-metric — when the answer is a single named measure
rather than a row set, a metric may be more reusable than a VQ.dogsled-author-model-spec-relationship — VQs that hand-write joins should
match the cardinality declared in the relationship spec.For programmatic edits to an existing VQ, see dogsled-model-spec-edit —
updateVq() is the validated entry point.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub bobsled-inc/dogsled-core --plugin dogsled-core65 skills in this plugin
/add-custom-api-integrationAuthor a generic custom_api source for any REST/GraphQL API purely in YAML — inline transport (base_url + auth), one declarative resource per endpoint, then validate/verify/extract. Use when the API isn't in the bundled catalog./add-custom-mcp-integrationAuthor a custom_mcp source for any remote MCP server (Model Context Protocol over streamable HTTP) purely in YAML — inline mcp_http transport (url + auth + auth_env_vars), one resource_kind mcp resource per tool, then validate/verify/extract. Use when the MCP server isn't in the bundled catalog./add-database-destinationOther plugins' skills for the same job