All skills
asyrafhussin avatar

/laravel-best-practices

@ef59186

Laravel 13 conventions and best practices. Use when creating controllers, models, migrations, validation, services, or structuring Laravel applications. Triggers on tasks involving Laravel architecture, Eloquent, database, API development, or PHP patterns.

Use this Skill: https://skilld.dev/gh/asyrafhussin/agent-skills/laravel-best-practices

This session only. Nothing lands on disk.

README.md

≈508 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Laravel 13 Best Practices

Comprehensive best practices for Laravel 13 applications.

Overview

This skill provides guidance for:

  • Application architecture and structure
  • Eloquent ORM and database patterns
  • Controller and routing conventions
  • Validation and form requests
  • Security best practices
  • Performance optimization
  • API design patterns

Categories

1. Architecture & Structure (Critical)

Service classes, actions, repositories, and folder organization.

2. Eloquent & Database (Critical)

Eager loading, query scopes, migrations, and indexing.

3. Controllers & Routing (High)

Resource controllers, route model binding, and API resources.

4. Validation & Requests (High)

Form request classes, custom rules, and authorization.

5. Security (High)

Mass assignment, SQL injection, XSS, and authentication.

6. Performance (Medium)

Caching, queues, and database optimization.

7. API Design (Medium)

Versioning, resources, pagination, and error handling.

8. Testing (Low-Medium)

Feature tests, unit tests, factories, and mocking.

Quick Start

// Form Request
class StorePostRequest extends FormRequest
{
    public function authorize(): bool
    {
        return $this->user()->can('create', Post::class);
    }

    public function rules(): array
    {
        return [
            'title' => ['required', 'string', 'max:255'],
            'body' => ['required', 'string'],
        ];
    }
}

// Controller
class PostController extends Controller
{
    public function store(StorePostRequest $request): RedirectResponse
    {
        $post = Post::create($request->validated());

        return redirect()->route('posts.show', $post);
    }
}

Usage

This skill triggers automatically when:

  • Creating Laravel controllers and models
  • Writing migrations and queries
  • Implementing validation
  • Building APIs

References

Source: SKILL.md on GitHub

No alerts16d5 checks · Risk SAFE
  • Gen Agent Trust Hub16d

    The skill is a comprehensive guide to Laravel 13 best practices, providing safe and standard architectural, database, and security patterns for PHP development. No malicious behavior or security risks were detected.

  • Socket16d

    No alerts

  • Snyk16d

    Risk: LOW · No issues

  • Runlayer6mo

    1/37 files flagged

  • ZeroLeaks5mo

    2 findings · Score: 80/100

Signed by skilld at ef59186. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub last month.

Steadyupdated 7 months ago
Other metadata
metadata
{
  "author": "Laravel Community",
  "version": "2.1.0",
  "laravelVersion": "13.x",
  "phpVersion": "8.3+"
}

README badge

README badge for asyrafhussin/agent-skills/laravel-best-practices