plugins/laravel-expert/skills/laravel-blade/SKILL.md
Create Blade templates with components, slots, layouts, and directives. Use when building views, reusable components, or templating.
npx skillsauth add fusengine/agents laravel-bladeInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Before ANY implementation, use TeamCreate to spawn 3 agents:
After implementation, run fuse-ai-pilot:sniper for validation.
Blade is Laravel's templating engine. It provides a clean syntax for PHP in views while compiling to pure PHP for performance.
| Component Type | When to Use | |----------------|-------------| | Anonymous | Simple UI, no logic needed | | Class-based | Dependency injection, complex logic | | Layout | Page structure, reusable shells | | Dynamic | Runtime component selection |
{{ }} not {!! !!} unless absolutely necessary$attributes->merge()@csrf in formsNeed dependency injection?
├── YES → Class-based component
└── NO → Anonymous component
│
Need complex props logic?
├── YES → Class-based component
└── NO → Anonymous component
Simple page structure?
├── YES → Component layout (<x-layout>)
└── NO → Need fine-grained sections?
├── YES → @extends/@section
└── NO → Component layout
| Concept | Description | Reference | |---------|-------------|-----------| | @props | Declare component properties | components.md | | $attributes | Pass-through HTML attributes | slots-attributes.md | | x-slot | Named content areas | slots-attributes.md | | @yield/@section | Traditional layout inheritance | layouts.md | | $loop | Loop iteration info | directives.md |
| Topic | Reference | When to Consult | |-------|-----------|-----------------| | Components | components.md | Class vs anonymous, namespacing | | Slots & Attributes | slots-attributes.md | Data flow, $attributes bag | | Layouts | layouts.md | Page structure, inheritance | | Directives | directives.md | @if, @foreach, @auth, @can | | Security | security.md | XSS, CSRF, escaping | | Vite | vite.md | Asset bundling | | Advanced Directives | advanced-directives.md | @once, @use, @inject, @switch, stacks | | Custom Directives | custom-directives.md | Blade::if, Blade::directive | | Advanced Components | advanced-components.md | @aware, shouldRender, index | | Forms & Validation | forms-validation.md | @error, form helpers | | Fragments | fragments.md | @fragment, HTMX integration |
| Template | When to Use | |----------|-------------| | ClassComponent.php.md | Component with logic/DI | | AnonymousComponent.blade.md | Simple reusable UI | | LayoutComponent.blade.md | Page layout structure | | FormComponent.blade.md | Form with validation | | CardWithSlots.blade.md | Named slots pattern | | DynamicComponent.blade.md | Runtime component | | AdvancedDirectives.blade.md | @once, @use, @inject, @switch | | CustomDirectives.php.md | Create custom directives | | AdvancedComponents.blade.md | @aware, shouldRender, index | | Fragments.blade.md | HTMX partial updates |
{{-- resources/views/components/alert.blade.php --}}
@props(['type' => 'info', 'message'])
<div {{ $attributes->merge(['class' => 'alert alert-'.$type]) }}>
{{ $message }}
</div>
// app/View/Components/Alert.php
class Alert extends Component
{
public function __construct(
public string $type = 'info',
public string $message = ''
) {}
public function render(): View
{
return view('components.alert');
}
}
<x-card>
<x-slot:header class="font-bold">
Title
</x-slot>
Content goes here
<x-slot:footer>
Footer content
</x-slot>
</x-card>
@props(['disabled' => false])
<button {{ $attributes->merge([
'type' => 'submit',
'class' => 'btn btn-primary'
])->class(['opacity-50' => $disabled]) }}
@disabled($disabled)
>
{{ $slot }}
</button>
@props to document expected props$attributes->merge() for flexibility{!! !!} without sanitization@csrf in forms#[Middleware] et #[Authorize]Laravel 13 supporte les attributs PHP sur les classes ET méthodes de controllers pour déclarer middleware et autorisations (remplace __construct middleware boilerplate).
use Illuminate\Routing\Attributes\Middleware;
use Illuminate\Routing\Attributes\Authorize;
#[Middleware(['auth', 'verified'])]
final class PostController extends Controller
{
#[Authorize('viewAny', Post::class)]
public function index() { return view('posts.index'); }
#[Middleware('throttle:60,1')]
#[Authorize('create', Post::class)]
public function store(StorePostRequest $request) { /* ... */ }
}
Le middleware passé via attribut s'applique avant les middlewares groupes/routes. #[Authorize] jette AuthorizationException (403) si la policy refuse.
testing
Copy self-audit and ban-lists — filler verbs/hype adjectives, slop placeholder names, fake-precise numbers, Title Case headlines, humor in error copy ('Oops!'), em-dash crutch, one copy register per page.
development
Logged-in web apps — dashboards, auth flows, settings, onboarding, data tables, command palettes, modals, toasts. Register `product`: density and glance-speed over marketing polish, no hero/CTA-tricks, every data surface covers empty/loading/error explicitly, tables and dataviz follow preattentive-processing rules.
development
Marketing sites, landing pages, campaign pages — register `brand` (design IS the product). Structure comes from the register's POV + a macrostructure pick, never from copying an inspiration site's section flow. Hero discipline, deviated section order, asymmetric grids, and a silhouette lookalike-test gate before ship.
development
Token-strategy core — OKLCH color rules, neutral tinting, accent-commitment levels, type scale, 8pt spacing grid, touch targets, and the canonical output format of design-system.md (the file the harness gates on). This is routing step 1 of design-method/SKILL.md — read it before design-web/design-webapp/design-ios/design-android, before picking or auditing a single color/type/spacing value.