htmx-go-templates
htmx on Go html/template: how a handler picks page, fragment or redirect, how templates carry hx-* attributes, where client JS lives, and how errors and…
Skill by O-Marsters-1997
Chalk Labs
Need help deploying htmx-go-templates?
Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.
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/o-marsters-1997-htmx-go-templates
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: frontend, writing, agent-building
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 and code. Checked Nov 1, 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/htmx-go-templates
Tools it pre-approves 7
From allowed-tools in SKILL.md: the agent may use these without asking you each time.
Read,Edit,Write,Glob,Grep,Bash(go:*),Bash(git:*)
What's inside
- Skill name
htmx-go-templates- Description
- htmx on Go html/template: how a handler picks page, fragment or redirect, how templates carry hx-* attributes, where client JS lives, and how errors and polling surface. TRIGGER — load BEFORE writing, not after: a .tmpl or .gohtml file is created or edited; an hx-* attribute or HX-* header is added or changed; a Go handler calls ExecuteTemplate or reads HX-Request; the prompt names htmx, hx-get, hx-swap, a fragment, partial, swap target, polling or an htmx event. Trigger on plain requests in a Go + htmx repo — "add a page", "make this form inline", "refresh this every 5s", "why doesn't the error show". Load alongside go-idiomatic. SKIP for templ components, JSON APIs and React or Solid UIs.
- License
- MIT
- Allowed tools
- Read,, Edit,, Write,, Glob,, Grep,, Bash(go:*),, Bash(git:*)
- Instructions
- 97 lines in SKILL.md · view on GitHub
Before installing
- Pre-approves some shell commands
Files (8)
- SKILL.md
- evals.json · evals/
- board.tmpl · evals/fixtures/
- layout.tmpl · evals/fixtures/
- server.go · evals/fixtures/
- client.md · references/
- responses.md · references/
- templates.md · references/
SKILL.md (first lines)
# htmx on Go html/template
The server owns state; a template only presents it; htmx moves HTML between the two. Most drift
in these apps comes from that split being decided ad hoc, per handler and per template: seven ways
to detect an htmx request, the same four attributes hand-copied across files, errors that vanish.
The rules below make each of those decisions once.
This skill holds the general rules. The repo's AGENTS.md holds what only the repo knows: its
swap-target ids, the names of its shared partials, and the htmx version it vendors. Read it first.
## Where to look
| If you're working on… | Load |
|---|---|
| A handler: choosing page / fragment / redirect, htmx headers, `Vary`, 303, error responses | `references/responses.md` |
| A template: partials, repeated attribute bundles, forms, live regions, conditionals | `references/templates.md` |
| Any client JS: whether you need it at all, islands, htmx glue, polling guards, `aria-busy` | `references/client.md` |
## The rules
1. **htmx headers go through one helper set, never hand-typed strings.**
A typo in `"HX-Request"` or a check for `""` instead of `"true"` fails silently; one package
of constants and predicates makes the wrong spelling unrepresentable. If the repo has no such
set yet, introduce it the first time a handler you touch needs an htmx header — `Vary` included.
2. **Every route declares its response shape — page, fragment or redirect — in one place.**
A handler that sniffs headers inline grows a new branch per feature. When one URL can return
either a page or a fragment, set `Vary: HX-Request`, or a cache or the back button can serve
the bare fragment as a page. A history-restore request (`HX-History-Restore-Request: true`)
always gets the full page.
3. **A non-htmx form POST answers 303 to a GET; an htmx one answers `HX-Location` or a fragment.**
303 stops a refresh from resubmitting. A 303 to an htmx request is followed by the XHR and the
whole redirected page gets swapped into the target, which is never what you want.
4. **Forms work without JavaScript.** Real `action` and `method`, a real submit button; htmx
attributes layer on top. The non-JS path is also the path the 303 rule serves.
5. **A repeated attribute bundle becomes a named `{{define}}` partial.** Four attributes copied to
seventeen links drift the moment one copy changes. One partial, one place to change it.
(`codebase-design` has the vocabulary for why: one deep module beats many shallow copies.)
6. **Polling never fights the user.** `hx-sync` on every polling element, a guard that skips the
poll while the user is focused or typing inside the target, and a target that never contains
an input the user may be editing.
7. **Errors reach the user.** htmx 2.x does not swap 4xx/5xx bodies by default, so a refused
action looks like nothing happened. Fix it in two halves: a `responseHandling` entry that swaps
the status you use (typically 422), *and* `HX-Retarget` / `HX-Reswap` from the server so the
error lands in a known region. That region is a persistent `aria-live` container.
8. **In-flight state is visible.** `hx-disabled-elt` on submit controls so a double-click cannot
double-submit; `hx-indicator` or `aria-busy` on the region being replaced.
9. **Client JS is the exception, and it is never inline.** Before writing any, ask whether the
server can own it (a preference, a re-rendered region) or HTML can (`<details>`, `<dialog>`,
`popover`). A widget with real client state becomes an island in the repo's frontend framework,
mounted through `htmx.onLoad` and unmounted on swap. The only other JS is a fixed set of htmx
glue listeners. No `<script>` blocks, `onclick` or `hx-on` in templates: inline handlers are
untestable and re-run unpredictably on swaps. htmx config goes in `<meta name="htmx-config">`
with `"allowEval": false`, so htmx itself refuses `hx-on` and `js:` values.
10. **Templates branch on presentation only.** `{{if eq .Status "failed"}}` chains are domain
logic in the wrong layer. Compute a view-model field in Go (`.Badge`, `.CanRetry`) and let the
template read it.
## Choosing a response shape
```
request ──► HX-History-Restore-Request: true? ──yes──► page
│ no
▼
HX-Request: true? ──no──► POST? ──yes──► 303 to GET (or re-render page with 422 on invalid)
│ yes └─no──► page
▼
route declares: fragment ──► ExecuteTemplate(w, "<block>", vm)
page+select ──► page (template uses hx-select)
redirect ──► HX-Location (or HX-Redirect for a full reload)
```
`references/responses.md` has the helper set and a handler written both ways.
## htmx version
These rules target **htmx 2.x**. Check the version the repo vendors before relying on defaults.
If it is on 4.x, re-check rules 7 and 9 against the
[4.x migration notes](https://four.htmx.org/docs/whats-new-in-htmx-4):
- error responses swap by default, with per-status control through `hx-status`;
- attribute inheritance is explicit, so bundles that relied on inheriting `hx-target` break;
- event names changed, so listeners in the TS module need renaming.
## What not to do
- Don't reach for the `response-targets` extension to route errors. It moves a server decision
into markup and adds a second mechanism next to `HX-Retarget`.
- Don't swap an `aria-live` region with `outerHTML`. Screen readers track the original node; a
replaced live region announces nothing. Swap its `innerHTML`.
- Don't render into the `ResponseWriter` directly. Execute into a buffer first, so a template
error becomes a 500 rather than a half-written 200.
- Don't add `hx-boost` to fix a navigation problem. Declare the nav-link partial instead; boost
changes every link and form under it at once.
- Don't restate the htmx attribute reference here or in the repo; link
[htmx.org/reference](https://htmx.org/reference/).From O-Marsters-1997/my-claude-code, MIT.
More from O-Marsters-1997/my-claude-code
- 0.570score
go-testing
O-Marsters-1997
How Go tests are written in these repos: assertions, tables, test doubles, helpers, async waits, golden files, fuzzing, benchmarks, and integration tests…
SkillAFreshness: AClaude Code +9 - 0.570score
frontend-best-practices
O-Marsters-1997
Frontend engineering standards — component architecture, state, async, forms, accessibility, performance and TypeScript discipline.
SkillAFreshness: AClaude Code +9 - 0.570score
go-idiomatic
O-Marsters-1997
Go engineering standards for this repo — package layout, error handling, logging, testing, concurrency and design patterns.
SkillAFreshness: AClaude Code +9 - 0.566score
postgres-best-practices
O-Marsters-1997
Postgres schema and query rules, independent of the calling language.
SkillAFreshness: AClaude Code +9 - 0.565score
record-decision
O-Marsters-1997
Capture a design or architecture decision as an ADR in docs/adr/ and update CONTEXT.md if terminology is affected.
SkillAFreshness: AClaude Code +9 - 0.565score
clean-comments
O-Marsters-1997
Remove comments that fail ~/.claude/rules/comments.md from source files.
SkillAFreshness: AClaude Code +9 - 0.539score
tdd
O-Marsters-1997
Use when implementing any feature or fixing any bug.
SkillAFreshness: AClaude Code +9 - 0.539score
testing-policy-creator
O-Marsters-1997
Writes, or brings up to date, a repo's own testing-policy skill at .claude/skills/testing-policy/SKILL.md: which code gets which kind of test, with which…
SkillAFreshness: AClaude Code +9 - 0.539score
code-review
O-Marsters-1997
Use when the user wants to review a branch, a PR, work-in-progress changes, or asks to "review since X".
SkillAFreshness: AClaude Code +9 - 0.539score
codebase-design
O-Marsters-1997
Shared vocabulary for designing deep modules.
SkillAFreshness: AClaude Code +9 - 0.529score
tailwind-design-system
O-Marsters-1997
Tailwind CSS v4 design system architecture: CSS-first `@theme` configuration, the brand/semantic/component token hierarchy, OKLCH colour, CVA component…
SkillBFreshness: BClaude Code +9 - 0.529score
architecture-review
O-Marsters-1997
Use when the user wants an architecture review, a design health check, a staff-level read on architectural risk, or an assessment of coupling and cohesion…
SkillBFreshness: BClaude Code +9
Signals
- Stars
- 0
- Forks
- 0
- Open issues
- 10
- Last commit (this folder)
- Oct 12, 2026 (20 days ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from O-Marsters-1997
- 0.570score
go-testing
O-Marsters-1997
How Go tests are written in these repos: assertions, tables, test doubles, helpers, async waits, golden files, fuzzing, benchmarks, and integration tests…
SkillAFreshness: AClaude Code +9 - 0.570score
go-idiomatic
O-Marsters-1997
Go engineering standards for this repo — package layout, error handling, logging, testing, concurrency and design patterns.
SkillAFreshness: AClaude Code +9 - 0.570score
frontend-best-practices
O-Marsters-1997
Frontend engineering standards — component architecture, state, async, forms, accessibility, performance and TypeScript discipline.
SkillAFreshness: AClaude Code +9 - 0.566score
postgres-best-practices
O-Marsters-1997
Postgres schema and query rules, independent of the calling language.
SkillAFreshness: AClaude Code +9 - 0.565score
clean-comments
O-Marsters-1997
Remove comments that fail ~/.claude/rules/comments.md from source files.
SkillAFreshness: AClaude Code +9 - 0.565score
record-decision
O-Marsters-1997
Capture a design or architecture decision as an ADR in docs/adr/ and update CONTEXT.md if terminology is affected.
SkillAFreshness: AClaude Code +9
Done for you
Rather not set it up yourself?
Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.
See how we build AI agents →Read the case studies
Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.
- launches shipped
- 50+
- launches shipped
- media placements
- 500+
- media placements
- founders on every account
- 2
- founders on every account
Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block
Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.
Get htmx-go-templates running in your business
Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.
Cite this page
htmx-go-templates skill. Agent Mart. https://agentmart.dev/skills/o-marsters-1997-htmx-go-templates (last updated 2026-10-24)