rails-controller

Generate RESTful Rails controllers with TDD request specs and Pundit authorization.

643|80|Updated Dec 9, 2025
One-click install
npx skills add https://github.com/ThibautBaissac/rails_ai_agents --skill rails-controller
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: rails-controller
Source: https://github.com/ThibautBaissac/rails_ai_agents/tree/main/skills/rails-controller
Command: npx skills add https://github.com/ThibautBaissac/rails_ai_agents --skill rails-controller

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Rails controllers are often created without consistent tests and project conventions. This skill guides a TDD-first workflow to scaffold RESTful controllers that align with policies (Pundit), pagination (Pagy), presentational layers, multi-tenancy, and Turbo Stream updates.

Core Features & Use Cases

  • TDD-first controller generation: write failing request specs before implementing actions.
  • Conforms to project conventions (Pundit authorization, Pagy pagination, Presenters, multi-tenancy via current_account, Turbo Streams).
  • Supports standard CRUD actions and nested/namespace controllers.
  • Use Case: when adding new resources or API endpoints, ensure tests guide implementation.

Quick Start

Write a failing request spec for the new controller under spec/requests, then implement the corresponding action to make the spec pass, and re-run the test suite until it passes.

Frequently Asked Questions about rails-controller

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

FAQPage Schema
How do I generate Rails controllers using TDD with Pundit and Pagy?▼

Generate Rails controllers using TDD by writing failing request specs first, then implementing actions to pass tests. The workflow enforces Pundit authorization, Pagy pagination, policy_scope queries, and strong parameters for secure, consistent RESTful controllers.

What is the RED-GREEN-REFACTOR cycle for Rails controller request specs?▼

The RED-GREEN-REFACTOR cycle for Rails controllers involves writing failing request specs, implementing controller actions to make specs pass, then refactoring. This ensures test-driven development guides implementation of authorization, pagination, and strong parameters.

Can I use this Rails controller generator for multi-tenant apps with Turbo Streams?▼

Yes, you can use this Rails controller generator for multi-tenant apps. It supports current_account multi-tenancy, Turbo Stream responses for index and live updates, Pundit policy_scope queries, and presenters within standard CRUD and nested namespace controllers.

How do I add authorization and pagination to Rails controllers with request specs?▼

Add authorization and pagination to Rails controllers by writing request specs that enforce Pundit policies and Pagy pagination. The TDD workflow ensures policy_scope queries, strong parameters, and presenters are implemented correctly to make request specs pass.

Does this Rails controller skill require Pundit and Pagy dependencies?▼

This Rails controller skill assumes your project uses Pundit for authorization, Pagy for pagination, and Turbo Streams for live updates. It scaffolds controllers conforming to these conventions through a test-driven workflow with explicit request specs.

Why should I write request specs before implementing Rails controller actions?▼

Write request specs before implementing Rails controller actions to enforce a TDD-first workflow. This ensures controllers align with project conventions for Pundit authorization, multi-tenancy, strong parameters, and pagination, producing consistent and secure RESTful endpoints.