Skip to content
Development
Skill

/strategy-pattern

Implement the Strategy pattern with Symfony's tagged services for runtime algorithm selection and extensibility

From plugin
superpowers-symfony
23344 skills14 agents13 commands1 hook

Claude Code

$ npx -y skills add dev-toolings/superpowers-symfony --skill strategy-pattern --agent claude-code

SKILL.md

strategy-pattern.SKILL.md
name: strategy-pattern
description: Implement the Strategy pattern with Symfony's tagged services for runtime algorithm selection and extensibility
capabilities: [read, search]
tags: [architecture]
# projected by `bun run build` — do not edit by hand
allowed-tools:
  - Read
  - Glob
  - Grep

Strategy Pattern (Symfony)

Use when

  • One operation has several interchangeable algorithms chosen at runtime, such as payment providers or export formats.
  • A `switch` or `match` on a type string keeps growing.
  • New variants must be added without editing the code that selects them.

Default workflow

1. Define the strategy interface, with a `supports()` method or a key per strategy. 2. Tag every implementation through `#[AutoconfigureTag]` on the interface or on each class. 3. Inject them with `#[AutowireIterator]` to try each in order, or `#[AutowireLocator]` to fetch one by key. 4. Set priorities where evaluation order matters, and register a fallback strategy. 5. 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 `match` is 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`
Read more
@dev-toolings
Ships withsuperpowers-symfony

Superpowers Symfony gives coding agents deep, version-accurate Symfony expertise: from Doctrine schema design and API Platform REST/GraphQL APIs to test-driven development, async Messenger workflows, caching, rate limiting, and clean architecture.

23344 skills14 agents
Get the whole plugin

Stars on GitHub

Momentum

stars in total
233
Star history of dev-toolings/superpowers-symfony on GitHub, a chart by star-history.com

Other skills on superpowers-symfony.

More skills from other plugins.

brainstorming
Auto-invoked

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…

@obra@obraInstall Skill
ask-matt

ask-matt

Ask which skill or flow fits your situation. A router over the skills in this repo.

skills2w309k
@mattpocock@mattpocockInstall Skill
accessibility
Auto-invoked

accessibility

Design, implement, and audit accessible UI to WCAG 2.2 Level AA across Web, iOS, and Android — semantic ARIA roles and labels,…

ecc2w293k
@affaan-m@affaan-mInstall Skill
compiler-commit

compiler-commit

Use when you want to verify compiler changes and commit with the correct convention. Runs tests, lint, and format, then commits…

react5d252k
@facebook@facebookInstall Skill

Questions about strategy-pattern.

Which coding agents can use strategy-pattern?
strategy-pattern installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.