About laravel-interfaces-and-di
A Laravel development skill covering narrow interfaces and dependency injection. It guides developers in defining contracts, binding implementations in service providers, and making consumers easier to test or adapt.
Key features
- 01Define narrow interfaces
- 02Inject dependencies
- 03Bind implementations in providers
- 04Support mock-based testing
- 05Swap implementations without consumer changes
Use cases
- 01Isolating dependencies in tests
- 02Replacing an implementation behind a contract
- 03Clarifying service boundaries
Install
Copy the command and run it in a terminal.
$
npx skills add https:/ / github.com/ noartem/ skills --skill laravel-interfaces-and-diAfter installing, type/laravel-interfaces-and-diin Claude Code to confirm it loaded.
Details
From the project READMEInterfaces 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