RBAC Design Prompt
Design a role model that scales — roles derived from real permissions, the role-permission mapping, and the inheritance and edge cases before you hardcode 'isAdmin'.
Overview
RBAC done wrong becomes a tangle of special-case checks and a role nobody dares change. This prompt designs the model properly: it starts from the actual permissions the system needs, groups them into roles that map to real jobs, defines inheritance and the deny rules, and pressure-tests the edge cases (the admin who shouldn't see billing, the cross-team access) before any of it is code.
Why This Works
- Starting from permissions stops roles from becoming arbitrary buckets
- Explicit deny rules catch the leak that a missing grant would allow
- Designing edge cases into the model avoids the special-case checks that rot RBAC
Best for
- Systems with more than two or three user types
- Apps where access mistakes leak data
- Teams about to hardcode role checks
Not for
- Reviewing existing authorization code — use the Authorization Review Prompt
- Building the permission matrix artifact alone — use the Permission Matrix Prompt
Use cases
- Designing roles and permissions for a new system
- Replacing a tangle of isAdmin checks with a real model
- Mapping permissions to roles before implementation