dev-toolings/superpowers-symfony116 installs
strategy-pattern
Implement the Strategy pattern with Symfony's tagged services for runtime algorithm selection and extensibility
How do I install this agent skill?
npx skills add https://github.com/dev-toolings/superpowers-symfony --skill strategy-patternIs this agent skill safe to install?
- Gen Agent Trust Hubpass
The skill provides architectural guidance and code templates for implementing the Strategy pattern in Symfony applications using tagged services. It contains standard development practices and tools.
- Socketpass
No alerts
- Snykpass
Risk: LOW · No issues
What does this agent skill do?
Strategy Pattern (Symfony)
Use when
- One operation has several interchangeable algorithms chosen at runtime, such as payment providers or export formats.
- A
switchormatchon a type string keeps growing. - New variants must be added without editing the code that selects them.
Default workflow
- Define the strategy interface, with a
supports()method or a key per strategy. - Tag every implementation through
#[AutoconfigureTag]on the interface or on each class. - Inject them with
#[AutowireIterator]to try each in order, or#[AutowireLocator]to fetch one by key. - Set priorities where evaluation order matters, and register a fallback strategy.
- Test each strategy alone, and the selector with fakes.
Guardrails
- The selector fails explicitly when no strategy supports the input.
- Keep strategies stateless and independent of each other.
- Two cases that will not grow do not need the pattern: a
matchis enough.
Progressive disclosure
- Use this file for execution posture and risk controls.
- Open references when deep implementation details are needed.
Output contract
- The interface and its tagged implementations.
- The selector, with its order and its fallback.
- Tests per strategy and for the no-match case.
References
reference.md
How can the creator link this skill?
Add the canonical catalog link to the repository README so users can inspect current installs and available audits. The publishing guide covers the complete discovery path.
<a href="https://skillzs.dev/skills/dev-toolings/superpowers-symfony/strategy-pattern">View strategy-pattern on skillZs</a>