Skip to content

Guide · Agent skill

How to use the Kubernetes Security Policies agent skill

Updated · written with AI from the project's own documentation and checked against our catalogue data

The k8s-security-policies skill is a reference guide that gives an AI agent templates and guidance for securing a Kubernetes cluster. It covers NetworkPolicy, RBAC, Pod Security Standards and pod security context, plus OPA Gatekeeper and Istio examples. After this guide you will know what the skill does, how to install it, how to ask for help with natural requests, and what to check before applying any generated YAML.

Kubernetes Security Policieswshobson/agents · MIT

Quick start

  1. 1Download the ZIP. Download the k8s-security-policies ZIP file from this page.
  2. 2Unzip into a skills folder. Unzip it into ~/.claude/skills/ for personal use, or into .claude/skills/ in your project.
  3. 3Or upload it in the Claude apps. In the Claude apps, go to Settings → Capabilities → Skills and upload the ZIP.
  4. 4Describe your security goal. Ask in plain language, for example to isolate a namespace with a default-deny NetworkPolicy.
  5. 5Review the generated YAML. Check namespaces, labels, ports and permissions against your real workloads before applying.
  6. 6Test in a non-production cluster. Apply the manifests to a test cluster first, since network policies can block traffic.

What is an agent skill?

An agent skill is a folder containing instructions (a SKILL.md file) and supporting files that an AI agent can load when a task matches the skill's description. The agent reads the guide and uses its examples when it writes answers or files for you.

This skill is one of the plugins in the wshobson/agents collection. It is licensed under MIT.

What does the skill make the agent do?

When the skill is active, the agent can write configuration files for securing a cluster. It is a reference of examples and templates, not a live tool. It does not connect to or change any cluster itself.

  • Write NetworkPolicy manifests that control which pods can talk to each other, including a default-deny-all policy and an allow-DNS egress rule.
  • Write RBAC rules (Role, ClusterRole, RoleBinding) that limit who can do what, with patterns such as read-only access and secret reader.
  • Set pod security settings such as running as non-root, read-only root filesystem, seccomp RuntimeDefault and dropping all Linux capabilities.
  • Label namespaces for the Pod Security Standards (privileged, baseline, restricted).
  • Provide OPA Gatekeeper ConstraintTemplate and Constraint examples and Istio PeerAuthentication (mTLS) and AuthorizationPolicy examples.
  • Suggest kubectl troubleshooting commands for NetworkPolicy and RBAC problems.

How do you install the skill?

Download the ZIP file from this page and unzip it. You can install it for yourself or for a single project.

For your user account, unzip it into ~/.claude/skills/. For one project, unzip it into the project's .claude/skills/ folder. Alternatively, in the Claude apps you can upload the ZIP under Settings → Capabilities → Skills.

  • Personal install: ~/.claude/skills/
  • Project install: .claude/skills/ inside your project folder
  • Claude apps: Settings → Capabilities → Skills, then upload the ZIP

How do you trigger the skill with natural requests?

You do not need a special command. The skill is meant to be used when your request matches its description: securing clusters, implementing network isolation, or enforcing pod security standards. Describe your goal in plain language and name the resource type if you know it.

  • Write a default-deny NetworkPolicy for the production namespace, then allow only frontend pods to reach backend on TCP 8080.
  • Create a read-only Role for pods in the staging namespace and show me the RoleBinding for a user called jane.
  • Label my namespace so Pod Security Standards enforce the restricted profile.
  • Harden this Deployment: run as non-root, drop all capabilities and use a read-only root filesystem.
  • Set up an OPA Gatekeeper constraint that requires app and environment labels on Deployments.

What does the skill need?

You only need a cluster if you want to apply the output. The skill itself needs no scripts and no network access.

  • kubectl access, only if you run the troubleshooting commands yourself.
  • A Kubernetes cluster with a CNI plugin that supports NetworkPolicy, for the network examples. The skill's troubleshooting section suggests checking this first.
  • OPA Gatekeeper or Istio, only if you use those sections.
  • The skill runs no scripts and uses no network.

Example: check RBAC permissions with kubectl

If a service account gets permission denied errors, the skill suggests checking its effective permissions with kubectl auth can-i. You run these yourself against your cluster; the agent does not run them for you.

kubectl auth can-i list pods --as system:serviceaccount:default:my-sa kubectl auth can-i '*' '*' --as system:serviceaccount:default:my-sa

Safety notes before you apply anything

The generated YAML can block traffic or grant the wrong permissions if applied without review. A default-deny policy applied to the wrong namespace can cut off a working application. Read every manifest, check the namespace and labels, and test in a non-production cluster first.

Treat the output as a starting point for human review. The skill does not audit a live cluster, so it cannot tell you what is actually insecure in your environment.

  • Review every manifest before running kubectl apply.
  • Check namespaces and label selectors match your workloads.
  • Test network policies in a non-production cluster first, as they can block traffic.
  • Note that the skill's description mentions PodSecurityPolicy, but PSP was removed from Kubernetes in v1.25. Prefer Pod Security Standards labels instead.

Tips for better results

Give the agent your context: namespace names, pod labels, the ports your app uses and which service accounts exist. The examples use labels such as app: backend and app: frontend, so matching your own labels avoids edits.

For RBAC, ask for the narrowest verbs and resources you need. The reference file references/rbac-patterns.md contains patterns you can ask the agent to adapt. The network template is at assets/network-policy-template.yaml.

  • Start with one namespace and a default-deny policy, then add allow rules.
  • Ask for the reasoning behind each rule so you can review it.
  • Ask the agent to note which CNI features your examples assume.

What people use it for

  • Create a default-deny NetworkPolicy and then allow only specific pod-to-pod traffic in a production namespace.
  • Draft a least-privilege Role and RoleBinding for a service account or a developer.
  • Label namespaces with Pod Security Standards levels to enforce baseline or restricted settings.
  • Harden a Deployment's securityContext by running as non-root and dropping all capabilities.
  • Prepare a starting point for a CIS or NIST-style compliance review, to be checked by a human.

Frequently asked questions

How do I install the k8s-security-policies skill?

Download the ZIP from this page and unzip it into ~/.claude/skills/ for personal use, or into a project's .claude/skills/ folder. You can also upload the ZIP in the Claude apps under Settings → Capabilities → Skills.

Is the k8s-security-policies skill free?

The skill is licensed under MIT, according to the listing. Check the license file in the source repository for the exact terms.

What do I need to use this skill?

You need no cluster to get the YAML. A cluster with a CNI plugin that supports NetworkPolicy is needed to apply the network examples, and kubectl access is needed only for the troubleshooting commands. OPA Gatekeeper or Istio are needed only if you use those sections.

Does the skill scan my cluster for security problems?

No. It is a reference of examples and templates. It does not connect to or change your cluster, so it is not a security audit or scanner.

Does this skill support PodSecurityPolicy?

Its description mentions PodSecurityPolicy, but PSP was removed from Kubernetes in v1.25. Use Pod Security Standards namespace labels instead, and check any PSP examples against your cluster version before relying on them.

Why isn't my NetworkPolicy working?

The skill's troubleshooting section suggests first checking that your CNI plugin supports NetworkPolicy, then inspecting the policy with kubectl describe networkpolicy. Policies with no CNI support are silently ignored, so this check comes first.

New agent skills, repos and AI tools — every week

The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.

Our verdict

This skill suits platform or DevOps engineers hardening a cluster, developers who want a starting NetworkPolicy or RBAC manifest to review, and teams preparing for CIS or NIST-style checks. It is not a scanner or audit tool, and it is not a safe way to apply generated YAML to production without human review.

Download the skill