web-worker-patterns: Command for Claude Code

.claude/commands/migrate-example.md

migrate-example is a command for Claude Code from damiansire/web-worker-patterns. It costs 29 tokens per session (1,264 once invoked), scanned A, original, MIT.

A command for moving a Web Worker example into shared application logic and displaying it in five visual themes. A Web Worker runs JavaScript in the background so it does not block the main page.

In plain words
What is it for?
Use it to migrate an existing Worker example, create its testable logic and service, register it, and connect it to each theme. It can also select the next unmigrated example when no example is specified.
Why use it?
It gives a repeatable path for moving old examples without duplicating their core logic. It also includes testing and design review so the example works across themes.

Command for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: names the TodoWrite tool; positional $N argument.

This is damiansire/web-worker-patterns's own configuration. It tells Claude Code how to work on web-worker-patterns itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything web-worker-patterns configures →

Reuse

Borrowing it

Nothing to install: this file belongs to damiansire/web-worker-patterns. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/damiansire/web-worker-patterns/main/.claude/commands/migrate-example.md
Clone the repo
git clone --depth 1 https://github.com/damiansire/web-worker-patterns

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for migrate-example

README.md
[![agentmods](https://agentmods.dev/badge/commands/damiansire/web-worker-patterns/migrate-example/github.svg)](https://agentmods.dev/commands/damiansire/web-worker-patterns/migrate-example)
Your own site
<a href="https://agentmods.dev/commands/damiansire/web-worker-patterns/migrate-example"><img src="https://agentmods.dev/badge/commands/damiansire/web-worker-patterns/migrate-example/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for migrate-example

Your own site · 80×15
<a href="https://agentmods.dev/commands/damiansire/web-worker-patterns/migrate-example"><img src="https://agentmods.dev/badge/commands/damiansire/web-worker-patterns/migrate-example.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 29 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,264 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00029 $0.01264
Opus 5.5 $0.00012 $0.00506
Sonnet 5.5 $0.00006 $0.00253
Haiku 4.5 $0.00003 $0.00126

Measured 23d ago against content hash 30c3d13b59ba, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

migrate-example scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 23d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/commands/migrate-example.md · 76 lines

How it starts

The opening of the file, as written. The whole thing — 76 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Migrar ejemplo: $1

Codifica el pipeline por-ejemplo que ya repetimos en los ejemplos 04–13. Seguilo en orden; no saltees el loop de design-review. La regla de oro manda: el dominio se escribe una vez en core/, la presentación vive en themes/. core/ NUNCA importa de themes/.

0. Encuadre

  • Si $1 está vacío, abrí src/app/core/domain/examples/examples.registry.ts y tomá el primer ejemplo sin migrar (sin @case en los layouts / sin entrada de contenido).
  • Mirá el worker legacy correspondiente y decidí el DemoKind (o si hace falta uno nuevo).
  • Anotá el plan con TodoWrite antes de tocar código.

1. Dominio (se escribe UNA vez, en core/)

  1. Worker neutral: portá el legacy a core/domain/workers/<id>.worker.ts. Extraé la lógica pura a <id>.worker.logic.ts para poder testearla sin Worker real (jsdom no los soporta). El worker queda como cáscara fina sobre la lógica pura.
  2. Service: core/services/<algo>-demo.service.ts, @Injectable({ providedIn: 'root' }), estado en signals. Seam de tiempo inyectable (clock / stepDelayMs) para los specs. Requisito duro: el estado sobrevive al cambio de theme (un worker corriendo sigue).
  3. DemoKind: si el ejemplo no encaja en una variante existente, sumá el literal a la union en core/domain/examples/example.model.ts.
  4. Registry: entrada en examples.registry.ts con workerFactory/sharedWorkerFactory y los snippets de código neutrales que muestra el code-block.
  5. Test de dominio (antes de UI): spec del .worker.logic.ts y/o del service con un fake-worker. Si tocaste dominio, hay test que lo cubre. npm test verde.

2. i18n (contenido neutral)

  • Agregá examples.$1.* a public/i18n/es.json (único idioma registrado hoy; availableLangs en src/app/app.config.ts). El contenido educativo es neutral; sólo el chrome de cada theme tiene strings propios.

3. Presentación (theme default)

  • Sumá el @case '<DemoKind>' en el example-layout de src/app/themes/default/.
  • El theme midnight reusa el example-layout de default (ver theme.registry.ts / midnight.theme.ts), así que no hace falta duplicar nada ahí. Si más adelante un theme nuevo tiene presentación propia, sumá el mismo @case en su layout.
  • Visualización sin colores/fuentes literales, siempre tokens semánticos (--surface, --ink, --accent, --thread-*): así el switch de theme (incluido midnight) se ve correcto sin tocar el layout. El visualizer se resuelve por DI (THREAD_VISUALIZER).
  • Criterio clave: la visualización enseña el concepto SIN leer el código.

Read the full file on GitHub · 76 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 23d ago Changed · -1 lines 30c3d13b59ba
  2. 1mo ago Changed · +8 lines · -1 tokens per session 3dd3e1fd14e1
  3. 2mo ago First seen · 69 lines · 30 tokens per session scan A e09a253d338a

Subscribe to this mod's changes

migrate-example is a command published in the GitHub repository damiansire/web-worker-patterns (173 stars, last pushed 11d ago), licensed MIT. It adds 29 tokens to every session and 1,264 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.