Apply Webminty's Inertia.js coding standards for any task that creates, edits, reviews, refactors, or formats Laravel controllers returning Inertia responses, HandleInertiaRequests middleware, shared data, or Inertia-specific testing patterns; covers the Laravel side of Inertia.js applications.
php artisan boost:add-skill webminty/boost-webminty-guidelines
Save this content to: .claude/skills/webminty-inertia-standards/SKILL.md
# Webminty Inertia Guidelines
## Overview
Apply Webminty's Inertia guidelines for projects using Inertia.js as the frontend bridge. These standards cover the **Laravel side only**: controllers, middleware, shared data, redirects, form handling, and testing. Frontend framework conventions (React, Vue, Svelte) are out of scope.
## When to Activate
- Activate this skill when working on controllers that return `Inertia::render()` responses.
- Activate this skill when editing `HandleInertiaRequests` middleware or shared data.
- Activate this skill when writing tests that use `assertInertia()`.
- Activate this skill when creating or editing Inertia-related routes.
## Scope
- In scope: Inertia controllers, `Inertia::render()`, `HandleInertiaRequests` middleware, shared props, partial reloads and prop types (`Inertia::optional()`, `Inertia::defer()`, `Inertia::always()`, `Inertia::merge()`, `Inertia::once()`, `shareOnce()`), SSR configuration (Laravel side), Inertia redirects, Inertia testing with `assertInertia()`.
- Out of scope: Core PHP/Laravel standards (see `webminty-laravel-standards`), Tailwind CSS conventions (see `webminty-tailwind-standards`), frontend framework conventions (React, Vue, Svelte components, TypeScript, state management).
## Workflow
1. Identify the Inertia artifact (controller, middleware, shared data, route, test).
2. Read only the reference file(s) listed under References that match the task.
3. Apply `webminty-laravel-standards` first (PHP conventions, strict types), then Inertia-specific rules.
## Core Rules
- Controllers return `Inertia::render('PageName', [...props])`, never JSON. Keep API-only endpoints in separate API controllers.
- Page component names use PascalCase path notation: `Tickets/Show`, `Auth/Login`.
- Share common data (auth user, flash messages) via `HandleInertiaRequests::share()`. Don't share large datasets globally — use `Inertia::optional()` or page-specific props.
- Use `Inertia::optional()`, `Inertia::defer()`, `Inertia::always()`, `Inertia::merge()`, and `Inertia::once()` for controlling when props are loaded; use `Inertia::optional()` for expensive data that isn't always needed (frontend opts in via partial reload). (`Inertia::lazy()` was removed in v3.)
- Redirects use standard Laravel `redirect()->route()` / `redirect()->back()` after successful form submissions — Inertia handles them automatically.
- Use Form Requests for validation — Inertia handles 422 responses automatically.
- Delegate business logic to Actions, not controllers.
## Examples
```php
// Inertia controller
class ShowController extends Controller
{
public function __invoke(Ticket $ticket): Response
{
return Inertia::render('Tickets/Show', [
'ticket' => TicketsResource::make($ticket),
'comments' => Inertia::optional(
fn () => CommentResource::collection($ticket->comments),
),
]);
}
}
```
```php
// Inertia test
test('can view ticket', function (): void {
$user = User::factory()->create();
$ticket = Ticket::factory()->create();
$this->actingAs($user)
->get(route('tickets.show', $ticket))
->assertInertia(fn (Assert $page) => $page
->component('Tickets/Show')
->has('ticket')
);
});
```
## References
Read only what the task needs, all under `references/`:
- `controllers-data.md` — Controllers, shared data, partial reloads
- `forms-routing.md` — Form handling, redirects, routes, directory structure, SSR
- `testing.md` — Inertia testing
Apply Webminty's Inertia guidelines for projects using Inertia.js as the frontend bridge. These standards cover the Laravel side only: controllers, middleware, shared data, redirects, form handling, and testing. Frontend framework conventions (React, Vue, Svelte) are out of scope.
Inertia::render() responses.HandleInertiaRequests middleware or shared data.assertInertia().Inertia::render(), HandleInertiaRequests middleware, shared props, partial reloads and prop types (Inertia::optional(), Inertia::defer(), Inertia::always(), Inertia::merge(), Inertia::once(), shareOnce()), SSR configuration (Laravel side), Inertia redirects, Inertia testing with assertInertia().webminty-laravel-standards), Tailwind CSS conventions (see webminty-tailwind-standards), frontend framework conventions (React, Vue, Svelte components, TypeScript, state management).webminty-laravel-standards first (PHP conventions, strict types), then Inertia-specific rules.Inertia::render('PageName', [...props]), never JSON. Keep API-only endpoints in separate API controllers.Tickets/Show, Auth/Login.HandleInertiaRequests::share(). Don't share large datasets globally — use Inertia::optional() or page-specific props.Inertia::optional(), Inertia::defer(), Inertia::always(), Inertia::merge(), and Inertia::once() for controlling when props are loaded; use Inertia::optional() for expensive data that isn't always needed (frontend opts in via partial reload). (Inertia::lazy() was removed in v3.)redirect()->route() / redirect()->back() after successful form submissions — Inertia handles them automatically.// Inertia controller
class ShowController extends Controller
{
public function __invoke(Ticket $ticket): Response
{
return Inertia::render('Tickets/Show', [
'ticket' => TicketsResource::make($ticket),
'comments' => Inertia::optional(
fn () => CommentResource::collection($ticket->comments),
),
]);
}
}
// Inertia test
test('can view ticket', function (): void {
$user = User::factory()->create();
$ticket = Ticket::factory()->create();
$this->actingAs($user)
->get(route('tickets.show', $ticket))
->assertInertia(fn (Assert $page) => $page
->component('Tickets/Show')
->has('ticket')
);
});
Read only what the task needs, all under references/:
controllers-data.md — Controllers, shared data, partial reloadsforms-routing.md — Form handling, redirects, routes, directory structure, SSRtesting.md — Inertia testingHow can I help you explore Laravel packages today?