跳到主内容
智客 ZICQ

技能库 智客分类:Agent 工作流 laravel-inertia-react

Laravel Inertia React

Laravel + Inertia.js + React 集成模式. 在构建 Inertia 页面组件时使用, 用处理表单 形式,管理共享数据,或实施持续布局. 触发涉及Inertia.js,页面道具,窗体处理,或Laravel React集成的任务.

1677 安装量

官方网址:skills.sh

技能介绍

先看中文介绍;官方 description 原文单独保留,不改写 SKILL.md。

做什么

Laravel + Inertia.js + 反应融合模式

何时用

构建 Inertia 页面组件, 随用处理表格 形式,管理共享数据,或实施持续布局. Inertia.js、页面道具、窗体处理或 Laravel React 集成等任务的触发器

代理如何加载

按 Agent Skills 渐进披露:启动时只加载 name 与 description(约 100 token);任务匹配后才读入整份 SKILL.md 正文;scripts/、references/、assets/ 仅在需要时再读。 本文件正文结构:Laravel + Inertia.js + React、When to Apply、Rule Categories by Priority、Quick Reference、1. Page Components (CRITICAL)、2. Forms & Validation (CRITICAL)。

文件分析

文件分析:这是一份仅含 SKILL.md 的指令型技能,代理激活后整份正文进入上下文。

官方 description(原文)

Laravel + Inertia.js + React integration patterns. Use when building Inertia page components, handling forms with useForm, managing shared data, or implementing persistent layouts. Triggers on tasks involving Inertia.js, page props, form handling, or Laravel React integration.

Laravel + Inertia.js + ReactWhen to ApplyRule Categories by PriorityQuick Reference1. Page Components (CRITICAL)2. Forms & Validation (CRITICAL)3. Navigation & Links (HIGH)4. Shared Data (HIGH)5. Layouts (MEDIUM)6. File Uploads (MEDIUM)7. Advanced Patterns (LOW)Essential Patterns

· 许可:MIT

来源分类:skills.sh agent-skill

SKILL.md 与 Agent 调用

官方规范 ↗
name
laravel-inertia-react
description
Laravel + Inertia.js + React integration patterns. Use when building Inertia page components, handling forms with useForm, managing shared data, or implementing persistent layouts. Triggers on tasks involving Inertia.js, page props, form handling, or Laravel React integration.
许可
MIT
  1. 发现技能客户端向 Agent 提供名称与描述目录。
  2. 匹配与调用用户指定或任务匹配后,载入 SKILL.md 指令。
  3. 按需加载按步骤读取参考文档、使用脚本与素材。

具体调用语法与可用工具以目标 Agent 客户端为准。 查看调用机制说明 ↗

安装这个技能

Skills CLI ↗

先选择目标 Agent 和安装范围,保留技能包的附属文件,安装后检查客户端能否发现该技能。

交给 Agent 安装

复制安装指令给支持 Agent Skills 的代理,确认其中的目标目录与客户端匹配。

把 Agent Skill「laravel-inertia-react」安装到我的项目:SKILL.md 原文与官方 description 见 https://zicq.com/zh/skills/skl-38b8fdfa0a3be368-Laravel-Inertia-%E5%8F%8D%E5%BA%94.html
请存为 .cursor/skills/laravel-inertia-react/SKILL.md 或 .claude/skills/laravel-inertia-react/SKILL.md,frontmatter 的 name 与 description 保持原样,不要改写。

GitHub 完整包 ↗

终端安装 · Skills CLI

需要 Node.js 与 npx。先查看仓库技能列表,确认实际名称。

npx skills add 'https://github.com/asyrafhussin/agent-skills' --list

npx skills add 'https://github.com/asyrafhussin/agent-skills' --skill 'laravel-inertia-react'

CLI 会交互选择目标 Agent,默认安装到项目;用户级安装使用 -g。先通过查看命令核对仓库内容,再用 npx skills list 检查已安装技能。

