strategy-pattern — скилл для Claude Code: что делает и как установить
Скилл strategy-pattern для Claude Code внедряет паттерн «Стратегия» в приложениях на Symfony с помощью тегированных сервисов. Обрабатывает растущий список алгоритмов или провайдеров.
MIT ★ 234 обновлён 2026-10-05
npx skills add dev-toolings/superpowers-symfony --skill strategy-pattern -a claude-codeЧто делает strategy-pattern
Скилл проектирует расширяемую архитектуру на Symfony без разрастающихся выражений match или switch. Он создаёт интерфейс стратегии с методом supports() либо ключом, вешает атрибут #[AutoconfigureTag] и связывает реализации через #[AutowireIterator] для последовательного перебора или #[AutowireLocator] для прямого получения сервиса.
В итоговый код входят селектор с явной ошибкой при отсутствии подходящего варианта, запасная стратегия, а также модульные тесты для каждого класса и селектора с фейками. Если в логике всего два неизменных сценария, скилл прямо рекомендует оставить обычный match вместо усложнения кодовой базы.
Какие задачи решает
- заменить разрастающийся
switchилиmatchпо строковому типу - настроить перебор алгоритмов через
#[AutowireIterator] - получать нужный сервис по ключу через
#[AutowireLocator] - изолировать провайдеры оплаты или форматы экспорта в независимые классы
Примеры запросов агенту
- Вынеси обработку платёжных шлюзов в отдельные стратегии Symfony с тегированием
- Спроектируй селектор экспорта отчётов через AutowireIterator и добавь fallback-обработчик
- Покрой тестами селектор стратегий и проверь падение при неизвестном типе
Как установить strategy-pattern
1Через Skills CLI (Vercel)
npx skills add dev-toolings/superpowers-symfony --skill strategy-pattern -a claude-code2Вручную: положить файлы
~/.claude/skills/strategy-pattern/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/strategy-pattern/
1Через Skills CLI (Vercel)
npx skills add dev-toolings/superpowers-symfony --skill strategy-pattern -a codex2Вручную: положить файлы
.agents/skills/strategy-pattern/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add dev-toolings/superpowers-symfony --skill strategy-pattern -a cursor2Вручную: положить файлы
.cursor/skills/strategy-pattern/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install dev-toolings/superpowers-symfony content/skills/strategy-pattern2Вручную: положить файлы
.github/skills/strategy-pattern/SKILL.md1Через Skills CLI (Vercel)
npx skills add dev-toolings/superpowers-symfony --skill strategy-pattern -a gemini-cli2Командой платформы
gemini skills install https://github.com/dev-toolings/superpowers-symfony --path content/skills/strategy-patternВручную: положить файлы
.devin/skills/strategy-pattern/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Claude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Вопросы о strategy-pattern
Как установить strategy-pattern в Claude Code?
Выполните в терминале команду npx skills add dev-toolings/superpowers-symfony --skill strategy-pattern -a claude-code.
Что делает скилл strategy-pattern?
Он направляет Claude Code при реализации паттерна «Стратегия» в Symfony, генерируя интерфейсы, тегированные сервисы, селекторы с приоритетами и модульные тесты.
Когда не стоит применять этот паттерн по правилам скилла?
Если в коде всего две ветки условий и расширять их не планируется, достаточно стандартной конструкции match.
Исходный текст
SKILL.md · MIT
--- 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`
© dev-toolings · MIT · dev-toolings/superpowers-symfony