react-with-rails

react-with-rails is a skill for Claude Code, Codex from sandeepmvl/rails-skills. It costs 114 tokens per session (1,711 once invoked), scanned A, original, MIT.

Guidance for adding React, a JavaScript user-interface library, to a Ruby on Rails application. It compares Inertia.js, which lets Rails provide routing and data to React pages, with a separate React app that talks to a Rails API.

In plain words
What is it for?
Use it to integrate React into Rails, configure JavaScript building, choose between Inertia and a separate API, and decide when Rails' built-in Hotwire is a better fit.
Why use it?
It helps choose an arrangement that matches the number of clients, teams, and deployment needs. That avoids taking on a separate API and application when a single Rails web app would be enough.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is import { mountCalendar } from "../components/Calendar".

Good fit Use it to integrate React into Rails, configure JavaScript building, choose between Inertia and a separate API, and decide when Rails' built-in Hotwire is a better fit.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/sandeepmvl/rails-skills
agentmods
npx agentmods add skills/sandeepmvl/rails-skills/24-react-with-rails

Made for: Claude Code, Codex.

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 react-with-rails

README.md
[![agentmods](https://agentmods.dev/badge/skills/sandeepmvl/rails-skills/24-react-with-rails/github.svg)](https://agentmods.dev/skills/sandeepmvl/rails-skills/24-react-with-rails)
Your own site
<a href="https://agentmods.dev/skills/sandeepmvl/rails-skills/24-react-with-rails"><img src="https://agentmods.dev/badge/skills/sandeepmvl/rails-skills/24-react-with-rails/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 react-with-rails

Your own site · 80×15
<a href="https://agentmods.dev/skills/sandeepmvl/rails-skills/24-react-with-rails"><img src="https://agentmods.dev/badge/skills/sandeepmvl/rails-skills/24-react-with-rails.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 114 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,711 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.00114 $0.01711
Opus 5 $0.00057 $0.00856
Sonnet 5 $0.00023 $0.00342
Haiku 4.5 $0.00011 $0.00171

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

Security

Grade A, and why

react-with-rails 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 11d 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.

skills/24-react-with-rails/SKILL.md · 211 lines

How it starts

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

React with Rails

Two viable paths: Inertia.js (Rails controllers render React components, no separate API) or classical API + SPA (Rails-API serves JSON; React lives in its own repo or its own folder). Pick wrong and you pay for years.

The opinion

Inertia.js for most React + Rails apps. Classical API + SPA only when you have an explicit reason (multi-platform clients, separate deployment cadence, separate teams). Use jsbundling-rails with esbuild or vite_rails. Don't add React to a Hotwire app unless you have a concrete need React solves and Turbo doesn't.

Counter-position: React + GraphQL + Apollo + bespoke routing is mature and has its place. For most Rails + React teams in 2026, Inertia is the right default.

Decision matrix

Need Use
One web client, server-rendered routing, want React's component model Inertia.js
Native mobile client + web SPA + third-party API consumers Classical API + separate React SPA
Heavy real-time + multi-user state React + dedicated state layer (Liveblocks, Yjs); Rails as API
Sprinkles of interactivity on a Rails monolith Don't. Use Hotwire.

Core patterns

Pattern 1: Inertia.js (recommended default)

# Gemfile
gem "inertia_rails"

# config/initializers/inertia_rails.rb (optional)
InertiaRails.configure do |config|
  config.version = ViteRuby.digest  # auto-bust cache on JS bundle change
end
# Controller
class PostsController < ApplicationController
  def index
    posts = Post.includes(:author).order(created_at: :desc).limit(20)
    render inertia: "Posts/Index", props: {
      posts: posts.as_json(only: %i[id title status], include: { author: { only: %i[id name] } })
    }
  end

  def show
    post = Post.find(params[:id])
    render inertia: "Posts/Show", props: { post: post.as_json }
  end
end
// app/frontend/Pages/Posts/Index.jsx
import { Link } from "@inertiajs/react"

export default function Index({ posts }) {
  return (
    <div>
      {posts.map(post => (
        <Link key={post.id} href={`/posts/${post.id}`}>{post.title}</Link>
      ))}
    </div>
  )
}

Read the full file on GitHub · 211 lines

Files

What ships with it

1 file 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. 11d ago First seen · 211 lines · 114 tokens per session scan A f27e350f7b5f

Subscribe to this mod's changes

react-with-rails is a skill published in the GitHub repository sandeepmvl/rails-skills (21 stars, last pushed 3mo ago), licensed MIT. It adds 114 tokens to every session and 1,711 once invoked, about $0.0006 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-30.

Related

Other skills, from other repositories

copilotkit-upgrade

Use when migrating a CopilotKit v1 application to v2 -- updating package imports, replacing deprecated hooks and components, switching from GraphQL runtime to AG-UI protocol runtime, and resolving breaking API changes.

CopilotKit/CopilotKit · 48 tokens

nextjs-app-router

Full end-to-end tRPC setup for Next.js App Router. Covers route handler with fetchRequestHandler (GET + POST exports), TRPCProvider with QueryClientProvider, createTRPCOptionsProxy for RSC prefetching, HydrateClient/HydrationBoundary for hydration, useSuspenseQuery for Suspense, and server-side callers.

trpc/trpc · 74 tokens

nextjs-pages-router

Set up tRPC in Next.js Pages Router with createNextApiHandler, createTRPCNext, withTRPC HOC, SSR via ssr option and ssrPrepass, SSG via createServerSideHelpers with getStaticProps, and server-side helpers for getServerSideProps prefetching.

trpc/trpc · 67 tokens

with-tanstack-query

Compose Angular Query with signal-owned Table filtering, sorting, and pagination state using reactive query options, manual row-model boundaries, direct query data, server counts, and valid injection context.

TanStack/table · 42 tokens

langbot-dev

Develop, build, and debug the LangBot core backend and web frontend. Use when working inside the LangBot repository — backend (Python/Quart, src/langbot/pkg), the Vite/React web UI, HTTP API controllers/services, Alembic migrations, or the MCP server. Covers the dev environment (uv, pnpm), repo layout, the API auth…

langbot-app/LangBot · 136 tokens

trigger-realtime-and-frontend

Trigger.dev client/frontend surface: subscribe to runs in realtime (runs.subscribeToRun and the @trigger.dev/react-hooks hook useRealtimeRun), consume metadata and AI/text streams in React (useRealtimeStream), trigger tasks from the browser (useTaskTrigger, useRealtimeTaskTrigger), and mint scoped frontend credentials…

triggerdotdev/trigger.dev · 148 tokens