MCPInstall

mz-deploy

Using the mz-deploy CLI to manage a declarative SQL project for Materialize — project layout and the stage/wait/promote deployment lifecycle. Use this skill whenever the user is working in an mz-deploy project (a directory containing project.toml), asks how to deploy SQL changes to Materialize safely, or mentions mz-deploy, project.toml, profiles.toml, types.lock, staging deployments, deploy IDs, mz-deploy stage, mz-deploy promote, mz-deploy abort, mz-deploy apply, SET api = stable, stable API schemas, replacement materialized views, EXECUTE UNIT TEST, or per-profile SQL file overrides (nameprofile.sql). Also trigger when a user needs to roll back a Materialize deployment or resolve a deployment conflict.

Installs
113
Last 24h
—
Trending rank
—
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/materializeinc/agent-skills --skill mz-deploy
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads mz-deploy automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

mz-deploy

mz-deploy is declarative SQL project tooling for Materialize. A project is a git-tracked directory of .sql files describing the desired state of a Materialize environment; mz-deploy compiles it, type-checks it offline, tests it in a local container, and deploys changes through an atomic stage-then-promote lifecycle.

brew install materializeinc/materialize/mz-deploy

Discover Before You Run

The CLI is self-documenting, and its help text is the source of truth. Do not guess command names, flags, or argument order.

  1. mz-deploy help — all commands, grouped by purpose.
  2. mz-deploy help <command> — the detailed usage guide for one command: behavior, every flag, examples, error recovery, and exit codes.
  3. mz-deploy help profiles — the configuration topic guide (profiles, variables, suffixes, file overrides, TLS).

This skill covers the concepts and the shape of the workflow so you know which command to reach for. Read that command's help for the flags before running it.

Run commands from the project root, or pass -d <path>. Global options worth knowing: -p/--profile selects the connection profile, --output json for machine-readable output (supported by most commands, useful in CI), -v for verbose debugging, -q to suppress informational output.

Project Layout

project.toml              # project config: mz_version, dependencies, per-profile settings
profiles.toml             # connection profiles (also resolved from ~/.mz)
.mzprofile                # gitignored per-checkout default profile
types.lock                # cached schemas of external dependencies, for offline type checking
target/                   # gitignored local build cache (safe to delete; see `clean`)
models/
  <database>/
    <schema>.sql          # schema mod file — schema-level statements (see below)
    <schema>/
      <object>.sql        # one view, materialized view, table, source, sink, connection, or secret
clusters/<name>.sql       # cluster definitions (+ their GRANTs)
roles/<name>.sql          # role definitions
network-policies/<name>.sql

The path determines the object's fully qualified name: an MV in models/materialize/catalog/clusters.sql is materialize.catalog.clusters. A schema mod file — <schema>.sql sitting beside the <schema>/ directory — holds statements that apply to the schema as a whole, such as SET api = stable.

mz-deploy new <name> scaffolds this structure in a new directory; init does the same in the current one.

Command Map

GroupCommands
Getting startednew, init, profile (list/set/current), setup, debug
Developcompile, clean, test, explain, dev, lsp, sql, mcp
Infrastructurelock, apply, delete
Deploystage, wait, promote, abort, describe, list, log

One-time bootstrap: mz-deploy setup creates the _mz_deploy tracking database, its tables, the _mz_deploy_server cluster, and three roles. It must be run by a superuser when RBAC is enabled, because it grants system privileges. Everything after that runs as an ordinary user.

Workflow

mz-deploy compile              # parse, resolve dependencies, type-check offline
mz-deploy test                 # run unit tests in a local Materialize container
mz-deploy apply                # converge infrastructure (see below)
mz-deploy stage                # deploy changed views/MVs to suffixed staging schemas
mz-deploy wait <DEPLOY_ID>     # watch clusters hydrate until ready
mz-deploy promote <DEPLOY_ID>  # atomic swap into production

