/dogsled-core:dogsled-model-spec-editfrom dogsled-core
Provides programmatic, validation-backed edits to Model Spec YAML files for sources, models, metrics, relationships, and verified queries.
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.
Read when SKILL.md points to them.
Use @bobsled-inc/model-spec/edit when an agent, UI, or service needs to update a small part of a Model Spec YAML spec without rewriting the full file.
The YAML files remain the source of truth. The edit API preserves comments where possible, validates with the compiler schemas before writing, and writes atomically.
import {
addModelColumn,
addSourceColumn,
removeModelColumn,
removeSourceColumn,
updateMetric,
updateModel,
updateModelColumn,
updateRelationship,
updateSource,
updateSourceColumn,
updateVq,
} from '@bobsled-inc/model-spec/edit';
Every function returns { ok: true, data } or { ok: false, error }. Always branch on result.ok.
updateSourceColumn({
projectDir,
sourceName: 'raw_customers',
connection: 'ecom',
columnName: 'EMAIL',
patch: {
description: 'Primary email address for customer communications',
pii: true,
semantic_role: 'email',
},
});
Set a patch value to undefined to delete that field.
updateModelColumn({
projectDir,
modelName: 'stg_orders',
columnName: 'ORDER_DATE',
patch: {
expr: "DATE_TRUNC('day', ORDERED_AT)",
type: 'DATE',
description: 'Order date at day grain',
},
});
addModelColumn({
projectDir,
modelName: 'stg_orders',
column: {
name: 'ORDER_YEAR',
expr: "DATE_PART('year', ORDER_DATE)",
description: 'Year the order was placed',
},
});
updateMetric({
projectDir,
metricName: 'gross_revenue',
patch: { expression: 'SUM({fct_orders.NET_REVENUE})' },
});
updateRelationship({
projectDir,
relationshipName: 'orders_customers',
patch: { join_type: 'left' },
});
updateVq({
projectDir,
vqName: 'orders_by_month',
patch: { sql: 'SELECT COUNT(*) FROM {fct_orders}' },
});
dryRun: true for previews and diffs.skipValidation unset for normal edits.dogsled model validate after substantial edits.{ filePath, content } instead of re-reading after a successful edit.After changing code that calls the edit API, run focused validation first:
pnpm --filter @bobsled-inc/model-spec typecheck
pnpm --filter @bobsled-inc/model-spec test -- tests/unit/edit
After using the API to edit a real Model Spec project, run project validation:
dogsled model validate --integration <handle>
If the edit changes model expressions or removes columns, also run lineage:
dogsled model lineage --integration <handle> --json
Full docs: packages/model-spec/docs/programmatic-edit-api.md.
Read the compiler and editing reference when the task needs the full API or schema:
Use @bobsled-inc/model-spec/edit when an agent, web UI, or service needs to update a small part of a Model Spec YAML spec without rewriting the whole file.
The YAML files remain the source of truth. The edit API preserves comments where possible, validates with the same schemas as the compiler, and writes atomically.
import {
addModelColumn,
addSourceColumn,
removeModelColumn,
removeSourceColumn,
updateMetric,
updateModel,
updateModelColumn,
updateRelationship,
updateSource,
updateSourceColumn,
updateVq,
} from '@bobsled-inc/model-spec/edit';
Every function returns:
type EditResult<T> = { ok: true; data: T } | { ok: false; error: string };
Always branch on result.ok. Do not assume the edit wrote to disk.
projectDir.dryRun: true first when showing a preview or diff.result.ok.dogsled model validate or package tests after substantial edits.Use source edits for sources/<connection>/*.yml.
const result = updateSourceColumn({
projectDir,
sourceName: 'raw_customers',
connection: 'ecom',
columnName: 'EMAIL',
patch: {
description: 'Primary email address for customer communications',
pii: true,
semantic_role: 'email',
},
});
Set a patch value to undefined to delete the field:
updateSourceColumn({
projectDir,
sourceName: 'raw_customers',
connection: 'ecom',
columnName: 'EMAIL',
patch: { deprecated: undefined },
});
Use addSourceColumn only when the source table schema actually changed. Use removeSourceColumn only after checking downstream lineage and models that reference the column.
Use model edits for models/*.yml.
updateModelColumn({
projectDir,
modelName: 'stg_orders',
columnName: 'ORDER_DATE',
patch: {
expr: "DATE_TRUNC('day', ORDERED_AT)",
type: 'DATE',
description: 'Order date at day grain',
},
});
addModelColumn({
projectDir,
modelName: 'stg_orders',
column: {
name: 'ORDER_YEAR',
expr: "DATE_PART('year', ORDER_DATE)",
description: 'Year the order was placed',
},
});
When changing expr, prefer running lineage and compile validation because expression changes can affect downstream SQL even when the YAML schema is valid.
updateModel({
projectDir,
modelName: 'fct_orders',
patch: {
description: 'Completed orders with revenue metrics',
owner: 'data-eng',
tags: ['finance'],
},
});
updateMetric({
projectDir,
metricName: 'gross_revenue',
patch: {
expression: 'SUM({fct_orders.NET_REVENUE})',
synonyms: ['sales', 'revenue'],
},
});
updateRelationship({
projectDir,
relationshipName: 'orders_customers',
patch: { join_type: 'left' },
});
updateVq({
projectDir,
vqName: 'orders_by_month',
patch: {
sql: "SELECT DATE_TRUNC('month', ORDER_DATE), COUNT(*) FROM {fct_orders} GROUP BY 1",
},
});
The API finds each spec by its declared type and name anywhere in the project, so it works with any folder layout. Pass a folder override only to limit the search to one folder:
updateSourceColumn({
projectDir,
sourcesDir: 'warehouse-sources',
sourceName: 'raw_customers',
connection: 'ecom',
columnName: 'EMAIL',
patch: { description: 'Primary email address' },
});
dryRun: true for UI previews.skipValidation unset for normal use.content for previews and diffs instead of re-reading the file.When changing the edit API itself, run:
pnpm --filter @bobsled-inc/model-spec typecheck
pnpm --filter @bobsled-inc/model-spec test -- tests/unit/edit
When using the API to modify a project, run:
dogsled model validate --integration <handle>
For model expression edits, column removals, or schema metadata changes with downstream risk, run lineage as well:
dogsled model lineage --integration <handle> --json
Full docs: packages/model-spec/docs/programmatic-edit-api.md.
What SKILL.md sets; muted values are Claude Code's defaults
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