$ skilldirectory
— zsh — registry.skilldirectory.dev
skill library blog

home / DevOps / Policy As Code Skill by @BagelHole

Policy As Code Skill by @BagelHole

FREE
github stars★ 1,111updatedSep 2026repo@BagelHole
$git clone https://github.com/BagelHole/DevOps-Security-Agent-Skills

The skill is the compliance/governance/policy-as-code folder inside that repository. Copy it into the folder your agent loads skills from; check your agent's documentation for where that is.

Read the opening of the original SKILL.md
# Policy as Code

Automate policy enforcement through code using OPA/Rego, Kyverno, Checkov, and CI/CD integration to prevent compliance violations before they reach production.

## When to Use

- Enforcing security and compliance policies on infrastructure-as-code changes
- Preventing misconfigured Kubernetes workloads from deploying
- Automating guardrails in CI/CD pipelines for Terraform, CloudFormation, or Helm
- Implementing organizational standards that must be consistently applied
- Replacing manual approval gates with automated policy checks

## Open Policy Agent (OPA) Rego Policies

```rego
# deny_public_s3.rego - Deny S3 buckets with public access
package terraform.aws.s3

import rego.v1

deny contains msg if {
    resource := input.resource_changes[_]
    resource.type == "aws_s3_bucket"
    resource.change.after.acl == "public-read"
    msg := sprintf(
        "S3 bucket '%s' has public-read ACL. All buckets must be private. [Policy: no-public-s3]",
…

Excerpt only, quoted from the author's repository. Open the repository for the complete file.