compile needs no database connection, so it belongs in CI on every commit. A passing compile guarantees stage and apply will not fail at the SQL parsing stage. Note that every profile variant is validated regardless of --profile, so a syntax error in foo#staging.sql still fails compile --profile production.

Alongside: list shows unpromoted deployments (like git branch), describe <ID> details one, log shows promotion history (like git log), and abort <ID> destroys a staging deployment without promoting it.

Key Concepts

apply owns infrastructure; stage owns views. apply is declarative, diff-based, and idempotent, converging clusters, roles, network policies, secrets, connections, sources, and tables in dependency order. stage handles views and materialized views. Tables and sources are never created by stage — they must already exist, so apply runs first. delete <type> <name> is the inverse of apply: it drops one object without CASCADE and removes its project file.

Deploy IDs and staging suffixes. Each deployment gets an ID — by default the first 7 characters of the current commit SHA — used to suffix its schemas and clusters (public → public_abc123). Staging clusters are cloned from the corresponding production cluster's configuration, including any auto-scaling strategy, so staged objects hydrate the way production will. Staging runs in isolation alongside production.

Change detection is hash-based. stage compares each object's SQL hash against the last promoted snapshot and deploys only what changed, plus anything downstream of a change. Unchanged objects are not recreated. Override with --redeploy-schema <db.schema> or --redeploy-all.

Promotion is atomic and resumable. promote executes ALTER … SWAP on schemas and clusters inside a single transaction, then does post-swap work: creating deferred sinks, applying replacement MVs, repointing sinks at the new production objects, and dropping the old resources. If it dies mid-flight, re-running the same command detects the post-swap state and resumes cleanup.

Sinks are deferred to promote. They must not start producing until the deployment is live, so stage records them and promote creates them.

Conflict detection works at schema and cluster granularity. Because a whole schema is swapped as a unit, two deployments touching any of the same schemas or clusters conflict — even when they modify different objects inside them. The first to promote wins; the second is rejected and must be re-staged against current production. --force skips the check, and doing so drops the other deployer's schemas, since schemas are swapped wholesale rather than merged. Only use it when clobbering that work is the intent.

Stable API schemas. By default a changed object is recreated in staging and its whole schema is swapped, which redeploys in-project dependents automatically but breaks consumers in other mz-deploy projects. Adding SET api = stable to a schema mod file marks that schema as an API boundary: changed MVs are updated in place via ALTER MATERIALIZED VIEW … APPLY REPLACEMENT, preserving object identity. Downstream consumers — in any project — need no redeployment. Constraints: stable schemas may contain only materialized views, and a changed replacement MV does not propagate dirtiness to its dependents.

Type checking is offline. compile and test read external dependency schemas from types.lock. Declare external objects in project.toml as dependencies = ["db.schema.table"] and run mz-deploy lock to refresh the file. Source tables created by CREATE TABLE FROM SOURCE are auto-discovered and need no declaration; apply tables regenerates the lock automatically.

Roles. setup creates materialize_deployer (stage, promote, abort), materialize_developer (read-only deployment state, plus dev overlays), and materialize_monitor. Each user must belong to exactly one — holding several is an error. Use separate profiles with distinct users for deploying, developing, and monitoring.

Profiles and Per-Profile Configuration

A profile is a named connection target in profiles.toml, resolved from --profiles-dir, then MZ_DEPLOY_PROFILES_DIR, then ~/.mz. The active profile resolves from --profile, then MZ_DEPLOY_PROFILE, then the gitignored .mzprofile in the project root (written by mz-deploy profile set). A built-in emulator profile always exists, so a local Materialize emulator works with zero configuration.

Passwords support ${VAR} substitution, overridable by MZ_PROFILE_<NAME>_PASSWORD. sslmode follows PostgreSQL's vocabulary and defaults to prefer for loopback hosts, require otherwise — use verify-full for Materialize Cloud.

