/fuse-laravel:solid-phpfrom fuse-laravel
Enforces SOLID principles and DRY on Laravel 13 / PHP 8.3+ code with file size limits, interface placement rules, mandatory PHPDoc, and anti-pattern detection. Auto-detects FuseCore modular architecture and routes code placement.
Ships in fuse-laravel. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Before ANY implementation, spawn 3 agents in parallel, one Agent call each with a name:
After implementation, run fuse-ai-pilot:sniper for validation.
Before writing ANY new code:
FuseCore/Core/App/Services/, FuseCore/Core/App/Traits/, FuseCore/[Module]/App/Contracts/| Files Detected | Architecture | Interfaces Location |
|---|---|---|
FuseCore/ directory | FuseCore Modular | FuseCore/[Module]/App/Contracts/ |
module.json in modules | FuseCore Modular | FuseCore/[Module]/App/Contracts/ |
Verification: php artisan --version → Laravel 13.x
Structure: Always FuseCore modular. Shared in FuseCore/Core/App/.
New code needed?
├── HTTP validation → FuseCore/[Module]/App/Http/Requests/
├── Single action → FuseCore/[Module]/App/Actions/
├── Business logic → FuseCore/[Module]/App/Services/
├── Data access → FuseCore/[Module]/App/Repositories/
├── Data transfer → FuseCore/[Module]/App/DTOs/
├── Interface → FuseCore/[Module]/App/Contracts/
├── Event → FuseCore/[Module]/App/Events/
└── Authorization → FuseCore/[Module]/App/Policies/
| Need | Pattern | Location |
|---|---|---|
| HTTP handling | Controller | Controllers/ |
| Validation | FormRequest | Requests/ |
| Single operation | Action | Actions/ |
| Complex logic | Service | Services/ |
| Data access | Repository | Repositories/ |
| Data structure | DTO | DTOs/ |
| Abstraction | Interface | Contracts/ |
FUSE_SOLID_MAX_LINESFuseCore/[Module]/App/Contracts/ # Module interfaces ONLY
├── UserRepositoryInterface.php
└── PaymentGatewayInterface.php
FuseCore/Core/App/Contracts/ # Shared interfaces
/**
* 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
| Topic | Reference | When to consult |
|---|---|---|
| SOLID Overview | solid-principles.md | Quick reference all principles |
| SRP | single-responsibility.md | File too long, fat controller/model |
| OCP | open-closed.md | Adding payment methods, channels |
| LSP | liskov-substitution.md | Interface contracts, swapping providers |
| ISP | interface-segregation.md | Fat interfaces, unused methods |
| DIP | dependency-inversion.md | Tight coupling, testing, mocking |
| Anti-Patterns | anti-patterns.md | Code smells detection |
| Decisions | decision-guide.md | Pattern selection |
| PHP 8.5 | php85-features.md | Modern PHP features |
| Structure | laravel12-structure.md | Standard Laravel |
| FuseCore | fusecore-structure.md | Modular architecture |
| Template | When to use |
|---|---|
| code-templates.md | Service, DTO, Repository, Interface |
| controller-templates.md | Controller, Action, FormRequest, Policy |
| refactoring-guide.md | Step-by-step migration from legacy code |
| Anti-Pattern | Detection | Fix |
|---|---|---|
Files above FUSE_SOLID_MAX_LINES | Line count | Split into smaller files |
| Controllers with business logic | Code review | Extract to Service |
| Interfaces in impl files | Location | Move to FuseCore/[Module]/App/Contracts/ |
| Business logic in Models | Code in model | Extract to Service |
| Concrete dependencies | new Class() | Inject via ModuleServiceProvider |
| Missing PHPDoc | No doc block | Add documentation |
| Missing strict_types | No declare | Add to all files |
| Fat classes | > 5 public methods | Split responsibilities |
| Duplicated logic | Same code in 2+ files | Extract to Service/Trait |
| No Grep before coding | Creating without search | Grep codebase first |
| DO | DON'T |
|---|---|
| Use constructor property promotion | Use property assignment |
| Depend on interfaces | Depend on concrete classes |
Use final readonly class | Use mutable classes |
Use declare(strict_types=1) | Skip type declarations |
Split well before FUSE_SOLID_MAX_LINES | Wait until the hook blocks |
| Use DTOs for data transfer | Use arrays |
Laravel 13 requires PHP 8.3 (was 8.2 on L12). SOLID-friendly features:
readonly classes: final readonly class UserDto (full immutability)const int MAX_RETRIES = 3;#[\Override] attribute: explicitly declares an override of a parent method (catches typos)json_validate() (faster than json_decode + try/catch)$class::{$name}use Override;
final readonly class PaymentService implements PaymentContract
{
public const int DEFAULT_TIMEOUT = 30;
public function __construct(
private StripeClient $stripe,
private LoggerInterface $logger,
) {}
#[Override]
public function process(PaymentDto $payment): PaymentResult
{
// ...
}
}
final readonly class for all DTOs/Value Objects#[\Override] on every inherited method (caught in CI)const string ROLE = 'admin';)references/anti-patterns.md (opens in a new tab)references/decision-guide.md (opens in a new tab)references/dependency-inversion.md (opens in a new tab)references/fusecore-structure.md (opens in a new tab)references/interface-segregation.md (opens in a new tab)references/laravel12-structure.md (opens in a new tab)references/liskov-substitution.md (opens in a new tab)references/open-closed.md (opens in a new tab)references/php85-features.md (opens in a new tab)references/single-responsibility.md (opens in a new tab)references/solid-principles.md (opens in a new tab)references/templates/code-templates.md (opens in a new tab)references/templates/controller-templates.md (opens in a new tab)references/templates/refactoring-guide.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
23 skills in this plugin
/fusecoreUse when creating modules, understanding FuseCore structure, or implementing features in a FuseCore modular-monolith Laravel project./laravel-ai-sdkUse when integrating AI agents, tool calling, embeddings, structured output, or streaming in Laravel 13 via the `laravel/ai` package./laravel-apiUse when creating API endpoints, transforming responses with API Resources, or handling API authentication, rate limiting, or versioning./laravel-architectureUse when structuring a Laravel project, creating services/repositories/actions, implementing dependency injection, or organizing code layers./laravel-attributesUse when migrating Eloquent models, Jobs, Console commands, Controllers, API Resources, Validation, Factories or Seeders to Laravel 13 PHP attributes./laravel-authUse when implementing user authentication, API tokens, social login, or authorization in Laravel 13.npx claudepluginhub fusengine/claude-plugins --plugin fuse-laravelOther plugins' skills for the same job