laravel-architecture

Enforce core architectural standards for scalable Laravel applications. Use when structuring controllers, service layers, action classes, Form Requests, or Service Container bindings in Laravel projects. (triggers: app/Http/Controllers/**/*.php, routes/*.php, controller, service, action, request, container)

385 stars

Best use case

laravel-architecture is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Enforce core architectural standards for scalable Laravel applications. Use when structuring controllers, service layers, action classes, Form Requests, or Service Container bindings in Laravel projects. (triggers: app/Http/Controllers/**/*.php, routes/*.php, controller, service, action, request, container)

Teams using laravel-architecture should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/laravel-architecture/SKILL.md --create-dirs "https://raw.githubusercontent.com/HoangNguyen0403/agent-skills-standard/main/skills/laravel/laravel-architecture/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/laravel-architecture/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How laravel-architecture Compares

Feature / Agentlaravel-architectureStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Enforce core architectural standards for scalable Laravel applications. Use when structuring controllers, service layers, action classes, Form Requests, or Service Container bindings in Laravel projects. (triggers: app/Http/Controllers/**/*.php, routes/*.php, controller, service, action, request, container)

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Laravel Architecture

## **Priority: P0 (CRITICAL)**

## Structure

See [project structure](references/implementation.md#project-structure) for the recommended directory layout.

## Workflow

1. **Create Form Request** for validation (`php artisan make:request StoreUserRequest`).
2. **Create Action class** with a single `handle()` method for the use case.
3. **Inject Action** into controller via constructor DI.
4. **Bind interfaces** in `AppServiceProvider` for swappable implementations.

## Controller Pattern

See [implementation examples](references/implementation.md#controller-pattern) for slim controller, action class, and service container binding patterns.

## Validation

- Use Form Requests with `authorize()` and `rules()` methods.
- Call `$request->validated()` in the controller for mass assignment.
- Never use inline `$request->validate()`.

## Anti-Patterns

- **No logic in Controllers**: Move to Services or Action classes.
- **No manual instantiation**: Use Service Container via DI.
- **No inline `$request->validate()`**: Favor Form Request classes.
- **No excessive global helpers**: Use class-based logic instead.

## References

- [Slim Controller Patterns](references/implementation.md)

Related Skills

spring-boot-architecture

385
from HoangNguyen0403/agent-skills-standard

Structure Spring Boot 3+ projects with feature packaging and clean layering. Use when structuring Spring Boot 3 projects, defining layers, or applying architecture patterns. (triggers: pom.xml, build.gradle, structure, layering, dto, controller, @RestController, @Service, @Repository, @Entity, @Bean, @Configuration)

react-native-architecture

385
from HoangNguyen0403/agent-skills-standard

Structure React Native projects with feature-first organization and separation of concerns. Use when structuring a React Native project or applying clean architecture patterns. (triggers: src/**/*.tsx, src/**/*.ts, app.json, feature, module, directory structure, separation of concerns, Expo, React Navigation, StyleSheet.create, react-native, mobile architecture)

nextjs-architecture

385
from HoangNguyen0403/agent-skills-standard

Structure Next.js projects with Feature-Sliced Design layers, domain-grouped slices, and strict import hierarchy. Use when organizing features into FSD layers, enforcing slice boundaries, or keeping page.tsx thin. (triggers: src/features/**, src/entities/**, src/widgets/**, FSD, Feature Sliced Design, slices, segments)

nestjs-architecture

385
from HoangNguyen0403/agent-skills-standard

Design decoupled, testable NestJS module boundaries with feature, core, and shared modules. Use when structuring module imports, creating feature modules, or enforcing separation of concerns in NestJS. (triggers: **/*.module.ts, main.ts, NestFactory, Module, Controller, Injectable)

laravel-tooling

385
from HoangNguyen0403/agent-skills-standard

Configure Laravel ecosystem with custom Artisan commands, Vite asset bundling, Pint code styling, and Horizon queue monitoring. Use when creating Artisan commands, migrating from Mix to Vite, or configuring Pint code standards. (triggers: package.json, composer.json, vite.config.js, artisan, vite, horizon, pint, blade)

laravel-testing

385
from HoangNguyen0403/agent-skills-standard

Write Pest feature tests with RefreshDatabase, mock external services, and create test data with Eloquent Factories in Laravel. Use when adding HTTP tests, configuring SQLite in-memory test database, or mocking payment services. (triggers: tests/**/*.php, phpunit.xml, feature, unit, mock, factory, sqlite)

laravel-sessions-middleware

385
from HoangNguyen0403/agent-skills-standard

Configure Redis session drivers, register security-header middleware, and prevent session fixation in Laravel. Use when switching session drivers, adding HSTS/CSP headers via middleware, or regenerating sessions after login. (triggers: app/Http/Middleware/**/*.php, config/session.php, session, driver, handle, headers, csrf)

laravel-security

385
from HoangNguyen0403/agent-skills-standard

Harden Laravel apps with Policies for model authorization, Gate-based RBAC, validated mass assignment, and CSRF protection. Use when creating authorization policies, securing env config access, or preventing mass assignment vulnerabilities. (triggers: app/Policies/**/*.php, config/*.php, policy, gate, authorize, env, config)

laravel-eloquent

385
from HoangNguyen0403/agent-skills-standard

Write performant Eloquent queries with eager loading, reusable scopes, and strict lazy-loading prevention in Laravel. Use when defining model relationships, creating query scopes, or processing large datasets with chunk/cursor. (triggers: app/Models/**/*.php, scope, with, eager, chunk, model)

laravel-database-expert

385
from HoangNguyen0403/agent-skills-standard

Optimize Laravel queries with subqueries, joinSub, Redis cache-aside patterns, and read/write connection splitting. Use when writing complex joins, implementing Cache::remember with tags, or configuring database read replicas. (triggers: config/database.php, database/migrations/*.php, join, aggregate, subquery, selectRaw, Cache)

laravel-clean-architecture

385
from HoangNguyen0403/agent-skills-standard

Implement Domain-Driven Design with typed DTOs, repository interfaces, and single-responsibility Action classes in Laravel. Use when creating domain folders, binding repository contracts in providers, or passing DTOs between layers. (triggers: app/Domains/**/*.php, app/Providers/*.php, domain, dto, repository, contract, adapter)

laravel-background-processing

385
from HoangNguyen0403/agent-skills-standard

Build scalable asynchronous workflows using Queues, Jobs, and Events in Laravel. Use when implementing queued jobs, event-driven workflows, or async processing in Laravel. (triggers: app/Jobs/**/*.php, app/Events/**/*.php, app/Listeners/**/*.php, ShouldQueue, dispatch, batch, chain, listener)