The profile does more than pick a host. It also selects, at compile time:

  • profile_suffix (in project.toml) — appended to every database and cluster name, including IN CLUSTER references. Write the delimiter yourself: "_staging", not "staging". Staging suffixes stack on top (foo → foo_staging → foo_staging_a).
  • SQL variables — [<profile>.variables] in project.toml, referenced in any .sql file with psql syntax: :name (raw), :'name' (quoted string), :"name" (quoted identifier). Referencing an undefined variable fails compilation.
  • File overrides — name#<profile>.sql replaces name.sql when that profile is active. All variants are validated at compile time regardless of which is active, and all must share the same primary statement type. Views and materialized views cannot have file overrides — use SQL variables instead.

Rollback

There is no rollback command. Reverse the change in the project and promote the result:

git revert <commit>
mz-deploy stage
mz-deploy promote <DEPLOY_ID>

Because promote swaps atomically, the rollback promotion is itself atomic — production switches back in a single transaction.

Unit Tests

mz-deploy test runs tests written inline in the same .sql file as the view they cover, using EXECUTE UNIT TEST with mocked dependencies. The syntax is specific to mz-deploy and documented nowhere else — see references/unit-tests.md for the full grammar, worked examples, and failure modes.

Gotchas

  • stage requires a clean git tree. Commit, stash, or pass --allow-dirty.
  • setup needs a superuser under RBAC, one time only.
  • test and explain need Docker, and share one container named mz-deploy-sandbox across invocations on the host. Reuse is by name, not by image, so --docker-image has no effect until you docker rm -f mz-deploy-sandbox.
  • delete never cascades. If dependents exist it fails and leaves the project file in place.
  • dev will not target a production cluster. Provision a dedicated dev cluster.
  • A profile's cluster option is ignored. mz-deploy pins every connection to its own internal _mz_deploy_server cluster; resize that with a standard ALTER CLUSTER if needed.
  • stage failures roll back automatically. Pass --no-rollback to keep the partial deployment for debugging, then clean up with abort.
  • A stale target/ cache can produce confusing compile or type errors. Run mz-deploy clean.

FAQ

What does the mz-deploy skill do?

Using the mz-deploy CLI to manage a declarative SQL project for Materialize — project layout and the stage/wait/promote deployment lifecycle. Use this skill whenever the user is working in an mz-deploy project (a directory containing project.toml), asks how to deploy SQL changes to Materialize safely, or mentions mz-deploy, project.toml, profiles.toml, types.lock, staging deployments, deploy IDs, mz-deploy stage, mz-deploy promote, mz-deploy abort, mz-deploy apply, SET api = stable, stable API schemas, replacement materialized views, EXECUTE UNIT TEST, or per-profile SQL file overrides (nameprofile.sql). Also trigger when a user needs to roll back a Materialize deployment or resolve a deployment conflict.

How do I install mz-deploy?

Run npx skills add https://github.com/materializeinc/agent-skills --skill mz-deploy in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/mz-deploy/ (personal) or .claude/skills/mz-deploy/ (project).

Which AI agents can use mz-deploy?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is mz-deploy safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains mz-deploy?

It is published by materializeinc in materializeinc/agent-skills. It has 113 recorded installs.

More from materializeinc/agent-skills

View all →

materialize-docs

materializeinc/agent-skills

Materialize documentation for SQL syntax, data ingestion, concepts, and best practices. Use when users ask about Materialize queries, sources, sinks, views, or clusters.

Docs & Writing532 installs

mcp-developer-analysis

materializeinc/agent-skills

Analyze a Materialize environment via the MCP Developer endpoint, and/or configure an MCP client (Claude Code, Cursor, VS Code, Zed, Continue, Windsurf, Claude Desktop) to connect to the materialize-developer server. For analysis: check environment health, investigate performance, troubleshoot stale materialized views, diagnose memory pressure, audit resource utilization, run EXPLAIN ANALYZE on user objects, get optimization recommendations. For client connection: configure/connect/set-up an MCP client to materialize-developer (Emulator, Cloud, or self-managed), control which user/role is used, switch between identities. Trigger even if user just says "check my environment", "why is my MV stale", "why is my cluster slow", "what can I optimize", "explain analyze my materialized view", "how do I connect Claude Code to materialize-developer", or "configure Cursor for the Materialize MCP".

