agentleFS
mguttmannmguttmann/code-audit-suite/skills/kubescape-k8s/SKILL.md

kubescape-k8s

Skill0 starsChanged 5 months agoMITView on GitHub

This skill should be used when the user asks to "run Kubescape", "scan Kubernetes manifests", "Kubernetes prüfen", "K8s security", "Helm chart security", "cluster posture", "NSA/CIS Kubernetes compliance", or wants to check Kubernetes/Helm/Kustomize files for misconfigurations and compliance. Runs Kubescape in Docker, processed directly in Claude Code. Only relevant for projects with Kubernetes manifests.

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use medium to be stricter.

    line 39

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Kubescape K8s

Purpose

Kubernetes-specific posture and compliance analysis: scores manifests, Helm charts and Kustomize against frameworks (NSA-CISA, CIS, MITRE ATT&CK, SOC2, PCI), and analyzes RBAC and privilege configuration.

Relation to Trivy (no needless overlap): Trivy already does basic K8s/IaC misconfiguration. Kubescape adds more on the K8s axis — framework-based compliance scoring and RBAC/cluster posture that Trivy does not provide. Use this skill only when the project actually contains Kubernetes resources; otherwise Trivy's misconfig scanner is enough.

Core Workflow (drive to zero)

  1. Scan the directory containing manifests/charts:
    ~/.claude/skills/kubescape-k8s/scripts/scan.sh [TARGET_DIR]
  2. Fix each failed control in the YAML: drop privileged/root, set readOnlyRootFilesystem, resource limits, securityContext, network policies, least-privilege RBAC, pinned image digests.
  3. Re-run until controls pass.

Enforcing a gate

The hard gate is the severity threshold — fail if any failed control is at/above a severity (this is what the audit suite uses by default, high):

KUBESCAPE_SEVERITY=high ~/.claude/skills/kubescape-k8s/scripts/scan.sh [DIR]

Use medium to be stricter. This is the only reliable gate: the compliance-percentage flag (--compliance-threshold) does not fail the scan with the pinned CLI image (a manifest at 66% compliance still exits 0 even at threshold 100), so it was removed rather than expose a gate that does not gate.

The gate works by exit code: a failed control at/above the threshold makes kubescape exit 1, which the wrapper maps to RESULT: FAIL. kubescape logs that verdict as a level:fatal line ("... exceeds severity threshold ..."); the wrapper does not mistake that for an operational error — only a non-gate fatal (e.g. "no resources found to scan", a Docker/parse error) maps to RESULT: ERROR (exit 125).

Notes

  • The container runs --rm with no persistent cache volume, so Kubescape re-downloads its frameworks on each run (a few seconds). The pinned CLI image runs as user nonroot, so mount a cache volume to /home/nonroot/.kubescape (not /home/ks, which does not exist in this image) if you want to persist them.
  • JSON/SARIF output for parsing: KUBESCAPE_FORMAT=json scan.sh [DIR].
  • Live-cluster scanning is possible but out of scope here — this skill targets manifests in the repo (the coding/refactoring workflow).

Resources

  • scripts/scan.sh — runs kubescape scan against a manifest directory with an optional severity gate. Exit: 0 = pass, 1 = failed controls (FINDINGS), 125 = operational error (no resources / Docker / parse). Env: KUBESCAPE_FORMAT, KUBESCAPE_SEVERITY (the hard gate), KUBESCAPE_IMAGE.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.