Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Use when a val needs to ship JavaScript that runs in the browser — React apps, vanilla DOM scripts, canvas/games, htmx/Alpine, or any client-side module beyond a single inline snippet. Explains how Val Town serves transpiled .ts/.tsx/.jsx modules with no build step, how the browser resolves their imports, and how to load third-party deps.
.claude/skills/hashgraph-online-client-side-js/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-02 | ✗→✓ | ▲ Improved | 17% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 13% | 0% |
| case-04 | ✗→✓ | ▲ Improved | -24% | 0% |
| case-05 | ✗→✓ | ▲ Improved | 48% | 0% |
| case-06 | ✗→✓ | ▲ Improved | -23% | 0% |
Val Town has no build step and no bundler. A client-side module is just a file in your val that you serve over HTTP; Val Town transpiles it per request. You point a <script type="module"> at a route that returns the file, and the browser runs it. There is nothing to configure (no webpack/vite/esbuild).
serveFile from std/utils reads a file and serves it with the correct Content-Type. For .ts, .tsx, and .jsx it transpiles to JavaScript — strips types, compiles JSX — and serves text/javascript. You serve the source file; the browser receives runnable JS.
tsimport { serveFile } from "https://esm.town/v/std/utils/index.ts"; // in any HTTP handler — serve a client module at some URL path app.get("/app.tsx", (c) => serveFile("/app.tsx"));
Then load it from your HTML:
html<script type="module" src="/app.tsx"></script>
The path you serve at and the file's location are up to you. A common shortcut is a wildcard that serves a whole directory of modules and assets:
tsapp.get("/client/**/*", (c) => serveFile(c.req.path));
serveFile defaults to the current val. If you call it from a non-entrypoint file and paths don't resolve, pass import.meta.url as the second argument.
serveImmutableFile makes your val's frontend faster by letting browsers cache files immutably; publishing bumps the val's version, which invalidates automatically. Measured: repeat visits 665ms → 157ms with zero asset requests.
tsimport { immutableFileUrl, serveImmutableFile } from "https://esm.town/v/std/utils/index.ts"; app.get("/__immutable/*", (c) => serveImmutableFile(c.req.path));
In the never-cached HTML shell, stamp the entry module: immutableFileUrl("/frontend/index.tsx") → /__immutable/42/frontend/index.tsx (42 = the val's current version). Relative imports resolve under the same prefix, so only the entry needs stamping — one route and one stamped URL cover the whole client graph.
picks up the new version.
file route at serveImmutableFile — bare paths then 302 into versioned space, at one redirect per page view.
Every val file already has a public esm.town URL that transpiles on demand, so you can skip serveFile and point a script straight at it:
html<script type="module" src="https://esm.town/v/youruser/yourval/app.tsx"></script>
serveFile is usually preferred because the module is served same-origin from a path you control, and you don't have to hardcode your own val URL.
The transpiler does not bundle or rewrite imports — it only strips types and JSX. So every import in a client module must be something the browser can fetch as a URL:
import { x } from "./util.ts"resolves to /util.ts (or relative to the served path) and must be served too — by the same route or a wildcard. Omitting the extension (./util) 404s.
"react" don't resolve in the browser. Import from a CDN such as esm.sh, with versions pinned:
ts import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
An import map in the HTML is an option if you want bare specifiers in client code.
The same model works for any client code — React, vanilla DOM scripts, a canvas game loop, Alpine, htmx. Only the imports differ; for a plain .ts module with no dependencies there's nothing to load from a CDN at all.
Pin all React-family imports to the same version (18.2.0) and pass ?deps=react@18.2.0,react-dom@18.2.0 on libraries that depend on React. Mismatched copies cause Cannot read properties of null (reading 'useState'). See the react-ui skill for JSX and styling conventions.
<script> blobs or template-string HTML. Put clientcode in real .ts/.tsx files so it's typed, linted, and reviewable. A few lines of inline bootstrap are fine; the app is not.
serveStatic from Hono does not work on Val Town — use serveFile.Fetch the module's URL (e.g. /app.tsx) and confirm it returns text/javascript, not HTML or an error. Add https://esm.town/v/std/catch to the HTML shell to pipe browser errors into get_logs, then load the page and check the logs. Don't report the change as done without both.
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→fail | 21,975 | 16,125 | -27% | 1 | 1 | 0% | 3,987 | 3,658 | -8% | 0 | 0 | — |
case-02 | fail→pass | 24,955 | 13,057 | -48% | 1 | 1 | 0% | 3,337 | 3,915 | +17% | 0 | 0 | — |
case-03 | fail→pass | 21,646 | 17,286 | -20% | 1 | 1 | 0% | 3,109 | 3,522 | +13% | 0 | 0 | — |
case-04 | fail→pass | 19,947 | 6,290 | -68% | 1 | 1 | 0% | 3,338 | 2,530 | -24% | 0 | 0 | — |
case-05 | fail→pass | 19,862 | 19,718 | -1% | 1 | 1 | 0% | 2,635 | 3,906 | +48% | 0 | 0 | — |
case-06 | fail→pass | 14,231 | 4,029 | -72% | 1 | 1 | 0% | 2,658 | 2,046 | -23% | 0 | 0 | — |
case-07 | fail→pass | 21,731 | 17,042 | -22% | 1 | 1 | 0% | 2,750 | 2,907 | +6% | 0 | 0 | — |
case-08 | pass→pass | 14,470 | 6,313 | -56% | 1 | 1 | 0% | 2,023 | 2,373 | +17% | 0 | 0 | — |
case-09 | pass→pass | 11,347 | 3,604 | -68% | 1 | 1 | 0% | 982 | 1,815 | +85% | 0 | 0 | — |
case-10 | pass→pass | 10,370 | 5,759 | -44% | 1 | 1 | 0% | 1,793 | 2,303 | +28% | 0 | 0 | — |
case-11 | fail→pass | 15,947 | 4,447 | -72% | 1 | 1 | 0% | 1,856 | 2,214 | +19% | 0 | 0 | — |
case-12 | fail→pass | 14,581 | 11,740 | -19% | 1 | 1 | 0% | 2,264 | 2,338 | +3% | 0 | 0 | — |
case-13 | fail→pass | 22,604 | 14,721 | -35% | 1 | 1 | 0% | 3,292 | 3,174 | -4% | 0 | 0 | — |
case-14 | fail→pass | 24,328 | 10,799 | -56% | 1 | 1 | 0% | 2,510 | 2,362 | -6% | 0 | 0 | — |
case-15 | pass→pass | 12,607 | 3,459 | -73% | 1 | 1 | 0% | 1,158 | 1,803 | +56% | 0 | 0 | — |
case-16 | fail→pass | 18,761 | 8,715 | -54% | 1 | 1 | 0% | 2,448 | 1,921 | -22% | 0 | 0 | — |
case-17 | pass→pass | 8,803 | 6,815 | -23% | 1 | 1 | 0% | 556 | 1,635 | +194% | 0 | 0 | — |
case-18 | pass→pass | 10,399 | 3,730 | -64% | 1 | 1 | 0% | 968 | 1,999 | +107% | 0 | 0 | — |
case-19 | fail→pass | 19,048 | 10,655 | -44% | 1 | 1 | 0% | 2,135 | 2,196 | +3% | 0 | 0 | — |
case-20 | fail→pass | 22,951 | 11,631 | -49% | 1 | 1 | 0% | 2,074 | 2,340 | +13% | 0 | 0 | — |
case-21 | pass→pass | 12,739 | 11,640 | -9% | 1 | 1 | 0% | 2,238 | 2,577 | +15% | 0 | 0 | — |
case-22 | pass→pass | 14,173 | 16,080 | +13% | 1 | 1 | 0% | 2,497 | 3,366 | +35% | 0 | 0 | — |
case-23 | pass→pass | 13,966 | 17,978 | +29% | 1 | 1 | 0% | 2,471 | 3,805 | +54% | 0 | 0 | — |
case-24 | pass→pass | 11,686 | 16,053 | +37% | 1 | 1 | 0% | 2,605 | 3,182 | +22% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 24 cases were attempted. The headline lift of +54 percentage points is the difference between those two pass rates over the 24 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.