rails-controller

Generate RESTful Rails controllers with request specs using TDD.

Updated Nov 1, 2025
One-click install
npx skills add https://github.com/nschneble/rails-superstack --skill rails-controller-nschneble
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rails-controller
Source: https://github.com/nschneble/rails-superstack/tree/main/.agents/skills/rails-controller
Command: npx skills add https://github.com/nschneble/rails-superstack --skill rails-controller-nschneble

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Creates Rails controllers with a TDD approach - request spec first, then implementation. Use when creating new controllers, adding controller actions, implementing CRUD operations, or when user mentions controllers, routes, or API endpoints.

Core Features & Use Cases

  • Generates RESTful controllers following project conventions with request specs first.
  • Enforces a TDD workflow: write failing request specs, then implement actions.
  • Supports common project conventions: Pundit authorization, Pagy pagination, Presenters, and multi-tenancy via current_account.
  • Ideal for scaffolding controllers when routes or API endpoints are discussed.

Quick Start

Write a failing request spec first, then run the generator to scaffold the controller and tests in a TDD-first workflow.

Frequently Asked Questions about rails-controller

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

FAQPage Schema
How do I scaffold Rails controllers using a TDD approach?

Scaffold Rails controllers by writing a failing request spec first, then generating the controller implementation. This TDD workflow ensures actions are validated by tests before logic is written.

Can I generate Rails controllers with Pundit authorization and Pagy pagination?

Yes, generated Rails controllers enforce project conventions including Pundit for authorization and Pagy for pagination, ensuring new RESTful actions integrate seamlessly with existing access control and data handling.

Does this Rails controller generator support multi-tenant applications?

Yes, the Rails controller generator supports multi-tenancy by scoping queries and actions through current_account, ensuring data isolation across tenants when implementing CRUD operations.

What is the best way to add Turbo Streams to Rails controller actions?

Add Turbo Streams to Rails controllers by generating actions with dynamic update support built-in. The generator includes Turbo Stream responses to handle real-time page updates without full reloads.

How do I write RSpec request specs for new Rails API endpoints?

Write RSpec request specs for Rails API endpoints by starting with a failing test that defines expected HTTP responses. The generator scaffolds both the spec and the controller action to fulfill it.

When should I use Presenters in Rails controller scaffolding?

Use Presenters in Rails controller scaffolding when view formatting logic needs separation from the controller. The generator integrates Presenters to handle complex view formatting and keep controller actions lean.