hwc-stimulus-fundamentals
Installation
SKILL.md
Stimulus Fundamentals
Implement robust Stimulus controllers with clear lifecycle and state boundaries.
Core Workflow
- Define controller contract first: targets, values, outlets, actions, and expected lifecycle.
- Keep state transitions in value callbacks when reactive updates are required.
- Guard callbacks that can run before
connect()completes. - Use
connect()/disconnect()for setup and teardown symmetry. - Isolate DOM event handling from business rules; keep controllers composable.
Guardrails
- Prefer declarative action parameters over manual dataset parsing.
- Use outlets for controller-to-controller communication instead of private internals.
- Keep target callbacks idempotent; account for repeated connect/disconnect cycles.
- Use MutationObserver only when DOM-driven reactivity is required.
- Feature-detect browser APIs before exposing UI affordances.
Related skills