Claude Rails Developer Kit automates Ruby on Rails application development. It transforms Claude Code into a specialized Rails engineering team for your terminal. Ideal for operations teams building modern web applications.
git clone https://github.com/alec-c4/claude-rails-dev.gitClaude Rails Developer Kit automates Ruby on Rails application development. It transforms Claude Code into a specialized Rails engineering team for your terminal. Ideal for operations teams building modern web applications.
No install command available. Check the GitHub repository for manual installation instructions.
git clone https://github.com/alec-c4/claude-rails-devCopy the install command above and run it in your terminal.
Launch Claude Code, Cursor, or your preferred AI coding agent.
Use the prompt template or examples below to test the skill.
Adapt the skill to your specific use case and workflow.
I need to build a [FEATURE] for my Rails application. The feature should [DESCRIBE_FUNCTIONALITY]. Here's the current codebase structure: [CODEBASE_STRUCTURE]. Generate the necessary Rails code, including models, controllers, views, and any required migrations. Also, provide a step-by-step implementation guide.
Based on your request, I've generated the following Rails code for your new user authentication feature. Here's the implementation guide:
1. First, create the User model with the following code:
```ruby
class CreateUsers < ActiveRecord::Migration[6.1]
def change
create_table :users do |t|
t.string :email, null: false
t.string :password_digest, null: false
t.timestamps
end
end
end
```
2. Generate the User model with:
```ruby
class User < ApplicationRecord
has_secure_password
validates :email, presence: true, uniqueness: true
end
```
3. Create the SessionsController for handling logins:
```ruby
class SessionsController < ApplicationController
def new
end
def create
user = User.find_by(email: params[:email])
if user&.authenticate(params[:password])
session[:user_id] = user.id
redirect_to root_path, notice: 'Logged in successfully'
else
flash.now[:alert] = 'Invalid email or password'
render :new
end
end
def destroy
session[:user_id] = nil
redirect_to root_path, notice: 'Logged out successfully'
end
end
```
4. Create the corresponding views in app/views/sessions:
- new.html.erb:
```erb
<h1>Log In</h1>
<%= form_with url: sessions_path do |form| %>
<div>
<%= form.label :email %>
<%= form.email_field :email %>
</div>
<div>
<%= form.label :password %>
<%= form.password_field :password %>
</div>
<div>
<%= form.submit 'Log In' %>
</div>
<% end %>
```
- _form.html.erb (partial for login form):
```erb
<%= form_with model: @user, url: sessions_path do |form| %>
<div>
<%= form.label :email %>
<%= form.email_field :email %>
</div>
<div>
<%= form.label :password %>
<%= form.password_field :password %>
</div>
<div>
<%= form.submit 'Log In' %>
</div>
<% end %>
```
5. Add authentication routes to config/routes.rb:
```ruby
resources :sessions, only: [:new, :create, :destroy]
```
6. Create a UsersController for registration:
```ruby
class UsersController < ApplicationController
def new
@user = User.new
end
def create
@user = User.new(user_params)
if @user.save
redirect_to root_path, notice: 'Account created successfully'
else
render :new
end
end
private
def user_params
params.require(:user).permit(:email, :password, :password_confirmation)
end
end
```
7. Create the registration views in app/views/users:
- new.html.erb:
```erb
<h1>Sign Up</h1>
<%= form_with model: @user, url: users_path do |form| %>
<div>
<%= form.label :email %>
<%= form.email_field :email %>
end
<div>
<%= form.label :password %>
<%= form.password_field :password %>
</div>
<div>
<%= form.label :password_confirmation %>
<%= form.password_field :password_confirmation %>
</div>
<div>
<%= form.submit 'Sign Up' %>
</div>
<% end %>
```
8. Add registration routes to config/routes.rb:
```ruby
resources :users, only: [:new, :create]
```
9. Add authentication helpers to ApplicationController:
```ruby
class ApplicationController < ActionController::Base
helper_method :current_user, :logged_in?
private
def current_user
@current_user ||= User.find_by(id: session[:user_id]) if session[:user_id]
end
def logged_in?
!!current_user
end
end
```
10. Add a navigation partial to app/views/layouts/_navigation.html.erb:
```erb
<% if logged_in? %>
<%= link_to 'Log Out', sessions_path, method: :delete %>
<% else %>
<%= link_to 'Log In', new_session_path %>
<%= link_to 'Sign Up', new_user_path %>
<% end %>
```
To implement this feature, run the following commands in your terminal:
1. `rails generate migration CreateUsers email:string password_digest:string`
2. `rails db:migrate`
3. `rails generate controller Sessions new create destroy`
4. `rails generate controller Users new create`
After running these commands, copy the generated code into the appropriate files and you'll have a fully functional user authentication system in your Rails application.Automate your browser workflows effortlessly
Your one-stop shop for church and ministry supplies.
AI assistant built for thoughtful, nuanced conversation
neobank for e-commerce businesses
Customer feedback management made simple
Enterprise workflow automation and service management platform
Take a free 3-minute scan and get personalized AI skill recommendations.
Take free scan