
This teaches Claude how to design OpenFGA authorization models the right way. It covers the full workflow: defining types and relations, writing tuples, deriving can_* permissions, setting up type restrictions, and validating everything with .fga.yaml tests. You get guidance on hierarchical structures, organization-level access, role patterns, and tuple optimization. The skill includes SDK references for JavaScript, Go, Python, Java, and .NET when you need to integrate, but the real value is in the step-by-step modeling workflow that pushes you to validate and test before calling anything done. Good for both new models and refactoring existing ones that have gotten messy.
$ npx -y skills add openfga/agent-skills --skill openfga --agent claude-codeInstalls into .claude/skills of the current project.
Use this skill to design and review OpenFGA models end to end: define types and relations, write tuples, derive can_* permissions, choose usersets and inheritance patterns, and validate behavior with .fga.yaml tests and CLI checks.
Minimal model:
model
schema 1.1
type user
type organization
relations
define admin: [user]
define member: [user] or admin
type document
relations
define organization: [organization]
define owner: [user]
define can_edit: owner or admin from organization
define can_view: can_edit or member from organization
Example tuples:
organization:acme#admin@user:alice
document:roadmap#organization@organization:acme
document:roadmap#owner@user:bob
Example test targets:
check that user:alice can view and edit document:roadmapcheck that user:bob can edit their own documentlist_users for document:roadmap#can_viewlist_objects for documents user:alice can editWhen a workflow step points to a rule ID, open the matching file in references/ for detailed guidance and examples.
Sponsors