/platform-skills:opa [generate|test|validate|explain|debug] [policy description or file path]from platform-skills
Writes, tests, validates, explains, and debugs OPA Rego policies and Conftest configs, covering deny/warn rules, unit tests, and regal linting.
Ships in platform-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Write, test, validate, explain, and debug OPA Rego policies with Conftest.
AI-agent behavior, not infra policy: to gate what an AI coding agent (Copilot, Claude Code) can edit or run in a repo, use
/platform-skills:ai-governance— a different policy engine for a different input shape (tool calls and diffs, not Terraform/Kubernetes manifests).
When invoked with no arguments, ask before proceeding:
Q1 — Mode?
What do you need?
1. generate — write a new production-ready Rego policy
2. test — write _test.rego unit tests for an existing policy
3. validate — run the full pipeline (fmt, lint, tests) against a directory
4. explain — translate an existing Rego policy into plain English
5. debug — diagnose why a policy is not firing as expected
Enter 1–5 or mode name:
Q2 — Context (after mode selected, one at a time):
Describe the policy — target resource type (Terraform/Kubernetes/GHA/Dockerfile) and what to deny or warn on:Paste the Rego policy to write tests for:Provide the directory path containing your .rego files:Paste the Rego policy to explain:Describe the symptom — is the policy not firing, producing no output, or throwing an error? Paste the conftest output:Then proceed into the relevant mode below.
Write a production-ready Rego policy from a description.
Steps:
conftest parse <file> to show the input shape if the user has a file, then write rules that match that shape exactly# METADATA block: title, description, authors, entrypoint: truepackage <namespace> — use main only when a single policy set applies; use a named package (package terraform.iam, package k8s.pods) for multi-domain reposimport rego.v1 — required for modern Rego syntaxdeny for hard failures, warn for advisory violations, violation for OPA framework integrations (Gatekeeper, Conftest policy sets)msg that includes the offending resource name/value and a remediation hintsome for iteration, in for membership, startswith/contains for string matchingterraform validate and before terraform plan as a blocking gate — failing conftest must prevent plan from runningValidation: Test the policy against both a passing and a failing resource before deploying to CI:
# Should produce no output (policy passes)
conftest test --policy <dir> <passing-resource.yaml>
# Should produce a deny/warn message (policy fires)
conftest test --policy <dir> <failing-resource.yaml>
Both must behave as expected. A policy that never fires on a failing resource is not enforcing anything.
Write _test.rego unit tests for a given policy.
Steps:
<policy>_test.rego in the same directory:
package <namespace>_test (e.g. package terraform.iam_test)import rego.v1import data.<namespace>deny/warn/violation rule, write:
test_deny_ / test_warn_; assert count(<rule>) == 1 or count(<rule>) > 0test_allow_; assert count(<rule>) == 0conftest verify --policy <dir>Validation: All tests must pass with zero skipped:
conftest verify --policy <dir>
# Expected: PASS - X tests, 0 failures, 0 skipped
# Skipped tests mean test fixtures are incomplete — fix before merging
Run the full policy validation pipeline against a directory.
Steps:
conftest fmt <dir>/*.rego --check — fails if any file is not canonically formattedconftest fmt <dir>/*.rego — rewrites in placeregal lint <dir> — reports style and correctness violations; fix each finding before continuingconftest verify --policy <dir> — all *_test.rego files must passconftest test --policy <dir> <input-files>Translate an existing Rego policy into plain English.
Steps:
input.<field> to the resource attribute it readsdata.* (external allow-lists or config)Diagnose why a policy is not firing as expected.
Steps:
conftest test or conftest verify output# Extract every input.<path> reference from the policy
grep -oE 'input\.[a-zA-Z0-9_.[\]]+' <policy-file> | sort -u
# Build a targeted jq filter from those paths and run it
conftest parse <input-file> | jq '{field1: .<path1>, field2: .<path2>, ...}'
Compare each extracted path against the parsed output. A missing or mismatched key is the most common cause of silent policy failures.--namespace or --all-namespaces?deny, warn, or violation? Other names are silently ignored by Conftestdeny[msg]) or a boolean? Conftest expects set comprehensions for message outputimport rego.v1 missing: without it, if, in, contains may not work as expectedsome missing: iterating without some can cause unexpected behaviour in Rego v0 compatibility modeconftest test --policy <dir> <input>What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub nitinjain999/platform-skills --plugin platform-skills52 skills in this plugin
/ai-governanceGenerate and enforce policy gates for AI coding agents (Copilot, Claude Code) — real-time session hooks that deny protected-path edits and dangerous commands, plus a merge-time backstop for anything that bypasses them. Use when asked to "govern AI agents", "block AI from touching secrets", "add an AI policy gate", or "why did the AI agent hook not fire"./awesome-docsGenerate, convert, and maintain animated GitHub-safe Markdown documents with animated SVG diagrams. Covers four SVG patterns (architecture flow, lifecycle loop, field carousel, timeline phases), guided interview for any doc type (README, architecture guide, runbook, API reference, tutorial, RFC, post-mortem, how-it-works, or custom), converting existing plain Markdown, diffing for stale diagrams, quality auditing, local preview, and multi-platform export. Use when asked to "create a README for X", "write an architecture doc", "animate this guide", "convert my doc to animated", "check if my diagrams are stale", or "export my doc for Confluence"./awsStructured guidance for AWS CloudFront distributions, WAF web ACLs, Lambda@Edge, CloudFront Functions, Firewall Manager multi-account enforcement, and IAM/IRSA patterns. Covers OAC, cache policies, security headers, managed rule groups, rate limiting, FMS FIRST/MIDDLE/LAST ownership model, and production-ready Terraform generation.2 plugins in one repository ship this exact skill · first indexed Oct 12, 2026
Other plugins' skills for the same job