datastar
БесплатноБез исполняемых скриптовНе проверенUse Datastar data-* attributes and actions in HTML and Templ templates, including signals, bindings, events, server actions and request options. Use when…
от romshark★ 122 звезды на GitHubОб этом скилле
Datastar
Datastar provides client-side reactivity through data-* attributes. Datapages serves Datastar v1.0.5 and manages its script tag and SSE streams. Docs: https://data-star.dev/docs.md
Signals are reactive variables written as $name. In an expression, Datastar replaces $signal references and binds el to the current element. The sandbox allows calls only to @name() action helpers.
Use hyphens in signal keys. data-signals:new-title declares $newTitle. HTML lowercases attribute names, so data-signals:newTitle declares $newtitle. To preserve case without hyphens, put the name in an attribute value, as in data-bind="newTitle".
Signal keys occur in data-bind:*, data-signals:*, data-computed:*, data-indicator:* and data-ref:*. Other keys remain in kebab-case. Use __case.camel|kebab|snake|pascal to override conversion. For example, data-on:widget-loaded__case.camel listens for widgetLoaded. A signal name must not contain __.
Datastar applies attributes depth first in DOM order. It applies them again when a patch changes them. Morphing preserves attributes that a patch does not change.
Attributes
| attribute | effect |
|---|---|
data-attr:aria-label="$foo" |
sets an HTML attribute from an expression, kept in sync |
data-bind:name |
two-way binding on input, select, textarea and web components; keeps a predefined signal's type; type=file gives base64 |
data-class:font-bold="$x" |
adds or removes a class |
data-computed:foo="$a + $b" |
read-only derived signal |
data-effect="$a = $b" |
runs on load and whenever a signal it reads changes |
data-ignore |
skip the element and its subtree; __self for the element alone |
data-ignore-morph |
a morph skips the element, its attributes and its children when the old and the new element both carry it |
data-indicator:fetching |
true while a fetch is in flight; put it on the element that triggers one |
data-init="@get('/x')" |
runs when the attribute initializes; __delay.500ms |
data-json-signals |
dumps signals as JSON for debugging; __terse |
data-on:click="$x = 1" |
event listener |
data-on-intersect |
on viewport intersection; __once, __exit, __half, __full |
data-on-interval |
repeatedly, default 1s; __duration.500ms |
data-on-signal-patch |
whenever signals are patched; narrow it with data-on-signal-patch-filter |
data-preserve-attr="open class" |
keeps those attributes across morphs |
data-ref:foo |
exposes the element as $foo |
data-show="$x" |
toggles display |
data-signals:count="0" |
declares signals, dot notation nests them; null removes one; __ifmissing keeps an existing value; a _ prefix keeps it out of requests |
data-style:color="$c" |
sets a style property, falsy restores the original |
data-text="$x" |
sets the text content |
data-on modifiers: __once, __passive, __capture, __prevent, __stop, __window, __document, __outside, __delay.500ms, __debounce.500ms[.leading|.notrailing], __throttle.500ms[.noleading|.trailing], __viewtransition, __case.*.
Actions
@get(url, opts), @post, @put, @patch, @delete and @query send a fetch request. In a Datapages app, use them through the generated action package. See datapages-templates.
@peek(fn) reads signals without subscribing to them. @setAll(value, {include, exclude}) and @toggleAll({include, exclude}) write every matching signal. The filters are regular expressions over signal paths.
Request options:
| option | values and effect |
|---|---|
contentType |
json sends signals; form sends the closest form or the form selected by selector |
filterSignals |
{include, exclude} regular expressions; signals prefixed with _ are excluded by default |
selector |
selects the form for contentType: form |
headers |
adds request headers |
openWhenHidden |
defaults to false for GET and true for other methods |
payload |
sets a request payload expression |
retry |
auto for network errors, error for 4xx and 5xx, always or never |
retryInterval |
defaults to 1000 ms |
retryScaler |
defaults to 2 |
retryMaxWait |
defaults to 30000 ms |
retryMaxCount |
defaults to 10 |
requestCancellation |
auto, cleanup, disabled or an AbortController |
auto cancels an active request from the same element. cleanup also cancels the request when the element or attribute is removed.
Datastar handles a response by content type:
| content type | result |
|---|---|
text/event-stream |
applies Datastar SSE events |
text/html |
patches elements |
application/json |
patches signals |
text/javascript |
executes the response |
Each request fires datastar-fetch events. evt.detail.type is started, finished, error, retrying or retries-failed.
Practice
- Keep authoritative state on the server and interaction st
Установить datastar в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл datastar?
Use Datastar data-* attributes and actions in HTML and Templ templates, including signals, bindings, events, server actions and request options. Use when writing template markup that uses Datastar.
Как установить скилл datastar?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл datastar запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic