rails-controllers

Organize Rails controllers with RESTful actions, concerns, and params.expect.

4|2|Updated Dec 12, 2025
One-click install
npx skills add https://github.com/rubakas/agent-notes --skill rails-controllers-rubakas
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rails-controllers
Source: https://github.com/rubakas/agent-notes/tree/main/rails-controllers
Command: npx skills add https://github.com/rubakas/agent-notes --skill rails-controllers-rubakas

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Rails controllers often become bloated as business logic leaks into actions. This Skill provides a structured template and best practices to keep controllers thin, leverage concerns, standard REST patterns, and consistent parameter handling.

Core Features & Use Cases

  • Thin controllers: delegate business logic to models.
  • Standard REST: index, show, new, create, edit, update, destroy.
  • Concerns for shared behavior: authentication, scoping, etc.
  • Respond to multiple formats: HTML, JSON, Turbo Stream.
  • File structure guidance and parameter handling with Rails 8+ params.expect.

Quick Start

Add the controller patterns to your CLAUDE.md and reference @agent-notes/rails/index.md.

Frequently Asked Questions about rails-controllers

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure Rails controllers to keep them thin and scalable?

Structure Rails controllers by delegating business logic to models and using concerns for shared behavior. This pattern enforces standard RESTful actions and consistent parameter handling, keeping controllers thin and scalable across nested resources.

What is the best way to handle parameters in Rails 8 controllers?

The best way to handle parameters in Rails 8 controllers is using params.expect with safe defaults. This approach standardizes parameter handling, ensuring consistent and secure data filtering across standard REST actions like create and update.

How do I organize shared behavior across multiple Rails controllers?

Organize shared behavior across Rails controllers by extracting common functionality like authentication and scoping into concerns. This promotes file structure consistency and prevents code duplication across your controller architecture.

Can Rails controllers respond to HTML, JSON, and Turbo Stream formats consistently?

Rails controllers can consistently respond to HTML, JSON, and Turbo Stream formats by applying structured response strategies. This approach standardizes multi-format handling within standard RESTful actions without bloating controller logic.

Does this Rails controller pattern work for nested resource architectures?

This Rails controller pattern explicitly supports nested resource architectures. It provides scalable controller templates and standardized parameter handling suitable for organizing complex nested resources within typical Rails applications.

When do I need a standardized Rails controller template?

You need a standardized Rails controller template when business logic begins leaking into actions, causing controllers to become bloated. Applying a structured pattern library with RESTful actions and concerns restores maintainable file organization.