agentsclimarketplace

Container k8s validator

Skill ccronca/dotfiles/claude/skills/container-k8s-validator

A set of zsh, git, bash, Claude and tmux configuration files

Install
npx -y skills add ccronca/dotfiles --skill container-k8s-validator

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Validates Containerfile COPY commands and Kubernetes manifest paths for consistency. Automatically runs when working with Containerfiles or K8s manifests to ensure source paths exist and destinations match between files.

SKILL.md

6.5 KB, as published. Nobody here has run it

Container and Kubernetes Manifest Validator Skill

IMPORTANT: This skill executes automatically when working with Containerfiles or Kubernetes manifests.

Automatic Invocation

This skill is automatically invoked when:

  • Creating or modifying Containerfiles/Dockerfiles
  • Creating or modifying Kubernetes manifests (*.yaml, *.yml)
  • Before committing changes to these files

Execution Protocol

When this skill is invoked, you MUST:

  1. Find all relevant files in the current context:

    • Containerfiles/Dockerfiles being modified
    • Kubernetes manifests (Deployments, StatefulSets, ConfigMaps, Secrets)
    • Check common locations: k8s/, manifests/, deploy/, .kube/, root directory
  2. Extract and validate Containerfile paths:

    • Parse all COPY and ADD commands
    • Extract source paths (left side of COPY/ADD)
    • Extract destination paths (right side of COPY/ADD)
    • Verify source paths exist using ls or test -f
  3. Extract Kubernetes manifest file references:

    • Parse volumeMounts.mountPath in Deployments/StatefulSets
    • Parse configMapKeyRef and secretKeyRef
    • Parse ConfigMap/Secret creation from files (e.g., kubectl create configmap --from-file=)
    • Note any file paths referenced
  4. Cross-validate consistency:

    • Check if files referenced in K8s manifests are copied in Containerfile
    • Check if destination paths in Containerfile match mountPath in manifests
    • Report mismatches and missing COPY commands
  5. Generate validation report with findings

Validation Steps

Step 1: Find Containerfiles

find . -name "Containerfile" -o -name "Dockerfile" -o -name "*.containerfile" -o -name "*.dockerfile"

Step 2: Extract COPY/ADD Commands

For each Containerfile, extract paths:

grep -E "^(COPY|ADD)" Containerfile

Parse format: COPY <source> <destination>

Step 3: Validate Source Paths

For each source path found:

ls -la <source-path>  # Verify exists

Step 4: Find Kubernetes Manifests

find . -path "*/k8s/*.yaml" -o -path "*/manifests/*.yaml" -o -path "*/deploy/*.yaml" -o -name "*deployment.yaml" -o -name "*statefulset.yaml"

Step 5: Extract Mount Paths from Manifests

grep -A 5 "volumeMounts:" manifest.yaml
grep "mountPath:" manifest.yaml

Step 6: Cross-Validate

Compare:

  • Containerfile destination paths vs. K8s volumeMounts paths
  • K8s manifest file references vs. Containerfile COPY sources
  • Report any missing COPY commands for files used in manifests

Validation Report Format

Present findings in this format:

## Container & K8s Validation Report

### Containerfiles Checked
- path/to/Containerfile
- path/to/Dockerfile

### Kubernetes Manifests Checked
- k8s/deployment.yaml
- k8s/configmap.yaml

### ✓ COPY Commands Validated
- ✓ COPY config/app.yaml /etc/config/app.yaml
  - Source exists: config/app.yaml
  - Used in: k8s/deployment.yaml (mountPath: /etc/config/app.yaml)

### ⚠ Issues Found

#### Missing Source Files
- ✗ COPY scripts/startup.sh /usr/local/bin/
  - Source NOT found: scripts/startup.sh
  - Action: Create file or remove COPY command

#### Missing COPY Commands
- ✗ File referenced in K8s but not copied to image
  - Manifest: k8s/deployment.yaml
  - Mount path: /etc/secrets/db-password
  - Action: Add COPY command to Containerfile

#### Path Mismatches
- ✗ Path inconsistency detected
  - Containerfile: COPY config/db.yaml /app/config/db.yaml
  - K8s manifest: mountPath: /etc/config/db.yaml
  - Action: Align paths in both files

### Recommendations
- Fix missing source files before building
- Add missing COPY commands for referenced files
- Ensure path consistency between Containerfile and manifests
- Consider generating files with RUN instead of COPY where appropriate

Example Execution

Scenario: User modifies Containerfile and k8s/deployment.yaml

Step 1: Detect files in context

ls -la Containerfile k8s/deployment.yaml

Step 2: Parse Containerfile

FROM python:3.11
COPY config/app.yaml /etc/config/app.yaml
COPY scripts/entrypoint.sh /usr/local/bin/

Step 3: Validate source paths

ls config/app.yaml        # ✓ Exists
ls scripts/entrypoint.sh  # ✗ NOT found

Step 4: Parse K8s manifest

volumeMounts:
  - name: app-config
    mountPath: /etc/config/app.yaml
  - name: db-config
    mountPath: /etc/config/database.yaml  # Not in Containerfile!

Step 5: Generate report showing:

  • Missing source: scripts/entrypoint.sh
  • Missing COPY: /etc/config/database.yaml used in manifest
  • Valid: config/app.yaml/etc/config/app.yaml

Critical Rules

  • ALWAYS run validation before committing Containerfile changes
  • ALWAYS check both directions:
    • Containerfile COPY sources must exist
    • K8s manifest files must be in Containerfile
  • DO NOT skip validation even for small changes
  • DO provide actionable recommendations in the report
  • DO suggest alternatives (RUN vs COPY) when appropriate

Alternative Suggestions

When finding issues, suggest alternatives:

Missing File - Suggest Generation

# Instead of: COPY scripts/startup.sh /usr/local/bin/
# Suggest:
RUN echo '#!/bin/bash\nset -euo pipefail\npython app.py' > /usr/local/bin/startup.sh && \
    chmod +x /usr/local/bin/startup.sh

ConfigMap from File - Suggest Direct Creation

# Instead of: COPY config/app.yaml (then creating ConfigMap)
# Suggest: Create ConfigMap directly from local file
kubectl create configmap app-config --from-file=config/app.yaml

Integration with CLAUDE.md Guidelines

This skill enforces the Containerfile and Kubernetes manifest validation guidelines in CLAUDE.md:

  • Path existence validation
  • Path consistency between files
  • Completeness checks for COPY commands
  • Security checks (avoid copying .env, credentials)

Troubleshooting

If Containerfile is not in standard location:

  • Ask user for the path to Containerfile
  • Search recursively in common locations

If K8s manifests use Helm/Kustomize:

  • Note that validation may be limited
  • Suggest rendering templates first: helm template or kustomize build

If using multi-stage builds:

  • Validate COPY --from=builder paths
  • Check that files exist in the builder stage

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.