Skip to main content
command CX Codex

build-model — Claude Code command: dbt model plan with tests

The build-model command builds a data modeling plan: transforms, tests, deployment schedule and dependencies for analytics use cases.

Apache-2.0 ★ 450 updated 2026-04-03

Install into Claude Code · Manually: put the files in place All methods and platforms ↓
.claude/commands/build-model.md
Open on GitHub

What build-model does

The command takes a metric (--use_case), stack (--stack: dbt, LookML, SQL Runner, Python jobs), refresh cadence (--refresh: hourly, daily, weekly or cron) and generates a model spec with staging, intermediate and mart layers, join keys, surrogate IDs. It defines a testing strategy: schema checks, freshness, uniqueness, accepted values and custom tests. It drafts a deployment plan with resource configs, backfill strategy and rollback steps.

The result is stored in .claude/plans/plan-<timestamp>.json with objective, data lineage, dependency matrix, error handling and success metrics: freshness percentage, defect ceiling, SLA adherence. If testing and deployment prep can run in parallel, the command logs a diamond segment with a merge gate. Default retry limit is 2 for failed tests; escalation goes to Analytics Modeling Lead → Data Engineering Lead → RevOps.

The command invokes the analytics-modeling-lead agent to architect the model, the quality-gates skill for validation coverage, the instrumentation skill for data contracts. It produces a model diagram, SQL pseudocode, test plan, deployment checklist with monitoring hooks and rollback instructions.

What it helps with

  • plan data transforms for a metric or dashboard
  • set up freshness, uniqueness and schema tests for a dbt model
  • draft a deployment schedule with backfill and rollback
  • document model dependencies and data contracts
  • prepare a plan with SLA metrics and defect ceiling

Example prompts for the agent

  • Build a model for the pipeline velocity metric in dbt with daily refresh: /analytics-pipeline-orchestration:build-model --use_case "pipeline velocity" --stack "dbt" --refresh daily
  • Create a model plan for the retention dashboard with hourly refresh and dependency on the events table: `/analytics-pipeline-orchestration:build-model --use_case "retention dashboard" --stack "LookML" --refresh hourly --dependencies "events"`
  • Plan a Python model for weekly analytics with uniqueness and accepted value tests

How to install build-model

Manually: put the files in place

.claude/commands/build-model.md

Call it with /build-model. For all projects use ~/.claude/commands/

Questions about build-model

How do I install build-model in Claude Code?

Create a .claude/commands/build-model.md file in the project root with the command description from the gtmagents/gtm-agents repository.

What does the build-model command do?

The command generates a data modeling plan: staging, intermediate and mart layer outline, schema and freshness tests, deployment schedule with backfill, rollback instructions and saves the plan to .claude/plans with success metrics.

Which stacks does build-model support?

The command works with dbt, LookML, Metrics Layer, SQL Runner and Python jobs — you specify the stack with the --stack parameter.

Source text

build-model.md · Apache-2.0
---
name: build-model
description: Generates a modeling plan detailing transforms, tests, and deployment schedule for analytics use cases.
usage: /analytics-pipeline-orchestration:build-model --use_case "pipeline velocity" --stack "dbt" --refresh daily
---

# Command: build-model

## Inputs
- **use_case** – name of metric or dashboard relying on the model.
- **stack** – modeling tool (dbt, LookML, Metrics Layer, SQL Runner, Python jobs).
- **refresh** – cadence (hourly, daily, weekly) or cron.
- **dependencies** – optional upstream tables or APIs.
- **tests** – optional list of validations to enforce.

### GTM Agents Pattern & Plan Checklist
> Mirrors GTM Agents orchestrator blueprint @puerto/plugins/orchestrator/README.md#112-325.

- **Pattern selection**: Modeling often runs **pipeline** (spec → blueprint → testing → deployment → docs). If testing + deployment prep can parallelize, log a **diamond** segment with merge gate.
- **Plan schema**: Save `.claude/plans/plan-<timestamp>.json` with objective, data lineage, task IDs, parallel groups, dependency matrix, error handling, and success metrics (freshness %, defect ceiling, SLA adherence).
- **Tool hooks**: Reference `docs/gtm-essentials.md` stack—Serena for repo diffs/dbt patches, Context7 for platform docs, Sequential Thinking for review cadences, Playwright for UI validations tied to modeled data.
- **Guardrails**: Default retry limit = 2 for failed tests/deployments; escalation path = Analytics Modeling Lead → Data Engineering Lead → RevOps.
- **Review**: Run `docs/usage-guide.md#orchestration-best-practices-puerto-parity` before execution to confirm agents, dependencies, deliverables.

## Workflow
1. **Spec Alignment** – review event/tracking plan, KPI definitions, stakeholders.
2. **Model Blueprint** – outline staging, intermediate, mart layers, join keys, surrogate IDs.
3. **Testing Strategy** – define schema, freshness, unique, accepted value, and custom tests.
4. **Deployment Plan** – schedule jobs, resource configs, backfill strategy, rollback steps.
5. **Documentation & Handoff** – update dbt docs / catalog, change log, owner assignments.

## Outputs
- Modeling spec (diagram, SQL pseudocode, dependencies).
- Test plan + configuration snippets.
- Deployment checklist with monitoring hooks and rollback instructions.
- Plan JSON entry stored/updated in `.claude/plans` for audit trail.

## Agent/Skill Invocations
- `analytics-modeling-lead` – architects model + tests.
- `quality-gates` skill – ensures validation coverage.
- `instrumentation` skill – confirms data contracts stay intact.

## GTM Agents Safeguards
- **Fallback agents**: document substitutes (e.g., BI Publisher covering modeling reviews) when specialists unavailable.
- **Escalation triggers**: if freshness, defect, or SLA guardrails breach twice within 24h, escalate to Data + RevOps leadership per GTM Agents runbook and consider rollback.
- **Plan maintenance**: update plan JSON whenever dependencies, owners, or deployment cadence changes, keeping audit alignment with GTM Agents standards.

---

© gtmagents · Apache-2.0 · gtmagents/gtm-agents

Similar slash commands

All slash commands for Data and databases →
using-dbt-for-analytics-engineering dbt-labs using-dbt-for-analytics-engineering — a skill that walks the agent through dbt work: building models, writing SQL with ref() and source(), adding tests, validating output with dbt show. CX Codex +1 1,200installs dbt-transformation-patterns Seth Hobson dbt-transformation-patterns — a skill for Claude, Claude and Cursor that tells the agent how to layer dbt models, write data tests and set up incremental marts. CX Codex +1 11,000installs dbt-data-transformation manutej dbt-data-transformation — a dbt skill for analytics engineering: models, tests, docs, incremental builds, macros and packages. Useful when your warehouse SQL needs structure. CX Codex +1 443installs analytics-engineer borghei analytics-engineer — a skill for Claude Code, Codex, Cursor, Copilot, Gemini CLI and OpenCode that builds dbt transformations and dimensional schemas. Triggered when you need SQL models, tests, incremental fact tables or metrics. CX Codex +1 207installs running-dbt-commands dbt-labs running-dbt-commands — a skill for Claude Code, Codex, Cursor and other platforms that formats and executes dbt CLI commands. Picks the right dbt executable and structures parameters for build, run, test, show. CX Codex +1 1,100installs dbt Analytics Project taste f dbt Analytics Project taste — a prompt for ChatGPT sets conventions for dbt models, tests, documentation, and CI. Use it while shaping an analytics project or revising its model structure. GP ChatGPT ★ 178,201repo stars

From the same set224

The whole set →
manage-production The manage-production command turns a campaign and its assets into a production tracker with owners, review steps, and QA. Use it to plan work across several deliverables. CX Codex +1 ★ 450repo stars design-referral design-referral is a Claude Code command that designs referral programs with incentives, rules, and governance, producing a charter, stakeholder deck, and risk log. CX Codex +1 ★ 450repo stars design-nurture design-nurture builds multi-stage nurture journey blueprints with audience segmentation, triggers, and a content plan. Useful for planning lifecycle marketing and RevOps campaigns. CX Codex +1 ★ 450repo stars run-launch The run-launch command builds a launch execution plan with a timeline, communications, monitoring, and go/no-go gates. Use it to coordinate channel work and launch-day operations. CX Codex +1 ★ 450repo stars monitor-sla monitor-sla tracks MQL to SQL SLA compliance, highlights routing bottlenecks, and suggests corrective steps across marketing and sales pipelines. CX Codex +1 ★ 450repo stars ship-dashboards ship-dashboards builds a dashboard launch plan covering visualization, publishing, user enablement, and monitoring. Use it to coordinate the rollout and define what to track afterward. CX Codex +1 ★ 450repo stars launch-program launch-program takes a referral program from task checklist through tooling, launch comms and training to a monitored go-live day. CX Codex +1 ★ 450repo stars plan-pillar plan-pillar builds a content pillar plan with hero assets, derivative pieces, and a distribution schedule. Saves task dependencies and KPIs directly to JSON. CX Codex +1 ★ 450repo stars

Project sponsors

Companies that keep this analytics open