/inertia-rails-skills:inertia-rails-setupfrom inertia-rails-skills
One-time project initializer for Inertia Rails stacks. Detects frontend framework and offers recommended gems (alba-inertia, js-routes, pagy, shadcn). Generates a CLAUDE.md section for skill patterns.
Ships in inertia-rails-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Detect stack, offer recommended deps, generate CLAUDE.md configuration.
Run once per project. Re-run when the stack changes.
NEVER:
inertia_rails gem in Gemfile — all skills assume it exists. If missing, tell the user to install it first.## Inertia Rails Stack in CLAUDE.md without reading it — the user may have manual customizations. Replace only the auto-generated block.@/ resolve aliases to vite.config.ts — vite-plugin-ruby already provides them. Only add to tsconfig.json.alba-inertia if the project uses jbuilder AND the user hasn't expressed interest in switching — suggest it, but don't push. You CAN still suggest it if the project has blueprinter (alba is a direct upgrade path).Read Gemfile (NOT Gemfile.lock) and package.json and check for:
| Look for | Means |
|---|---|
inertia_rails gem | Inertia Rails installed (required) |
@inertiajs/react in package.json | React frontend |
@inertiajs/vue3 in package.json | Vue 3 frontend |
@inertiajs/svelte in package.json | Svelte frontend |
alba-inertia gem | Convention-based rendering active |
alba + typelizer gems (no alba-inertia) | Alba serialization without convention rendering |
pagy gem | Pagy pagination |
kaminari gem | Kaminari pagination |
rspec-rails gem | RSpec testing |
js-routes gem | Typed frontend path helpers |
devise gem | Devise authentication |
pundit gem | Pundit authorization |
action_policy gem | Action Policy authorization |
components.json in root exists | shadcn installed (React: shadcn/ui, Vue: shadcn-vue, Svelte: shadcn-svelte) |
Present detected stack, then offer deps that unlock skill features but aren't installed yet. Use AskUserQuestion with multiSelect for the recommendations.
Only recommend what's missing. Skip anything already detected in Step 1.
| Dep | Type | Install command | What it unlocks |
|---|---|---|---|
alba + typelizer + alba-inertia | gems | bundle add alba typelizer alba-inertia | Convention-based rendering, auto-generated TypeScript types from Ruby. Eliminates render inertia: { ... } boilerplate and manual TS interfaces. Unlocks alba-inertia skill. |
js-routes | gem | bundle add js-routes | Typed path helpers (usersPath(), userPath(id)) in React — no more hardcoded URL strings. |
pagy | gem | bundle add pagy | Lightweight pagination with Inertia-friendly metadata. |
| shadcn/ui (React) | npx | npx shadcn@latest init | Pre-built React components adapted for Inertia. Unlocks shadcn-inertia skill. |
| shadcn-vue (Vue) | npx | npx shadcn-vue@latest init | Pre-built Vue components adapted for Inertia. Unlocks shadcn-vue-inertia skill. |
| shadcn-svelte (Svelte) | npx | npx shadcn-svelte@latest init | Pre-built Svelte components (bits-ui) adapted for Inertia. Unlocks shadcn-svelte-inertia skill. |
Do NOT recommend gems the user clearly chose alternatives for (e.g., don't suggest Pagy if Kaminari is present, you can still suggest alba if the project has jbuilder or blueprinter).
Post-install scaffolding per dep:
ApplicationResource:
# app/resources/application_resource.rb
class ApplicationResource
include Alba::Resource
helper Typelizer::DSL
helper Alba::Inertia::Resource
include Rails.application.routes.url_helpers
end
And add Typelizer initializer:
# config/initializers/typelizer.rb
Typelizer.configure do |config|
config.output_dir = Rails.root.join("app/frontend/types/generated")
end
rails generate js_routes if the generator existsnpx shadcn@latest initnpx shadcn-vue@latest initnpx shadcn-svelte@latest init
After init, add @/ resolve aliases to tsconfig.json if not presentFind or create CLAUDE.md in the project root. If ## Inertia Rails Stack
exists, replace it (up to next ## or EOF). Otherwise, append.
MANDATORY — READ ENTIRE FILE before assembling the CLAUDE.md block:
references/claude-md-templates.md (~90 lines) — all
template blocks for each stack variant (serialization, UI, pagination, testing, routing,
authorization). Pick one block per category based on the detected stack.
Do NOT load the templates file until Step 4 — Steps 1-3 determine which blocks to use.
| Symptom | Cause | Fix |
|---|---|---|
npx shadcn@latest init fails with "No framework detected" | Missing or misconfigured vite.config.ts | Ensure vite-plugin-ruby is configured and tailwindcss is in package.json before running init |
| Typelizer generates types in wrong directory | Missing or wrong output_dir in initializer | Add config/initializers/typelizer.rb with config.output_dir = Rails.root.join("app/frontend/types/generated") |
@/ imports not resolving | Aliases added to vite.config.ts instead of tsconfig.json | vite-plugin-ruby handles Vite aliases — only tsconfig.json needs @/ paths for TypeScript |
| CLAUDE.md has conflicting instructions | Multiple ## Inertia Rails Stack sections | Delete duplicates — only one auto-generated block should exist |
Skills reference alba-inertia but it's not installed | Setup wasn't run, or alba wasn't selected | Re-run setup; CLAUDE.md should say "alba-inertia skill does NOT apply" if gem is absent |
js_routes:generate fails | js-routes gem installed but generator not yet run | Run rails generate js_routes first to create the config file, then rails js_routes:generate |
Tell the user:
## Inertia Rails Stack in CLAUDE.md — it takes precedence over
generic examples in individual skillsWhat SKILL.md sets; muted values are Claude Code's defaults
Generated from the plugin's indexed repository (inertia-rails/skills) — no native marketplace selected
npx claudepluginhub p/inertia-rails-inertia-rails-skills11 skills in this plugin
/alba-inertiaAlba serializers + Typelizer for type-safe Inertia Rails props with auto-generated TypeScript types. Use when serializing models for Inertia responses, setting up Alba resources, generating TypeScript types from Ruby, or using Inertia prop options (defer, once, merge, scroll) with Alba attributes. Replaces as_json with structured, auto-typed ApplicationResource, page resources, and shared props resources. When active, OVERRIDES the `render inertia: { ... }` pattern from other skills — use convention-based instance variable rendering instead./inertia-rails-architectureServer-driven architecture patterns for Inertia Rails + React. Load this FIRST when building any Inertia page or feature — it routes to the right skill. Decision matrix for data loading, forms, navigation, state management. NEVER useEffect+fetch, NEVER redirect_to for external URLs (use inertia_location), NEVER react-hook-form (use Form component). MUST invoke when adding pages, models with views, CRUD, or displaying data in an Inertia Rails app. ALWAYS `render inertia: { key: value }` to pass data — `@ivars` are NOT auto-passed as props./inertia-rails-controllersALWAYS `render inertia: { key: data }` to pass data as props — instance variables are NOT auto-passed (only alba-inertia does that). Rails controller patterns for Inertia.js: render inertia, prop types (defer, optional, merge, scroll), shared data, flash, PRG redirects, validation errors. Use when writing controllers that load data, display records, or serve Inertia responses. CRITICAL: external URLs (Stripe/OAuth) MUST use inertia_location, NEVER redirect_to./inertia-rails-formsFull-stack form handling for Inertia Rails: create, edit, delete, multi-step wizard, and file upload forms with validation errors and progress tracking. React examples inline; Vue and Svelte equivalents in references. Use when building any form, handling file uploads, multi-step forms, client-side validation, or wiring form submission to Rails controllers. NEVER react-hook-form. Use `<Form>` for simple forms, useForm for dynamic/programmatic control./inertia-rails-pagesPage components, persistent layouts, Link/router navigation, Head, Deferred, WhenVisible, InfiniteScroll, and URL-driven state for Inertia Rails. React examples inline; Vue and Svelte equivalents in references. Use when building pages, adding navigation, implementing persistent layouts, infinite scroll, lazy-loaded sections, or working with client-side Inertia APIs (router.reload, router.replaceProp, prefetching)./inertia-rails-testingTesting Inertia Rails responses with RSpec and Minitest: component assertions, prop matching, flash verification, deferred props, and partial reload helpers. Use when writing controller specs, request specs, or integration tests for Inertia pages. ALWAYS use matchers (render_component, have_props, have_flash), NOT direct access (inertia.component, inertia.props). CRITICAL: after POST/PATCH/DELETE with redirect, MUST call follow_redirect! before asserting flash or props — without it you're asserting against the 302, not the Inertia page. Setup: require 'inertia_rails/rspec'.Other plugins' skills for the same job