alpinejs

Installation
SKILL.md

AlpineJS Best Practices

Golden Rule: Keep Attributes Short

Never put complex logic in HTML attributes. If your x-data, x-init, or any directive exceeds ~50 characters, extract it.

Directive Cheatsheet

Directive Purpose Example
x-data Declare reactive component state x-data="{ open: false }"
x-init Run code on component init x-init="fetchData()"
x-show Toggle visibility (CSS display) x-show="open"
x-if Conditional rendering (must wrap <template>) <template x-if="show">
x-for Loop (must wrap <template>) <template x-for="item in items">
x-bind: / : Bind attribute to expression :class="{ active: isActive }"
x-on: / @ Listen to events @click="open = !open"
x-model Two-way bind form inputs x-model="email"
x-text Set text content x-text="message"
Related skills

More from brettatoms/agent-skills

Installs
107
First Seen
Feb 1, 2026