add-authentication-system — Claude Code security command
Build an authentication layer for an existing application with a selected sign-in method. The command covers user accounts, session handling, access rules, and common security controls.
npx claude-code-templates@latest --command security/add-authentication-systemWhat add-authentication-system does
The add-authentication-system command examines the project's structure and existing login code before working on authentication. You can request username/password login, OAuth 2.0, JWT, SAML, MFA, or passwordless access. Choose the method through the command argument so the implementation matches the intended sign-in flow.
The requested work can include account registration, profile management, verification, login and logout, session handling, and route protection. It also covers role-based access control (RBAC), password hashing, request throttling, CSRF defenses, and secure cookies. Frontend elements, API endpoints, database models, and middleware are part of the integration scope.
The command can inspect project files such as package.json, requirements.txt, and Cargo.toml, along with environment settings and existing user models. Its permitted tools are Read, Write, Edit, and Bash. The security approach draws on OWASP authentication guidance; the resulting implementation still depends on the application's architecture and the selected login method.
What it helps with
- Add account registration and login to an application
- Set up OAuth 2.0, JWT, or multi-factor sign-in
- Restrict API endpoints and routes by user role
- Manage sessions and secure cookies
- Apply password hashing and request rate limits
Example prompts for the agent
- Add password-based login, account registration, verification, and secure session handling with
/add-authentication-system username/password. - Configure OAuth 2.0 for this application and connect authorization to its API using
/add-authentication-system --oauth. - Implement multi-factor authentication and protect the application's routes with
/add-authentication-system --mfa.
How to install add-authentication-system
1claude-code-templates
npx claude-code-templates@latest --command security/add-authentication-system2Manually: put the files in place
.claude/commands/add-authentication-system.mdCall it with /add-authentication-system. For all projects use ~/.claude/commands/
Manually: put the files in place
~/.codex/prompts/add-authentication-system.mdCall it with /prompts:add-authentication-system. Codex marks this format deprecated in favour of skills
Manually: put the files in place
.github/prompts/add-authentication-system.prompt.mdManually: put the files in place
.gemini/commands/add-authentication-system.tomlGemini stores commands as TOML: the prompt text goes into the prompt field
Questions about add-authentication-system
How do I install add-authentication-system in Claude Code?
Run npx claude-code-templates@latest --command security/add-authentication-system. The command file is placed at .claude/commands/add-authentication-system.md.
What does add-authentication-system do?
It helps build application authentication, user account management, and access controls. Its scope also includes session security, password protection, and API integration.
Which authentication methods can I choose?
The command supports username/password login, OAuth 2.0, JWT, SAML, MFA, and passwordless authentication. Pass your preferred method as an argument.
Source text
add-authentication-system.md · MIT
--- allowed-tools: Read, Write, Edit, Bash argument-hint: "[auth-method] | --oauth | --jwt | --mfa | --passwordless" description: Implement secure user authentication system with chosen method and security best practices --- # Add Authentication System Implement secure user authentication system: **$ARGUMENTS** ## Current Application State - Framework detection: @package.json or @requirements.txt or @Cargo.toml - Existing auth: !`grep -r "auth\|login\|jwt\|session" src/ --include="*.js" --include="*.py" --include="*.rs" | wc -l` - Security config: @.env* (check for auth-related variables) - Database setup: Check for user models or auth tables ## Task Implement comprehensive authentication system with security best practices: **Authentication Methods**: Choose from username/password, OAuth 2.0, JWT, SAML, MFA, or passwordless based on $ARGUMENTS **Implementation Areas**: 1. **User Management** - Registration, profiles, password policies, account verification 2. **Authentication Flow** - Login/logout, session management, token handling, middleware 3. **Authorization System** - RBAC, permissions, route protection, API security 4. **Security Hardening** - Password hashing, rate limiting, CSRF protection, secure cookies 5. **Integration** - Frontend components, API endpoints, database models, middleware **Security Standards**: Implement OWASP authentication guidelines, secure session management, and proper error handling. **Output**: Production-ready authentication system with comprehensive security controls and user-friendly interface.
© davila7 · MIT · davila7/claude-code-templates