Agent skill

Laravel Patterns

by affaan-m in affaan-m/ECC

Patrones de arquitectura Laravel, routing/controladores, Eloquent ORM, capas de servicio, colas, eventos, caché y API resources para aplicaciones en producción.

MITAuto-check: notesBackend & APIs

Install Laravel Patterns

skills CLI
$ npx skills add affaan-m/ECC --skill laravel-patterns -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install affaan-m/ECC laravel-patterns --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/affaan-m/ECC.git skills-src && mkdir -p .claude/skills && cp -r skills-src/docs/es/skills/laravel-patterns .claude/skills/laravel-patterns && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
laravel-patterns
GitHub stars
276k
Token cost
~2.7k tokens
SKILL.md length
505 words
Files
1
Skills in repo
683
Repo updated
First seen
Licence
MIT

At a glance

Patrones de arquitectura Laravel, routing/controladores, Eloquent ORM, capas de servicio, colas, eventos, caché y API resources para aplicaciones en producción.

  • Tasks that involve Backend development
  • SKILL.md covers Cuándo Usar, Cómo Funciona and Ejemplos
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
  • Tasks that involve ORMs and data access

What it does

Laravel Patterns is an agent skill from affaan-m/ECC. Patrones de arquitectura Laravel, routing/controladores, Eloquent ORM, capas de servicio, colas, eventos, caché y API resources para aplicaciones en producción.

Its SKILL.md is about 2.7k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Backend & APIs, covering Backend development and ORMs and data access. It works with Laravel. The repository describes itself as: The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond. The licence is MIT.

When your agent uses it

  • Tasks that involve Backend development
  • Tasks that involve ORMs and data access

Example prompts

  • “Use the laravel-patterns skill to patrone de arquitectura Laravel, routing/controladores, Eloquent ORM, capas de servicio, colas, eventos, caché y…”
  • “/laravel-patterns”

What it can do on your machine

Read from SKILL.md and the folder at commit 4eb71d9. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are php).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Laravel Patterns loads about 2.7k tokens when it runs. Until then it costs about 44 tokens; SKILL.md has 505 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~44
When it runs · the whole SKILL.md, loaded when a task matches
~2.7k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check: notes

The automated check noted patterns worth knowing about, such as sudo or a known installer.

  • NoteMentions a .env fileSKILL.md:414
    - Mantener secretos en `.env` y configuración en `config/*.php`

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from affaan-m/ECC at commit 4eb71d9, republished under its MIT licence (© affaan-m). 505 words, ~2,716 tokens.

