rbac-system

Enforce RBAC governance on Prisma models with checkPermission route protection and transactional auditing.

Updated Nov 11, 2025
One-click install
npx skills add https://github.com/codexyzdev/codexyz --skill rbac-system
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rbac-system
Source: https://github.com/codexyzdev/codexyz/tree/main/.trae/skills/rbac-system/rbac-system
Command: npx skills add https://github.com/codexyzdev/codexyz --skill rbac-system

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Administrators and developers struggle to consistently secure admin features and APIs without a clear RBAC strategy. This skill provides a comprehensive guide to implement and enforce role-based access control, permissions, and audit trails within your codebase.

Core Features & Use Cases

  • RBAC data model guidance using Prisma with Role, Permission, and RoleAuditLog.
  • API security patterns including checkPermission-based route protection and transactional auditing.
  • Auditing changes to roles and permissions to maintain an traceable authorization history.
  • Use Case: Implement roles for admins vs editors and protect sensitive endpoints with permission checks.

Quick Start

Use the RBAC skill as a reference to define roles and permissions in your app, protect endpoints with checkPermission, and add RoleAuditLog entries on changes.

Frequently Asked Questions about rbac-system

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

FAQPage Schema
How do I implement role-based access control with Prisma?

Role-based access control with Prisma is implemented by defining Role, Permission, and RoleAuditLog models. This establishes a structured authorization data model to govern user access levels and protected API routes.

How do I protect API routes using RBAC permissions?

Protecting API routes with RBAC permissions involves applying a checkPermission function to sensitive endpoints. This enforces defined permissions so only authorized roles can access specific administrative features.

How does transactional audit logging work for role changes?

Transactional audit logging for role changes records authorization history via prisma.$transaction. This ensures that every modification to roles and permissions is captured safely in a RoleAuditLog entry.

Can I use this RBAC guidance for editors versus admins?

Yes, you can use this RBAC guidance to implement distinct roles like editors versus admins. It provides patterns to define granular permissions and protect sensitive endpoints based on those specific role hierarchies.

What is the best way to secure admin features and trace authorization history?

The best way to secure admin features and trace authorization history is combining checkPermission route protection with transactional auditing. This approach enforces permissions while maintaining a traceable record of authorization changes.