datastar
Skill4 starsChanged 7 months agoMITView on GitHub
Use when building web applications with Datastar — the hypermedia framework that drives frontend reactivity from the backend using HTML data-* attributes and Server-Sent Events. Triggers on Datastar, data-star, SSE-driven UI, hypermedia framework, backend-driven frontend, data-signals, data-on, PatchElements, or any Go/Python web app using Datastar SDKs.
2 other projects use a version of this.
Adopted by
Most recently taken up by
- MarcinDudekDev/claude-skill-datastartheir own version, first seen May 16, 2026
- maragudk/skillstheir own version, first seen Feb 12, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- maragudk/skills★ 49same name
- MarcinDudekDev/claude-skill-datastar★ 2same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository124 other files it gives its agents.
- apple-contactsSkill
- atlassian-cli-jiraSkill
- bellardSkill
- brainstormingSkill
- career-interviewSkill
- carmackSkill
- cavecrewSkill
- caveman-commitSkill
- caveman-compressSkill
- caveman-helpSkill
- caveman-reviewSkill
- cavemanSkill
- caveman-statsSkill
- ci-watchSkill
- clone-configSkill
- cloudflare-emailSkill
- course-correctSkill
- datastar-patternsSkill
- datastar-taoSkill
- defuddleSkill
- description-linterSkill
- deterministic-simulation-testingSkill
- dispatching-parallel-agentsSkill
- dopplerSkill
- dx-auditSkill
- evolution-changelogSkill
- evolution-engineSkill
- executing-plansSkill
- farleySkill
- finishing-a-bones-leafSkill
- frontend-component-decision-treesSkill
- gh-project-charterSkill
- gh-project-operationsSkill
- gh-project-setupSkill
- gh-project-sharedSkill
- goal-completeSkill
- golang-patternsSkill
- hellandSkill
- hickeySkill
- hippSkill
- investigating-agent-sessionsSkill
- landingSkill
- linear-cliSkill
- linear-methodSkill
- memorizeSkill
- midscene-testingSkill
- monitoring-the-operatorSkill
- normanSkill
- obsidian-basesSkill
- obsidian-canvasSkill
- obsidian-markdownSkill
- orchestrator-modeSkill
- orchestrator-suitSkill
- ousterhoutSkill
- pikchr-generatorSkill
- pocock-cavemanSkill
- pocock-diagnoseSkill
- pocock-git-guardrailsSkill
- pocock-handoffSkill
- pocock-setup-pre-commitSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 227
All actions automatically send current signals to the server.
- Distinctive: line 370
Elements need IDs for patching: Default merge mode is outer — it matches by element ID.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Datastar — Hypermedia-First Reactive Framework
Datastar is a lightweight framework for building reactive, real-time web applications by driving frontend logic and state from the backend using HTML data-* attributes and Server-Sent Events (SSE). No client-side JavaScript framework required.
Core idea: The backend sends HTML fragments and state updates via SSE. The frontend declares behavior with data-* attributes. No virtual DOM, no build step, no npm.
How It Works
Browser Server (Go)
│ │
│ data-on:click="@get('/api')" │
│ ──────────────────────────────> │
│ │ ReadSignals(r, &store)
│ │ sse := NewSSE(w, r)
│ SSE: datastar-patch-elements │ sse.PatchElements(html)
│ <────────────────────────────── │ sse.PatchSignals(json)
│ │
│ DOM morphs, signals update │- User interacts with element →
data-onfires action (@get,@post, etc.) - Server reads signals from request, processes business logic
- Server streams SSE events: patch DOM elements, update signals, execute scripts
- Browser morphs DOM (only changed parts), updates reactive signals
Go SDK Quick Start
package main
import (
"fmt"
"net/http"
"github.com/starfederation/datastar-go/datastar"
)
type Store struct {
Count int `json:"count"`
}
func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, "index.html")
})
http.HandleFunc("/increment", func(w http.ResponseWriter, r *http.Request) {
store := &Store{}
if err := datastar.ReadSignals(r, store); err != nil {
http.Error(w, err.Error(), http.StatusBadRequest)
return
}
store.Count++
sse := datastar.NewSSE(w, r)
sse.PatchElements(
fmt.Sprintf(`<span id="count">%d</span>`, store.Count),
)
sse.MarshalAndPatchSignals(store)
})
http.ListenAndServe(":8080", nil)
}<!-- index.html -->
<html>
<head>
<script type="module" src="https://cdn.jsdelivr.net/npm/@starfederation/datastar"></script>
</head>
<body>
<div data-signals:count="0">
<span id="count">0</span>
<button data-on:click="@get('/increment')">+1</button>
</div>
</body>
</html>Go SDK API
Reading Client State
// ALWAYS read signals BEFORE creating SSE stream
store := &MyStore{}
if err := datastar.ReadSignals(r, store); err != nil {
http.Error(w, err.Error(), http.StatusBadRequest)
return
}Signals come from query params (GET) or JSON body (POST/PUT/DELETE). Struct tags use json:"fieldName".
Creating SSE Stream
sse := datastar.NewSSE(w, r)Patching DOM Elements
// Replace element (default: outer mode — replaces entire element by ID)
sse.PatchElements(`<div id="content">Hello</div>`)
// Target specific selector with inner mode
sse.PatchElements(`<p>New content</p>`,
datastar.WithSelectorID("container"),
datastar.WithModeInner(),
)
// Append to a list
sse.PatchElements(`<li>New item</li>`,
datastar.WithSelector("ul#items"),
datastar.WithModeAppend(),
)
// Prepend
sse.PatchElements(html, datastar.WithModePrepend())
// Before/After element
sse.PatchElements(html, datastar.WithSelector("#target"), datastar.WithModeBefore())
sse.PatchElements(html, datastar.WithSelector("#target"), datastar.WithModeAfter())Merge modes: WithModeOuter() (default), WithModeInner(), WithModeAppend(), WithModePrepend(), WithModeBefore(), WithModeAfter()
Updating Client Signals
// From struct
sse.MarshalAndPatchSignals(store)
// From raw JSON
sse.PatchSignals([]byte(`{"count": 42}`))Removing Elements
sse.RemoveElements("#temporary")
sse.RemoveElement("#single-element")Executing JavaScript
sse.ExecuteScript(`console.log("Hello from server")`)
sse.ExecuteScript(`import {toast} from './notify.js'; toast("Done!")`,
datastar.WithExecuteScriptAttributes(`type="module"`),
)Redirecting
sse.Redirect("/new-page")Connection State
if !sse.IsClosed() {
// Connection still alive — safe to send
}HTML Data Attributes Reference
Signals & State
| Attribute | Purpose | Example |
data-signals | Define/patch reactive signals | data-signals:count="0" |
data-computed | Read-only derived signal | data-computed:total="$price * $qty" |
data-bind | Two-way binding to input | <input data-bind:name /> |
data-ref | Reference to DOM element | data-ref:myDiv → $myDiv.tagName |
Rendering
| Attribute | Purpose | Example |
data-text | Bind text content | data-text="$message" |
data-show | Toggle visibility | data-show="$isVisible" |
data-class | Toggle CSS classes | data-class:active="$isActive" |
data-attr | Set any HTML attribute | data-attr:disabled="$loading" |
data-style | Set inline styles | data-style:color="$theme" |
Events & Actions
| Attribute | Purpose | Example |
data-on | Event listener | data-on:click="@post('/save')" |
data-on-intersect | Viewport intersection | data-on-intersect="@get('/lazy')" |
data-on-interval | Recurring timer | data-on-interval__duration.5s="@get('/poll')" |
data-init | Run on load | data-init="@get('/initial-data')" |
data-effect | Run on signal change | data-effect="console.log($count)" |
Backend Actions
<!-- GET request -->
<button data-on:click="@get('/api/data')">Load</button>
<!-- POST request -->
<button data-on:click="@post('/api/save')">Save</button>
<!-- PUT, PATCH, DELETE -->
<button data-on:click="@put('/api/update')">Update</button>
<button data-on:click="@delete('/api/remove')">Delete</button>All actions automatically send current signals to the server.
Loading Indicators
<button data-on:click="@get('/slow')"
data-indicator:loading
data-attr:disabled="$loading">
<span data-show="!$loading">Submit</span>
<span data-show="$loading">Loading...</span>
</button>Event Modifiers
<!-- Debounce input -->
<input data-on:input__debounce.300ms="@get('/search')" data-bind:query />
<!-- Throttle scroll -->
<div data-on:scroll__throttle.100ms="handleScroll()"></div>
<!-- Once only -->
<div data-on-intersect__once="@get('/lazy-load')"></div>
<!-- Prevent default -->
<form data-on:submit__prevent="@post('/save')"></form>
<!-- Window/document events -->
<div data-on:keydown__window="handleKey(evt)"></div>Persistence
<!-- Persist all signals to localStorage -->
<div data-persist></div>
<!-- Persist specific signals -->
<div data-persist="{include: /theme|lang/}"></div>
<!-- Session storage -->
<div data-persist__session></div>Patterns
Search with Debounce
<input data-bind:query
data-on:input__debounce.300ms="@get('/search')"
data-indicator:searching
placeholder="Search..." />
<div data-show="$searching">Searching...</div>
<div id="results"></div>func handleSearch(w http.ResponseWriter, r *http.Request) {
store := &struct{ Query string `json:"query"` }{}
datastar.ReadSignals(r, store)
results := searchDB(store.Query)
sse := datastar.NewSSE(w, r)
sse.PatchElements(renderResults(results),
datastar.WithSelectorID("results"),
datastar.WithModeInner(),
)
}Infinite Scroll
<div id="list">
<div>Item 1</div>
</div>
<div data-signals:offset="1"
data-on-intersect__once="@get('/more')"
id="load-more">
Loading more...
</div>func handleMore(w http.ResponseWriter, r *http.Request) {
store := &struct{ Offset int `json:"offset"` }{}
datastar.ReadSignals(r, store)
sse := datastar.NewSSE(w, r)
sse.PatchElements(
fmt.Sprintf(`<div>Item %d</div>`, store.Offset+1),
datastar.WithSelectorID("list"),
datastar.WithModeAppend(),
)
if store.Offset+1 < maxItems {
sse.PatchSignals([]byte(fmt.Sprintf(`{"offset":%d}`, store.Offset+1)))
} else {
sse.RemoveElements("#load-more")
}
}Form Submission
<form data-signals:name="''" data-signals:email="''">
<input data-bind:name placeholder="Name" />
<input data-bind:email placeholder="Email" />
<button data-on:click__prevent="@post('/submit')"
data-indicator:saving
data-attr:disabled="$saving">
Save
</button>
</form>
<div id="message"></div>Live Updates (Polling)
<div data-on-interval__duration.5s="@get('/status')"
id="status">
Checking...
</div>Tabs
<div data-signals:tab="'home'">
<button data-on:click="$tab = 'home'" data-class:active="$tab == 'home'">Home</button>
<button data-on:click="$tab = 'profile'" data-class:active="$tab == 'profile'">Profile</button>
<div data-show="$tab == 'home'" id="tab-home">Home content</div>
<div data-show="$tab == 'profile'" id="tab-profile">Profile content</div>
</div>Key Rules
- Read signals BEFORE creating SSE stream.
ReadSignals(r, &store)must come beforeNewSSE(w, r). - Elements need IDs for patching. Default merge mode is outer — it matches by element ID.
- Signals are reactive. Changing a signal automatically updates all expressions that reference it.
$prefix accesses signals.$countreads thecountsignal. All$namepatterns in expressions become signal reads.- Actions send all signals.
@get('/api')automatically includes all signals in the request. - Morphing preserves state. DOM updates only change what's different — focus, scroll position, form state are preserved.
- No build step. Single
<script>tag CDN include. No npm, no bundler, no node_modules. - Backend owns the HTML. Server renders fragments, client morphs them in. This is hypermedia — not JSON APIs + client rendering.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

