Authorization

From clawic/skills · View interactive version

Authorization is an AI agent skill from the GitHub repository clawic/skills. Build secure access control with RBAC, ABAC, permissions, policies, and scope-based authorization.

How to use this skill

Skill file

When to Use

User needs to control what actions users can perform. Agent handles permission design, role hierarchies, policy evaluation, and access control middleware.

Quick Reference

| Topic | File |

|-------|------|

| RBAC vs ABAC comparison | models.md |

| Implementation patterns | patterns.md |

| Framework middleware | middleware.md |

Core Rules

1. Auth ≠ Authorization

2. Principle of Least Privilege

3. Choose the Right Model

| Model | Best For | Complexity |

|-------|----------|------------|

| ACL | Simple resource ownership | Low |

| RBAC | Organizational hierarchies | Medium |

| ABAC | Dynamic context-based rules | High |

| ReBAC | Social graphs, sharing | High |

Start simple → evolve when needed.

4. Role Design Patterns

5. Permission Naming

resource:action:scope
documents:write:own     ← Can edit own documents
documents:write:team    ← Can edit team documents
documents:delete:all    ← Can delete any document

Consistent naming prevents ambiguity.

6. Policy Evaluation Order

  1. Explicit deny → always wins
  2. Explicit allow → checked second
  3. No match → default deny
  4. Log all denials for debugging

7. Never Hardcode

// ❌ Bad — hardcoded role check
if (user.role === 'admin') { ... }

// ✅ Good — permission check
if (can(user, 'settings:update')) { ... }

Roles change. Permissions are stable.

Common Traps

Security & Privacy

Data that stays local:

This skill does NOT:

Feedback

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.