SOLID principles for Laravel 12 and PHP 8.5. Files < 100 lines, interfaces separated, PHPDoc mandatory.
/plugin marketplace add fusengine/claude-code-plugins/plugin install fuse:laravel@fusengine-pluginsThis skill inherits all available tools. When active, it can use any tool Claude has access to.
Today: January 2026 - ALWAYS use the current year for your searches. Search with "2025" or "2026", NEVER with past years.
CRITICAL: Check today's date first, then search documentation and web BEFORE writing any code.
WORKFLOW:
1. Check date → 2. Research docs + web (current year) → 3. Apply latest patterns → 4. Code
Search queries (replace YYYY with current year):
Laravel [feature] YYYY best practicesPHP 8.5 [feature] YYYYLivewire 3 [component] YYYYPest PHP testing YYYYNever assume - always verify current APIs and patterns exist for the current year.
Before ANY implementation:
Continue implementation by:
Before writing ANY new code:
app/Services/, app/Actions/, app/Traits/When creating new code:
app/Services/ or app/Actions/app/
├── Contracts/ # Interfaces ONLY
│ ├── UserRepositoryInterface.php
│ └── PaymentGatewayInterface.php
├── Repositories/ # Implementations
│ └── EloquentUserRepository.php
└── Services/ # Business logic
└── UserService.php
/**
* Create a new user from DTO.
*
* @param CreateUserDTO $dto User data transfer object
* @return User Created user model
* @throws ValidationException If email already exists
*/
public function create(CreateUserDTO $dto): User
UserService.php (main)
├── UserValidator.php (validation)
├── UserDTO.php (types)
└── UserHelper.php (utils)
1 class = 1 responsibility
// ❌ BAD - Fat Controller
class UserController extends Controller
{
public function store(Request $request)
{
$validated = $request->validate([...]);
$user = User::create($validated);
Mail::send(new WelcomeEmail($user));
return response()->json($user);
}
}
// ✅ GOOD - Thin Controller
class UserController extends Controller
{
public function __construct(
private UserService $userService,
) {}
public function store(StoreUserRequest $request): JsonResponse
{
$user = $this->userService->create(
CreateUserDTO::fromRequest($request)
);
return response()->json($user, 201);
}
}
Open for extension, closed for modification
// Extensible interface
interface PaymentGatewayInterface
{
public function charge(Money $amount): PaymentResult;
}
// New implementations without modifying existing code
class StripeGateway implements PaymentGatewayInterface { }
class PayPalGateway implements PaymentGatewayInterface { }
Subtypes must be substitutable
interface NotificationInterface
{
public function send(User $user, string $message): bool;
}
// All implementations respect the contract
class EmailNotification implements NotificationInterface { }
class SmsNotification implements NotificationInterface { }
Specific interfaces, not generic ones
// ❌ BAD - Interface too broad
interface UserInterface
{
public function create();
public function sendEmail();
public function generateReport();
}
// ✅ GOOD - Separated interfaces
interface CrudInterface { }
interface NotifiableInterface { }
interface ReportableInterface { }
Depend on abstractions
// app/Providers/AppServiceProvider.php
public function register(): void
{
$this->app->bind(
UserRepositoryInterface::class,
EloquentUserRepository::class
);
}
// Service depends on interface
class UserService
{
public function __construct(
private UserRepositoryInterface $repository,
) {}
}
// ❌ Old style
$result = array_sum(array_filter(array_map(fn($x) => $x * 2, $data)));
// ✅ PHP 8.5 - Pipe operator
$result = $data
|> array_map(fn($x) => $x * 2, ...)
|> array_filter(...)
|> array_sum(...);
readonly class UserDTO
{
public function __construct(
public string $name,
public string $email,
) {}
}
// PHP 8.5 - clone with
$updated = clone($dto, email: 'new@email.com');
#[\NoDiscard("Result must be used")]
public function calculate(): Result
{
return new Result();
}
// Warning if result ignored
$this->calculate(); // ⚠️ Warning
$result = $this->calculate(); // ✅ OK
app/
├── Http/
│ ├── Controllers/ # < 50 lines each
│ ├── Requests/ # Form validation
│ └── Resources/ # API transformations
├── Models/ # < 80 lines (excluding relations)
├── Services/ # < 100 lines
├── Contracts/ # Interfaces ONLY
├── Repositories/ # Data access
├── Actions/ # Single-purpose (< 50 lines)
├── DTOs/ # Data transfer objects
├── Enums/ # PHP 8.1+ enums
├── Events/ # Domain events
├── Listeners/ # Event handlers
└── Policies/ # Authorization
<?php
declare(strict_types=1);
namespace App\Services;
use App\Contracts\UserRepositoryInterface;
use App\DTOs\CreateUserDTO;
use App\Models\User;
/**
* User service for business logic.
*/
final readonly class UserService
{
public function __construct(
private UserRepositoryInterface $repository,
) {}
/**
* Create a new user.
*/
public function create(CreateUserDTO $dto): User
{
return $this->repository->create($dto);
}
}
<?php
declare(strict_types=1);
namespace App\DTOs;
use App\Http\Requests\StoreUserRequest;
/**
* User creation data transfer object.
*/
readonly class CreateUserDTO
{
public function __construct(
public string $name,
public string $email,
public ?string $phone = null,
) {}
public static function fromRequest(StoreUserRequest $request): self
{
return new self(
name: $request->validated('name'),
email: $request->validated('email'),
phone: $request->validated('phone'),
);
}
}
<?php
declare(strict_types=1);
namespace App\Contracts;
use App\DTOs\CreateUserDTO;
use App\Models\User;
use Illuminate\Support\Collection;
/**
* User repository contract.
*/
interface UserRepositoryInterface
{
public function create(CreateUserDTO $dto): User;
public function findById(int $id): ?User;
public function findAll(): Collection;
}
declare(strict_types=1)array instead of DTOs for complex dataThis skill should be used when the user asks about libraries, frameworks, API references, or needs code examples. Activates for setup questions, code generation involving libraries, or mentions of specific frameworks like React, Vue, Next.js, Prisma, Supabase, etc.
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems. Create original algorithmic art rather than copying existing artists' work to avoid copyright violations.