Skip to content
Back to skills

Twig Components

ASecurity

Build reusable UI components with Symfony UX Twig Components (props, slots, anonymous components, CVA) for clean templates

  • 221 stars
  • 0 votes
  • 1 copy
  • 11 views
  • Added August 31, 2026
developmentphpreactrails

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned October 6, 2026

npx -y skills add dev-toolings/superpowers-symfony --skill twig-components --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Twig Components?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Twig Components
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/dev-toolings-twig-components/badge)](https://www.skillsdirectory.com/skills/dev-toolings-twig-components)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
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`

Files in this skill

  • SKILL.md1.1 KB
  • reference.md9.9 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.