skillZs
★ LIVE SKILL TAGS ★
>>> LIVE SKILLS INDEX <<<
* OPEN SOURCE *
NO LOGIN, NO TRACKING
※ REAL INSTALL DATA ※
← back to all skills
fusengine/agents192 installs

laravel-blade

Create Blade templates with components, slots, layouts, and directives. Use when building views, reusable components, or templating.

How do I install this agent skill?

npx skills add https://github.com/fusengine/agents --skill laravel-blade
view source ↗

Is this agent skill safe to install?

  • Gen Agent Trust Hubpass

    This skill provides a comprehensive set of documentation and templates for Laravel Blade development. It correctly emphasizes security best practices, such as XSS prevention through mandatory output escaping and CSRF protection in forms. No malicious patterns, obfuscation, or high-risk behaviors were detected.

  • Socketpass

    No alerts

  • Snykpass

    Risk: LOW · No issues

  • Runlayerwarn

    22/22 files flagged

What does this agent skill do?

<objective> Covers Laravel Blade templating: anonymous and class-based components, named slots and attribute bags ($attributes->merge()), layouts (component-based and @extends/@section inheritance), directives (@if, @foreach, @auth, @can, and advanced ones like @once/@use/@inject/@switch/stacks), custom directives (Blade::if, Blade::directive), security (XSS/CSRF escaping), Vite asset integration, forms/validation helpers (@error), and fragments for HTMX-style partial updates. </objective>

Laravel Blade

Agent Workflow (MANDATORY)

Before ANY implementation, spawn 3 agents in parallel, one Agent call each with a name:

  1. fuse-ai-pilot:explore-codebase - Check existing views, components structure
  2. fuse-ai-pilot:research-expert - Verify latest Blade docs via Context7
  3. mcp__context7__query-docs - Query specific patterns (components, slots)

After implementation, run fuse-ai-pilot:sniper for validation.


Overview

Blade is Laravel's templating engine. It provides a clean syntax for PHP in views while compiling to pure PHP for performance.

Component TypeWhen to Use
AnonymousSimple UI, no logic needed
Class-basedDependency injection, complex logic
LayoutPage structure, reusable shells
DynamicRuntime component selection

Critical Rules

  1. Always escape output - Use {{ }} not {!! !!} unless absolutely necessary
  2. Use @props - Declare expected props explicitly
  3. Merge attributes - Allow class/attribute overrides with $attributes->merge()
  4. Prefer anonymous - Use class components only when logic is needed
  5. Use named slots - For complex layouts with multiple content areas
  6. CSRF in forms - Always include @csrf in forms

Decision Guide

Component Type Selection

Need dependency injection?
├── YES → Class-based component
└── NO → Anonymous component
    │
    Need complex props logic?
    ├── YES → Class-based component
    └── NO → Anonymous component

Layout Strategy

Simple page structure?
├── YES → Component layout (<x-layout>)
└── NO → Need fine-grained sections?
    ├── YES → @extends/@section
    └── NO → Component layout

Key Concepts

ConceptDescriptionReference
@propsDeclare component propertiescomponents.md
$attributesPass-through HTML attributesslots-attributes.md
x-slotNamed content areasslots-attributes.md
@yield/@sectionTraditional layout inheritancelayouts.md
$loopLoop iteration infodirectives.md

Reference Guide

Concepts (WHY & Architecture)

TopicReferenceWhen to Consult
Componentscomponents.mdClass vs anonymous, namespacing
Slots & Attributesslots-attributes.mdData flow, $attributes bag
Layoutslayouts.mdPage structure, inheritance
Directivesdirectives.md@if, @foreach, @auth, @can
Securitysecurity.mdXSS, CSRF, escaping
Vitevite.mdAsset bundling
Advanced Directivesadvanced-directives.md@once, @use, @inject, @switch, stacks
Custom Directivescustom-directives.mdBlade::if, Blade::directive
Advanced Componentsadvanced-components.md@aware, shouldRender, index
Forms & Validationforms-validation.md@error, form helpers
Fragmentsfragments.md@fragment, HTMX integration

Templates (Complete Code)

TemplateWhen to Use
ClassComponent.php.mdComponent with logic/DI
AnonymousComponent.blade.mdSimple reusable UI
LayoutComponent.blade.mdPage layout structure
FormComponent.blade.mdForm with validation
CardWithSlots.blade.mdNamed slots pattern
DynamicComponent.blade.mdRuntime component
AdvancedDirectives.blade.md@once, @use, @inject, @switch
CustomDirectives.php.mdCreate custom directives
AdvancedComponents.blade.md@aware, shouldRender, index
Fragments.blade.mdHTMX partial updates

Quick Reference

Anonymous Component

{{-- resources/views/components/alert.blade.php --}}
@props(['type' => 'info', 'message'])

<div {{ $attributes->merge(['class' => 'alert alert-'.$type]) }}>
    {{ $message }}
</div>

Class Component

// 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');
    }
}

Named Slots

<x-card>
    <x-slot:header class="font-bold">
        Title
    </x-slot>

    Content goes here

    <x-slot:footer>
        Footer content
    </x-slot>
</x-card>

Attribute Merging

@props(['disabled' => false])

<button {{ $attributes->merge([
    'type' => 'submit',
    'class' => 'btn btn-primary'
])->class(['opacity-50' => $disabled]) }}
    @disabled($disabled)
>
    {{ $slot }}
</button>

Best Practices

DO

  • Use @props to document expected props
  • Use $attributes->merge() for flexibility
  • Prefer anonymous components for simple UI
  • Use named slots for complex layouts
  • Keep components focused and reusable

DON'T

  • Use {!! !!} without sanitization
  • Forget @csrf in forms
  • Put business logic in Blade templates
  • Create deeply nested component hierarchies
  • Hardcode classes (allow overrides)

Laravel 13 Notes

Controller attributes #[Middleware] and #[Authorize]

Laravel 13 supports PHP attributes on controller classes AND methods to declare middleware and authorization (replaces __construct middleware boilerplate).

use Illuminate\Routing\Attributes\Controllers\Middleware;
use Illuminate\Routing\Attributes\Controllers\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) { /* ... */ }
}

Attribute-declared middleware is merged with group/route middleware (13.8+) and inherited by child controllers (13.5+); #[Middleware('log', only: ['index'])] / except: and #[WithoutMiddleware(...)] (13.20+) are available. #[Authorize] is a shorthand for the can middleware (403 when the policy denies).

@fonts directive (13.7+)

Injects the self-hosted fonts generated by the fonts option of laravel-vite-plugin (see [[laravel-vite]]).

Add the canonical catalog link to the repository README so users can inspect current installs and available audits. The publishing guide covers the complete discovery path.

<a href="https://skillzs.dev/skills/fusengine/agents/laravel-blade">View laravel-blade on skillZs</a>