AI & Agents289 installs

materialize-dbt

materializeinc/agent-skills

Using the dbt-materialize adapter to manage Materialize streaming pipelines with dbt. Covers materializations (source, sourcetable, view, materializedview, sink, table, seed), profile configuration, index creation, blue/green deployments (deployinit, deploypromote, deploycleanup), cluster management, strict mode, and testing. Use this skill whenever the user asks about writing dbt models for Materialize, configuring dbt profiles for Materialize, running dbt against Materialize, blue/green or zero-downtime deployments with dbt, creating sources or sinks in dbt, troubleshooting dbt-materialize issues, or migrating existing dbt projects to Materialize. Also trigger when the user mentions dbt-materialize, materializedview materialization, deployinit, deploypromote, deployawait, strictmode, refreshinterval, retainhistory, or partitionby in a dbt context.

Data & Databases126 installs

materialize-terraform-self-managed

materializeinc/agent-skills

Terraform modules for deploying self-managed Materialize on AWS (EKS), Azure (AKS), and GCP (GKE). Covers networking, Kubernetes clusters, managed PostgreSQL, object storage, the Materialize operator, and Materialize instance configuration. Use this skill whenever the user asks about deploying self-managed Materialize with Terraform, setting up Materialize infrastructure on any cloud, configuring EKS/AKS/GKE for Materialize, troubleshooting a self-managed deployment, upgrading Materialize instances, customizing Terraform variables for Materialize, or working with the materialize-terraform-self-managed repository. Also trigger when the user mentions Karpenter node pools for Materialize, persist or metadata backend URLs, the Materialize operator Helm chart, CRD versions (v1alpha1 vs v1), rollout strategies, or NVMe swap configuration for Materialize nodes.

DevOps & Cloud118 installs

materialize-terraform-provider

materializeinc/agent-skills

Using the Materialize Terraform provider to manage Materialize resources declaratively. Covers clusters, sources (Kafka, Postgres, MySQL, SQL Server), sinks (Kafka, Iceberg), connections, materialized views, indexes, tables, roles, grants, secrets, network policies, and cloud-only resources (users, SSO, SCIM, app passwords). Use this skill whenever the user asks about writing Terraform for Materialize, creating or configuring Materialize resources with Terraform, importing existing Materialize objects into Terraform state, configuring the Materialize provider for Cloud or self-managed, setting up RBAC or grants via Terraform, creating connections or sources in Terraform, or troubleshooting Terraform plan/apply issues with Materialize resources. Also trigger when the user mentions materializecluster, materializesourcekafka, materializeconnectionpostgres, or any other materialize resource type.

DevOps & Cloud117 installs

mz-sql-navigation

materializeinc/agent-skills

Use when reading or editing .sql files in an mz-deploy project (a directory with project.toml) — resolve object references, columns, and types with the LSP tool instead of grepping. Covers go-to-definition, hover, and document/workspace symbols for Materialize SQL.

Data & Databases116 installs

Popular devops & cloud skills

View category →

microsoft-foundry

microsoft/azure-skills

