opa

opa is a command for Claude Code from nitinjain999/platform-skills. It costs 98 tokens per session (1,969 once invoked), scanned A, original, Apache-2.0.

A helper for OPA (Open Policy Agent), a tool that checks whether configuration follows rules written in the Rego language. Conftest can apply those checks to files such as Terraform and Kubernetes configurations.

In plain words
What is it for?
Use it to write and test rules, format and lint Rego files, validate configuration directories, diagnose rules that do not trigger, and connect checks to GitHub Actions.
Why use it?
It makes policy rules easier to create, test, explain, and debug so invalid or unsafe configuration can be caught automatically.

Command for Claude Code

Written for Claude Code: argument-hint in frontmatter. Also seen: mentions Claude Code.

Part of the platform-skills plugin — 1 skill, 43 commands shipped together

Good fit Use it to write and test rules, format and lint Rego files…

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/nitinjain999/platform-skills/opa
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/nitinjain999/platform-skills

Made for: Claude Code.

Or install platform-skills, the plugin that ships this one along with the rest of its 1 skill, 43 commands.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for opa

README.md
[![agentmods](https://agentmods.dev/badge/commands/nitinjain999/platform-skills/opa.svg)](https://agentmods.dev/commands/nitinjain999/platform-skills/opa)
Your own site
<a href="https://agentmods.dev/commands/nitinjain999/platform-skills/opa"><img src="https://agentmods.dev/badge/commands/nitinjain999/platform-skills/opa.svg" alt="Measured on agentmods" height="20"></a>
Per session 98 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,969 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00098 $0.01969
Opus 5 $0.00049 $0.00984
Sonnet 5 $0.00020 $0.00394
Haiku 4.5 $0.00010 $0.00197

Measured 7d ago against content hash 9bb1413548f3, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

opa scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 7d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

commands/opa.md · 142 lines

How it starts

The opening of the file, as written. The whole thing — 142 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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).


Interactive Wizard (fires when no arguments are provided)

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):

  • generate: Describe the policy — target resource type (Terraform/Kubernetes/GHA/Dockerfile) and what to deny or warn on:
  • test: Paste the Rego policy to write tests for:
  • validate: Provide the directory path containing your .rego files:
  • explain: Paste the Rego policy to explain:
  • debug: 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.


Mode: generate

Write a production-ready Rego policy from a description.

Steps:

  1. Ask for: target resource type (Terraform HCL, Kubernetes manifest, GitHub Actions workflow, Dockerfile, JSON/YAML), the rule logic (what to deny or warn on), and whether a named namespace is needed
  2. Parse what Conftest sees — use conftest parse <file> to show the input shape if the user has a file, then write rules that match that shape exactly
  3. Generate the policy file:
    • Start with a # METADATA block: title, description, authors, entrypoint: true
    • Declare package <namespace> — use main only when a single policy set applies; use a named package (package terraform.iam, package k8s.pods) for multi-domain repos
    • Add import rego.v1 — required for modern Rego syntax
    • Use deny for hard failures, warn for advisory violations, violation for OPA framework integrations (Gatekeeper, Conftest policy sets)
    • Generate a descriptive msg that includes the offending resource name/value and a remediation hint
    • Use some for iteration, in for membership, startswith/contains for string matching
  4. Show the Conftest command to test the policy against sample input
  5. State CI placement: conftest runs after terraform validate and before terraform plan as a blocking gate — failing conftest must prevent plan from running

Read the full file on GitHub · 142 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 7d ago First seen · 142 lines · 98 tokens per session scan A 9bb1413548f3

Subscribe to this mod's changes

opa is a command published in the GitHub repository nitinjain999/platform-skills (41 stars, last pushed 5d ago), licensed Apache-2.0. It adds 98 tokens to every session and 1,969 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other commands, from other repositories