auth-implementation-patterns — скилл для Claude: JWT, OAuth2, RBAC
Скилл для проектирования аутентификации и авторизации: JWT, OAuth2, сессии, роли. Пригодится, когда пишете вход в систему или чините дыру в доступе.
/plugin marketplace add wshobson/agents
/plugin install developer-essentials@claude-code-workflowsЧто делает auth-implementation-patterns
Скилл описывает, как устроены аутентификация и авторизация, и разводит эти два понятия. Первое отвечает на вопрос «кто ты»: проверка личности, выдача сессий и токенов, вход и выход. Второе — «что тебе можно»: проверка прав, роли, владение ресурсом.
Внутри разобраны три подхода: сессии на сервере с идентификатором в cookie, токены JWT без состояния и OAuth2 с OpenID Connect для входа через Google или GitHub и корпоративного SSO. Отдельно идёт список типовых ошибок — пароли без хеширования, JWT в localStorage, бессрочные токены, проверка прав только на клиенте. Подробные примеры лежат в references/details.md, этот файл читают, когда краткого описания не хватает.
Ставить стоит, если вы делаете вход с нуля или переписываете старую схему доступа. Если аутентификация уже работает и вопрос не в ней, скилл ничего не добавит.
Какие задачи решает
- спроектировать вход в систему на JWT или сессиях
- добавить вход через Google или GitHub по OAuth2
- развести роли и права доступа в API
- закрыть REST или GraphQL от неавторизованных запросов
- найти причину, по которой токен или сессия ведут себя не так
Примеры запросов агенту
- помоги спроектировать аутентификацию для REST API на JWT
- добавь вход через GitHub по OAuth2 в текущий проект
- проверь мою схему RBAC и скажи, где дыры
Как установить auth-implementation-patterns
1Через маркетплейс плагинов
/plugin marketplace add wshobson/agents/plugin install developer-essentials@claude-code-workflows2Через Skills CLI (Vercel)
npx skills add wshobson/agents --skill auth-implementation-patterns -a claude-code3Вручную: положить файлы
~/.claude/skills/auth-implementation-patterns/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/auth-implementation-patterns/
1Через Skills CLI (Vercel)
npx skills add wshobson/agents --skill auth-implementation-patterns -a codex2Вручную: положить файлы
.agents/skills/auth-implementation-patterns/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add wshobson/agents --skill auth-implementation-patterns -a cursor2Вручную: положить файлы
.cursor/skills/auth-implementation-patterns/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install wshobson/agents auth-implementation-patterns2Вручную: положить файлы
.github/skills/auth-implementation-patterns/SKILL.mdКомандой платформы
gemini skills install https://github.com/wshobson/agents --path plugins/developer-essentials/skills/auth-implementation-patternsВручную: положить файлы
.devin/skills/auth-implementation-patterns/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Claude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
Похожие
Вопросы о auth-implementation-patterns
Как установить auth-implementation-patterns в Claude?
Через маркетплейс плагинов: /plugin marketplace add wshobson/agents, затем /plugin install developer-essentials@claude-code-workflows. Либо напрямую: npx skills add wshobson/agents --skill auth-implementation-patterns -a claude-code.
Что делает auth-implementation-patterns?
Разбирает паттерны аутентификации и авторизации: сессии, JWT, OAuth2, RBAC. Помогает выбрать схему и не наступить на типовые ошибки вроде JWT в localStorage.
Для каких платформ подходит скилл?
Claude Code, Codex и Cursor. Для каждой платформы своя команда установки, файл скилла кладётся в её каталог.
Исходный текст
SKILL.md · MIT
--- name: auth-implementation-patterns description: Master authentication and authorization patterns including JWT, OAuth2, session management, and RBAC to build secure, scalable access control systems. Use when implementing auth systems, securing APIs, or debugging security issues. --- # Authentication & Authorization Implementation Patterns Build secure, scalable authentication and authorization systems using industry-standard patterns and modern best practices. ## When to Use This Skill - Implementing user authentication systems - Securing REST or GraphQL APIs - Adding OAuth2/social login - Implementing role-based access control (RBAC) - Designing session management - Migrating authentication systems - Debugging auth issues - Implementing SSO or multi-tenancy ## Core Concepts ### 1. Authentication vs Authorization **Authentication (AuthN)**: Who are you? - Verifying identity (username/password, OAuth, biometrics) - Issuing credentials (sessions, tokens) - Managing login/logout **Authorization (AuthZ)**: What can you do? - Permission checking - Role-based access control (RBAC) - Resource ownership validation - Policy enforcement ### 2. Authentication Strategies **Session-Based:** - Server stores session state - Session ID in cookie - Traditional, simple, stateful **Token-Based (JWT):** - Stateless, self-contained - Scales horizontally - Can store claims **OAuth2/OpenID Connect:** - Delegate authentication - Social login (Google, GitHub) - Enterprise SSO ## Detailed patterns and worked examples Detailed pattern documentation lives in `references/details.md`. Read that file when the navigation tier above is insufficient. ## Best Practices 1. **Never Store Plain Passwords**: Always hash with bcrypt/argon2 2. **Use HTTPS**: Encrypt data in transit 3. **Short-Lived Access Tokens**: 15-30 minutes max 4. **Secure Cookies**: httpOnly, secure, sameSite flags 5. **Validate All Input**: Email format, password strength 6. **Rate Limit Auth Endpoints**: Prevent brute force attacks 7. **Implement CSRF Protection**: For session-based auth 8. **Rotate Secrets Regularly**: JWT secrets, session secrets 9. **Log Security Events**: Login attempts, failed auth 10. **Use MFA When Possible**: Extra security layer ## Common Pitfalls - **Weak Passwords**: Enforce strong password policies - **JWT in localStorage**: Vulnerable to XSS, use httpOnly cookies - **No Token Expiration**: Tokens should expire - **Client-Side Auth Checks Only**: Always validate server-side - **Insecure Password Reset**: Use secure tokens with expiration - **No Rate Limiting**: Vulnerable to brute force - **Trusting Client Data**: Always validate on server
© Seth Hobson · MIT · wshobson/agents