claudegoodies
Command

authentication

From davila7

Generate Rails 8's built-in authentication system with modern security practices.

Install

/authentication

Facts

Status
Actively maintained
Last commit

Source preview

The instructions Claude Code reads when this command runs.

# Rails 8 Native Authentication Generator

Generate Rails 8's built-in authentication system with modern security practices.

## Purpose

This command helps you implement Rails 8's new native authentication system, eliminating the need for external gems like Devise for basic authentication needs.

## Usage

```
/authentication
```

## What this command does

1. **Generates authentication models** with secure password handling
2. **Creates authentication controllers** for login/logout/signup
3. **Adds authentication views** with modern styling
4. **Implements session management** with security best practices
5. **Sets up authentication helpers** for controllers and views

## Rails 8 Authentication Generator

```bash
# Generate authentication for User model
bin/rails generate authentication User

# Or specify custom model name
bin/rails generate authentication Account

# Generate with custom attributes
bin/rails generate authentication User first_name:string last_name:string
```

## Generated User Model

```ruby
# app/models/user.rb
class User < ApplicationRecord
  has_secure_password
  
  validates :email, presence: true, uniqueness: true
  validates :password, length: { minimum: 8 }, if: -> { new_record? || !password.blank? }
  
  normalizes :email, with: ->(email) { email.strip.downcase }
  
  before_save :normalize_email
  
  private
  
  def normalize_email
    self.email = 
View full source on GitHub →

Other slash commands