twig-components — скилл для Claude Code: Twig-компоненты Symfony
Скилл для Claude Code собирает переиспользуемые компоненты на Symfony UX Twig Components: props, слоты, анонимные шаблоны и CVA-варианты. Использует один и тот же фрагмент Twig на разных страницах.
MIT ★ 234 обновлён 2026-10-05
npx skills add dev-toolings/superpowers-symfony --skill twig-components -a claude-codeЧто делает twig-components
Скилл ведёт агента по Symfony UX Twig Components. Сначала выбирается вид: анонимный шаблон, класс с #[AsTwigComponent] или реактивный #[AsLiveComponent]. Потом props объявляются публичными изменяемыми свойствами, а вычисляемые значения собираются в mount(). Контент отдаётся через блоки-слоты, чтобы не плодить лишние props.
Для реактивных частей состояние помечается #[LiveProp(writable: true)], ввод пользователя демпфируется. Тест пишется через InteractsWithTwigComponents и проверяет монтирование вместе с рендером.
Публичные props нельзя делать readonly: они присваиваются после создания объекта, и компонент не соберётся. Сервисы внедряются как private readonly, а writable ставится только там, где значение меняет браузер. Инструменты скилла ограничены Read, Glob и Grep — файлы он не правит, правки вносите сами.
Какие задачи решает
- вынести повторяющийся блок Twig в компонент с props и слотами
- собрать реактивный поиск по списку на Live Components
- протестировать монтирование и рендер компонента
- развести варианты кнопки по CVA вместо копий шаблона
- найти в шаблонах места, где одна и та же разметка дублируется
Примеры запросов агенту
- Вынеси карточку товара из
templates/product/show.html.twigв компонент с props и слотом. - Сделай поиск по списку реактивным через
#[AsLiveComponent]и задемпфируй ввод. - Напиши тест на монтирование и рендер
AlertComponentчерезInteractsWithTwigComponents.
Как установить twig-components
1Через Skills CLI (Vercel)
npx skills add dev-toolings/superpowers-symfony --skill twig-components -a claude-code2Вручную: положить файлы
~/.claude/skills/twig-components/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/twig-components/
1Через Skills CLI (Vercel)
npx skills add dev-toolings/superpowers-symfony --skill twig-components -a codex2Вручную: положить файлы
.agents/skills/twig-components/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add dev-toolings/superpowers-symfony --skill twig-components -a cursor2Вручную: положить файлы
.cursor/skills/twig-components/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install dev-toolings/superpowers-symfony content/skills/twig-components2Вручную: положить файлы
.github/skills/twig-components/SKILL.md1Через Skills CLI (Vercel)
npx skills add dev-toolings/superpowers-symfony --skill twig-components -a gemini-cli2Командой платформы
gemini skills install https://github.com/dev-toolings/superpowers-symfony --path content/skills/twig-componentsВручную: положить файлы
.devin/skills/twig-components/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Claude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Вопросы о twig-components
Как установить twig-components в Claude Code?
Выполните npx skills add dev-toolings/superpowers-symfony --skill twig-components -a claude-code. Скилл окажется по пути ~/.claude/skills/twig-components/SKILL.md.
Что делает twig-components?
Помогает агенту разложить шаблоны Symfony на компоненты: выбрать вид компонента, объявить props и слоты, добавить реактивное состояние и тест.
Почему публичные props нельзя делать readonly?
Значения присваиваются уже после создания объекта, а readonly так нельзя — компонент не соберётся. Внедряйте сервисы как private readonly, а props оставляйте изменяемыми.
Исходный текст
SKILL.md · MIT
--- name: twig-components description: Build reusable UI components with Symfony UX Twig Components (props, slots, anonymous components, CVA) for clean templates capabilities: [read, search] tags: [architecture, ui] # projected by `bun run build` — do not edit by hand allowed-tools: - Read - Glob - Grep --- # Twig Components (Symfony) ## Use when - Extracting a repeated piece of Twig into a reusable component. - Building a component with props, slots, computed logic, or CVA variants. - Making a component reactive with Live Components (search, counters, forms). ## Default workflow 1. Choose the kind: anonymous (template only), class-based `#[AsTwigComponent]`, or `#[AsLiveComponent]`. 2. Declare props as public mutable properties; use `mount()` for derived values. 3. Expose content injection through blocks (slots) rather than more props. 4. For Live Components, mark writable state with `#[LiveProp(writable: true)]` and debounce user input. 5. Test the PHP class with `InteractsWithTwigComponents`. ## Guardrails - Never make public props `readonly`: they are assigned after instantiation. - Inject services as `private readonly`, never as public props. - Only mark a `LiveProp` writable when the browser must change it. - Keep one responsibility per component. ## Progressive disclosure - Use this file for execution posture and risk controls. - Open references when deep implementation details are needed. ## Output contract - Component classes and templates, with their props and slots. - Live state and actions, when the component is reactive. - A component test for mount and render. ## References - `reference.md`
© dev-toolings · MIT · dev-toolings/superpowers-symfony