阅读排版
--- name: laravel-inertia-react description: Laravel + Inertia.js + React integration patterns. Use when building Inertia page components, handling forms with useForm, managing shared data, or implementing persistent layouts. Triggers on tasks involving Inertia.js, page props, form handling, or Laravel React integration. license: MIT metadata: author: AsyrafHussin version: "1.0.2" laravelVersion: "13.x" phpVersion: "8.3+" --- # Laravel + Inertia.js + React Comprehensive patterns for building modern monolithic applications with Laravel, Inertia.js, and React. Contains 30+ rules for seamless full-stack development. ## When to Apply Reference these guidelines when: - Creating Inertia page components - Handling forms with useForm hook - Managing shared data and authentication - Implementing persistent layouts - Navigating between pages ## Rule Categories by Priority | Priority | Category | Impact | Prefix | |----------|----------|--------|--------| | 1 | Page Components | CRITICAL | `page-` | | 2 | Forms & Validation | CRITICAL | `form-` | | 3 | Navigation & Links | HIGH | `nav-` | | 4 | Shared Data | HIGH | `shared-` | | 5 | Layouts | MEDIUM | `layout-` | | 6 | File Uploads | MEDIUM | `upload-` | | 7 | Advanced Patterns | LOW | `advanced-` | ## Quick Reference ### 1. Page Components (CRITICAL) - `page-props-typing` - Type page props from Laravel - `page-component-structure` - Standard page component pattern - `page-head-management` - Title and meta tags with Head - `page-default-layout` - Assign layouts to pages ### 2. Forms & Validation (CRITICAL) - `form-useform-basic` - Basic useForm usage - `form-validation-errors` - Display Laravel validation errors - `form-processing-state` - Handle form submission state - `form-reset-preserve` - Reset vs preserve form data - `form-nested-data` - Handle nested form data - `form-transform` - Transform data before submit ### 3. Navigation & Links (HIGH) - `nav-link-component` - Use Link for navigation - `nav-preserve-state` - Preserve scroll and state - `nav-partial-reloads` - Reload only what changed - `nav-replace-history` - Replace vs push history ### 4. Shared Data (HIGH) - `shared-auth-user` - Access authenticated user - `shared-flash-messages` - Handle flash messages - `shared-global-props` - Access global props - `shared-typescript` - Type shared data ### 5. Layouts (MEDIUM) - `layout-persistent` - Persistent layouts pattern - `layout-nested` - Nested layouts - `layout-default` - Default layout assignment - `layout-conditional` - Conditional layouts ### 6. File Uploads (MEDIUM) - `upload-basic` - Basic file upload - `upload-progress` - Upload progress tracking - `upload-multiple` - Multiple file uploads ### 7. Advanced Patterns (LOW) - `advanced-polling` - Real-time polling - `advanced-prefetch` - Prefetch pages - `advanced-modal-pages` - Modal as pages - `advanced-infinite-scroll` - Infinite scrolling ## Essential Patterns ### Page Component with TypeScript ```tsx // resources/js/Pages/Posts/Index.tsx import { Head, Link } from '@inertiajs/react' interface Post { id: number title: string excerpt: string created_at: string author: { id: number name: string } } interface Props { posts: { data: Post[] links: { url: string | null; label: string; active: boolean }[] } filters: { search?: string } } export default function Index({ posts, filters }: Props) { return ( <>

Posts

