datastar-patterns
Use when implementing UI patterns with Datastar — search, inline editing, infinite scroll, file upload, validation, bulk operations, polling, lazy loading…
Skill by danmestas
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/danmestas-datastar-patterns
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: design, data, writing
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/datastar-patterns
What's inside
- Skill name
datastar-patterns- Description
- Use when implementing UI patterns with Datastar — search, inline editing, infinite scroll, file upload, validation, bulk operations, polling, lazy loading, progress indicators, or keyboard shortcuts. Triggers on data-* attributes, @get/@post/@put/@patch helpers, SSE response formatting, or any "how do I do X in Datastar" implementation question.
- License
- MIT
- Instructions
- 399 lines in SKILL.md · view on GitHub
Files (1)
- SKILL.md
SKILL.md (first lines)
# Datastar Patterns
Concrete implementation patterns for Datastar. For architecture decisions, see `datastar-tao`.
## Quick Reference: Attributes
| Attribute | Purpose | Example |
|-----------|---------|---------|
| `data-on:<event>` | Event handler | `data-on:click="@get('/endpoint')"` |
| `data-bind:<signal>` | Two-way input binding | `data-bind:search` |
| `data-signals` | Initialize signals | `data-signals="{count: 0}"` |
| `data-signals__ifmissing` | Initialize only if absent | `data-signals__ifmissing="{count: 0}"` |
| `data-text` | Set element text content | `data-text="$count"` |
| `data-attr:<attr>` | Set HTML attribute reactively | `data-attr:disabled="$_fetching"` |
| `data-effect` | Run expression on signal change | `data-effect="$selections; $_all = $selections.every(Boolean)"` |
| `data-indicator:<signal>` | Set signal true during requests | `data-indicator:_fetching` |
| `data-init` | Run expression on element init | `data-init="@get('/updates')"` |
| `data-on:intersect` | Trigger when element enters viewport | `data-on:intersect="@get('/more')"` |
| `data-on:interval` | Trigger on a timer | `data-on-interval__duration.5s="@get('/poll')"` |
## Quick Reference: Modifiers
| Modifier | Effect | Example |
|----------|--------|---------|
| `__debounce.Nms` | Delay until input pauses | `data-on:input__debounce.200ms` |
| `__throttle.Nms` | Rate-limit execution | `data-on:scroll__throttle.100ms` |
| `__duration.Ns` | Set interval period | `data-on-interval__duration.5s` |
| `__window` | Listen on window, not element | `data-on:keydown__window` |
| `.leading` | Execute immediately on first tick | `data-on-interval__duration.5s.leading` |
## Quick Reference: SSE Response Format
| Event | Data Fields | Purpose |
|-------|-------------|---------|
| `datastar-patch-elements` | `elements`, `selector` (opt), `mode` (opt) | Update DOM fragments |
| `datastar-patch-signals` | `signals` (JSON) | Update client signals |
Merge modes: `outer` (default — replace element by ID), `append`, `prepend`, `remove`.
## Patterns
### Active Search
Debounced input that queries the server as the user types.
```html
<input type="text" placeholder="Search..."
data-bind:search
data-on:input__debounce.200ms="@get('/search')" />
<div id="results"><!-- server replaces this --></div>
```
```go
func handleSearch(w http.ResponseWriter, r *http.Request) {
query := r.URL.Query().Get("search")
results := db.Search(query)
sse := datastar.NewSSE(w, r)
sse.PatchElements(renderTemplate("results", results))
}
```
### Click to Edit
Inline record editing — toggle between view and edit mode.
```html
<!-- View mode -->
<div id="contact">
<p>Name: John Doe</p>
<button data-on:click="@get('/contact/edit')"
data-indicator:_fetching
data-attr:disabled="$_fetching">Edit</button>
</div>
<!-- Edit mode (returned by server) -->
<div id="contact">
<input type="text" data-bind:name />
<button data-on:click="@put('/contact')"
data-indicator:_fetching
data-attr:disabled="$_fetching">Save</button>
<button data-on:click="@get('/contact/cancel')">Cancel</button>
</div>
```
```go
func handleContactEdit(w http.ResponseWriter, r *http.Request) {
contact := db.GetContact(r)
sse := datastar.NewSSE(w, r)
sse.PatchElements(renderTemplate("contact-edit", contact))
}
func handleContactSave(w http.ResponseWriter, r *http.Request) {
contact := datastar.ReadSignals[Contact](r)
db.SaveContact(contact)
sse := datastar.NewSSE(w, r)
sse.PatchElements(renderTemplate("contact-view", contact))
}
```
> Signal data automatically becomes the request body — no `<form>` element needed.
### Inline Validation
Server-side field validation triggered as the user types.
```html
<input type="email" required
aria-live="polite"
data-bind:email
data-on:keydown__debounce.500ms="@post('/validate')" />
<p id="email-error"></p>
```
```go
func handleValidate(w http.ResponseWriter, r *http.Request) {
form := datastar.ReadSignals[FormData](r)
errors := validate(form)
sse := datastar.NewSSE(w, r)
sse.PatchElements(renderTemplate("form-errors", errors))From danmestas/wardrobe, MIT.
More from danmestas/wardrobe
- 0.524score
caveman-compress
danmestas
Use when the user invokes /caveman-compress FILEPATH, says "compress memory file", or otherwise asks to compress natural-language memory files (CLAUDE.md…
SkillCFreshness: C★ 4Claude Code +9 - 0.524score
cloudflare-email
danmestas
Use when sending outbound transactional or one-off emails from a Cloudflare-managed domain without running a mail server or paying for a mailbox provider.
SkillCFreshness: C★ 4Claude Code +9 - 0.519score
bellard
danmestas
The Fabrice Bellard lens: build the smallest self-contained thing that fully does the job, get performance from insight instead of hardware, and reuse…
SkillCFreshness: C★ 4Claude Code +9 - 0.519score
brainstorming
danmestas
Help turn ideas into fully formed designs and specs through natural collaborative dialogue.
SkillCFreshness: C★ 4Claude Code +9 - 0.519score
carmack
danmestas
The John Carmack lens: minimize the mutable state you have to reason about, do the simple thing before the clever one, and treat correctness tooling — static…
SkillCFreshness: C★ 4Claude Code +9 - 0.519score
cavecrew
danmestas
Use when the user says "delegate to subagent", "use cavecrew", "spawn investigator/builder/reviewer", "save context", or "compressed agent output".
SkillCFreshness: C★ 4Claude Code +9 - 0.519score
caveman
danmestas
Use when the user wants ultra-compressed responses — says "caveman mode", "talk like caveman", "use caveman", "less tokens", "be brief", or invokes /caveman.
SkillCFreshness: C★ 4Claude Code +9 - 0.519score
caveman-commit
danmestas
Use when the user says "write a commit", "commit message", "generate commit", "/commit", or invokes /caveman-commit, or when staging changes.
SkillCFreshness: C★ 4Claude Code +9 - 0.519score
caveman-help
danmestas
Use when the user invokes /caveman-help, says "caveman help", asks "what caveman commands", or asks "how do I use caveman".
SkillCFreshness: C★ 4Claude Code +9 - 0.519score
ci-watch
danmestas
Use when watching CI/CD checks complete — `gh pr checks`, `gh run watch`, polling PR conclusion, waiting for builds to finish before merge.
SkillCFreshness: C★ 4Claude Code +9 - 0.519score
atlassian-cli-jira
danmestas
Use when working with Atlassian CLI (acli) to install, authenticate, and manage Jira Cloud work items/issues from the command line: search (JQL), view…
SkillCFreshness: C★ 4Claude Code +9 - 0.519score
clone-config
danmestas
Use when bootstrapping a fresh Mac/server, managing dotfiles, tracking shell configs, refreshing a Brewfile, adding ~/.zshrc to a dotfiles repo, or asking how…
SkillCFreshness: C★ 4Claude Code +9
Signals
- Stars
- 4
- Forks
- 0
- Open issues
- 1
- Last commit (this folder)
- Apr 27, 2026 (6 months ago)
- Last release
- Apr 27, 2026 (6 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/danmestas/wardrobe
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from danmestas
- 0.524score
cloudflare-email
danmestas
Use when sending outbound transactional or one-off emails from a Cloudflare-managed domain without running a mail server or paying for a mailbox provider.
SkillCFreshness: C★ 4Claude Code +9 - 0.524score
caveman-compress
danmestas
Use when the user invokes /caveman-compress FILEPATH, says "compress memory file", or otherwise asks to compress natural-language memory files (CLAUDE.md…
SkillCFreshness: C★ 4Claude Code +9 - 0.519score
atlassian-cli-jira
danmestas
Use when working with Atlassian CLI (acli) to install, authenticate, and manage Jira Cloud work items/issues from the command line: search (JQL), view…
SkillCFreshness: C★ 4Claude Code +9 - 0.519score
brainstorming
danmestas
Help turn ideas into fully formed designs and specs through natural collaborative dialogue.
SkillCFreshness: C★ 4Claude Code +9 - 0.519score
carmack
danmestas
The John Carmack lens: minimize the mutable state you have to reason about, do the simple thing before the clever one, and treat correctness tooling — static…
SkillCFreshness: C★ 4Claude Code +9 - 0.519score
bellard
danmestas
The Fabrice Bellard lens: build the smallest self-contained thing that fully does the job, get performance from insight instead of hardware, and reuse…
SkillCFreshness: C★ 4Claude Code +9
Cite this page
datastar-patterns skill. Agent Mart. https://agentmart.dev/skills/danmestas-datastar-patterns (last updated 2026-10-24)