From superpowers-laravel
Implements hexagonal ports-and-adapters architecture in Laravel for external services like email; defines ports as PHP interfaces and provider adapters selected at composition root.
How this skill is triggered — by the user, by Claude, or both
Slash command
/superpowers-laravel:ports-and-adaptersThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Abstract integrations behind stable interfaces. Keep vendor SDKs out of your domain code.
Abstract integrations behind stable interfaces. Keep vendor SDKs out of your domain code.
// Port
interface MailPort {
public function send(string $to, string $subject, string $html): void;
}
// Adapter
final class SesMailAdapter implements MailPort {
public function __construct(private \Aws\Ses\SesClient $ses) {}
public function send(string $to, string $subject, string $html): void {
// wrap SES specifics here
}
}
// Composition (AppServiceProvider)
$this->app->singleton(MailPort::class, function () {
return match (config('mail.driver')) {
'ses' => new SesMailAdapter(app('aws.ses')),
default => new SmtpMailAdapter(/* ... */),
};
});
npx claudepluginhub jpcaparas/superpowers-laravel --plugin superpowers-laravelGuides implementing Hexagonal (Ports and Adapters) architecture: define ports, build adapters, enforce dependencies to isolate domain logic from infrastructure. For testable, adaptable systems.
Provides patterns, antipatterns, and PHP-specific guidelines for auditing Hexagonal Architecture (Ports & Adapters) implementations.
Design, implement, and refactor Ports & Adapters systems with clear domain boundaries, dependency inversion, and testable use-case orchestration across TypeScript, Java, Kotlin, and Go services.