laravel:template-method-and-plugins

SkillDev tools

Stabilize workflows with Template Method or Strategy; extend by adding new classes instead of editing core logic

Available today. Use it from your connected AI after setup.

Connect ahel once, and every AI you use reads what you have installed.

Then ask your AI: use the laravel:template-method-and-plugins skill

What this skill tells your AI

The instructions your AI receives, as published by jpcaparas/superpowers-laravel in skills/template-method-and-plugins/SKILL.md and read by ahel’s review.

Keep core flows stable; enable extension via small classes.

Template Method

Use a base class that defines the algorithm skeleton; subclasses override hooks.

abstract class Importer {
    final public function handle(string $path): void {
        $rows = $this->load($path);
        $data = $this->normalize($rows);
        $this->validate($data);
        $this->save($data);
    }
    abstract protected function load(string $path): array;
    protected function normalize(array $rows): array { return $rows; }
    protected function validate(array $data): void {}
    abstract protected function save(array $data): void;
}

Strategy/Plugin

Define an interface; register implementations; select by key/config.

interface PaymentGateway { public function charge(int $cents, string $currency): string; }

final class StripeGateway implements PaymentGateway { /* ... */ }
final class BraintreeGateway implements PaymentGateway { /* ... */ }

final class PaymentsRegistry {
    /** @param array<string,PaymentGateway> $drivers */
    public function __construct(private array $drivers) {}
    public function for(string $key): PaymentGateway { return $this->drivers[$key]; }
}

Prefer adding a class over editing switch statements. Test implementations in isolation.

Signals

GitHub stars
153
Forks
2
Last commit
Jul 2026
Advanced
Catalog kind
skill
Gateway key
laravel-template-method-and-plugins
Source
github.com/jpcaparas/superpowers-laravel