laravel-11-12-app-guidelines
Original:🇺🇸 English
Translated
Guidelines and workflow for working on Laravel 11 or Laravel 12 applications across common stacks (API-only or full-stack), including optional Docker Compose/Sail, Inertia + React, Livewire, Vue, Blade, Tailwind v4, Fortify, Wayfinder, PHPUnit, Pint, and Laravel Boost MCP tools. Use when implementing features, fixing bugs, or making UI/backend changes while following project-specific instructions (AGENTS.md, docs/).
8installs
Added on
NPX Install
npx skill4agent add thienanblog/awesome-ai-agent-skills laravel-11-12-app-guidelinesTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →Laravel 11/12 App Guidelines
Overview
Apply a consistent workflow for Laravel 11/12 apps with optional frontend stacks, Dockerized commands, and Laravel Boost tooling.
Quick Start
- Read repository instructions first: . If
AGENTS.mdexists, readdocs/and relevant module docs before decisions.docs/README.md - Detect the stack and command locations; do not guess.
- Use Laravel Boost for Laravel ecosystem guidance; use Context7 only if Boost docs are unavailable.
search-docs - Follow repo conventions for naming, UI language, docs-first policies, and existing component patterns.
Stack Detection
- Check ,
composer.json,package.json, anddocker-compose.*to confirm:config/*- Docker Compose/Sail vs host commands
- API-only vs full-stack
- Frontend framework (Inertia/React, Livewire, Vue, Blade)
- Auth (Fortify, Sanctum, Passport, custom)
Laravel 11/12 Core Conventions
- Use the Laravel 11/12 structure: configure middleware, exceptions, and routes in ; service providers in
bootstrap/app.php; console configuration inbootstrap/providers.php.routes/console.php - Use Eloquent models and relationships first; avoid raw queries and unless truly necessary.
DB:: - Create Form Request classes for validation instead of inline validation.
- Prefer named routes and for URL generation.
route() - When altering columns, include all existing attributes in the migration to avoid dropping them.
- Ask before destructive database operations (e.g., reset/rollback/fresh).
API-Only Mode
- Use ; avoid Inertia and frontend assumptions.
routes/api.php - Prefer API Resources and versioning if the repo already uses them.
- Follow the repo's auth stack (Sanctum/Passport/custom) and response format conventions.
- Do not require Vite/Tailwind/NPM unless the repo already includes them.
Inertia + React + Wayfinder (if present)
- Use for server-side routing; place pages under
Inertia::render()unless the repo says otherwise.resources/js/Pages - Use or
<Form>for Inertia forms; add skeleton/empty states for deferred props.useForm - Use or
<Link>for navigation.router.visit() - Use Wayfinder named imports for tree-shaking; avoid default imports; regenerate routes after changes if required.
Livewire / Vue / Blade (if present)
- Follow existing component patterns and conventions; do not mix frameworks unless the repo already does.
- Keep UI strings in the repo's expected language.
Tailwind CSS v4 (if present)
- Use and
@import "tailwindcss";for tokens.@theme - Avoid deprecated utilities; use replacements (e.g., ,
shrink-*,grow-*).text-ellipsis - Use for spacing between items; follow existing dark mode conventions if present.
gap-*
Testing and Formatting
- Use PHPUnit; generate tests with and prefer feature tests.
php artisan make:test --phpunit - Run the minimal relevant tests (or
php artisan test <file>).--filter= - Run before finalizing code changes.
vendor/bin/pint --dirty - After minimal tests pass, offer to run the full test suite.
Laravel Boost MCP Tools (when available)
- before changing behavior or using framework features.
search-docs - to confirm Artisan options.
list-artisan-commands - to inspect routing changes.
list-routes - for PHP debugging and
tinkerfor read-only DB checks.database-query - to inspect frontend errors.
browser-logs - for sharing project URLs.
get-absolute-url - See for query patterns and tool usage tips.
references/boost-tools.md
Output Expectations
- Preserve existing architecture, structure, and dependencies unless the user explicitly requests changes.
- Reuse existing components and follow local patterns.
- Ask concise clarifying questions when repo guidance is missing or ambiguous.