turbo-streams-patterns

turbo-streams-patterns is a skill for Claude Code from davidteren/hotwire-codex-skills. It costs 105 tokens per session (788 once invoked), scanned A, original, MIT.

A guide to building live page updates in Ruby on Rails with Turbo Streams, which send small HTML changes to connected browsers.

In plain words
What is it for?
Use it for live chat messages, replacing or editing individual page elements, showing presence, creating custom stream actions, and restricting updates to authorized users.
Why use it?
It helps avoid refreshing whole pages and prevents common mistakes with updates, custom actions, background jobs, and access control.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the hotwire-codex-skills plugin — 8 skills shipped together

Good fit Use it for live chat messages, replacing or editing individual page elements, showing presence, creating custom stream actions, and restricting updates to authorized users.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/davidteren/hotwire-codex-skills/turbo-streams-patterns
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add davidteren/hotwire-codex-skills --skill turbo-streams-patterns
Clone the repo
git clone --depth 1 https://github.com/davidteren/hotwire-codex-skills

Made for: Claude Code.

Or install hotwire-codex-skills, the plugin that ships this one along with the rest of its 8 skills.

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 turbo-streams-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/davidteren/hotwire-codex-skills/turbo-streams-patterns/github.svg)](https://agentmods.dev/skills/davidteren/hotwire-codex-skills/turbo-streams-patterns)
Your own site
<a href="https://agentmods.dev/skills/davidteren/hotwire-codex-skills/turbo-streams-patterns"><img src="https://agentmods.dev/badge/skills/davidteren/hotwire-codex-skills/turbo-streams-patterns/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 turbo-streams-patterns

Your own site · 80×15
<a href="https://agentmods.dev/skills/davidteren/hotwire-codex-skills/turbo-streams-patterns"><img src="https://agentmods.dev/badge/skills/davidteren/hotwire-codex-skills/turbo-streams-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 105 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 788 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.00105 $0.00788
Opus 5 $0.00053 $0.00394
Sonnet 5 $0.00021 $0.00158
Haiku 4.5 $0.00011 $0.00079

Measured 10d ago against content hash 88deb23b7ea2, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

turbo-streams-patterns 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 10d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (scripts/lint_turbo_streams.sh), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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.

skills/turbo-streams-patterns/SKILL.md · 59 lines

How it starts

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

Targeted Turbo Streams

Surgical DOM updates: broadcast/render specific <turbo-stream> actions against specific ids. Use this when you need precision (append a chat message, replace one card, move a class); use turbo-morphing when a whole-page refresh-with-morph is simpler. Full patterns: references/turbo-streams-guide.md.

When to use

  • Live updates: model change → broadcast a partial to subscribers.
  • A custom stream action Turbo doesn't ship (e.g. switch_class).
  • A record's broadcasts are private — only authorized users may subscribe.
  • Debugging: a stream that does nothing, a custom action the client ignores, or broadcasts arriving for the wrong user.

Patterns (and their footguns)

  1. Model broadcast: after_create -> { broadcast_append_later_to parent, target:, partial: }. The _later variants enqueue a job — need an Active Job backend. View subscribes with turbo_stream_from parent, channel: "FooChannel".

  2. Authorize the stream (security): turbo_stream_from only signs the stream name — it does NOT prove this user may receive that record's broadcasts. Use a custom channel that authorizes and rejects otherwise (templates/authorized_channel.rb.tmpl). The default Turbo::StreamsChannel streams from any signed name with no per-record check → eavesdropping risk.

  3. Custom stream action = two halves that MUST match: a JS StreamActions.X and a Ruby helper registered via Turbo::Streams::TagBuilder.prepend (templates/custom_stream_action*.tmpl). One side alone fails silently.

  4. Stream tags inside a frame response: to patch an element outside the frame you're rendering into, embed turbo_stream.* tags in the frame's HTML — no separate *.turbo_stream.erb needed.

  5. Kredis presence: a kredis_set of online users (maintained in the channel's subscribed/unsubscribed) decides live-append vs also notifying/emailing.

Lint an app

Read the full file on GitHub · 59 lines

Files

What ships with it

5 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 10d ago First seen · 59 lines · 105 tokens per session scan A 88deb23b7ea2

Subscribe to this mod's changes

turbo-streams-patterns is a skill published in the GitHub repository davidteren/hotwire-codex-skills (3 stars, last pushed 2mo ago), licensed MIT. It adds 105 tokens to every session and 788 once invoked, about $0.0005 per session on Opus 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-31.

Related

Other skills, from other repositories

liveview-patterns

Build LiveView: async data (assignasync), PubSub (check connected?), phx-change events, form components/modals/uploads, streams for lists, livepatch. Use when handling interactions, debugging events, or tracking Presence.

oliver-kriska/claude-elixir-phoenix · 51 tokens

cesiumjs-core-utilities

CesiumJS core utilities and networking - Resource, Color, Event, Request, RequestScheduler, error handling, helper functions, feature detection. Use when fetching remote data, managing HTTP requests, working with colors, handling events, debugging errors, or using utility functions like defined, clone, or…

CesiumGS/cesiumjs-skills · 69 tokens

fec-data-fetching

A frontend guide for handling data that comes from a server, including typed requests, caching, refreshing, pagination, and updates. Server state means data owned by an API rather than by a page’s local controls.

bovinphang/frontend-craft · 76 tokens

litestar-inertia

Auto-activate for litestarvite.inertia, InertiaConfig, component=, @inertia, @inertiajs/, createInertiaApp, useForm, usePage, Link, router, or pages/. Not for HTMX.

litestar-org/litestar-skills · 56 tokens

litestar-vite

Auto-activate for litestarvite, VitePlugin, ViteConfig, PathConfig, RuntimeConfig, TypeGenConfig, InertiaConfig, vite.config.ts, HMR, typegen, assets, or modes. Not for plain Vite.

litestar-org/litestar-skills · 57 tokens

litestar-htmx

Auto-activate for litestarhtmx, HTMXPlugin, HTMXConfig, HTMXRequest, HTMXTemplate, HXLocation, ReplaceUrl, TriggerEvent, HX- headers, or Litestar partial HTML. Not for generic browser-side HTMX or Litestar Vite JSON templating — those are client concerns.

litestar-org/litestar-skills · 71 tokens