npx skills add ...
npx skills add akin-ozer/cc-devops-skills --skill helm-validator
Validate, lint, audit, check Helm charts — Chart.yaml, templates, values.yaml, CRDs, schemas.
npx skills add akin-ozer/cc-devops-skills --skill helm-validator
This skill provides a comprehensive validation and analysis workflow for Helm charts, combining Helm-native linting, template rendering, YAML validation, schema validation, CRD documentation lookup, and security best practices checking.
IMPORTANT: This validator is read-only by default. It analyzes charts and proposes improvements. Only modify files when the user explicitly asks to apply fixes.
Use this skill when one or more of these top cases apply:
Trigger phrase examples:
helm template fail?"Out of scope by default:
helm-generator)Run Mode A plus Stage 8 dry-run commands in this document.
Follow this sequential validation workflow. Each stage catches different types of issues:
Before starting validation, verify required tools are installed:
Required tools:
Fallback policy for unavailable tools or environment constraints:
| Condition | Action | Stage status |
|---|---|---|
helm missing | Run Stage 2 only, then report Stages 3 to 9 as skipped/blocked | ⚠️ Warning |
yamllint missing | Use yq syntax checks if available; otherwise skip Stage 5 | ⚠️ Warning |
kubeconform missing | Skip Stage 7 and rely on Stage 6 CRD/manual checks | ⚠️ Warning |
kubectl missing or no kube-context | Skip Stage 8, continue with remaining stages | ⚠️ Warning |
| No internet access for CRD docs | Use local CRD manifests and kubeconform output, mark doc lookup incomplete | ⚠️ Warning |
If tools are missing, provide installation instructions from scripts/setup_tools.sh output and continue with the fallback path above.
Verify the chart follows the standard Helm directory structure:
Expected structure:
Common issues caught:
Run Helm's built-in linter to catch chart-specific issues:
Optional flags:
--values <values-file>: Test with specific values--set key=value: Override specific values--debug: Show detailed error informationCommon issues caught:
Auto-fix approach:
helm lint after fixes are appliedRender templates locally to verify they produce valid YAML:
Options to consider:
--values values.yaml: Use specific values file--set key=value: Override individual values--show-only templates/deployment.yaml: Render specific template--validate: Validate against Kubernetes OpenAPI schema--include-crds: Include CRDs in rendered output--is-upgrade: Simulate upgrade scenario--kube-version 1.28.0: Target specific Kubernetes versionCommon issues caught:
For template errors:
Validate YAML syntax and formatting of rendered templates:
Common issues caught:
Auto-fix approach:
Before schema validation, detect if the chart contains or renders Custom Resource Definitions:
The script outputs JSON with resource information:
For each detected CRD:
Try context7 MCP first (preferred):
Fallback to web.search_query (web search) if Context7 fails:
Extract key information:
specWhy this matters: CRDs have custom schemas not available in standard Kubernetes validation tools. Understanding the CRD's spec requirements prevents validation errors and ensures correct resource configuration.
Validate rendered templates against Kubernetes schemas:
Options to consider:
-strict to reject unknown fields (recommended for production)-ignore-missing-schemas if working with custom/internal CRDs-kubernetes-version 1.28.0 to validate against specific K8s version-output json for programmatic processingCommon issues caught:
For CRDs: If kubeconform reports "no schema found", this is expected. Use the documentation from Stage 6 to manually validate the spec fields.
Stage 7 success criteria (explicit):
kubeconform exits 0, and no invalid resources are reported.If kubectl is configured and cluster access is available, perform a server-side dry-run:
If the Helm version does not support --dry-run=server, use --dry-run and document that only client-side Helm simulation was executed.
This catches:
If dry-run is not possible:
kubectl apply --dry-run=server -f ./rendered/For updates to existing releases:
This shows what would change, helping catch unintended modifications. (Requires helm-diff plugin)
Stage 8 success criteria (explicit):
0 with no admission/policy errors.kubectl/cluster context/access is unavailable, or only client-side fallback was possible.IMPORTANT: This stage is MANDATORY. Analyze rendered templates for security best practices compliance.
Check rendered Deployment/Pod templates for:
Missing securityContext - Look for pods/containers without security settings:
Missing container securityContext - Each container should have:
Missing resource limits/requests - Check for:
Image tag issues - Flag if using :latest or no tag
Missing probes - Check for liveness/readiness probes
How to check: Read the rendered deployment YAML files and grep for these patterns:
IMPORTANT: This stage is MANDATORY even if all validations pass. You MUST complete ALL of the following actions.
Default behavior is read-only. Do not modify files unless the user explicitly asks you to apply fixes.
If ANY warnings, errors, or security issues were found, you MUST read:
Use these references to provide context and recommendations for each issue found.
Always present a validation summary formatted as a table showing:
Example:
Group findings by severity:
❌ Errors (must fix):
⚠️ Warnings (should fix):
:latest image tagℹ️ Info (recommendations):
For each issue, provide a proposed fix with:
Example format:
Proposed:
File: .helmignore (new file) Severity: ⚠️ Warning Reason: Excludes unnecessary files from chart packaging
Proposed: Copy from assets/.helmignore
Chart: Status: ⚠️ Warnings Found (or ✅ Ready for Deployment)
Issues Found:
Proposed Changes: N changes recommended
Next Steps:
When to create helpers:
Reference and use these Helm template functions for robust charts:
required - Enforce required values:default - Provide fallback values:quote - Safely quote string values:include - Use helpers with pipeline:tpl - Render strings as templates:toYaml - Convert objects to YAML:fromYaml - Parse YAML strings:merge - Merge maps:lookup - Query cluster resources (use carefully):Prefer flat structures when possible:
Always provide defaults in values.yaml:
Document all values:
Use Helm template comments for documentation:
Use YAML comments for user-facing notes:
Use - to chomp whitespace in template directives:
Good formatting:
Bad formatting:
When analyzing charts, identify opportunities for helper functions:
Identify repetition:
Common helper patterns to recommend:
.name).fullname).chart).labels).selectorLabels).serviceAccountName)When to recommend helpers:
_helpers.tpl fileFor detailed Helm and Kubernetes best practices, load the references:
These references include:
When to load: When validation reveals issues that need context, when implementing new features, or when the user asks about best practices.
When a chart has dependencies (in Chart.yaml or charts/ directory):
Validate dependencies:
Override dependency values:
scripts/setup_tools.sh to check availability--debug flag for detailed error messagesSymptom: Helm reports "Chart.yaml file is missing" even though the file exists and is readable.
Cause: On macOS, files created programmatically (via Write tool, scripts, or certain editors) may have extended attributes (e.g., com.apple.provenance, com.apple.quarantine) that interfere with Helm's file detection.
Diagnosis:
Solutions:
Remove extended attributes:
Create files using shell commands instead:
Copy from helm-created chart:
Prevention: When creating new chart files on macOS, prefer using helm create as a base or use shell heredocs (cat > file << 'EOF') rather than direct file creation tools.
When presenting validation results and fixes:
Always consider Kubernetes and Helm version compatibility:
kubectl api-versions to list available API versionskubeVersion constraint in Chart.yaml if neededFor comprehensive testing, use Helm test resources:
During Stage 10 (Final Report), list all detected automation opportunities in the summary.
Do NOT ask user questions or modify files. Simply list recommendations.
Automation opportunities to detect and list:
| Missing Item | Recommendation |
|---|---|
_helpers.tpl | Run: bash scripts/generate_helpers.sh <chart> |
.helmignore | Copy from: assets/.helmignore |
values.schema.json | Copy and customize from: assets/values.schema.json |
NOTES.txt | Create post-install notes template |
README.md | Create chart documentation |
| Repeated patterns | Extract to helper functions |
Security recommendations to include when issues found:
| Issue | Recommendation |
|---|---|
| Missing pod securityContext | Add runAsNonRoot: true, runAsUser: 1000, fsGroup: 2000 |
| Missing container securityContext | Add allowPrivilegeEscalation: false, readOnlyRootFilesystem: true, capabilities.drop: [ALL] |
| Missing resource limits | Add CPU/memory limits and requests |
Using :latest tag | Pin to specific image version |
| Missing probes | Add liveness and readiness probes |
Template improvement recommendations:
| Issue | Recommendation |
|---|---|
Using template instead of include | Replace with include for pipeline support |
Missing nindent | Add nindent for proper YAML indentation |
| No default values | Add default function for optional values |
Missing required function | Add required for critical values |
setup_tools.sh
bash scripts/setup_tools.shvalidate_chart_structure.sh
bash scripts/validate_chart_structure.sh <chart-directory>detect_crd_wrapper.sh
bash scripts/detect_crd_wrapper.sh <file.yaml> [file2.yaml ...]detect_crd.py
python3 scripts/detect_crd.py <file.yaml> [file2.yaml ...]generate_helpers.sh
bash scripts/generate_helpers.sh <chart-directory>helm_best_practices.md
k8s_best_practices.md
template_functions.md
.helmignore
.yamllint
yamllint -c assets/.yamllint <file.yaml>values.schema.json
bash scripts/setup_tools.shbash scripts/validate_chart_structure.sh <chart-directory>mychart/
Chart.yaml # Chart metadata (required)
values.yaml # Default values (required)
values.schema.json # JSON Schema for values validation (optional)
templates/ # Template directory (required)
_helpers.tpl # Template helpers (recommended)
NOTES.txt # Post-install notes (recommended)
*.yaml # Kubernetes manifest templates
charts/ # Chart dependencies (optional)
crds/ # Custom Resource Definitions (optional)
.helmignore # Files to ignore during packaging (optional)helm lint <chart-directory> --stricthelm template <release-name> <chart-directory> \
--values <values-file> \
--debug \
--output-dir ./renderedfind ./rendered -type f \( -name "*.yaml" -o -name "*.yml" \) \
-exec yamllint -c assets/.yamllint {} +# Check crds/ directory
if [ -d <chart-directory>/crds ]; then
find <chart-directory>/crds -type f \( -name "*.yaml" -o -name "*.yml" \) \
-exec bash scripts/detect_crd_wrapper.sh {} +
fi
# Check rendered templates
find ./rendered -type f \( -name "*.yaml" -o -name "*.yml" \) \
-exec bash scripts/detect_crd_wrapper.sh {} +[
{
"kind": "Certificate",
"apiVersion": "cert-manager.io/v1",
"group": "cert-manager.io",
"version": "v1",
"isCRD": true,
"name": "example-cert"
}
]spec:
securityContext:
runAsNonRoot: true
runAsUser: 1000
fsGroup: 2000
containers:
- name: app
image: nginx:1.21
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities:
drop:
- ALL
#### Step 5: Automation Opportunities
List all detected automation opportunities:
- If `_helpers.tpl` is missing → Recommend: `bash scripts/generate_helpers.sh <chart>`
- If `.helmignore` is missing → Recommend: Copy from `assets/.helmignore`
- If `values.schema.json` is missing → Recommend: Copy and customize from `assets/values.schema.json`
- If `NOTES.txt` is missing → Recommend: Create post-install notes template
- If `README.md` is missing → Recommend: Create chart documentation
#### Step 6: Final Summary
Provide a final summary: