laravel-architecture
Design Laravel app architecture with services, repositories, actions, and clean code patterns. Use when structuring projects, creating services, implementing DI, or organizing code layers.
What this skill does
# Laravel Architecture Patterns
## Agent Workflow (MANDATORY)
Before ANY implementation, use `TeamCreate` to spawn 3 agents:
1. **fuse-ai-pilot:explore-codebase** - Analyze existing architecture
2. **fuse-ai-pilot:research-expert** - Verify Laravel patterns via Context7
3. **mcp__context7__query-docs** - Check service container and DI patterns
After implementation, run **fuse-ai-pilot:sniper** for validation.
---
## Overview
Laravel architecture focuses on clean separation of concerns, dependency injection, and maintainable code organization. This skill covers everything from project structure to production deployment.
### When to Use
- Structuring new Laravel projects
- Implementing services, repositories, actions
- Setting up dependency injection
- Configuring development environments
- Deploying to production
---
## Critical Rules
1. **Thin controllers** - Delegate business logic to services
2. **Interfaces in app/Contracts/** - Never alongside implementations
3. **DI over facades** - Constructor injection for testability
4. **Files < 100 lines** - Split larger files per SOLID
5. **Environment separation** - .env never committed
---
## Architecture
```text
app/
├── Actions/ # Single-purpose action classes
├── Contracts/ # Interfaces (DI)
├── DTOs/ # Data transfer objects
├── Enums/ # PHP 8.1+ enums
├── Events/ # Domain events
├── Http/
│ ├── Controllers/ # Thin controllers
│ ├── Middleware/ # Request filters
│ ├── Requests/ # Form validation
│ └── Resources/ # API transformations
├── Jobs/ # Queued jobs
├── Listeners/ # Event handlers
├── Models/ # Eloquent models only
├── Policies/ # Authorization
├── Providers/ # Service registration
├── Repositories/ # Data access layer
└── Services/ # Business logic
```
---
## Reference Guide
### Core Architecture
| Reference | When to Use |
|-----------|-------------|
| [container.md](references/container.md) | Dependency injection, binding, resolution |
| [providers.md](references/providers.md) | Service registration, bootstrapping |
| [facades.md](references/facades.md) | Static proxies, real-time facades |
| [contracts.md](references/contracts.md) | Interfaces, loose coupling |
| [structure.md](references/structure.md) | Directory organization |
| [lifecycle.md](references/lifecycle.md) | Request handling flow |
### Configuration & Setup
| Reference | When to Use |
|-----------|-------------|
| [configuration.md](references/configuration.md) | Environment, config files |
| [installation.md](references/installation.md) | New project setup |
| [upgrade.md](references/upgrade.md) | Version upgrades, breaking changes |
| [releases.md](references/releases.md) | Release notes, versioning |
### Development Environments
| Reference | When to Use |
|-----------|-------------|
| [sail.md](references/sail.md) | Docker development |
| [valet.md](references/valet.md) | macOS native development |
| [homestead.md](references/homestead.md) | Vagrant (legacy) |
| [octane.md](references/octane.md) | High-performance servers |
### Utilities & Tools
| Reference | When to Use |
|-----------|-------------|
| [artisan.md](references/artisan.md) | CLI commands, custom commands |
| [helpers.md](references/helpers.md) | Global helper functions |
| [filesystem.md](references/filesystem.md) | File storage, S3, local |
| [processes.md](references/processes.md) | Shell command execution |
| [context.md](references/context.md) | Request-scoped data sharing |
### Advanced Features
| Reference | When to Use |
|-----------|-------------|
| [pennant.md](references/pennant.md) | Feature flags |
| [mcp.md](references/mcp.md) | Model Context Protocol |
| [concurrency.md](references/concurrency.md) | Parallel execution |
### Operations
| Reference | When to Use |
|-----------|-------------|
| [deployment.md](references/deployment.md) | Production deployment |
| [envoy.md](references/envoy.md) | SSH task automation |
| [logging.md](references/logging.md) | Log channels, formatting |
| [errors.md](references/errors.md) | Exception handling |
| [packages.md](references/packages.md) | Creating packages |
---
## Templates
| Template | Purpose |
|----------|---------|
| [UserService.php.md](references/templates/UserService.php.md) | Service + repository pattern |
| [AppServiceProvider.php.md](references/templates/AppServiceProvider.php.md) | DI bindings, bootstrapping |
| [ArtisanCommand.php.md](references/templates/ArtisanCommand.php.md) | CLI commands, signatures, I/O |
| [McpServer.php.md](references/templates/McpServer.php.md) | MCP servers, tools, resources, prompts |
| [PennantFeature.php.md](references/templates/PennantFeature.php.md) | Feature flags, A/B testing |
| [Envoy.blade.php.md](references/templates/Envoy.blade.php.md) | SSH deployment automation |
| [sail-config.md](references/templates/sail-config.md) | Docker Sail configuration |
| [octane-config.md](references/templates/octane-config.md) | FrankenPHP, Swoole, RoadRunner |
---
## Feature Matrix
| Feature | Reference | Priority |
|---------|-----------|----------|
| Service Container | container.md | High |
| Service Providers | providers.md | High |
| Directory Structure | structure.md | High |
| Configuration | configuration.md | High |
| Installation | installation.md | High |
| Octane (Performance) | octane.md | High |
| Sail (Docker) | sail.md | High |
| Artisan CLI | artisan.md | Medium |
| Deployment | deployment.md | Medium |
| Envoy (SSH) | envoy.md | Medium |
| Facades | facades.md | Medium |
| Contracts | contracts.md | Medium |
| Valet (macOS) | valet.md | Medium |
| Upgrade Guide | upgrade.md | Medium |
| Logging | logging.md | Medium |
| Errors | errors.md | Medium |
| Lifecycle | lifecycle.md | Medium |
| Filesystem | filesystem.md | Medium |
| Helpers | helpers.md | Low |
| Pennant (Flags) | pennant.md | Low |
| Context | context.md | Low |
| Processes | processes.md | Low |
| Concurrency | concurrency.md | Low |
| MCP | mcp.md | Low |
| Packages | packages.md | Low |
| Releases | releases.md | Low |
| Homestead | homestead.md | Low |
---
## Quick Reference
### Service Injection
```php
public function __construct(
private readonly UserServiceInterface $userService,
) {}
```
### Service Provider Binding
```php
public function register(): void
{
$this->app->bind(UserServiceInterface::class, UserService::class);
$this->app->singleton(CacheService::class);
}
```
### Artisan Command
```shell
php artisan make:provider CustomServiceProvider
php artisan make:command ProcessOrders
```
### Environment Access
```php
$debug = env('APP_DEBUG', false);
$config = config('app.name');
```
---
## Laravel 13 Notes
### Stack mis à jour
- **Symfony 7.4 et 8.0** supportés en parallèle (HttpFoundation, Console, Mailer)
- **PHP 8.3 minimum** (8.2 retiré)
- **pda/pheanstalk 8.0+** requis si driver Beanstalk
### Cache::touch() API
Nouvelle méthode pour rafraîchir le TTL sans recalculer la valeur.
```php
Cache::touch('user:123', now()->addHour());
Cache::touch(['user:123', 'user:456'], 3600);
```
### Queue::route() pour routing dynamique
Voir [[laravel-queues]] pour le routing déclaratif par job (connexion/queue cible via configuration plutôt que sur chaque job).
### `new Model()` dans boot() → LogicException
Laravel 13 jette une `LogicException` si vous instanciez un modèle Eloquent dans `register()` d'un ServiceProvider (container pas prêt). Utiliser `boot()` ou un listener.
## Migration Laravel 13 → 13
| Sujet | Avant (12) | Après (13) |
|-------|-----------|------------|
| PHP minimum | 8.2 | **8.3** |
| PHPUnit | 11 | **12** |
| Pest | 3 | **4** |
| CSRF | `VerifyCsrfToken` | **`PreventRequestForgery`** (origin-aware) |
| Cache prefix | underscore | **hyphens par défaut** (configurer `CACHE_PREFIX`, `REDIS_PREFIX`, `SESSION_COOKIE` pour Related in Design
contribute
IncludedLocal-only OSS contribution command center. Auto-refreshes the user's in-flight PR and issue state on invoke so conversations start with full context — no need to brief Claude on what's in flight. Helps the user find issues to contribute to on GitHub, builds per-repo dossiers of what each upstream expects (CLA, DCO, branch convention, AI policy, draft-first, review bots, issue templates), runs deterministic gates before any external action so AI-assisted contributions don't reach maintainers as slop. State is markdown-only: candidate files at ~/.contribute-system/candidates/, repo dossiers at ~/.contribute-system/research/, append-only event log at ~/.contribute-system/log.jsonl. No database, no cloud calls. Use when the user asks about their PRs / issues / contributions, wants to find new work to take on, claim an issue, build/refresh a repo's dossier, or draft a Design Issue or PR. Trigger with "/contribute", "what's my PR status", "find a contribution", "claim issue X", "draft a Design Issue for Y", "refresh dossier for Z".
architectural-analysis
IncludedUser-triggered deep architectural analysis of a codebase or scoped subtree across eight modes — information architecture, data flow, integration points, UI surfaces, interaction patterns, data model, control flow, and failure modes. This skill should be used when the user asks to "diagram this codebase," "map the architecture," "show the data flow," "give me an ERD," "trace control flow," "find the integration points," "verify the layout pattern," "audit the UX architecture," or any similar request whose primary deliverable is mermaid diagrams plus cited reports under docs/architecture/. Dispatches haiku/sonnet sub-agents in parallel for per-mode exploration, then verifies every citation mechanically before any node lands in a diagram. Not for one-off prose explanations of code (use code-explanation) or for high-level system design from scratch (use system-design).
mcp
IncludedModel Context Protocol (MCP) server development and tool management. Languages: Python, TypeScript. Capabilities: build MCP servers, integrate external APIs, discover/execute MCP tools, manage multi-server configs, design agent-centric tools. Actions: create, build, integrate, discover, execute, configure MCP servers/tools. Keywords: MCP, Model Context Protocol, MCP server, MCP tool, stdio transport, SSE transport, tool discovery, resource provider, prompt template, external API integration, Gemini CLI MCP, Claude MCP, agent tools, tool execution, server config. Use when: building MCP servers, integrating external APIs as MCP tools, discovering available MCP tools, executing MCP capabilities, configuring multi-server setups, designing tools for AI agents.
react-native-skia
IncludedDesign, build, debug, and optimise high-polish animated graphics in React Native or Expo using @shopify/react-native-skia, Reanimated, and Gesture Handler. Use when the user wants canvas-driven UI, shaders, paths, rich text, image filters, sprite fields, Skottie, video frames, snapshots, web CanvasKit setup, or performance tuning for custom motion-heavy elements such as loaders, hero art, cards, charts, progress indicators, particle systems, or gesture-driven surfaces. Also use when the user asks for fluid, glow, glass, blob, parallax, 60fps/120fps, or GPU-friendly animated effects in React Native, even if they do not explicitly say "Skia". Do not use for ordinary form/layout work with standard views.
plaid
IncludedProduct Led AI Development — guides founders from idea to launched product. Six capabilities: Idea (discover a product idea), Validate (pressure-test the idea against fatal flaws, problem reality, competition, and 2-week MVP feasibility), Plan (vision intake + document generation), Design (translate image references into a design.md spec), Launch (go-to-market strategy), and Build (roadmap execution). Use when someone says "PLAID", "plaid idea", "help me find an idea", "product idea", "idea from my business", "idea from my expertise", "plaid validate", "validate my idea", "pressure-test", "is this idea good", "find fatal flaws", "validate the problem", "plan a product", "define my vision", "generate a PRD", "product strategy", "plaid design", "design from image", "translate image to design", "create design.md", "extract design tokens", "plaid launch", "go-to-market", "launch plan", "GTM strategy", "launch playbook", "plaid build", "build the app", "start building", or "execute the roadmap".
nextjs-framer-motion-animations
IncludedAdds production-safe Motion for React or Framer Motion animations to Next.js apps, including reveal, hover and tap micro-interactions, whileInView, stagger, AnimatePresence, layout and layoutId transitions, reorder, scroll-linked UI, and lightweight route-content transitions. Use when the user asks to add, refactor, or debug Motion or Framer Motion in App Router or Pages Router codebases, especially around server/client boundaries, reduced motion, LazyMotion, bundle size, hydration, or route transitions. Avoid for GSAP-style timelines, WebGL or 3D scenes, heavy scroll storytelling, or CSS-only effects unless Motion is explicitly requested.