Build, deploy, evaluate, optimize, fine-tune, and manage Microsoft Foundry agents, models, and resources end to end. USE FOR: foundry, azd ai agent, azd provision/deploy, hosted agent scaffold/develop/run/deploy/troubleshoot, prompt agent create, managed harness agent create, GitHub Copilot harness agent, create agent, update agent, add tool to agent, invoke agent, agent insights, evaluate agent, batch eval, continuous eval, continuous monitoring, agent CI/CD, optimize prompt, improve prompt, optimize agent instructions, Agent Optimizer scaffold, dataset curation from traces, deploy model, model fine-tuning (SFT/DPO/RFT), Foundry project, RBAC, role assignment, permissions, quota, capacity, region, deployment failure, AI Services, create Foundry resource, knowledge index, customize deployment, onboard, availability, training-data, grader, distillation, large file upload. DO NOT USE FOR: Azure Functions, App Service, general Azure deploy (use azure-deploy), general Azure prep (use azure

OfficialDevOps & Cloud579.1K installs

azure-diagnostics

microsoft/azure-skills

Debug Azure production issues on Azure using AppLens, Azure Monitor, resource health, and safe triage. WHEN: debug production issues, troubleshoot app service, app service high CPU, app service deployment failure, troubleshoot container apps, container app 503 or target port mismatch, troubleshoot functions, function telemetry missing or stopped after a config/connection-string change, troubleshoot AKS, VM RDP, Linux SSH, VM black screen, can't connect to VM, reset VM password, NSG or firewall blocking, kubectl cannot connect, kube-system/CoreDNS failures, pod pending, crashloop, node not ready, upgrade failures, analyze logs, KQL, insights, image pull failures, cold start issues, health probe failures, resource health, root cause of errors, troubleshoot event hubs, troubleshoot service bus, messaging SDK error, AMQP connection failure, message lock lost, lock renewal during long-running processing, service bus dead letter.

OfficialDevOps & Cloud569.8K installs

azure-prepare

microsoft/azure-skills

Prepare azd-based Azure projects for deployment: generates azure.yaml, infrastructure (Bicep/Terraform), and Dockerfiles for the Azure Developer CLI (azd) workflow. USE ONLY when the user explicitly wants to use azd as the deployment tool, or the project already has an azure.yaml file. DO NOT USE FOR: non-azd deployments, Python App Service code-only deploys (use python-appservice-deploy), or cross-cloud migration (use azure-cloud-migrate). WHEN: prepare app for azd, create azure.yaml, set up azd infrastructure, modernize app for Azure with azd, deploy with azd, function app, timer trigger, service bus trigger, event-driven function, managed identity, generate Bicep, generate Terraform, create and deploy to Azure.

OfficialDevOps & Cloud569K installs

azure-ai

microsoft/azure-skills

Use for Azure AI: Search, Speech, OpenAI, Document Intelligence. Helps with search, vector/hybrid search, speech-to-text, text-to-speech, transcription, OCR. WHEN: AI Search, query search, vector search, hybrid search, semantic search, speech-to-text, text-to-speech, transcribe, OCR, convert text to speech.

OfficialDevOps & Cloud568.8K installs

azure-deploy

microsoft/azure-skills

Execute Azure deployments for ALREADY-PREPARED applications that have existing .azure/deployment-plan.md and infrastructure files. DO NOT use this skill when the user asks to CREATE a new application — use azure-prepare instead. This skill runs azd up, azd deploy, terraform apply, and az deployment commands with built-in error recovery. Requires .azure/deployment-plan.md from azure-prepare and validated status from azure-validate. WHEN: "run azd up", "run azd deploy", "execute deployment", "push to production", "push to cloud", "go live", "ship it", "bicep deploy", "terraform apply", "publish to Azure", "launch on Azure". DO NOT USE WHEN: "create and deploy", "build and deploy", "create a new app", "set up infrastructure", "create and deploy to Azure using Terraform" — use azure-prepare for these.

OfficialDevOps & Cloud568.6K installs

azure-validate

microsoft/azure-skills

Pre-deployment validation for Azure readiness. Run deep checks on configuration, infrastructure (Bicep or Terraform), RBAC role assignments, managed identity permissions, and prerequisites before deploying. WHEN: validate my app, check deployment readiness, run preflight checks, verify configuration, check if ready to deploy, validate azure.yaml, validate Bicep, test before deploying, troubleshoot deployment errors, validate Azure Functions, validate function app, validate serverless deployment, verify RBAC roles, check role assignments, review managed identity permissions, what-if analysis, validate Container Apps deployment.

OfficialDevOps & Cloud568K installs