Skip to content
laravel-blade logo

Laravel Blade

laravel-blade

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

SKILL.md

Full skill instructions

Laravel Blade

Agent Workflow (MANDATORY)

Before ANY implementation, launch in parallel:

  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)

More Security skills

supabase logo
Security

supabase

Handles the full Supabase workflow from schema changes to deployment, with built-in security guardrails that catch common traps like RLS...

2.7K 308.9K
View

Comprehensive guides and best practices for Neon Serverless Postgres, covering setup, connection methods, authentication, and platform APIs.

98 216.2K
View

Guide for setting up and using Firebase Authentication. Use this skill when the user's app requires user sign-in, user management, or secure data access using auth rules.

462 163.8K
View

A skill to evaluate how secure Firestore security rules are. Use this when Firestore security rules are updated to ensure that the generated rules are extremely secure and robust.

462 127.7K
View

Official skill for integrating Firebase AI Logic (Gemini API) into web applications. Covers setup, multimodal inference, structured output, and security.

462 125.1K
View

Complete Better Auth server and client setup with database adapters, session management, plugins, and security configuration.

222 118.2K
View

Deploy and manage projects on Vercel using token-based authentication. Use when working with Vercel CLI using access tokens rather than interactive login — e.g. "deploy to vercel", "set up vercel", "add environment variables to vercel".

31.9K 116.1K
View
cloudflare logo
Security

cloudflare

Complete Cloudflare platform integration with decision trees for compute, storage, AI, networking, security, and infrastructure-as-code.

3K 110.7K
View

Run Azure compliance and security audits with azqr plus Key Vault expiration checks. Covers best-practice assessment, resource review, policy/compliance validation, and security posture checks. WHEN: compliance scan, security audit, BEFORE running azqr (compliance cli tool), Azure best practices, Key Vault expiration check, expired certificates, expiring secrets, orphaned resources, compliance assessment.

253 103K
View
gws-gmail logo
Security

gws-gmail

Send, read, and manage Gmail messages, drafts, labels, and account settings.

31.2K 78.9K
View

Comprehensive website auditing across 230+ rules in 21 categories including SEO, performance, security, and accessibility.

94 72.3K
View
gws-shared logo
Security

gws-shared

Shared authentication, CLI syntax, and output formatting patterns for gws Google Workspace commands.

31.2K 63.4K
View

Security AI tools

StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
GeoSpy logo
Security

GeoSpy

GeoSpy: Pricing, Features, FAQs, and Alternatives for AI Teams

Free
View

Detect AI-generated voices to protect against audio fraud.

Paid
View

Ensure Your Content's Originality with AI Plagiarism Checker

Freemium
View
Img Upscaler logo
Security

Img Upscaler

Upscale images by 400% without quality loss

Freemium
View
AICheatCheck logo
Security

AICheatCheck

Accurately Detect AI-Generated Content with TheChecker.AI

Free
View
D
Security

Detect GPT

Chrome extension that detects and flags AI-generated content

Free
View