rails-controller

Generate Rails REST controllers with TDD from failing tests to passing behavior.

1|Updated Jan 8, 2026
One-click install
npx skills add https://github.com/LaunchPadLab/ai-bank --skill rails-controller-launchpadlab
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rails-controller
Source: https://github.com/LaunchPadLab/ai-bank/tree/main/claude/skills/rails-controller
Command: npx skills add https://github.com/LaunchPadLab/ai-bank --skill rails-controller-launchpadlab

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Creating Rails controllers quickly while keeping correctness, authorization, and multi-tenant isolation from the start.

Core Features & Use Cases

  • TDD-first controller workflow: write failing controller tests (RED), implement the controller (GREEN), then refactor safely.
  • Convention-driven REST CRUD setup: covers index/show/new/create/edit/update/destroy with consistent patterns for controller structure.
  • Built-in Rails best practices: includes Pundit authorization (authorize, 404-style unauthorized behavior), policy_scope queries, Pagy pagination, Presenters for view formatting, and current_account multi-tenancy.
  • Turbo Stream response patterns: supports dynamic UI updates for create/update flows in Turbo-enabled apps.

Quick Start

Generate a new REST controller by first writing a failing controller test, then run the Rails test command to confirm RED, and only then implement the controller action code.

Frequently Asked Questions about rails-controller

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

FAQPage Schema
How do I generate a Rails controller using TDD?

To generate a Rails controller using TDD, write a failing integration test first, run it to confirm RED status, then implement the controller action to achieve GREEN. This workflow ensures test-first development for REST CRUD endpoints.

How does Pundit authorization work in Rails controller generation?

Pundit authorization is built into the generated controllers using `authorize` calls and `policy_scope` queries. This enforces 404-style unauthorized behavior and ensures proper authorization checks across controller actions automatically.

Can I use Turbo Stream responses with Rails CRUD controllers?

Yes, Turbo Stream response patterns are supported for create and update flows in Turbo-enabled Rails apps. The controller generation includes optional Turbo Stream responses to handle dynamic UI updates seamlessly.

What is the best way to handle multi-tenancy in Rails controllers?

Handling multi-tenancy in Rails controllers is managed using `current_account` tenant isolation. The generated controllers enforce multi-tenancy expectations automatically, ensuring proper tenant isolation for CRUD operations.

Does Rails controller generation include pagination and presenters?

Yes, Rails controller generation includes built-in best practices for Pagy pagination and Presenters for view formatting. These conventions are applied consistently across generated controller structures for optimized data handling.

Why write failing tests before implementing Rails controller actions?

Writing failing tests before implementing Rails controller actions establishes a RED-to-GREEN TDD workflow ensuring correctness from the start. This approach validates controller behavior, authorization, and tenant isolation before implementation is finalized.