home / skills / makfly / superpowers-symfony / strategy-pattern

strategy-pattern skill

/skills/strategy-pattern

This skill helps optimize Symfony architecture by applying the strategy pattern with controlled checkpoints, ensuring safe, auditable context-driven changes.

npx playbooks add skill makfly/superpowers-symfony --skill strategy-pattern

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
1.1 KB
---

name: symfony:strategy-pattern
allowed-tools:
  - Read
  - Glob
  - Grep
description: Apply production-grade Symfony architecture and execution workflows with controlled scope and clear checkpoints. Use for strategy pattern tasks.
---

# Strategy Pattern (Symfony)

## Use when
- Refining architecture/workflows/context handling in Symfony projects.
- Planning and executing medium/complex changes safely.

## Default workflow
1. Establish current boundaries, constraints, and coupling points.
2. Propose smallest coherent architectural adjustment.
2. Execute in checkpoints with validation at each stage.
2. Summarize tradeoffs and follow-up backlog.

## Guardrails
- Use existing project patterns by default.
- Avoid broad refactors without explicit need.
- Keep decision log clear and auditable.

## Progressive disclosure
- Use this file for execution posture and risk controls.
- Open references when deep implementation details are needed.

## Output contract
- Architecture/workflow changes.
- Checkpoint validation outcomes.
- Residual risks and next steps.

## References
- `reference.md`
- `docs/complexity-tiers.md`

Overview

This skill applies a production-grade Symfony architecture and controlled execution workflow focused on the Strategy Pattern. It helps plan, validate, and roll out scoped architectural adjustments with clear checkpoints. The goal is safe, auditable changes that minimize risk while improving design and behavior.

How this skill works

I inspect the current Symfony boundaries, coupling points, and existing patterns to find the smallest coherent change that implements the Strategy Pattern. I propose an incremental plan broken into checkpoints, run validation steps at each checkpoint, and capture tradeoffs, validation outcomes, and residual risks. Deliverables include code-level change suggestions, checkpoint tests or criteria, and a follow-up backlog.

When to use it

  • Refactoring behavior selection into Strategy Pattern for maintainability
  • Introducing runtime pluggable algorithms or business rules
  • Preparing medium-complexity changes where rollback and auditability are required
  • Aligning new behavior with existing project conventions
  • When you need staged delivery with automated/explicit validations

Best practices

  • Prefer existing project patterns and service configuration to minimize cognitive load
  • Scope changes to the smallest coherent unit that achieves the goal
  • Define explicit checkpoint criteria (tests, metrics, manual checks) before each execution step
  • Keep a decision log for each step: rationale, alternatives, and expected impact
  • Avoid broad or sweeping refactors unless checkpoints prove feasibility

Example use cases

  • Replace large conditional logic with strategy services to simplify controllers and services
  • Introduce selectable pricing or tax calculation algorithms switchable at runtime
  • Create pluggable notification dispatchers (email/SMS/push) using the Strategy Pattern
  • Migrate an algorithm to a service-oriented strategy with feature-flagged rollout and rollback checkpoints
  • Break complex domain logic into testable, injectable strategies for easier QA

FAQ

How do checkpoints look in practice?

Each checkpoint is a small, executable delivery with clear acceptance criteria: unit/integration tests, behavior verification steps, and a rollback plan if criteria fail.

Will this force a full refactor?

No. The approach prefers minimal, targeted changes that reuse existing patterns. Broad refactors are only recommended when unavoidable and are executed in validated stages.