Auth

From clawic/skills · View interactive version

Auth is an AI agent skill from the GitHub repository clawic/skills. Build secure authentication with sessions, JWT, OAuth, passwordless, MFA, and SSO for web and mobile apps.

How to use this skill

Skill file

Documentation-Only Skill

This skill is a reference guide. It contains code examples that demonstrate authentication patterns.

Important: The code examples in this skill:

The agent provides guidance. The developer implements in their own project.

When to Use

User needs guidance on implementing authentication. Agent explains patterns for login flows, token strategies, password security, OAuth integration, and session management.

Quick Reference

| Topic | File |

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

| Session vs JWT strategies | strategies.md |

| Password handling | passwords.md |

| MFA implementation | mfa.md |

| OAuth and social login | oauth.md |

| Framework middleware | middleware.md |

Scope

This skill ONLY:

This skill NEVER:

Note on Code Examples

Code examples in auxiliary files show:

The agent does not have access to these values. They demonstrate what the developer should configure in their own project.

Core Rules

1. Auth vs Authorization

2. Choose the Right Strategy

| Use Case | Strategy | Why |

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

| Traditional web app | Sessions + cookies | Simple, instant revocation |

| Mobile app | JWT (short-lived) + refresh token | No cookies, offline support |

| API/microservices | JWT | Stateless, scalable |

| Enterprise | SSO (SAML/OIDC) | Central identity management |

| Consumer | Social login + email fallback | Reduced friction |

3. Never Roll Your Own Crypto

4. Defense in Depth

Rate limiting -> CAPTCHA -> Account lockout -> MFA -> Audit logging

5. Secure by Default

6. Fail Securely

// Bad - reveals if email exists
if (!user) return { error: 'User not found' };

// Good - same error for both cases
if (!user || !validPassword) {
  return { error: 'Invalid credentials' };
}

7. Log Everything (Except Secrets)

| Log | Do Not Log |

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

| Login success/failure | Passwords |

| IP, user agent, timestamp | Tokens |

| MFA events | Session IDs |

| Password changes | Recovery codes |

Common Traps

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.