stimulus
Installation
SKILL.md
<essential_principles>
How Stimulus Works
Stimulus is a modest JavaScript framework that connects JavaScript behavior to HTML via data attributes. It doesn't render HTML—it enhances existing HTML with interactivity.
1. HTML-First Philosophy
State lives in the DOM, not JavaScript. Controllers can be discarded between page changes and reinitialize from cached HTML. Design controllers to read state from data attributes and restore themselves on reconnection.
2. Convention Over Configuration
Stimulus uses predictable naming conventions:
- Controller:
data-controller="clipboard" - Targets:
data-clipboard-target="source" - Actions:
data-action="click->clipboard#copy" - Values:
data-clipboard-url-value="/api/copy" - Classes:
data-clipboard-supported-class="visible" - Outlets:
data-clipboard-result-outlet="#result"