Change data inside an existing ConfigHub Unit, preferring a function over a hand-edit, and write it so it still works in every variant. Use for "update the image", "bump the replicas", "set the annotation", "apply defaults", a bulk edit, or "why did that change miss some variants?". Not for creating a Unit (kubernetes-resources).
Execution mode: follow references/execution-modes.md. This Skill grants no automatic tool permission. After an exact diff and scope preview, standalone use submits one requested Unit mutation to the host permission system; an external overlay may stop it before Bash.
The get / modify / write-back loop for ConfigHub Units.
Prefer a function over a hand-edit. Functions like set-container-image, set-replicas, set-env-var, the defaults family — hermetic, idempotent, comment-preserving, and produce clean revisions. Hand-editing YAML is the fallback when no function fits.
And write the invocation so it works somewhere else too. A mutation is rarely a one-off: it runs across whatever selection you give it, it propagates to every downstream variant, and — because an upgrade now replays the upstream's recorded invocations against each variant rather than copying the paths they touched — it will be re-run later against data that has changed since. See Write invocations that generalize.
--where / --where-data — usually inside a ChangeSet (see below).--protect), or working out why an earlier change missed some variants.confighub-core).cub-query).triggers-and-applygates).cub auth status succeeds — it contacts the server's /me endpoint to confirm the token is still valid (not just local login state). If it fails, ask the user to run cub auth login (an interactive browser sign-in an agent cannot complete).TriggerFilterID (or its Triggers are otherwise in place) so validation will enforce the change. If not, suggest triggers-and-applygates — but don't block.Does a purpose-built function do this (set-container-image, set-replicas, defaults family, …)?
│
┌────┴────┐
yes no
│ │
▼ ▼
cub function set <fn> Is this a small, surgical path edit (1–3 fields)?
│
┌────┴────┐
yes no
│ │
▼ ▼
cub function set set-bool-path / set-int-path / set-string-path / set-cel
│
no again
▼
cub function set -- set-yq '<yq expression>' (catch-all; still via a function)
│
genuinely needs a whole-unit rewrite
▼
cub unit data … → edit locally → cub unit update
│
▼
Restoring history instead? cub unit update --restore <revision-or-tag>set-yq is the escape-hatch mutator: full yq expression power, still invoked via cub function set, still records a proper revision with your --change-desc. Its non-mutating counterpart get-yq is in cub-query's territory (reading a value out). Don't confuse the two.
An invocation that only works against the data in front of you fails silently in the variants where it does not match: most functions do not error when they find nothing to operate on, deliberately, because that is what lets one invocation run across a bulk selection. So the failure mode is a variant that quietly did not change, not an error message.
The most common reason an invocation stops working elsewhere is a hardcoded index.
# Fragile — whichever container happens to be first in this unit.
cub function set --space prod --unit backend \
-- set-string-path apps/v1/Deployment "spec.template.spec.containers.0.image" ghcr.io/acme/api:v2
# Portable — the container named "api", wherever it appears.
cub function set --space prod --unit backend \
-- set-container-image api ghcr.io/acme/api:v2containers.0 selects position 0. A variant that adds a sidecar, or orders its containers differently, has a different container there — and writing to it succeeds, because position 0 exists. Nothing fails; the wrong container is modified. Selecting by name is stable under both reordering and insertion, because ConfigHub matches the element rather than counting to it.
Three forms of the same rule:
set-container-image, set-env-var, set-container-resources — over a generic path setter. They already select their target by merge key.spec.template.spec.containers.?name=api.image selects the container named api.The same rule applies to expressions written in CEL, yq, and Starlark.
ConfigHub matches array elements by merge key (the container name, the volume name), like Kubernetes strategic merge patch and kustomize. A name identifies the element, so changing it makes it a different element as far as the merge engine and every stored invocation are concerned.
Rename a container from web to frontend in a downstream variant and every stored invocation naming web stops reaching that variant — without failing. Merge-key changes also break patches across variants. If a variant genuinely needs a differently-purposed container, add one and remove the old one: that states it directly. When a rename is unavoidable, treat it as a breaking change for that variant and update the invocations that name the old value.
Variants contain more or fewer resources, containers, ports, and volumes.
* wildcard, or a function that searches by value such as set-image-reference-by-uri.--where-resource, or with an expression in CEL/yq/Starlark, so the invocation doesn't touch paths it shouldn't.Where a template would express variation with conditional logic or per-environment values files — implicit reasons, buried in a directory layout — make the high-level characteristic explicit: put highly-available, pci-compliant, and the like on the Space or the resource as a label/annotation, then target invocations with a Unit or resource filter over it.
--dry-run takes the same selection bulk execution does, so an invocation can be checked against every variant before it becomes history:
cub function set --space "*" --where "Slug = 'deployment'" --dry-run -o mutations \
-- set-container-image web ghcr.io/acme/app:v2Two things in that output are worth reading:
Either is cheap to fix while the change is still a proposal.
The other half of a change reaching the right variants is a change not overwriting what a variant set deliberately. ConfigHub records protection per path, and a merge does not overwrite a protected one.
--protect on the change that sets it, or mark the path afterwards with cub unit set-protection --protect.--protect off, so the path stays open to the next upgrade.cub unit conflicts lists what was withheld and can apply the ones you want.See references/cub-cli.md → "Protection and merge conflicts".
Before an invocation becomes part of the history:
--space "*", and were the variants reporting no mutation accounted for?--protect — and if it is automation applying a value decided elsewhere, does it leave the flag off?Ask only what you need to compose the mutation:
--where filter, or a --where-data filter.)--space "*" for fleet-wide.)Keep answers in the shared transcript and reduce them to a short safe
model-authored --change-desc summary; never interpolate them verbatim.
Consult references/functions-catalog.md. Examples:
| Change | Function |
|---|---|
| Container image | set-container-image <container> <image> |
| Image tag only | set-container-image-reference <container> <ref> |
| Replicas | set-replicas <replicas> |
| Env var | set-env-var <container> <var> <value> / set-env <container> key=value |
| Resource requests/limits | set-container-resources |
| Probe | set-container-probe-defaults (defaults) or set-starlark (surgical) |
| Annotation / label | set-annotation / set-label |
| Generic path | set-string-path / set-int-path / set-bool-path / set-starlark |
Deprecated — don't reach for: set-image, set-image-reference, set-image-uri, cel-validate, no-placeholders, is-approved.
--space <space> --unit <slug> (bulk-only commands like cub function set / cub run accept --unit as a shortcut for --where "Slug = '<slug>'"; also takes a comma list or UUID).--space <space> --where "Labels.Environment = 'prod'".--space "*" --where ….--where-data "spec.replicas > 5".Use a short model-authored summary that satisfies the strict safe-character
rule in references/execution-modes.md. Never interpolate the verbatim user
prompt or clarification text into a shell command. Keep fuller context in the
shared transcript and result receipt.
For bulk cub run / cub function set across many Units: phrase the summary so it reads sensibly at the per-unit granularity (the same description is recorded in every affected Unit's head revision).
cub function set \
--space <space> \
--unit <slug> \
--change-desc 'Apply reviewed configuration update' \
-o mutations \
-- \
<function-name> [function args]Add --protect only when this value is the variant's own decision, to be held against the next upgrade from upstream. Leave it off when the change is propagating a value chosen elsewhere — a release rollout, a replayed change — because a change that protected everything it wrote would turn upstream content into local overrides and block every later merge. Neither choice is reversible by accident: a change never removes protection, cub unit set-protection --unprotect does.
-o mutations makes execution return the resulting diff. Include it in the exact command, but do not claim anything landed until the host permits the call, it succeeds, and a fresh revision read verifies it.
Pre-read race. The last source-reviewed v0.2.11 Unit update path could compare caller-supplied head and content fields transactionally. That older finding is not projected onto the installed v0.2.21 server. Current stock restore/function/run/update convenience commands do not expose proof that the values inspected during review were carried into execution. Re-read immediately before the one standalone mutation call, disclose the race, and do not claim exact reviewed-state binding.
--dry-run will return what the modified data would look like, but without persisting the change. It can be used with -o mutations.
For a multi-Unit request, include --wait so the command result includes
completion evidence.
Only when no function composition does the job. This is an explicitly coached local-file flow because it requires the user to edit a file. Do not combine the read, edit, and update in one Bash call. Tell the user that nothing has run, then give these as separate terminal steps:
cub unit get <slug> --space <space> -o yamlThe user saves and reviews that output in a literal file. Only after they name the exact file does the later terminal step become:
cub unit update --space <space> <slug> <reviewed-file> \
--change-desc 'Apply reviewed Unit file update'cub unit update also supports -o mutations, --dry-run, and --wait.
cub unit update --space <space> <slug> --restore <rev-num-or-tag> \
--change-desc 'Restore Unit to reviewed prior revision'Valid --restore targets: a number (absolute or negative-relative), LiveRevisionNum, LastAppliedRevisionNum, Tag:<tag>, ChangeSet:<name>, Before:ChangeSet:<name> (pre-open state), a revision UUID.
An Invocation is a saved function call (function name + arguments). For a requested mutation, use a mutating Invocation with:
cub invocation invoke set <slug> \
--space <space> --unit <slug-or-where> \
--change-desc 'Run reviewed saved invocation' \
-o mutations \
--param <name>=<value> # repeat per declared parametercub invocation invoke is verb-scoped like cub function get/set/vet: set runs only mutating Invocations, get only non-mutating, vet only validating — so the verb both picks the right Invocation kind and scopes agent permissions to the operation class. For mutations, always use set. It reuses the same flags as cub function set (--space, --where/--unit/--filter, --changeset, --dry-run, -o mutations, --change-desc).
cub invocation invoke set <slug> with no --param, or cub function set --invocation <slug>.--param name=value. Values are validated (required present, no unknown names) and coerced to the declared type. A parameterized Invocation cannot be referenced by a Trigger (no caller to supply values).Author a parameterized Invocation with cub invocation create, declaring parameters with --parameter name[:datatype[:required]] and referencing them from templated argument values via {{ .Params.<name> }}:
cub invocation create --space <space> scale Kubernetes/YAML \
--parameter replicas:int:true \
-- set-int-path apps/v1/Deployment spec.replicas 'template:{{ .Params.replicas }}'Prefer a saved Invocation when the same parameterized change is run repeatedly or must be a single reviewed, permissionable operation; otherwise compose the function call inline with cub function set (step 5 above).
Any time a logical change touches more than one Unit (a release, a defaults rollout, a cross-Space upgrade, a coordinated secret rotation), wrap it in a ChangeSet. Reasons:
--restore Before:ChangeSet:<name> against the Filter rewinds every affected Unit to its pre-open state.non-head-unit-approval in the
no-loss inventory, not reproduced as a guaranteed current semantic here.
Installed v0.2.15 help advertises the selector, while exact v0.2.21 server
acceptance and atomic preconditions are not source-reviewed. Confirm help,
inspect the result, and do not claim exact reviewed-artifact binding. A
ChangeSet also does not select or narrow a Space Release.--restore Before:ChangeSet:<slug> is it. See promote-release.Lifecycle:
# 1. Create the ChangeSet (lives in one home Space; Units can be anywhere).
cub changeset create --space <home-space> <slug> \
--description 'Prepare reviewed release scope'
# 2. Open: bulk-patch target Units into the ChangeSet via a saved Filter.
cub unit update --patch --space <target-space> \
--filter <home-space>/<filter-slug> \
--changeset <home-space>/<slug> \
--change-desc 'Start reviewed ChangeSet rollout'
# 3. Mutate: every function set / unit update / run must pass --changeset.
cub function set --space <target-space> \
--filter <home-space>/<filter-slug> \
--changeset <home-space>/<slug> \
--change-desc 'Apply reviewed ChangeSet update' \
-o mutations \
-- set-container-image <container> <image>:<tag>
# 4. Close with the "-" sentinel (empty string does not clear).
cub unit update --patch --space <target-space> \
--filter <home-space>/<filter-slug> \
--changeset -
# 5. Hand fresh state to release-publish. It computes the complete EffectiveReleaseSet.
# Each numbered write is a separate host-permission call, verified before the next.Don't use a ChangeSet for single-Unit edits (overhead without payoff) or for rolling per-Unit releases that need different approvals per Unit. See references/changesets.md for rollback via Before:ChangeSet:<...>, the merge / rebase pattern around a restored ChangeSet, and listing revisions by ChangeSet membership.
Use a named Filter (cub filter create --space <home-space> <slug> Unit --where-field "…") over inlined --where so the same selection flows through open / mutate / close and the reviewed release proposal. See references/filters-and-queries.md.
The release-publish skill maps apply/deploy intent to the exact current Space Release contract.
--change-desc on configuration-data mutations. Native approval is head-at-execution and the stock mutation convenience paths have the pre-read race above, so do not make stronger exact-artifact claims.kubectl apply/edit/patch/delete, controller mutation, or wholesale out-of-band replacement when a function-composed path exists. An external governance overlay may impose additional restrictions.cub function list for Kubernetes/YAML (wrong name — re-check via cub function list / cub function explain).--space "*" and the user hasn't confirmed the blast radius.triggers-and-applygates), and fix the data — do not bypass.cub unit get <slug> --space <space> — confirm the field now reflects the intended value.cub revision list <slug> --space <space> — new revision present, --change-desc matches what you composed.cub function vet --space <space> --unit <slug> vet-schemas, vet-placeholders, vet-format, vet-merge-keys (or rely on Triggers) — validation passes.cub space open <space> --print-url — Space review.cub unit open <slug> --space <space> --revisions --print-url — Unit history and --change-desc.references/functions-catalog.md — the canonical function index.references/cub-cli.md — agent-mode help and flag discipline.references/changesets.md — full ChangeSet lifecycle, rollback, merge / rebase.references/cub-cli.md → "Protection and merge conflicts" — --protect, cub unit set-protection, cub unit conflicts.references/filters-and-queries.md — named Filters (use these with ChangeSets).references/yaml-patterns.md — for hand-edit fallback.ba61249
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.