authorization

Designs authorization systems covering RBAC, ABAC, ReBAC models and XACML architecture patterns.

Updated Jan 30, 2026
One-click install
npx skills add https://github.com/RyoMa99/chezmoi_dotfiles --skill authorization-ryoma99
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: authorization
Source: https://github.com/RyoMa99/chezmoi_dotfiles/tree/main/dot_claude/skills/authorization
Command: npx skills add https://github.com/RyoMa99/chezmoi_dotfiles --skill authorization-ryoma99

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Designing access control is error-prone: teams pick the wrong authorization model, scatter permission checks across layers, and leave enforcement gaps that lead to privilege escalation bugs. This Skill provides a structured decision framework for authorization design, from model selection through architecture to structural enforcement. ## Core Features & Use Cases - Model Selection: Decision trees for choosing between RBAC, ABAC, ReBAC, or hybrids, with warnings about role explosion. - XACML Architecture: Guidance on separating PAP, PIP, PDP, and PEP responsibilities, plus decentralized vs. centralized placement patterns. - DDD Layer Placement: Rules for deciding whether authorization logic belongs in the application layer, domain layer (Specification pattern), or a dedicated bounded context. - Structural Enforcement: Four levels of enforcement strength, from architecture tests (ArchUnit) to Authorized<T> types and command bus middleware, with CQRS integration patterns. - Use Case: When reviewing code with @PreAuthorize annotations or designing a multi-tenant SaaS, use this Skill to decide where permission checks live, how to prevent forgotten checks, and how to combine ORM filters with PostgreSQL Row-Level Security. ## Quick Start Ask the AI to design the authorization model for a new feature, specifying your roles, resources, and whether permissions depend on entity relationships or attributes.

Frequently Asked Questions about authorization

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I choose between RBAC, ABAC, and ReBAC?

Choose RBAC when permissions map to fixed roles, ABAC when decisions depend on attributes like department or time, and ReBAC when access depends on entity relationships like sharing or folder hierarchies. In practice, start with an RBAC plus ABAC hybrid and add ReBAC only when relationship graphs are required.

Where should authorization logic live in a DDD layered architecture?

Place static role checks in the application layer, domain-state-dependent rules in the domain layer as Specifications, and complex cross-cutting rules in a dedicated bounded context. If a constraint holds regardless of the actor, it is a domain invariant and belongs in the entity, not in an authorization policy.

How do I prevent developers from forgetting authorization checks?

Use architecture tests like ArchUnit to verify every controller method has an authorization annotation, or enforce checks structurally with Authorized<T> types required as use case arguments. For CQRS systems, command bus middleware makes authorization impossible to bypass.

Should I use row-level security or application-level filtering for multi-tenant SaaS?

For multi-tenant SaaS where cross-tenant leakage is critical, combine ORM global filters with PostgreSQL Row-Level Security as a double layer. The ORM filter protects normal queries while RLS blocks direct SQL bypasses, configured to fail closed when the tenant setting is missing.

What is the difference between command-side and query-side authorization in CQRS?

Command-side authorization asks whether an operation may execute and returns explicit 403 errors, acting as a PDP. Query-side authorization filters which data is visible, acting as a PEP that silently excludes unauthorized rows via WHERE clauses or access scopes.

When should authorization move to a centralized service like OpenFGA or OPA?

Move to a centralized policy decision point when microservice count grows and rule consistency across services becomes hard to maintain, or when ReBAC relationship graph traversal requires a dedicated engine. Decentralized per-service authorization is simpler and faster for monoliths and single services.