Skip to content
Back to skills

Strategy Pattern

ASecurity

Use the Strategy pattern to select behavior at runtime; bind multiple implementations to a shared interface

  • 147 stars
  • 0 votes
  • 1 copy
  • 3 views
  • Added June 6, 2026
designphp

Security analysis

A100/100

Scanned June 6, 2026

npx -y skills add jpcaparas/superpowers-laravel --skill strategy-pattern --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Strategy Pattern?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Strategy Pattern
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/jpcaparas-strategy-pattern/badge)](https://www.skillsdirectory.com/skills/jpcaparas-strategy-pattern)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: laravel:strategy-pattern
description: Use the Strategy pattern to select behavior at runtime; bind multiple implementations to a shared interface
---

# Strategy Pattern

Create a common interface and multiple implementations. Choose a strategy by key or context.

```php
interface TaxCalculator { public function for(int $cents): int; }
final class NzTax implements TaxCalculator { /* ... */ }
final class AuTax implements TaxCalculator { /* ... */ }

final class TaxFactory {
  public function __construct(private array $drivers) {}
  public function forCountry(string $code): TaxCalculator { return $this->drivers[$code]; }
}
```

Register in a service provider and inject the factory where needed.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.