Kubernetes Validation Skills
A Claude Code plugin that validates Kubernetes manifests, application code, Dockerfiles, and Helm charts. The skill activates automatically when you generate Kubernetes-related code, applying NEVER/ALWAYS rules across two equal halves: security and correctness.
What it validates
Security domains
- Secrets management: never hardcode secrets, always use Kubernetes Secrets or external secret managers.
- Pod and container security: SecurityContext hardening, resource limits, non-root execution.
- Network exposure and Ingress: authentication on endpoints, NetworkPolicies, TLS requirements.
- Supply chain: pinned dependencies, digest-pinned images, secure Dockerfiles.
- Internal service auth: service-to-service auth, mTLS, JWT validation.
- File handling and path security: path traversal prevention, input sanitization.
- LLM and AI workload security: OWASP LLM Top 10 compliance, prompt injection prevention, output PII filtering.
- Helm and manifest generation: secure templating, PodDisruptionBudgets, probes.
- RBAC and ServiceAccounts: least privilege, dedicated ServiceAccounts.
- Observability and incident response: secure logging, metrics, alerting.
- App security: app-layer auth, IDOR prevention, injection, output sanitization for external/LLM data.
Correctness domains
- HTTP and types: parameter source matches HTTP method, type coercion at boundaries, environment-dependent code paths.
- Data flow: SQL aliases match downstream property access, WHERE clauses don't silently skip, request data reaches the query and the query result reaches the response.
- API contracts: response shapes match consumers, pagination math is correct, breaking changes are versioned.
- Async and error handling: missing
await is flagged, error fallbacks don't swallow real failures.
- Environment configuration: env var names in code match Kubernetes Secret keys and Helm values, required config fails fast at startup.
- Test coverage: new endpoints ship with integration tests that exercise the actual risk, not just the happy path.
How the skill shapes generation
When you ask the AI to add a new endpoint or feature, the skill instructs it to scan your existing codebase before generating anything — looking for auth decorators (@require_auth, requireAuth), sanitization utilities (filter_pii, sanitize), and error handling patterns. It uses what already exists rather than inventing new ones.
For example, given the prompt "add a /summarise endpoint that calls OpenAI's API", without the skill the model hardcodes the API key, skips auth, and returns the LLM response directly. With the skill loaded:
import os
from openai import OpenAI
from utils.sanitize import filter_pii # found by scanning the codebase
client = OpenAI(api_key=os.environ["OPENAI_API_KEY"])
@app.route('/summarise', methods=['POST'])
@require_auth # found by scanning the codebase
def summarise():
text = request.json.get('text', '')
response = client.chat.completions.create(
model="gpt-4",
messages=[{"role": "user", "content": f"Summarise: {text}"}],
)
summary = response.choices[0].message.content
return jsonify({"summary": filter_pii(summary)})
Three differences: the key comes from an env var backed by a Kubernetes Secret, the endpoint sits behind the project's existing auth decorator, and the LLM output is filtered for PII before going back to the user.
Installation
Claude Code plugin (recommended)
/plugin install k8s-validation@metalbear-co/k8s-validation-plugin
The skill activates automatically when generating Kubernetes-related code. The audit command becomes available as /k8s-validation:audit.
Cursor
git clone https://github.com/metalbear-co/k8s-validation-plugin.git .k8s-validation
cat >> .cursorrules << 'EOF'
## Validation Rules
Always read and follow the rules in .k8s-validation/skills/k8s-validation/SKILL.md
when generating or modifying Kubernetes manifests, Dockerfiles, Helm charts, or
application code that runs in Kubernetes.
EOF
GitHub Copilot
git clone https://github.com/metalbear-co/k8s-validation-plugin.git .k8s-validation
mkdir -p .github
cat >> .github/copilot-instructions.md << 'EOF'
## Validation Rules
Always read and follow the rules in .k8s-validation/skills/k8s-validation/SKILL.md.
EOF
What you get
Installing the plugin gives you two things at once:
- The skill (
k8s-validation): NEVER/ALWAYS rules that load into the AI's context automatically when generating Kubernetes-related code. You don't invoke the skill; it just shapes what gets generated.
- The audit command (
/k8s-validation:audit): an explicit, invokable check you can run on your codebase (or a specific path) to find rule violations in code that already exists.