/cub-scout:migrate-from-kubectlfrom cub-scout
Audits a legacy Kubernetes cluster for manual edits, maps orphaned resources, and classifies risk to plan a GitOps migration (Argo/Flux/ConfigHub). Read-only discovery and planning.
Ships in cub-scout. 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.
The legacy-cluster migration loop. A cluster has accumulated kubectl apply -f over years; the team wants to adopt GitOps (Argo / Flux / ConfigHub). Step 1 of that migration is finding what's been hand-touched and deciding per-resource: revert, port to git, or accept as canonical.
This skill composes the attribution layer (cause: manual-edit), map orphans, scan, and snapshot / import --git-path preview once a repo skeleton exists. Read-only throughout — the actual migration is user-driven.
Explicit phrasings:
kubectl-* has touched"Implicit intents:
triage-unhealthy-workloadwhy is THIS one different?) — investigate-driftaudit-fleet-conformanceprepare-for-confighub (closely related; that skill assumes the repo exists; this one assumes it doesn't yet)OwnerType=unknown?managedFields for the last writer. If a kubectl-* writer wrote it, this is a manual-edit candidate.scan produces severity-ranked findings. Use it to prioritize: high-severity / production-namespace resources first.manual-edit resource, decide: revert (let a future controller reconcile), port to git (commit current state + plan controller adoption), or accept as canonical (and then port).snapshot → GSF JSON). If you have already created a git layout, use import --git-path --dry-run --json to preview what ConfigHub would infer from it.receipt verify <kind>/<name> --since <migration-start-time> per resource — captures the pre-migration baseline as fingerprinted evidence. Useful when the migration is contested ("did we really revert that?").$ cub-scout map --format json | jq 'group_by(.ownership.type) | map({type: .[0].ownership.type, count: length})'
[
{"type": "argo", "count": 12},
{"type": "flux", "count": 5},
{"type": "helm", "count": 8},
{"type": "k8s", "count": 47}, # native chains (ReplicaSets etc.) — fine
{"type": "unknown", "count": 23} # ← the migration backlog
]
The 23 OwnerType=unknown resources are the candidates. Some are ad-hoc applies that should adopt GitOps; some might be orphans whose original owner is gone.
For each unknown-owned resource, read the last writer:
$ for r in $(cub-scout map --format json | jq -r '.[] | select(.ownership.type == "unknown") | "\(.kind)/\(.name)|\(.namespace)"'); do
kind=$(echo "$r" | cut -d/ -f1); rest=${r#*/}; name=${rest%|*}; ns=${rest#*|}
last=$(kubectl get "$kind" "$name" -n "$ns" -o jsonpath='{.metadata.managedFields[-1:].manager}')
echo "$kind/$name in $ns ← $last"
done
Group by writer:
| Writer | Population | Plan |
|---|---|---|
kubectl-edit | High-touch operator resources | High-risk migration; investigate per-resource |
kubectl-apply / kubectl-client-side-apply | Bulk applies | Likely the legacy kubectl apply -f *.yaml pattern; group by similar paths |
kubectl-patch / kubectl-create / kubectl-replace | Ad-hoc surgery | Audit; many of these are emergency fixes that should be in git |
kubectl-last-applied | CSA migration artifacts | Usually safe to ignore; the resource has the last-applied-configuration annotation |
| Anything else (custom Helm wrappers, in-house controllers) | Unknown | File an issue with the writer string; cub-scout's verified enumeration may not include it yet |
cub-scout explain <kind>/<name> -n <ns> gives the same writer info in human form per resource.
$ cub-scout scan --format json | jq '.findings | sort_by(.severity) | reverse | .[:10]'
scan returns risk findings: severity (error / warning / info), the rule that triggered, and the resource. Use it to prioritize the migration backlog:
severity=error + production namespace → migrate FIRSTseverity=warning + multi-replica deployment → nextseverity=info or single-pod jobs → deferscan complements the writer-classification: a kubectl-apply to a production deployment is much higher priority than the same writer on a one-off CronJob.
For each high-priority resource:
| Decision | When to pick it | Migration step (user-driven) |
|---|---|---|
| Revert | The manual edit was wrong (emergency hack, mistaken) | Find the original spec (git history? snapshot?). kubectl rollout undo or kubectl apply -f original.yaml. Eventually adopt GitOps. |
| Port to git | The manual edit is correct AND should be reproducible | kubectl get <kind>/<name> -o yaml > apps/.../resource.yaml; commit; eventually adopt Argo/Flux/ConfigHub for this directory. |
| Accept as canonical | The manual edit IS the source of truth; nothing in git matches | Snapshot the resource (kubectl get or cub-scout snapshot); commit the snapshot; treat the file as authoritative going forward. |
cub-scout doesn't pick. The user does — but cub-scout's evidence makes the decision well-informed (you know exactly which fields were edited, which writer touched them, and whether a controller would have set them differently).
For workloads adopting Argo / Flux / ConfigHub:
# Snapshot the current state as a starting point
$ cub-scout snapshot -n payments --format gsf > snapshot-payments.json
# Or, if you already have a repo skeleton, preview what ConfigHub would propose
$ cub-scout import --git-path ./proposed-repo --dry-run --json > proposed-units.json
See prepare-for-confighub for the import-preview flow once you have the repo skeleton.
$ MIGRATION_START="2026-05-22T00:00:00Z"
$ for r in $(cub-scout map --format json | jq -r '.[] | select(.ownership.type == "unknown") | "\(.kind)/\(.name) -n \(.namespace)"'); do
cub-scout receipt verify $r --since $MIGRATION_START --save
done
$ cub-scout receipt list --format json > migration-baseline.json
Each receipt captures "no kubectl-* writer touched this resource after $MIGRATION_START" — a verifiable baseline. If a stakeholder later disputes the migration (we agreed not to touch X), the receipts are the evidence.
See scout-verify for the receipt surface.
A team has a small payments namespace with 8 deployments, no GitOps. They want to adopt Argo CD.
$ cub-scout map -n payments --format json | jq '[.[] | {kind, name, owner: .ownership.type}]'
[
{"kind": "Deployment", "name": "api", "owner": "unknown"},
{"kind": "Deployment", "name": "worker", "owner": "unknown"},
{"kind": "Deployment", "name": "scheduler", "owner": "unknown"},
... (8 total) ...
]
$ for d in api worker scheduler; do
cub-scout explain deploy/$d -n payments --presentation ai | grep -E "(Owner|Last writer|Mutation cause)"
done
Owner: Unknown (no GitOps labels, no ownerReferences)
Last writer: kubectl (manager: kubectl-client-side-apply)
Mutation cause: manual-edit
Owner: Unknown (...)
Last writer: kubectl-edit
Mutation cause: manual-edit
Owner: Unknown (...)
Last writer: kubectl-patch
Mutation cause: manual-edit
$ cub-scout scan -n payments --format json | jq '.findings[] | select(.severity == "error")'
{"resource": "Deployment/api", "rule": "no-resource-requests", "severity": "error"}
# Migration plan emerges:
# - api: revert the manual patches (probably emergency tuning), then commit a clean version to git
# - worker: port to git as-is (the manual edits look intentional)
# - scheduler: accept as canonical, document the policy exception
# Scaffold the proposed repo:
$ mkdir -p apps/prod/payments
$ for d in api worker scheduler; do
kubectl get deploy/$d -n payments -o yaml > apps/prod/payments/$d.yaml
done
# Capture baseline receipts:
$ MIGRATION_START="2026-05-22T00:00:00Z"
$ for d in api worker scheduler; do
cub-scout receipt verify deploy/$d -n payments --since $MIGRATION_START --save
done
The user now has: a snapshot of current state in ./apps/prod/payments/, a per-resource migration decision, and 3 baseline receipts confirming the pre-migration state. The actual revert / commit / Argo Application creation is user-driven from here.
--git-path= would clear the path and turn it into a real import); receipt verify (specifically no-manual-edits-since for baselines); kubectl get / describe / managedFields reads.kubectl apply/edit/patch/delete (the actual port / revert is user-driven); cub-scout import apply; argocd app create (creating the Argo Application is user-driven); cub mutations. The migration itself is mutation; this skill stops at evidence + scaffolding.scout-observe — map / scan / snapshotscout-attribute — cause field readingscout-verify — baseline receiptsprepare-for-confighub — once you have the repo skeletonobserve-native — the OwnerType=unknown populationreferences/verified-manager-strings.md — writer enumerationmap orphans is the verb for stale-label orphans (different from OwnerType=unknown); see scout-observecause=unknown (no kubectl-* writer, but no controller signal either) is a separate category from manual-edit. The migration plan for unknown resources is "investigate why no managedFields signal" — typically an admission webhook stripped them.import --git-path produces low-confidence proposals; the rendering reconstruction is out of scope. Plan for additional manual review of the proposal in those cases.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Generated from the plugin's indexed repository (confighub/cub-scout) — no native marketplace selected
npx claudepluginhub p/confighub-cub-scout35 skills in this plugin
/ai-agent-readonly-contextUse when the user is WIRING CUB-SCOUT INTO AN AI AGENT (Claude / Codex / a custom LLM workflow) and needs the patterns for read-only context, MCP gateway tools, deterministic context snapshots, and the prompt-shape that makes cub-scout's output reliable for LLMs. Natural phrasing: "set up cub-scout as a Claude tool", "expose cub-scout to my agent over MCP", "give the LLM a deterministic snapshot of this cluster", "what cub-scout patterns work well for AI agents?", "MCP config for cub-scout in Claude Code", "best practices for wiring cub-scout into Codex / Cursor / Continue", "AI-ready cluster context", "prompt template for cub-scout output". Composes `mcp serve` + `context-pack` + `--presentation ai` + the structured JSON contracts. Do NOT load for: a specific verb invocation (load the corresponding scout-* skill), authoring an MCP server in general (this is about wiring CUB-SCOUT specifically), or any mutating workflow (cub-scout never mutates; the read-only triad is the whole point of this skill)./audit-fleet-conformanceUse when the user wants to verify CONFORMANCE ACROSS A FLEET — multiple namespaces, multiple clusters, or a defined View scope. Natural phrasing: "which clusters are conformant?", "audit fleet conformance against this View", "show me all outliers in prod fleet", "compare every service against its source-truth strategy", "scope-wide three-way check for drift", "fleet-level compliance audit", "which deployments drift across the cluster?". Composes `compare three-way --view` + `compare source-truth` + `fleet outliers` for multi-resource / multi-cluster checks. Requires connected mode for the View + ConfigHub surfaces. Do NOT load for: a single resource (use investigate-drift), a triage (use triage-unhealthy-workload), incident evidence for one event (use operator-incident-evidence), or anything mutating./confighub-source-truthUse when the user wants a STRATEGY-TYPED, PILOT-ACCEPTANCE-SHAPED VERDICT about whether ConfigHub / controller / runtime agree under a declared delivery strategy — the `compare source-truth` workflow with the explicit `--strategy <name>` requirement. Natural phrasing: "give me a source-truth verdict for deploy/api", "verify under git-argo strategy that ConfigHub matches the cluster", "run the source-truth contract for upstream Pilot acceptance", "compare source-truth confighub-oci-flux strategy across the namespace", "produce strategy-relative correctness evidence", "show me where the strategy declaration is being violated". Composes `compare source-truth --strategy <s>` + the source-truth evidence contract + (optionally) `receipt verify --strategy <s>` for a fingerprinted version. Requires CONNECTED MODE. Do NOT load for: a single-resource live drift question without a declared strategy (use investigate-drift), a triage (use triage-unhealthy-workload), or a fleet-wide audit that doesn't need strategy framing (use audit-fleet-conformance). cub-scout NEVER infers a strategy — this skill enforces that boundary./cub-scoutUse when working in the cub-scout repo or when answering capability-assistant questions ("can cub-scout do X?", "should I use cub-scout or kubectl here?", "how does cub-scout differ from cub?"). This is the umbrella router — it points you at the verb-grouped scenario skills under `skills/scout-*/` and the workflow / observer / reference skills planned for batches 2–5. For a specific verb-group task (observe / diagnose / compare / attribute / adopt existing config / govern / integrate / verify) load the corresponding `scout-*` skill directly./investigate-driftUse when the user wants to compare live and desired state and inspect available manager and source evidence. Natural phrasing: "why is this Deployment different from the git manifest?", "which recognized manager is recorded for this path?", "controller-drift or interactive-manager evidence?", "compare three-way + attribution for deploy/api". Composes `compare three-way` + `compare drift` + the attribution layer (`cause` / `managerHint` / `gitSource` / `bindingSource`). Do NOT promise who changed the value or which manager wrote last: path-level manager evidence is not time-ordered, and resource-level `explain` evidence is not field-specific. Do NOT load for: a triage where the workload won't start (use triage-unhealthy-workload), pure inventory (use scout-observe), generating a fingerprinted evidence artifact (use scout-verify and the no-manual-edits-since predicate), or any mutating fix (cub-scout never mutates)./observe-argocdUse when the user wants to observe ARGO CD-managed resources specifically — the controller-specific observer skill for Argo. Natural phrasing: "is this resource managed by Argo CD?", "show me Argo applications in this cluster", "trace this Argo-owned deployment back to source", "which ApplicationSet generated this app?", "did Argo apply the latest commit?", "explain the Argo CSA migration default", "what tracking-id annotation does Argo write?". Load whenever intent involves Argo CD specifically — Applications, ApplicationSets, sync status, tracking-id annotation, the kubectl-client-side-apply migration default, or Argo-as-deliverer-for-ConfigHub. Do NOT load for: generic ownership detection (use scout-observe), comparing live state to git (use scout-compare), the ConfigHub authoring side (use cub skills), or general Argo CRD authoring (Argo is a separate tool — this skill is about *observing* Argo-managed resources, not configuring Argo itself).Other plugins' skills for the same job