Use when creating new Rails files, naming models/controllers/views, organizing directories, or when unsure about Rails naming conventions. Also applies when reviewing code for convention violations like incorrect pluralization, wrong file locations, or non-standard naming. Covers file structure, naming patterns for models, controllers, views, routes, jobs, mailers, and migrations.
Guides Rails file creation, naming, and organization while ensuring adherence to standard conventions and best practices.
npx claudepluginhub chaserx/cpcThis skill inherits all available tools. When active, it can use any tool Claude has access to.
references/model-controller-examples.mdreferences/restful-design.mdGuidance for following Rails conventions, file organization, naming patterns, and "The Rails Way" for Rails 7+ applications.
Rails provides sensible defaults. Follow conventions to benefit from:
app/
├── assets/ # CSS, images, fonts (managed by asset pipeline)
├── channels/ # Action Cable channels
├── components/ # ViewComponents (if used)
├── controllers/ # Request handlers
│ ├── concerns/ # Shared controller logic
│ └── api/ # API controllers (namespaced)
├── helpers/ # View helpers
├── javascript/ # JavaScript/Stimulus controllers
├── jobs/ # Background jobs
├── mailers/ # Email senders
├── models/ # ActiveRecord models
│ └── concerns/ # Shared model logic
├── services/ # Service objects (optional)
├── views/ # Templates and partials
│ ├── layouts/ # Application layouts
│ └── shared/ # Shared partials
config/
├── routes.rb # Routing configuration
├── database.yml # Database configuration
├── environments/ # Environment-specific settings
└── initializers/ # Startup configuration
db/
├── migrate/ # Database migrations
├── schema.rb # Current schema (auto-generated)
└── seeds.rb # Seed data
lib/
├── tasks/ # Rake tasks
└── generators/ # Custom generators
spec/ or test/ # Test files (mirrors app/ structure)
User, OrderItem, BlogPost)user.rb, order_item.rb, blog_post.rb)users, order_items, blog_posts)_id (user_id, order_item_id)UsersController, OrderItemsController)users_controller.rb, order_items_controller.rb)index, show, new, create, edit, update, destroy)app/views/users/)index.html.erb, show.json.jbuilder)_form.html.erb, _user.html.erb)resources :users, resources :order_items)resource :profile, resource :dashboard)SendWelcomeEmailJob, ProcessPaymentJob)UserMailer, OrderMailer)welcome_email, order_confirmation)20240101120000_create_users.rb)CreateUsers, AddEmailToUsers)| What | Convention | Example |
|---|---|---|
| Model class | Singular PascalCase | User |
| Model file | Singular snake_case | user.rb |
| Table | Plural snake_case | users |
| Controller | Plural + Controller | UsersController |
| View folder | Plural snake_case | views/users/ |
| Route | Plural resource | resources :users |
| Foreign key | model_id | user_id |
| Join table | Alphabetical | posts_tags |
Follow these conventions consistently to create maintainable Rails applications that are easy to understand and extend.
For detailed code examples and patterns, consult:
references/restful-design.md — Standard REST actions table, custom actions, nested resources, namespace/scope patterns, and controller structurereferences/model-controller-examples.md — Association naming, polymorphic/self-referential associations, validation patterns, scope naming and chaining, callback conventions, and concern patternsservice-patterns — Service objects, form objects, query objects, and interactorsactive-record-patterns — ActiveRecord query and association patterns in depthaction-controller-patterns — Controller design patterns and advanced techniquesrails-antipatterns — Common anti-patterns, code smells, and refactoring guidanceActivates when the user asks about AI prompts, needs prompt templates, wants to search for prompts, or mentions prompts.chat. Use for discovering, retrieving, and improving prompts.
Search, retrieve, and install Agent Skills from the prompts.chat registry using MCP tools. Use when the user asks to find skills, browse skill catalogs, install a skill for Claude, or extend Claude's capabilities with reusable AI agent components.
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems. Create original algorithmic art rather than copying existing artists' work to avoid copyright violations.