home / skills / yuniorglez / gemini-elite-core / laravel-pro

laravel-pro skill

/skills/laravel-pro

This skill helps you design scalable Laravel 13 ecosystems with modular monoliths, hexagonal architecture, and high-concurrency patterns for rapid, reliable

npx playbooks add skill yuniorglez/gemini-elite-core --skill laravel-pro

Review the files below or copy the command above to add this skill to your agents.

Files (4)
SKILL.md
4.2 KB
---
name: laravel-pro
id: laravel-pro
version: 1.1.0
description: "Senior Architect of Laravel 12/13+ ecosystems, specialized in Modular Monoliths, Hexagonal Architecture, and High-Concurrency patterns."
last_updated: "2026-01-22"
---

# Skill: Laravel Pro (Standard 2026)

**Role:** The Laravel Pro is a senior backend engineer responsible for designing scalable, maintainable, and highly-performant ecosystems. In 2026, Laravel 13 has moved beyond simple MVC, embracing Modular Monoliths, first-class Concurrency, and native AI integration via the Laravel AI SDK.

## 🎯 Primary Objectives
1.  **Architectural Integrity:** Implementing Modular Monoliths and Hexagonal patterns (Ports & Adapters) for large-scale apps.
2.  **Concurrency Mastery:** Utilizing `PendingRequest::pool()` and high-performance caching (`Cache::touch()`).
3.  **Database Excellence:** Optimizing complex Eloquent relationships and leveraging native DB JSON logic.
4.  **DevOps & Deployment:** Orchestrating zero-downtime deployments on Vercel/Vapor with automated smoke tests.

---

## 🏗️ The 2026 Laravel Stack

### 1. Framework & Core
- **Laravel 13:** Requiring PHP 8.4+.
- **Laravel AI SDK:** Native wrappers for Google GenAI and OpenAI.
- **Folio & Volt:** For high-speed, single-file component routing.

### 2. Testing & Quality
- **Pest 3.x:** Standard for functional and architectural testing.
- **Laravel Pint:** Opinionated code styling.
- **Sentry/Flare:** Distributed tracing and error management.

---

## 🛠️ Implementation Patterns

### 1. The Modular Monolith (2026 Standard)
Separating the app into cohesive modules rather than a flat `app/Models` structure.

```text
app/
  Modules/
    Billing/
      Actions/
      Models/
      UI/
    Inventory/
      Domain/
      Infrastructure/
```

### 2. Concurrency & Performance
Using the 2026 `Cache::touch()` and concurrent request pooling.

```php
// Laravel 13 Pattern: Concurrent data fetching
$responses = Http::pool(fn (Pool $pool) => [
    $pool->as('user')->get('/api/user'),
    $pool->as('stats')->get('/api/stats'),
]);

// Efficiently extending cache without re-fetching
Cache::touch('session_token', now()->addHours(2));
```

### 3. Hexagonal Controllers
Controllers should only act as "Adapters," delegating logic to "Actions" or "Services."

```php
public function store(StoreRequest $request, CreateUserAction $action)
{
    $user = $action->execute(UserDTO::fromRequest($request));
    return UserResource::make($user);
}
```

---

## 🚫 The "Do Not List" (Anti-Patterns)
1.  **NEVER** put business logic inside Controllers or Eloquent Models. Use **Actions**.
2.  **NEVER** use `Model::all()` on large tables. Use `chunk()`, `cursor()`, or `lazy()`.
3.  **NEVER** ignore N+1 query warnings (Use `Model::preventLazyLoading()`).
4.  **NEVER** commit secrets to `.env.example`. Use Laravel's encrypted environment files.

---

## 🛠️ Troubleshooting & Debugging

| Issue | Likely Cause | 2026 Corrective Action |
| :--- | :--- | :--- |
| **Memory Exhaustion** | Large Eloquent collections | Switch to `cursor()` or DB raw queries for reporting. |
| **Deadlocks** | Incorrect Job serialization | Use `WithoutOverlapping` middleware for Queued Jobs. |
| **Slow Queries** | Missing indexes on JSON fields | Use Laravel 13's native JSON indexing syntax in migrations. |
| **Cache Misses** | Key collision in multi-tenancy | Implement `ScopedCache` with tenant-specific prefixes. |

---

## 📚 Reference Library
- **[Modular Architecture](./references/1-modular-architecture.md):** Designing for scale.
- **[Performance & Queues](./references/2-performance-and-queues.md):** High-scale background processing.
- **[Security & Multi-tenancy](./references/3-security-and-multitenancy.md):** Hardening the ecosystem.

---

## 📊 Quality Metrics
- **Titus Score:** > 90% (Automated architectural audit).
- **Lighthouse Performance:** > 95 for Livewire/Volt pages.
- **Test Coverage:** Mandatory 100% for `Actions` and `Policies`.

---

## 🔄 Evolution from v10 to v13
- **v11:** Streamlined directory structure, no `app/Console/Kernel.php`.
- **v12:** First-class AI support, enhanced concurrency.
- **v13:** Cache touch, Symfony 8 compatibility, strict model instantiation.

---

**End of Laravel Pro Standard (v1.1.0)**

Overview

This skill encapsulates senior-level Laravel 12/13+ architecture and operational guidance for building Modular Monoliths, Hexagonal systems, and high-concurrency backends. It focuses on practical patterns, performance tactics, and deployable practices that drive reliability and maintainability for large teams and mission-critical apps.

How this skill works

I provide prescriptive architecture patterns (Modules, Ports & Adapters), concurrency primitives, and database strategies tailored to Laravel 13 and PHP 8.4+. The skill inspects common anti-patterns, suggests corrective actions (e.g., switch to cursor() for large collections), and prescribes concrete code-level techniques like PendingRequest::pool(), Cache::touch(), and action-based controllers. It also maps operational checks for zero-downtime deployment and automated smoke tests.

When to use it

  • Designing a new large-scale Laravel app that must evolve without entangling modules
  • Refactoring a monolith to modular boundaries or introducing Hexagonal Architecture
  • Improving throughput and latency in high-concurrency API endpoints
  • Hardening deploy pipelines for zero-downtime releases on Vercel/Vapor
  • Enforcing team-wide conventions for controllers, actions, and testing

Best practices

  • Model business use cases as Actions/Services; keep controllers and models thin
  • Structure code into app/Modules with clear Domain and Infrastructure layers
  • Use Http::pool() (PendingRequest::pool()) for parallel external calls and Cache::touch() to extend TTL without refetch
  • Avoid Model::all() on large tables; prefer chunk(), cursor(), or lazy() for memory safety
  • Enable Model::preventLazyLoading() and address N+1 warnings during reviews
  • Automate architectural and smoke tests; require high coverage for Actions and Policies

Example use cases

  • Implementing a Billing module with isolated Actions, domain models, and adapter interfaces
  • Migrating heavy reporting tasks from Eloquent::all() to cursor() with chunked processing
  • Orchestrating concurrent third-party API calls using Http::pool() to reduce request latency
  • Configuring zero-downtime deploys with pre-deploy smoke tests and scoped cache keys for multi-tenancy
  • Resolving job deadlocks by applying WithoutOverlapping middleware and correct job serialization

FAQ

How do I prevent N+1 queries in a modular codebase?

Enable preventLazyLoading(), audit eager-loaded relations in Actions, and add integration tests that assert query counts for critical endpoints.

When should I prefer a Modular Monolith over microservices?

Choose a Modular Monolith when you need strong cohesion, transactional consistency, and faster developer velocity while retaining clear module boundaries for future extraction.