Agent Skill · Cerbos

cerbos-policy

Generate Cerbos authorization policies from requirements, PDFs, or specifications. Use when creating access control policies, resource permissions, derived roles, or RBAC/ABAC rules. Triggers on "cerbos", "authorization policy", "access control", "RBAC", "ABAC".

Provider: Cerbos Path in repo: cerbos/cerbos-policy/SKILL.md

Skill body

Cerbos Policy Generator

Generate production-ready Cerbos authorization policies from natural language requirements or specification documents.

Prerequisites

Before starting, verify Docker is available:

docker --version

If Docker is not installed, inform the user and provide installation guidance:

Do not proceed with policy generation until Docker is available.

Capabilities

  1. Generate policies from requirements, PDFs, or bullet points
  2. Answer questions about existing policies and Cerbos concepts
  3. Modify policies based on requests, ensuring tests pass
  4. Explain policies in plain language

Workflow Phases

Follow these phases in order. Do not skip ahead.

Phase 1 — Spec Intake

Before writing any files, converge on a compact spec by asking clarifying questions:

Produce a short spec artifact (resources, principals/roles, rules as role → action on resource [condition]) and confirm with the user before generating.

Phase 2 — Write

Batch-write all files in a single pass, in this order:

  1. _schemas/ (principal + resources)
  2. derived_roles/ and common_vars.yaml
  3. resource_policies/ / role_policies/
  4. testdata/ fixtures
  5. *_test.yaml

Every YAML file MUST begin with a # yaml-language-server: $schema=... header so LSP-aware editors validate the file. Policies use the Policy.schema.json URL, test suites use TestSuite.schema.json, and fixtures use the matching TestFixture/*.schema.json. See POLICIES.md and TEST-SUITES.md for the exact URLs.

Do not validate between files.

Phase 3 — Validate

docker run --rm -v "$(pwd):/policies" ghcr.io/cerbos/cerbos:latest compile /policies

Exit code 0 = done. Otherwise capture the error list and move to Phase 4.

Phase 4 — Fix

Apply one targeted fix per iteration, in this priority order:

  1. YAML / CEL syntax errors
  2. Schema validation errors (additionalProperties: false)
  3. Compile errors (missing imports, unresolved references)
  4. Test failures

Rules:

Phase 5 — Finalize

Confirm exit code 0, then report what was created and any assumptions made during spec intake.

Output

Complete policy bundle:

References

Skill frontmatter

license: Apache-2.0 compatibility: Requires Docker for policy validation metadata: {"author"=>"cerbos", "version"=>"1.0"} allowed-tools: Read Write Edit Bash Glob Grep Task WebFetch