Download SKILL.mdSave it as .claude/skills/laravel-patterns/SKILL.md (or your agent's skills folder).
name
laravel-patterns
description
Patrones de arquitectura Laravel, routing/controladores, Eloquent ORM, capas de servicio, colas, eventos, caché y API resources para aplicaciones en producción.
origin
ECC

Patrones de Desarrollo Laravel

Patrones de arquitectura Laravel de nivel producción para aplicaciones escalables y mantenibles.

Cuándo Usar

  • Construir aplicaciones web o APIs con Laravel
  • Estructurar controladores, servicios y lógica de dominio
  • Trabajar con modelos Eloquent y relaciones
  • Diseñar APIs con resources y paginación
  • Agregar colas, eventos, caché y jobs en segundo plano

Cómo Funciona

  • Estructurar la app con límites claros (controladores -> servicios/actions -> modelos).
  • Usar bindings explícitos y bindings con scope para mantener el routing predecible; aplicar autorización para el control de acceso.
  • Favorecer modelos tipados, casts y scopes para mantener la lógica de dominio consistente.
  • Mantener el trabajo intensivo de IO en colas y cachear lecturas costosas.
  • Centralizar la configuración en config/* y mantener los entornos explícitos.

Ejemplos

Estructura del Proyecto

Usar un layout convencional de Laravel con límites de capa claros (HTTP, servicios/actions, modelos).

Layout Recomendado
app/
├── Actions/            # Casos de uso de un solo propósito
├── Console/
├── Events/
├── Exceptions/
├── Http/
│   ├── Controllers/
│   ├── Middleware/
│   ├── Requests/       # Validación con Form Requests
│   └── Resources/      # API resources
├── Jobs/
├── Models/
├── Policies/
├── Providers/
├── Services/           # Servicios de dominio coordinadores
└── Support/
config/
database/
├── factories/
├── migrations/
└── seeders/
resources/
├── views/
└── lang/
routes/
├── api.php
├── web.php
└── console.php
Controladores -> Servicios -> Actions

Mantener los controladores delgados. Poner la orquestación en servicios y la lógica de un solo propósito en actions.

php
final class CreateOrderAction
{
    public function __construct(private OrderRepository $orders) {}

    public function handle(CreateOrderData $data): Order
    {
        return $this->orders->create($data);
    }
}

final class OrdersController extends Controller
{
    public function __construct(private CreateOrderAction $createOrder) {}

    public function store(StoreOrderRequest $request): JsonResponse
    {
        $order = $this->createOrder->handle($request->toDto());

        return response()->json([
            'success' => true,
            'data' => OrderResource::make($order),
            'error' => null,
            'meta' => null,
        ], 201);
    }
}
Routing y Controladores

Preferir route-model binding y controladores de recursos para mayor claridad.

php
use Illuminate\Support\Facades\Route;

Route::middleware('auth:sanctum')->group(function () {
    Route::apiResource('projects', ProjectController::class);
});
Route Model Binding con Scope

Usar bindings con scope para prevenir acceso entre tenants.

php
Route::scopeBindings()->group(function () {
    Route::get('/accounts/{account}/projects/{project}', [ProjectController::class, 'show']);
});
Rutas Anidadas y Nombres de Binding
  • Mantener prefijos y rutas consistentes para evitar doble anidamiento (ej. conversation vs conversations).
  • Usar un único nombre de parámetro que coincida con el modelo vinculado (ej. {conversation} para Conversation).
  • Preferir bindings con scope al anidar para aplicar relaciones padre-hijo.
php
use App\Http\Controllers\Api\ConversationController;
use App\Http\Controllers\Api\MessageController;
use Illuminate\Support\Facades\Route;

Route::middleware('auth:sanctum')->prefix('conversations')->group(function () {
    Route::post('/', [ConversationController::class, 'store'])->name('conversations.store');

    Route::scopeBindings()->group(function () {
        Route::get('/{conversation}', [ConversationController::class, 'show'])
            ->name('conversations.show');

        Route::post('/{conversation}/messages', [MessageController::class, 'store'])
            ->name('conversation-messages.store');

        Route::get('/{conversation}/messages/{message}', [MessageController::class, 'show'])
            ->name('conversation-messages.show');
    });
});

Si deseas que un parámetro resuelva a una clase de modelo diferente, definir un binding explícito. Para lógica de binding personalizada, usar Route::bind() o implementar resolveRouteBinding() en el modelo.

php
use App\Models\AiConversation;
use Illuminate\Support\Facades\Route;

Route::model('conversation', AiConversation::class);
Bindings del Contenedor de Servicios

Vincular interfaces a implementaciones en un service provider para una inyección de dependencias clara.

php
use App\Repositories\EloquentOrderRepository;
use App\Repositories\OrderRepository;
use Illuminate\Support\ServiceProvider;

final class AppServiceProvider extends ServiceProvider
{
    public function register(): void
    {
        $this->app->bind(OrderRepository::class, EloquentOrderRepository::class);
    }
}
Patrones de Modelos Eloquent
Configuración del Modelo
php
final class Project extends Model
{
    use HasFactory;

    protected $fillable = ['name', 'owner_id', 'status'];

    protected $casts = [
        'status' => ProjectStatus::class,
        'archived_at' => 'datetime',
    ];

    public function owner(): BelongsTo
    {
        return $this->belongsTo(User::class, 'owner_id');
    }

    public function scopeActive(Builder $query): Builder
    {
        return $query->whereNull('archived_at');
    }
}
Casts Personalizados y Objetos de Valor

Usar enums u objetos de valor para tipado estricto.

php
use Illuminate\Database\Eloquent\Casts\Attribute;

protected $casts = [
    'status' => ProjectStatus::class,
];
php
protected function budgetCents(): Attribute
{
    return Attribute::make(
        get: fn (int $value) => Money::fromCents($value),
        set: fn (Money $money) => $money->toCents(),
    );
}
Show full SKILL.md (204 more words)Show less
Eager Loading para Evitar N+1
php
$orders = Order::query()
    ->with(['customer', 'items.product'])
    ->latest()
    ->paginate(25);
Query Objects para Filtros Complejos
php
final class ProjectQuery
{
    public function __construct(private Builder $query) {}

    public function ownedBy(int $userId): self
    {
        $query = clone $this->query;

        return new self($query->where('owner_id', $userId));
    }

    public function active(): self
    {
        $query = clone $this->query;

        return new self($query->whereNull('archived_at'));
    }

    public function builder(): Builder
    {
        return $this->query;
    }
}
Global Scopes y Soft Deletes

Usar global scopes para filtrado por defecto y SoftDeletes para registros recuperables. Usar ya sea un global scope o un named scope para el mismo filtro, no ambos, a menos que se desee comportamiento en capas.

php
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Builder;

final class Project extends Model
{
    use SoftDeletes;

    protected static function booted(): void
    {
        static::addGlobalScope('active', function (Builder $builder): void {
            $builder->whereNull('archived_at');
        });
    }
}
Query Scopes para Filtros Reutilizables
php
use Illuminate\Database\Eloquent\Builder;

final class Project extends Model
{
    public function scopeOwnedBy(Builder $query, int $userId): Builder
    {
        return $query->where('owner_id', $userId);
    }
}

// En servicio, repositorio, etc.
$projects = Project::ownedBy($user->id)->get();
Transacciones para Actualizaciones Multi-Paso
php
use Illuminate\Support\Facades\DB;

DB::transaction(function (): void {
    $order->update(['status' => 'paid']);
    $order->items()->update(['paid_at' => now()]);
});
Migraciones
Convención de Nomenclatura
  • Los nombres de archivo usan timestamps: YYYY_MM_DD_HHMMSS_create_users_table.php
  • Las migraciones usan clases anónimas (sin clase con nombre); el nombre del archivo comunica la intención
  • Los nombres de tablas son snake_case y plurales por defecto
Ejemplo de Migración
php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    public function up(): void
    {
        Schema::create('orders', function (Blueprint $table): void {
            $table->id();
            $table->foreignId('customer_id')->constrained()->cascadeOnDelete();
            $table->string('status', 32)->index();
            $table->unsignedInteger('total_cents');
            $table->timestamps();
        });
    }

    public function down(): void
    {
        Schema::dropIfExists('orders');
    }
};
Form Requests y Validación

Mantener la validación en Form Requests y transformar las entradas a DTOs.

php
use App\Models\Order;

final class StoreOrderRequest extends FormRequest
{
    public function authorize(): bool
    {
        return $this->user()?->can('create', Order::class) ?? false;
    }

    public function rules(): array
    {
        return [
            'customer_id' => ['required', 'integer', 'exists:customers,id'],
            'items' => ['required', 'array', 'min:1'],
            'items.*.sku' => ['required', 'string'],
            'items.*.quantity' => ['required', 'integer', 'min:1'],
        ];
    }

    public function toDto(): CreateOrderData
    {
        return new CreateOrderData(
            customerId: (int) $this->validated('customer_id'),
            items: $this->validated('items'),
        );
    }
}
API Resources

Mantener respuestas de API consistentes con resources y paginación.

php
$projects = Project::query()->active()->paginate(25);

return response()->json([
    'success' => true,
    'data' => ProjectResource::collection($projects->items()),
    'error' => null,
    'meta' => [
        'page' => $projects->currentPage(),
        'per_page' => $projects->perPage(),
        'total' => $projects->total(),
    ],
]);
Eventos, Jobs y Colas
  • Emitir eventos de dominio para efectos secundarios (emails, analíticas)
  • Usar jobs en cola para trabajo lento (reportes, exportaciones, webhooks)
  • Preferir handlers idempotentes con reintentos y backoff
Caché
  • Cachear endpoints y consultas costosas con muchas lecturas
  • Invalidar cachés en eventos del modelo (created/updated/deleted)
  • Usar tags al cachear datos relacionados para facilitar la invalidación
Configuración y Entornos
  • Mantener secretos en .env y configuración en config/*.php
  • Usar sobreescrituras de configuración por entorno y config:cache en producción

© affaan-m, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in docs/es/skills/laravel-patterns of affaan-m/ECC.

Open the folder on GitHubat commit 4eb71d9

Compare with similar skills

Laravel Patterns next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Laravel Patterns compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Laravel Patterns this skillaffaan-m/ECC276k—~2.7kAutomated safety check: NotesMIT
Laravel SpecialistJeffallan/claude-skills12k1 repos~2.1kAutomated safety check: PassMIT
Laravel Query Builderhexlet-volunteers/hexlet-sicp114—~2.4kAutomated safety check: PassMIT
Php Framework Auditwgpsec/AboutSecurity1.8k—~767Automated safety check: NotesNone
Migratesoftspark/ai-toolkit179—~1.3kAutomated safety check: NotesApache-2.0
Configuring Horizoncoollabsio/coolify63k4 repos~898Automated safety check: PassMIT

Similar skills

  • Laravel Specialist

    Jeffallan/claude-skills

    Builds Laravel 10+ applications with Eloquent models, Sanctum authentication, Horizon queues, API resources and Livewire components, tested with Pest or PHPUnit.

    12k GitHub starsUsed in 1 repo~2.1k tokens
    Backend & APIsAuto-check passed
  • Laravel Query Builder

    hexlet-volunteers/hexlet-sicp

    Build filtered, sorted, and included API endpoints using spatie/laravel-query-builder.

    114 GitHub stars~2.4k tokensUpdated 5 days ago
    Backend & APIsAuto-check passed
  • Php Framework Audit

    wgpsec/AboutSecurity

    PHP 框架特定安全审计。当在 PHP 白盒审计中已识别目标使用特定框架、 需要检查框架特有安全机制和常见配置缺陷时触发。

    1.8k GitHub stars~767 tokensUpdated yesterday
    Backend & APIsAuto-check: notes
  • Migrate

    softspark/ai-toolkit

    Run/create DB migrations (Alembic, Prisma, Laravel, Django, Flyway, Drizzle); checks backup.

    179 GitHub stars~1.3k tokensUpdated 2 days ago
    DatabasesAuto-check: notes
  • Configuring Horizon

    coollabsio/coolify

    A skill your agent uses whenever the user mentions Horizon by name in a Laravel context.

    63k GitHub starsUsed in 4 repos~898 tokens
    Backend & APIsAuto-check passed
  • Fortify Development

    coollabsio/coolify

    ACTIVATE when the user works on authentication in Laravel. An agent skill from coollabsio/coolify.

    63k GitHub starsUsed in 4 repos~1.9k tokens
    Backend & APIsAuto-check passed

More from affaan-m/ECC

All 683 skills in this repo
  • Skill Stocktake

    affaan-m/ECC

    Audits your installed Claude skills and commands for quality, with a quick mode for recently changed skills and a full mode that evaluates all of them through subagents.

    276k GitHub starsUsed in 5 repos~3.1k tokens
    Auto-check passed
  • Ingests, indexes, searches, edits and monitors video, audio and live streams through the VideoDB Python SDK, returning stream links, clips and timestamps.

    276k GitHub starsUsed in 3 repos~3.5k tokens
    Auto-check: notes
  • Docs Governance

    affaan-m/ECC

    Route broad documentation-governance requests to existing ECC skills and run an opt-in, read-only audit of mapped documentation roles, links, ADR indexes, and evidence references.

    276k GitHub stars~1.1k tokensUpdated yesterday
    Auto-check passed
  • Rules Distillation

    affaan-m/ECC

    Scans installed skills for principles that recur across them and proposes rule-file changes: append, revise, add a section, create a file or leave as covered.

    276k GitHub starsUsed in 2 repos~2.3k tokens
    Auto-check passed
  • Builds DRAFT counterparty agreements from one markdown template and a small JSON spec per party, with clauses picked by the party's role.

    276k GitHub stars~2.9k tokensUpdated yesterday
    Auto-check passed
  • Measures whether agents actually follow a skill, rule or agent definition by generating scenarios at three strictness levels and scoring tool-call traces.

    276k GitHub starsUsed in 1 repo~623 tokens
    Auto-check passed

Works with

Categories

Questions about Laravel Patterns

What does Laravel Patterns do?

Patrones de arquitectura Laravel, routing/controladores, Eloquent ORM, capas de servicio, colas, eventos, caché y API resources para aplicaciones en producción. Laravel Patterns is an agent skill from affaan-m/ECC. Patrones de arquitectura Laravel, routing/controladores, Eloquent ORM, capas de servicio, colas, eventos, caché y API resources para aplicaciones en producción.

When should I use Laravel Patterns?

Laravel Patterns fits situations like: tasks that involve Backend development; tasks that involve ORMs and data access.

How do I install Laravel Patterns in Claude Code?

Run `npx skills add affaan-m/ECC --skill laravel-patterns -a claude-code`. Or copy the skill folder (docs/es/skills/laravel-patterns in affaan-m/ECC) into .claude/skills/laravel-patterns in your project. Claude Code loads it when a task matches its description.

How do I install Laravel Patterns in Codex?

Run `npx skills add affaan-m/ECC --skill laravel-patterns -a codex`. Or copy the skill folder (docs/es/skills/laravel-patterns in affaan-m/ECC) into .agents/skills/laravel-patterns in your project. Codex loads it when a task matches its description.

Can I use Laravel Patterns in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add affaan-m/ECC --skill laravel-patterns -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/laravel-patterns, .gemini/skills/laravel-patterns, .github/skills/laravel-patterns and .opencode/skills/laravel-patterns in your project.

What does Laravel Patterns need to run?

SKILL.md names no scripts, command-line tools or credentials: Laravel Patterns is instructions for the agent only.

Does Laravel Patterns access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Laravel Patterns safe to install?

Our automated static check of SKILL.md found notes only (mentions a .env file), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.

What licence does Laravel Patterns use?

Laravel Patterns is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Laravel Patterns use?

About 2.7k tokens (SKILL.md is roughly 11k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Laravel Patterns?

Skills that share tags, products or a category with Laravel Patterns: Laravel Specialist (Jeffallan/claude-skills, 12k stars), Laravel Query Builder (hexlet-volunteers/hexlet-sicp, 114 stars), Php Framework Audit (wgpsec/AboutSecurity, 1.8k stars) and Migrate (softspark/ai-toolkit, 179 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Laravel Patterns?

affaan-m (a GitHub user) maintains it in affaan-m/ECC, which has 276,111 GitHub stars. The repository holds 683 skills in this directory. The repository was last updated on October 10, 2026.

Source: affaan-m/ECC on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.