stimulus-controllers

Create and register Stimulus controllers in Rails JavaScript directories.

6|1|Updated Feb 4, 2026
One-click install
npx skills add https://github.com/RoleModel/rolemodel-skills --skill stimulus-controllers
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: stimulus-controllers
Source: https://github.com/RoleModel/rolemodel-skills/tree/main/skills/stimulus-controllers
Command: npx skills add https://github.com/RoleModel/rolemodel-skills --skill stimulus-controllers

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Stimulus controllers are the building blocks for modular, client-side interactivity in Rails apps, and setting them up and registering them can be repetitive and error-prone.

Core Features & Use Cases

  • Create controller files under app/javascript/controllers with proper naming and structure
  • Register controllers in app/javascript/controllers/index.js after creation
  • Follow the data-controller naming conventions in HTML
  • Provide clear examples for both automatic and manual registration

Quick Start

Create a new controller file at app/javascript/controllers/example_controller.js with a basic Stimulus Controller skeleton. Then run bin/rails stimulus:manifest:update to register the controller. Use data-controller attributes in HTML to connect the controller (e.g., data-controller="example").

Frequently Asked Questions about stimulus-controllers

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

FAQPage Schema
How do I create and register a new Stimulus controller in a Rails application?

To create and register a Stimulus controller, generate a new file under app/javascript/controllers and run bin/rails stimulus:manifest:update to automatically wire it into the application manifest.

What is the correct naming convention for Stimulus controller files and HTML data attributes?

Stimulus controller files must use snake_case naming like example_controller.js, while the corresponding HTML data-controller attribute uses kebab-case, such as data-controller="example".

How does manual registration for Stimulus controllers work in index.js?

Manual registration in index.js involves explicitly importing the controller file and calling the Stimulus application.register method to wire the controller manually without relying on the automatic manifest update.

Do I need to run bin/rails stimulus:manifest:update every time I add a new Stimulus controller?

Running bin/rails stimulus:manifest:update is the standard workflow to ensure newly added controllers are automatically registered, though you can also manually register them in index.js if preferred.

Why are my Stimulus controllers not connecting to the DOM elements in my Rails app?

Stimulus controllers fail to connect when file naming conventions are incorrect or the controller is missing from index.js, requiring you to verify snake_case files and run bin/rails stimulus:manifest:update.