Tooluck logoTooluck
SKILL.md

policy-as-code

Agent skill fromBagelHole/DevOps-Security-Agent-Skills

Implement policy as code with OPA, Sentinel, and Kyverno. Automate policy enforcement in CI/CD and infrastructure. Use when enforcing compliance through automation.

How to install policy-as-code

install policy-as-code
# install the DevOps-Security-Agent-Skills pack with the skills CLI
npx skills add BagelHole/DevOps-Security-Agent-Skills

# or add only this skill to Claude Code: copy the folder

compliance/governance/policy-as-code/

# into

~/.claude/skills/policy-as-code/ (all projects)

.claude/skills/policy-as-code/ (one project)

compliance/governance/policy-as-code/SKILL.md

MITFull file
1# Policy as Code
2
3Automate policy enforcement through code using OPA/Rego, Kyverno, Checkov, and CI/CD integration to prevent compliance violations before they reach production.
4
5## When to Use
6
7- Enforcing security and compliance policies on infrastructure-as-code changes
8- Preventing misconfigured Kubernetes workloads from deploying
9- Automating guardrails in CI/CD pipelines for Terraform, CloudFormation, or Helm
10- Implementing organizational standards that must be consistently applied
11- Replacing manual approval gates with automated policy checks
12
13## Open Policy Agent (OPA) Rego Policies
14
15```rego
16# deny_public_s3.rego - Deny S3 buckets with public access
17package terraform.aws.s3
18
19import rego.v1
20
21deny contains msg if {
22 resource := input.resource_changes[_]
23 resource.type == "aws_s3_bucket"
24 resource.change.after.acl == "public-read"
25 msg := sprintf(
26 "S3 bucket '%s' has public-read ACL. All buckets must be private. [Policy: no-public-s3]",
27 [resource.address]
28 )
29}
30
31deny contains msg if {
32 resource := input.resource_changes[_]
33 resource.type == "aws_s3_bucket"
34 resource.change.after.acl == "public-read-write"
35 msg := sprintf(
36 "S3 bucket '%s' has public-read-write ACL. This is strictly prohibited. [Policy: no-public-s3]",
37 [resource.address]
38 )
39}
40```
41
42```rego
43# require_encryption.rego - Require encryption on data stores
44package terraform.aws.encryption
45
46import rego.v1
47
48deny contains msg if {
49…

Excerpt shown under the repository's MIT license.

More skills in DevOps-Security-Agent-Skills

Keep exploring

Similar skill repositories

thedotmack /

claude-mem
116k

Persistent Context Across Sessions for Every Agent – Captures everything your agent does during sessions, compresses it with AI, and injects relevant context back into future sessions. Works with Claude Code, OpenClaw, Codex, Gemini, Hermes, Copilot, OpenCode + More

CCCXGHGM+135 skills

Newsletter

Join the Community

Subscribe to our newsletter for the latest news and updates