From k8s-validation
Validate Kubernetes manifests, Dockerfiles, Helm charts, and application code for both security and correctness. Enforces NEVER/ALWAYS rules across security domains and correctness domains so AI-generated code is shaped to fit a real Kubernetes environment.
How this skill is triggered — by the user, by Claude, or both
Slash command
/k8s-validation:k8s-validationThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Act as a persistent guardrail for AI code generation in Kubernetes environments. Validation here covers two equal halves:
README.mdreferences/app-security.mdreferences/correctness-api-contracts.mdreferences/correctness-async-and-errors.mdreferences/correctness-data-flow.mdreferences/correctness-environment-config.mdreferences/correctness-http-and-types.mdreferences/correctness-test-coverage.mdreferences/file-handling-security.mdreferences/helm-manifest-security.mdreferences/internal-service-auth.mdreferences/llm-ai-security.mdreferences/network-exposure.mdreferences/observability-incident-response.mdreferences/pod-container-security.mdreferences/pre-push-checklist.mdreferences/rbac-service-accounts.mdreferences/secrets-management.mdreferences/supply-chain-security.mdAct as a persistent guardrail for AI code generation in Kubernetes environments. Validation here covers two equal halves:
The skill enforces concrete NEVER/ALWAYS rules whenever you generate or modify:
Before generating ANY Kubernetes-related code, load the relevant reference files.
references/secrets-management.md - secrets, credentials, API keys
references/pod-container-security.md - Deployments, Pods, SecurityContext
references/network-exposure.md - Services, Ingress, NetworkPolicies
references/supply-chain-security.md - Dockerfiles, dependencies
references/internal-service-auth.md - service-to-service communication
references/file-handling-security.md - file uploads, path operations
references/llm-ai-security.md - LLM/AI workloads (OWASP LLM Top 10)
references/helm-manifest-security.md - Helm charts, raw manifests
references/rbac-service-accounts.md - RBAC, ServiceAccounts
references/observability-incident-response.md - logging, metrics, alerting
references/app-security.md - app-layer auth, IDOR, injection
references/correctness-http-and-types.md - HTTP method/param sources, type coercion
references/correctness-data-flow.md - SQL alias mismatches, WHERE clause gaps, end-to-end data flow
references/correctness-api-contracts.md - response shapes, pagination, backwards compatibility
references/correctness-async-and-errors.md - missing await, swallowed errors
references/correctness-environment-config.md - env var name/Secret/Helm wiring mismatches
references/correctness-test-coverage.md - integration test requirements for new code
references/pre-push-checklist.md - final verification before commit
These rules MUST NOT be violated under any circumstances:
privileged: true without explicit user justification.:latest or unpinned image tags.curl | bash install patterns in Dockerfiles./healthz, /readyz).*) verbs/resources in RBAC without justification.req.body in a GET, etc.).await on async calls whose result is used synchronously.These rules MUST be followed in all generated code:
runAsNonRoot, readOnlyRootFilesystem.automountServiceAccountToken: false unless K8s API access is needed.^, ~, or ranges).@require_auth, @login_required, requireAuth, authenticate, authMiddleware, verifyToken. Use what already exists — do not invent a new auth pattern.filter_pii, sanitize, redact, scrub. If one exists, import and use it.@app.errorhandler, app.use.*err, handleError. Match the project convention.tests/, __tests__/, spec/ to understand where integration tests live.SECURITY-POSTURE.md in the project root (create it if needed). Add an entry recording which controls were applied and why.SECURITY-POSTURE.md is in .gitignore.kubectl create secret ...").SECURITY-POSTURE.md with a findings section listing each violation, severity, location, and remediation.Generated files should be clean. All reasoning is recorded in SECURITY-POSTURE.md instead, using this structure:
## `path/to/file` — <Kind> (<date>)
**Controls applied:**
- `readOnlyRootFilesystem: true` + `emptyDir` at `/tmp` — feature requires writable temp dir; root FS locked down per pod-container-security Rule 5.
- `automountServiceAccountToken: false` — no K8s API access required.
- Integration test added at `tests/integration/test_<feature>.py` per correctness-test-coverage Rule 1.
**Additional steps required:**
- Create the API key Secret separately: `kubectl create secret generic ...`
When identifying issues during a review, append a findings section:
## Validation Review: `<file>` (<date>)
> This audit is read-only. No files were modified.
### CRITICAL: [Issue Title]
- **Rule**: NEVER/ALWAYS reference (security or correctness)
- **Risk**: What could happen if not addressed
- **Recommended fix**: Exact remediation with a corrected snippet
| Resource type | Required controls |
|---|---|
| Deployment / Pod | SecurityContext, resources, serviceAccount, probes |
| Service | NetworkPolicy, no LoadBalancer without justification |
| Ingress | TLS, authentication annotation |
| Secret | Never in git, use secretKeyRef |
| ConfigMap | No secrets, validate content |
| ServiceAccount | Dedicated per workload, minimal RBAC |
| Role / ClusterRole | Least privilege, no wildcards |
| Dockerfile | Multi-stage, pinned images, no curl | bash |
| Helm chart | Templated secrets, PDB, probes |
| New HTTP handler | Auth, input validation, integration test, env var matches Secret |
| New LLM/AI endpoint | Auth, input length limit, output filtered for PII, token budget, rate limiting |
| New SQL query | Aliases match consumer code, WHERE clause is required-or-explicit |
| New API response | Shape matches consumers, pagination fields present |
Before any code is committed, verify against references/pre-push-checklist.md. The checklist covers items from every domain (security and correctness) and can be copied directly into PR templates.
npx claudepluginhub metalbear-co/k8s-validation-plugin --plugin k8s-validationGuides completion of development work by verifying tests, detecting environment, and presenting structured options for merge, PR, or cleanup.
Enforces test-driven development: write failing test first, then minimal code to pass. Use when implementing features or bugfixes.
Guides creation and editing of skills using test-driven development with pressure scenarios and subagents to verify agent compliance.