
openfga
OpenFGA authorization modeling best practices and guidelines. This skill should be used when authoring, reviewing, or refactoring OpenFGA authorization models. Triggers on tasks involving OpenFGA models, relationship definitions, permission structures, .fga files, .fga.yaml test files, or OpenFGA SDK usage in JavaScript, TypeScript, Go, Python, Java, or .NET.
OpenFGA authorization modeling best practices and guidelines. This skill should be used when authoring, reviewing, or refactoring OpenFGA authorization models. Triggers on tasks involving OpenFGA models, relationship definitions, permission structures, .fga files, .fga.yaml test files, or OpenFGA SDK usage in JavaScript, TypeScript, Go, Python, Java, or .NET.
OpenFGA Best Practices
Comprehensive guide for authoring OpenFGA authorization models and using OpenFGA SDKs, maintained for AI agents and developers. Contains rules across 7 categories covering core concepts, relationship patterns, testing, custom roles, model optimization, and language-specific SDK usage.
When to Apply
Reference these guidelines when:
- Creating new OpenFGA authorization models
- Defining types and relations in
.fgafiles - Writing relationship tuples
- Testing models with
.fga.yamlfiles - Implementing custom roles
- Reviewing or refactoring existing models
- Integrating OpenFGA with JavaScript/TypeScript, Go, Python, Java, or .NET applications
Rule Categories by Priority
| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | Core Concepts | CRITICAL | core- |
| 2 | Relationship Definitions | CRITICAL | relation- |
| 3 | Testing & Validation | HIGH | test- |
| 4 | Model Design | HIGH | design- |
| 5 | Custom Roles | MEDIUM | roles- |
| 6 | Optimization | MEDIUM | optimize- |
| 7 | SDK Integration | HIGH | sdk- |
Quick Reference
1. Core Concepts (CRITICAL)
core-types- Define types for all entity classescore-schema-version- Always use schema 1.1core-relations- Define relations on object types, not user typescore-tuples- Write relationship tuples to establish factscore-separation- Separate schema (model) from data (tuples)
2. Relationship Definitions (CRITICAL)
relation-direct- Use[type]for direct assignmentsrelation-concentric- Useorfor permission inheritancerelation-indirect- UseX from Yfor hierarchical accessrelation-usersets- Usetype#relationfor group-based accessrelation-conditions- Use CEL conditions for contextual authorizationrelation-wildcards- Usetype:*for public access carefully
3. Testing & Validation (HIGH)
test-fga-yaml- Structure tests in.fga.yamlfilestest-check-assertions- Write check assertions for permission verificationtest-list-objects- Test list_objects queriestest-list-users- Test list_users queriestest-conditions- Test conditional relationships with contexttest-cli- Use OpenFGA CLI for model testing
4. Model Design (HIGH)
design-permissions- Definecan_*relations for permissionsdesign-hierarchy- Model parent-child relationships correctlydesign-organization- Structure organization-level accessdesign-naming- Use clear, consistent naming conventions
5. Custom Roles (MEDIUM)
roles-simple- Implement simple user-defined rolesroles-assignments- Use role assignments for resource-specific rolesroles-static-combo- Combine static and custom rolesroles-when-to-use- Choose the right role pattern
6. Optimization (MEDIUM)
optimize-simplify- Remove unused types and relationsoptimize-tuples- Use indirect relationships to reduce tuple countoptimize-type-restrictions- Apply appropriate type restrictions
7. SDK Integration (HIGH)
sdk-javascript- JavaScript/TypeScript SDK usagesdk-go- Go SDK usagesdk-python- Python SDK usage (async and sync)sdk-java- Java SDK usagesdk-dotnet- .NET SDK usage
How to Use
Read individual rule files for detailed explanations and code examples:
rules/core-types.md
rules/relation-concentric.md
rules/test-fga-yaml.md
Each rule file contains:
- Brief explanation of why it matters
- Incorrect code example with explanation
- Correct code example with explanation
- Additional context and references
Full Compiled Document
For the complete guide with all rules expanded: AGENTS.md
You Might Also Like
Related Skills

create-pr
Creates GitHub pull requests with properly formatted titles that pass the check-pr-title CI validation. Use when creating PRs, submitting changes for review, or when the user says /pr or asks to create a pull request.
n8n-io
electron-chromium-upgrade
Guide for performing Chromium version upgrades in the Electron project. Use when working on the roller/chromium/main branch to fix patch conflicts during `e sync --3`. Covers the patch application workflow, conflict resolution, analyzing upstream Chromium changes, and proper commit formatting for patch fixes.
electron
pr-creator
Use this skill when asked to create a pull request (PR). It ensures all PRs follow the repository's established templates and standards.
google-gemini
clawdhub
Use the ClawdHub CLI to search, install, update, and publish agent skills from clawdhub.com. Use when you need to fetch new skills on the fly, sync installed skills to latest or a specific version, or publish new/updated skill folders with the npm-installed clawdhub CLI.
moltbot
tmux
Remote-control tmux sessions for interactive CLIs by sending keystrokes and scraping pane output.
moltbot
create-pull-request
Create a GitHub pull request following project conventions. Use when the user asks to create a PR, submit changes for review, or open a pull request. Handles commit analysis, branch management, and PR creation using the gh CLI tool.
cline