---
title: "Agent skill for writing authorization policies in Cursor"
description: "Cursor's composer makes it a strong fit for authorization policy work. This guide walks through installing the Cerbos policy skill in Cursor, describing access rules in plain English, letting the composer pull schemas and derived roles into context, validating against the real compiler in the integrated terminal, and producing a complete policy bundle."
author: "Alex Olivier"
date: "2026-07-19T13:54:00.000Z"
canonical: "https://www.cerbos.dev/blog/agent-skill-for-writing-authorization-policies-in-cursor"
image: "https://stylish-appliance-1c1cc1c30d.media.strapiapp.com/Agent_skill_for_writing_authorization_policies_in_Cursor_84cd97918b.png"
tags: ["engineering","documentation","guide"]
source: "https://www.cerbos.dev/blog/agent-skill-for-writing-authorization-policies-in-cursor"
---

# Agent skill for writing authorization policies in Cursor

Cursor changed what an AI-native editor looks like. The composer pulls files from across the project, the agent runs commands, and the inline edits feel native to the codebase rather than bolted on. For authorization policy work, that workflow is a strong fit. Policies live in YAML and CEL, sit alongside schemas and test fixtures, and benefit from cross-file context every time you write a new rule.

We shipped an [agent skill](https://github.com/cerbos/skills) that takes a plain English requirement and produces a validated policy bundle. Cursor supports the skills protocol natively as of the 2.4 release, which means the same skill we run inside Claude Code and other agents runs unchanged in Cursor. Spec in, bundle out, compiled and tested before commit.  
This guide walks through installing the skill, what a Cursor session looks like, how validation runs against the real compiler in the integrated terminal, and what the composer adds to the workflow.

## Installing the policy skill in Cursor

Cursor added native support for the Agent Skills standard in its 2.4 release. The cross-agent installer registers the skill in the right place.

```

npx skills add cerbos/skills --skill cerbos-policy -a cursor
```

The install lands at `.cursor/skills/cerbos-policy/SKILL.md` for project scope. Cursor reloads automatically, or you can force it through the command palette with "Developer: Reload Window".

One thing worth flagging. This is separate from .cursorrules and .cursor/rules/. Those are Cursor's own native rules format. The Agent Skills standard uses a structured SKILL.md file with YAML frontmatter and works unchanged across Claude Code, Codex, and any other compliant agent. The skill source lives in [our skills repo](https://github.com/cerbos/skills) for inspection.

Inside Cursor, invoke the skill with /cerbos-policy from the agent panel, or describe a permission problem and Cursor will discover it automatically by description match.

## A typical Cursor policy session

Open the repo in Cursor. Drop into the agent panel and describe the access model in plain English.

"API platform with API keys and users. Users belong to organisations. Organisation owners manage keys and users in their org. Developers in an org can rotate their own keys. Read-only API tokens cannot create new keys. Audit-only API tokens see usage data without secrets."

The skill doesn't jump to YAML. It asks pointed questions first. Can a developer create a new key, or only rotate one that already exists. Are audit tokens scoped to an organisation. What happens when an owner downgrades their own role. The clarifying loop is deliberate because [authorization bugs](https://www.cerbos.dev/blog/avoid-authorization-errors) come from gaps in the requirement, not gaps in the syntax.

Once the spec is confirmed, the skill produces the full bundle in a single pass. Schemas under \_schemas/, [derived roles](https://docs.cerbos.dev/cerbos/latest/policies/derived_roles.html), shared variables, [resource policies](https://docs.cerbos.dev/cerbos/latest/policies/resource_policies.html), and a testdata/ directory with fixtures and a test suite. Each file lands in the right place. The composer can pull any of them back into context for follow-up edits.

## A note on using AI to write security policies

The Cerbos policy skill is a tool to help you get started. It is not a replacement for human review. Every policy the skill generates still needs eyes on it before it ships, because authorization is security and you should never trust AI with security decisions you haven't reviewed. Use the skill to accelerate the draft, then review like you'd review any other PR.

The review should focus on the deny paths first. The skill is explicit about the assumptions it made along the way, and those assumptions are where most policy mistakes hide. [OWASP's broken access control guidance](https://owasp.org/Top10/A01_2021-Broken_Access_Control/) is a good external reference for what reviewers should look for.

## How validation works in Cursor

The skill validates the bundle against the real Cerbos compiler.

```

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

In Cursor this runs in the integrated terminal. The agent reads the output and walks errors in priority order. YAML syntax first, then schema validation, then compile errors, then test failures. One fix per iteration. Tests are never deleted to make a build pass. After three failed attempts the skill stops and hands back to a human.

When the bundle compiles green, the skill writes a summary of what it produced and the assumptions it made along the way. Cursor preserves that summary in the chat alongside the file changes, which makes the review pass faster.

## What Cursor adds

Two things stand out.

The composer is the big one. When you ask Cursor to add a new resource policy, the composer pulls the schema, the existing derived roles, and the test patterns into context automatically. The skill rides on top of that. The generated policy uses real attributes from the schema, references existing derived roles by name, and matches the test patterns already in the repo. There's no parallel tree of half-matching files.

The inline edit experience is the other. Once the bundle is in the repo, Cursor's edit-in-place workflow is well suited to the small adjustments that always follow. Tighten a condition. Add a deny test. Rename a derived role. Each change happens in the editor with the AI as a collaborator on the diff rather than a separate step.

## When to slow down

A few scenarios call for more care than a single skill run can deliver.

Anything that touches money, health data, or regulated information should pair the generated policy with a focused review on the deny paths. The skill writes deny tests by default. The review should confirm those tests match the real constraint.

Multi-tenant systems with cross-tenant escalation usually want a [PBAC layer](https://www.cerbos.dev/features-benefits-and-use-cases/pbac) on top of the resource policies. The skill writes this when asked. The boundary between tenant policies and platform policies is a decision the team needs to make first.

If your repo already has policy structure and conventions in place, point Cursor at the existing tree before generating new policies. The skill respects existing structure rather than producing a parallel set of files. Our [authorization failure patterns](https://www.cerbos.dev/blog/authorization-failure-patterns) write-up covers what tends to go wrong when teams skip review.

## Getting started

Install the skill, open the repo in Cursor, and describe the next permission you need. For broader context on the workflow, our [policy authoring guide](https://www.cerbos.dev/blog/authorization-policies-how-to-write-test-validate-with-ai-help) covers the same ground from a non-agent angle.

[Try Cerbos](https://hub.cerbos.cloud/) to deploy and manage the policies the skill produces, or [book a workshop](https://www.cerbos.dev/workshop) to walk through your authorization model with us.

Go deeper:

* [How to adopt externalized authorization](https://solutions.cerbos.dev/how-to-adopt-externalized-authorization) (eBook) for the architecture pattern the bundle plugs into  
* [Building a scalable authorization system](https://www.cerbos.dev/ebooks-webinars/building-a-scalable-authorization-system-a-step-by-step-blueprint) (eBook) for a fuller view of the same problem

## Using a different agent?

The Cerbos policy skill also works in:
* [Claude Desktop](https://www.cerbos.dev/blog/agent-skill-for-writing-authorization-policies-in-claude-desktop)  
* [Claude Code](https://www.cerbos.dev/blog/agent-skill-for-writing-authorization-policies-in-claude-code)  
* [VSCode](https://www.cerbos.dev/blog/agent-skill-for-writing-authorization-policies-in-vs-code)  
* [Codex](https://www.cerbos.dev/blog/agent-skill-for-writing-authorization-policies-in-codex-cli)  
* [OpenCode](https://www.cerbos.dev/blog/agent-skill-for-writing-authorization-policies-in-open-code)  
* [Pi](https://www.cerbos.dev/blog/agent-skill-for-writing-authorization-policies-in-pi)  
* [Kiro](https://www.cerbos.dev/blog/agent-skill-for-writing-authorization-policies-in-aws-kiro)

## FAQ

### How do I install the Cerbos policy skill in Cursor?

You install the Cerbos policy skill in Cursor using the cross-agent installer. Run npx skills add cerbos/skills \--skill cerbos-policy \-a cursor from your terminal and the skill lands at `.cursor/skills/cerbos-policy/SKILL.md`. Cursor reloads automatically, or you can force a reload through the command palette.

### Does the Cerbos policy skill use Cursor's composer context? 

Yes, the Cerbos policy skill uses Cursor's composer context. When you ask Cursor to add a new resource policy, the composer pulls the existing schema, derived roles, and test patterns into context, and the generated policy reflects those rather than producing standalone files.

### Can the Cerbos policy skill update an existing policy bundle in Cursor? 

Yes, the Cerbos policy skill can update an existing policy bundle in Cursor. Point Cursor at the existing repo before generating new policies, and the skill respects existing structure, adds to it, and avoids duplicating derived roles or schemas.

### How does validation work for the Cerbos policy skill in Cursor? 

Validation for the Cerbos policy skill in Cursor runs the real Cerbos compiler via Docker inside the integrated terminal. The agent reads the output, walks errors in priority order (YAML syntax, schema, compile, tests), fixes one issue per pass, and stops after three failed attempts on the same error.
