Token导航 LogoToken导航TokenDH.com
前端设计需要联网github未标认证来源可访问许可证需确认审计通过

shadcn-inertiashadcn/ui inertia 命令行

Agent Skill

shadcn-inertia 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

2,584

周安装

111

GitHub Stars

44

下载量

906
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:shadcn-inertia(shadcn/ui inertia 命令行)
来源仓库:https://github.com/inertia-rails/skills
仓库路径:skills/shadcn-inertia
安装命令:
npx skills add https://github.com/inertia-rails/skills --skill shadcn-inertia
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/inertia-rails/skills --skill shadcn-inertia

简介

shadcn-inertia 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。

  • 适用于 shadcn/ui 与 Inertia.js 集成的前端项目协作,如页面路由管理。
  • 通过 npx skills add 命令从指定 GitHub 仓库安装,需结合原始 README 确认具体用法。
  • 安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写操作。
  • 可结合来源仓库和 SKILL.md 继续核验功能细节,确保与项目需求匹配。

SKILL.md

shadcn/ui for Inertia Rails

shadcn/ui patterns adapted for Inertia.js + Rails + React. NOT Next.js.

Before using a shadcn example, ask:

  • Does it use react-hook-form + zod? → Replace with Inertia <Form> + name attributes. Inertia handles CSRF, errors, redirects, processing state — react-hook-form would fight all of this.
  • Does it use 'use client'? → Remove it. Inertia has no RSC — all components are client components.
  • Does it use next/link, next/head, useRouter()? → Replace with Inertia <Link>, <Head>, router.

Key Differences from Next.js Defaults

shadcn default (Next.js)Inertia equivalent
'use client' directiveRemove — not needed (no RSC)
react-hook-form + zodInertia <Form> component
FormField, FormItem, FormMessagePlain <Input name="..."> + errors.field
next-themesCSS class strategy + @custom-variant
useRouter() (Next)router from @inertiajs/react
next/link<Link> from @inertiajs/react
next/head<Head> from @inertiajs/react

NEVER use shadcn's FormField, FormItem, FormLabel, FormMessage components — they depend on react-hook-form's useFormContext internally and will crash without it. Use plain shadcn Input/Label/Select with name attributes inside Inertia <Form>, and render errors from the render function's errors object (see examples below).

Setup

npx shadcn@latest init. add @/ resolve aliases to tsconfig.json if not present, Do NOT add @/ resolve aliases to vite.config.tsvite-plugin-ruby already provides them.

shadcn Inputs in Inertia <Form>

Use plain shadcn Input/Label/Button with name attributes inside Inertia <Form>. See inertia-rails-forms skill for full <Form> API — this section covers shadcn-specific adaptation only.

The key pattern: Replace shadcn's FormField/FormItem/FormMessage with plain components + manual error display:

// shadcn error display pattern (replaces FormMessage):
<Label htmlFor="name">Name</Label>
<Input id="name" name="name" />
{errors.name && <p className="text-sm text-destructive">{errors.name}</p>}

<Select> requires name prop for Inertia <Form> integration — shadcn examples omit it because react-hook-form manages values differently:

<Select name="role" defaultValue="member">
  <SelectTrigger><SelectValue placeholder="Select role" /></SelectTrigger>
  <SelectContent>
    <SelectItem value="admin">Admin</SelectItem>
    <SelectItem value="member">Member</SelectItem>
  </SelectContent>
</Select>

Dialog with Inertia Navigation

import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@/components/ui/dialog'
import { router } from '@inertiajs/react'

function UserDialog({ open, user }: { open: boolean; user: User }) {
  return (
    <Dialog
      open={open}
      onOpenChange={(isOpen) => {
        if (!isOpen) {
          router.replaceProp('show_dialog', false)
        }
      }}
    >
      <DialogContent>
        <DialogHeader>
          <DialogTitle>{user.name}</DialogTitle>
        </DialogHeader>
        {/* content */}
      </DialogContent>
    </Dialog>
  )
}

Table with Server-Side Sorting

shadcn <Table> renders normally. The Inertia-specific part is sorting via router.get:

const handleSort = (column: string) => {
  router.get('/users', { sort: column }, { preserveState: true })
}

<TableHead onClick={() => handleSort('name')} className="cursor-pointer">
  Name {sort === 'name' && '↑'}
</TableHead>

Use <Link> (not <a>) for row links to preserve SPA navigation.

Toast with Flash Messages

Flash config (flash_keys) is in inertia-rails-controllers. Flash access (usePage().flash) is in inertia-rails-pages. This section covers toast UI wiring only.

MANDATORY — READ ENTIRE FILE when implementing flash-based toasts with Sonner: references/flash-toast.md (~80 lines) — full useFlash hook and Sonner toast provider. Do NOT load if only reading flash values without toast UI.

Key gotcha: flash_keys in the Rails initializer MUST match your FlashData TypeScript type — do NOT use success/error unless you also update both.

Dark Mode (No next-themes)

npx shadcn@latest init generates CSS variables for light/dark and @custom-variant dark (&:is(.dark *)); in your CSS (Tailwind v4). No extra setup needed for the variables themselves.

CRITICAL — prevent flash of wrong theme (FOUC): Next.js handles this automatically; Inertia does NOT. Add an inline script in <head> (before React hydrates) and call initializeTheme() in your Inertia entrypoint:

<%# app/views/layouts/application.html.erb — in <head>, before any stylesheets %>
<script>
  document.documentElement.classList.toggle(
    "dark",
    localStorage.appearance === "dark" ||
      (!("appearance" in localStorage) && window.matchMedia("(prefers-color-scheme: dark)").matches),
  );
</script>
// app/frontend/entrypoints/inertia.tsx
import { initializeTheme } from '@/hooks/use-appearance'
initializeTheme() // must run before createInertiaApp

Use a useAppearance hook (light/dark/system modes, localStorage persistence, matchMedia listener) instead of next-themes. Toggle via .dark class on <html> — no provider needed.

Troubleshooting

SymptomCauseFix
FormField/FormMessage crashUsing shadcn form components that depend on react-hook-formReplace with plain Input/Label + errors.field display
Select value not submittedMissing name propAdd name="field" to <Select> — shadcn examples omit it
Dialog closes unexpectedlyMissing or wrong onOpenChange handlerUse onOpenChange={(open) => {if (!open) closeHandler()}}
Flash of wrong theme (FOUC)Missing inline <script> in <head>Add dark mode script before stylesheets (see Dark Mode section)

Related Skills

  • Form componentinertia-rails-forms (<Form> render function, useForm)
  • Flash configinertia-rails-controllers (flash_keys initializer)
  • Flash accessinertia-rails-pages (usePage().flash)
  • URL-driven dialogsinertia-rails-pages (router.get pattern)

References

Load references/components.md (~300 lines) when building shadcn components beyond those shown above (Accordion, Sheet, Tabs, DropdownMenu, AlertDialog with Inertia patterns).

Do NOT load components.md for basic Form, Select, Dialog, or Table usage — the examples above are sufficient.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

33.47%
按下载量换算303

Claude

30.77%
按下载量换算279

Cursor

17.31%
按下载量换算157

Gemini CLI

9.24%
按下载量换算84

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills