mcpField
L
laravel:interfaces-and-di

laravel:interfaces-and-di

github.com/jpcaparasDevelopment157117 installsUpdated 19w ago
Repository

About laravel:interfaces-and-di

A Laravel development skill on defining narrow interfaces, injecting them where needed, and binding implementations in a service provider to support testing and implementation swaps.

Key features

  1. 01Define narrow interfaces
  2. 02Inject interfaces where needed
  3. 03Bind implementations in service providers
  4. 04Mock interfaces for tests
  5. 05Swap concrete implementations

Use cases

  1. 01Define clear contracts for business logic
  2. 02Mock dependencies in tests
  3. 03Replace an interface implementation

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/jpcaparas/superpowers-laravel --skill laravel:interfaces-and-di

After installing, type/laravel:interfaces-and-diin Claude Code to confirm it loaded.

Details

From the project README

Interfaces and Dependency Injection

Define narrow interfaces and inject them where needed. Bind concrete implementations in a service provider.

interface Slugger { public function slug(string $s): string; }

final class AsciiSlugger implements Slugger {
  public function slug(string $s): string { /* ... */ }
}

$this->app->bind(Slugger::class, AsciiSlugger::class);

Benefits: easier testing (mock interfaces), clearer contracts, swap implementations without touching consumers.

Comments

Markdown supported