{posts.data.map((post) => (

{post.title}

{post.excerpt}

By {post.author.name}

))}
) } ``` ### Form with useForm ```tsx // resources/js/Pages/Posts/Create.tsx import { Head, useForm, Link } from '@inertiajs/react' import { FormEvent } from 'react' interface Category { id: number name: string } interface Props { categories: Category[] } export default function Create({ categories }: Props) { const { data, setData, post, processing, errors, reset } = useForm({ title: '', body: '', category_id: '', }) const handleSubmit = (e: FormEvent) => { e.preventDefault() post(route('posts.store'), { onSuccess: () => reset(), }) } return ( <>
Title setData('title', e.target.value)} className="w-full border rounded px-3 py-2" /> {errors.title && (

{errors.title}

)}
Category setData('category_id', e.target.value)} className="w-full border rounded px-3 py-2" > Select a category {categories.map((category) => ( {category.name} ))} {errors.category_id && (

{errors.category_id}

)}
Content setData('body', e.target.value)} rows={10} className="w-full border rounded px-3 py-2" /> {errors.body && ( <p className="text-red-500 text-sm mt-1">{errors.body}</p> )} </div> <div className="flex gap-4"> <button type="submit" disabled={processing} className="px-4 py-2 bg-blue-600 text-white rounded disabled:opacity-50" > {processing ? 'Creating...' : 'Create Post'} </button> <Link href={route('posts.index')} className="px-4 py-2 border rounded" > Cancel </Link> </div> </form> </> ) } ``` ### Persistent Layout ```tsx // resources/js/Layouts/AppLayout.tsx import { Link, usePage } from '@inertiajs/react' import { ReactNode } from 'react' interface Props { children: ReactNode } export default function AppLayout({ children }: Props) { const { auth } = usePage().props as { auth: { user: { name: string } } } return ( <div className="min-h-screen bg-gray-100"> <nav className="bg-white shadow"> <div className="container mx-auto px-4 py-3 flex justify-between"> <Link href="/" className="font-bold"> My App </Link> <span>Welcome, {auth.user.name}</span> </div> </nav> <main className="container mx-auto px-4 py-8"> {children} </main> </div> ) } // resources/js/Pages/Dashboard.tsx import AppLayout from '@/Layouts/AppLayout' export default function Dashboard() { return <h1>Dashboard</h1> } // Assign persistent layout Dashboard.layout = (page: ReactNode) => <AppLayout>{page}</AppLayout> ``` ### Laravel Controller ```php <?php namespace App\Http\Controllers; use App\Http\Requests\StorePostRequest; use App\Models\Post; use App\Models\Category; use Illuminate\Http\RedirectResponse; use Inertia\Inertia; use Inertia\Response; class PostController extends Controller { public function index(): Response { return Inertia::render('Posts/Index', [ 'posts' => Post::with('author:id,name') ->latest() ->paginate(10), 'filters' => request()->only('search'), ]); } public function create(): Response { return Inertia::render('Posts/Create', [ 'categories' => Category::all(['id', 'name']), ]); } public function store(StorePostRequest $request): RedirectResponse { $post = Post::create([ ...$request->validated(), 'user_id' => auth()->id(), ]); return redirect() ->route('posts.show', $post) ->with('success', 'Post created successfully.'); } public function show(Post $post): Response { return Inertia::render('Posts/Show', [ 'post' => $post->load('author', 'category'), ]); } } ``` ### Shared Data (HandleInertiaRequests) ```php <?php namespace App\Http\Middleware; use Illuminate\Http\Request; use Inertia\Middleware; class HandleInertiaRequests extends Middleware { public function share(Request $request): array { return array_merge(parent::share($request), [ 'auth' => [ 'user' => $request->user() ? [ 'id' => $request->user()->id, 'name' => $request->user()->name, 'email' => $request->user()->email, ] : null, ], 'flash' => [ 'success' => $request->session()->get('success'), 'error' => $request->session()->get('error'), ], ]); } } ``` ### Flash Messages Component ```tsx // resources/js/Components/FlashMessages.tsx import { usePage } from '@inertiajs/react' import { useEffect, useState } from 'react' export default function FlashMessages() { const { flash } = usePage().props as { flash: { success?: string; error?: string } } const [visible, setVisible] = useState(false) useEffect(() => { if (flash.success || flash.error) { setVisible(true) const timer = setTimeout(() => setVisible(false), 3000) return () => clearTimeout(timer) } }, [flash]) if (!visible) return null return ( <div className="fixed top-4 right-4 z-50"> {flash.success && ( <div className="bg-green-500 text-white px-4 py-2 rounded shadow"> {flash.success} </div> )} {flash.error && ( <div className="bg-red-500 text-white px-4 py-2 rounded shadow"> {flash.error} </div> )} </div> ) } ``` ## How to Use Read individual rule files for detailed explanations and code examples: ``` rules/form-useform-basic.md rules/page-props-typing.md rules/layout-persistent.md ``` ## Project Structure ``` laravel-inertia-react/ ├── SKILL.md # This file - overview and examples ├── README.md # Quick reference guide ├── AGENTS.md # Integration guide for AI agents ├── metadata.json # Skill metadata and references └── rules/ ├── _sections.md # Rule categories and priorities ├── _template.md # Template for new rules ├── page-*.md # Page component patterns (6 rules) ├── form-*.md # Form handling patterns (8 rules) ├── nav-*.md # Navigation patterns (5 rules) ├── shared-*.md # Shared data patterns (4 rules) └── layout-*.md # Layout patterns (1 rule) ``` ## References - [Inertia.js Documentation](https://inertiajs.com/) - Official Inertia.js docs - [Laravel Documentation](https://laravel.com/docs) - Laravel framework docs - [React Documentation](https://react.dev/) - Official React docs - [Ziggy](https://github.com/tighten/ziggy) - Laravel route helper for JavaScript ## License MIT License. This skill is provided as-is for educational and development purposes. ## Metadata - **Version**: 1.0.1 - **Last Updated**: 2026-01-17 - **Maintainer**: Asyraf Hussin - **Rule Count**: 24 rules across 6 categories - **Tech Stack**: Laravel 10+, Inertia.js 1.0+, React 18+, TypeScript 5+

相关技能

Agent 工作流

Skill Creator

创造有效技能指南。 当用户想创造出新的技能(或更新现有的技能),以专业知识,工作流程,或工具集成来扩展克洛德的能力时,应该使用这种技能.

Agent 工作流

Clawdhub

使用ClawdHub CLI搜索,安装,更新并发布从taladhub.com的代理技能. 需要获取苍蝇上的新技能时使用,将安装的技能同步到最新版本或特定版本,或者发布 npm-instainddhub CLI 的新/更新的技能文件夹.

Agent 工作流

Agent Team Orchestration

管弦乐团多代理团队,任务设定周期,交接协议,审查工作流程. 使用时间: (1)建立2+特派员队伍,具有不同专业,(2)确定任务路线和生命周期(收录框_ spec_建设_审查_完成),(3)在特派员之间制定交接协议,(4)建立审查和质量关口,(5)管理特派员之间的交流和文物共享.

Agent 工作流

Superpowers

Spec-first,TDD,子代理驱动的软件开发工作流程. 当:(1)构建任何新功能或应用——触发脑暴_计划_子代理执行回路,(2)调试出一个bug或测试失败——触发系统性的根起过程,(3)用户说"让我们构建","帮助我计划","我想添加X",或"这个被打破",(4)完成一个功…