agentleFS
sivaprasadreddysivaprasadreddy/sivalabs-agent-skills/skills/authentication-authorization/SKILL.md

authentication-authorization

Skill198 starsChanged 4 days agoMITView on GitHub

Design identity, authentication, sessions, authorization, roles, permissions, and tenant access consistently across application types.

The file

We split this skill into the rules it gives an agent

12 rules. About 0 are common, 12 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈12

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use when adding login, logout, registration, account recovery, federation, service identities, roles, permissions, tenant isolation, or …

    line 12
  2. Distinctive:

    Prefer established identity protocols and maintained identity providers over custom authentication mechanisms.

    line 15
  3. Distinctive:

    Treat authentication (who is the caller?) and authorization (what may they do?) as separate decisions.

    line 16
  4. Distinctive:

    Use stable internal subject identifiers.

    line 18
  5. Distinctive:

    Keep service-to-service identities separate from human identities.

    line 23
  6. Distinctive:

    Test both permitted and forbidden access paths, including cross-user and cross-tenant access.

    line 34
  7. Distinctive:

    Never store plaintext passwords.

    line 37
  8. Distinctive:

    Avoid long-lived bearer credentials unless there is a justified design and compensating protection.

    line 39
  9. Distinctive:

    Do not trust client-supplied roles, user IDs, tenant IDs, or permission claims without verification.

    line 41
  10. Distinctive:

    Avoid account enumeration in public-facing recovery and login responses where relevant.

    line 44
  11. Distinctive:

    Ensure administrative and support access is tightly controlled and auditable.

    line 46
  12. Distinctive:

    Document identity types, authentication flow, session/token policy, permission model, tenant/ownership rules, lifecycle workflows, and …

    line 59

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Authentication and Authorization

Purpose

Guide identity and access-control design independently of any identity provider, protocol, framework, or language.

When to use

Use when adding login, logout, registration, account recovery, federation, service identities, roles, permissions, tenant isolation, or protected operations.

Design principles

  • Prefer established identity protocols and maintained identity providers over custom authentication mechanisms.
  • Treat authentication (who is the caller?) and authorization (what may they do?) as separate decisions.
  • Define the application’s identity model before implementing endpoints.
  • Use stable internal subject identifiers; do not rely on mutable email addresses as primary identity keys.
  • Model permissions around actions and resources. Roles may group permissions but should not become the only authorization mechanism when resource-level rules are needed.
  • Enforce authorization at the trusted server-side boundary for every protected operation.
  • Apply least privilege and deny by default.
  • Make ownership, tenant membership, delegation, and administrative access explicit.
  • Keep service-to-service identities separate from human identities.
  • Design account lifecycle and recovery as security-critical workflows.

Workflow

  1. Identify user types, service actors, tenants, and administrative actors.
  2. Define identity attributes and stable identifiers.
  3. Select an established authentication approach appropriate to clients and deployment.
  4. Define session/token lifecycle: issuance, expiry, renewal, revocation, storage, and logout semantics.
  5. Define authorization rules for actions, resources, ownership, and tenant boundaries.
  6. Specify registration, verification, recovery, lockout, and account deactivation behavior where applicable.
  7. Define audit events for login, failures, privilege changes, and sensitive actions.
  8. Test both permitted and forbidden access paths, including cross-user and cross-tenant access.

Security expectations

  • Never store plaintext passwords; use a purpose-built password hashing algorithm and appropriate parameters.
  • Protect credentials and tokens in transit and at rest.
  • Avoid long-lived bearer credentials unless there is a justified design and compensating protection.
  • Validate token issuer, audience, signature, expiry, and relevant claims.
  • Do not trust client-supplied roles, user IDs, tenant IDs, or permission claims without verification.
  • Protect browser sessions with appropriate cookie flags and CSRF defenses.
  • Rate-limit credential, recovery, and verification workflows.
  • Avoid account enumeration in public-facing recovery and login responses where relevant.
  • Revoke or invalidate sessions after credential changes and account compromise.
  • Ensure administrative and support access is tightly controlled and auditable.

Authorization test matrix

For each protected resource, test:

  • Anonymous caller.
  • Authenticated caller without permission.
  • Authorized owner.
  • Different authenticated user.
  • User in a different tenant.
  • Privileged administrator.
  • Revoked, expired, or disabled identity.

Expected output

Document identity types, authentication flow, session/token policy, permission model, tenant/ownership rules, lifecycle workflows, and audit requirements. Avoid adding roles or permission abstractions that the product does not need.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.