From devops
Auto-trigger skill that activates when any kustomization.yaml file is edited. Validates resource references, patch references, orphaned files, cross-environment consistency, build success, and generator configurations.
How this skill is triggered — by the user, by Claude, or both
Slash command
/devops:kustomize-resource-validationThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Automatically activates when any `kustomization.yaml` file is edited.
Automatically activates when any kustomization.yaml file is edited.
Trigger: Any file named kustomization.yaml inside a Kustomize module directory (any directory containing base/ and overlays/ structure) is created or edited.
Scope: This applies to both base and overlay kustomization.yaml files.
After the user edits a kustomization.yaml, perform these validations in order. Use the file system tools (Glob, Read) to verify references -- do not guess.
For every entry in the resources: list, verify the target exists:
../../base): Resolve the relative path from the kustomization.yaml location and confirm the directory exists and contains its own kustomization.yaml.gitlab-runner-secret.yaml): Confirm the file exists in the same directory as the kustomization.yaml.Report missing references as FAIL.
For every entry in the patches: list that uses a path: key, verify:
kustomization.yaml directory.apiVersion, kind, and metadata fields).Report missing or malformed patches as FAIL.
List all .yaml files in the same directory as the kustomization.yaml, then check whether each file is referenced as a resources entry or a patches path entry.
Exclude from orphan detection:
kustomization.yaml itselfenv/ subdirectory (used by secretGenerator)*.envReport unreferenced files as WARN with the message:
WARNING:
<filename>exists in<directory>/but is not referenced inkustomization.yaml. It may be orphaned.
This check only applies when the edited file is in an overlay directory (e.g., overlays/dev/kustomization.yaml).
Discover sibling environments by listing subdirectories under the overlays/ parent directory. Compare the resources: and patches: lists across all discovered sibling environments. Report differences as WARN -- not FAIL, since environment-specific resources are sometimes intentional.
Example warning format:
WARNING:
overlays/dev/kustomization.yamlincludes patchairflow-sa-patch.yamlwhich is absent fromoverlays/stg/andoverlays/prd/. Verify this is intentional.
Determine the Kustomize module from the file path (the nearest ancestor directory containing both base/ and overlays/).
kustomize build for that specific environment only.overlays/ and run kustomize build for each.kustomize build <module>/overlays/<env>
Report build failures as FAIL with the error output.
If secretGenerator or configMapGenerator entries exist in the edited file, verify:
envs file paths exist relative to the kustomization.yaml directory.files paths exist relative to the kustomization.yaml directory.namespace.generatorOptions.disableNameSuffixHash: true, check it is set. If missing, warn:WARNING:
generatorOptions.disableNameSuffixHashis not set totrue. Consider settingdisableNameSuffixHash: trueat the top level of kustomization.yaml to maintain consistent resource names.
Kustomize module conventions to detect:
namePrefix in overlays, verify namePrefix is set and matches the environment directory name (e.g., dev-, stg-, prd-).namePrefix, do not flag its absence.Always show the validation summary table, regardless of whether issues are found.
Kustomize Validation: <path/to/kustomization.yaml>
| # | Check | Status | Details |
|---|------------------------|--------|--------------------------------------|
| 1 | Resources | PASS | 5 resources, 0 missing |
| 2 | Patches | PASS | 3 patches, 0 missing |
| 3 | Orphaned Files | WARN | 1 orphaned: unused-config.yaml |
| 4 | Cross-Env Consistency | OK | Consistent across all environments |
| 5 | Build (<env>) | PASS | Build succeeded |
| 6 | Generators | PASS | 2 secretGenerators, all refs valid |
If there are errors or warnings, list them after the table:
Errors:
- [#1 Resources] File `missing-secret.yaml` not found in overlays/dev/
Warnings:
- [#3 Orphaned] `unused-config.yaml` is not referenced in kustomization.yaml
- [#4 Cross-Env] Patch `extra-patch.yaml` exists only in dev overlay
If all checks pass with no warnings, end with: "All checks passed. No issues found."
For each entry in the patches: list, verify that the patch targets a resource that actually exists in the build:
apiVersion, kind, and metadata.nameresources: list and extract their apiVersion, kind, and metadata.nameWARNING: Patch
<patch-file>targets<kind>/<name>but no matching resource found inresources:. The patch may apply to a resource from a base directory.
op field), verify the patch structure matches the target resource's structureop: add/remove/replace), verify the path exists in the target resourceThis check reduces the risk of patches silently doing nothing because their target was renamed or removed.
kustomize not installed: Skip Check 5 (build validation). Report as SKIP with install command: brew install kustomize. All other checks (1-4, 6) work with file reading only.kustomize build fails: Report the error output as FAIL in Check 5. Continue with Check 6.kustomize build times out (> 30s): Kill the process, report as FAIL with timeout message.resources: [https://...]): Skip existence check, note as INFO that remote resources can't be validated offline.helmCharts: section exists, note it as INFO — these are validated by Helm, not Kustomize.After all checks complete, write the full validation report to the repository's docs/reports/ directory.
docs/reports/kustomize-validation-<YYYY-MM-DD>.md
YYYY-MM-DD format.docs/reports/ if it does not exist (use mkdir -p).The written report must include:
git rev-parse --abbrev-ref HEAD), and trigger file path.# Kustomize Validation Report
**Repository:** <repo-root-directory-name>
**Date:** <YYYY-MM-DD>
**Branch:** <current-branch>
**Triggered by:** <path/to/kustomization.yaml>
This skill is read-only by default — validation doesn't modify files. All checks use Glob/Read to verify references. The only command that has side effects is kustomize build, which writes to stdout only. The Report Persistence step is the sole exception — it writes one Markdown file to docs/reports/.
No rollback needed — this skill only reads and reports. The only file written is the Markdown report under docs/reports/, which can be safely deleted.
npx claudepluginhub qwedsazxc78/devops-ai-skill --plugin devopsGuides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.