twig-component

twig-component is a skill for Claude Code from smnandre/symfony-ux-skills. It costs 209 tokens per session (2,391 once invoked), scanned A, original, MIT.

A Symfony tool for building reusable interface pieces from PHP classes and Twig templates, such as buttons, cards, alerts, badges and navigation items. The pieces are rendered on the server and do not need JavaScript for their initial display.

In plain words
What is it for?
Use it to create reusable UI elements with inputs, content slots or computed values, including layouts, form widgets, table rows and modal structures.
Why use it?
It prevents repeated markup and keeps a component's data and template together. Simple visual pieces can use only Twig, while pieces with logic can also use a PHP class.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the symfony-ux-skills plugin — 7 skills shipped together

Good fit Use it to create reusable UI elements with inputs, content slots or computed values, including layouts, form widgets, table rows and modal structures.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/smnandre/symfony-ux-skills/twig-component
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add smnandre/symfony-ux-skills --skill twig-component
Clone the repo
git clone --depth 1 https://github.com/smnandre/symfony-ux-skills

Made for: Claude Code.

Or install symfony-ux-skills, the plugin that ships this one along with the rest of its 7 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for twig-component

README.md
[![agentmods](https://agentmods.dev/badge/skills/smnandre/symfony-ux-skills/twig-component/github.svg)](https://agentmods.dev/skills/smnandre/symfony-ux-skills/twig-component)
Your own site
<a href="https://agentmods.dev/skills/smnandre/symfony-ux-skills/twig-component"><img src="https://agentmods.dev/badge/skills/smnandre/symfony-ux-skills/twig-component/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for twig-component

Your own site · 80×15
<a href="https://agentmods.dev/skills/smnandre/symfony-ux-skills/twig-component"><img src="https://agentmods.dev/badge/skills/smnandre/symfony-ux-skills/twig-component.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 209 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,391 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00209 $0.02391
Opus 5 $0.00105 $0.01196
Sonnet 5 $0.00042 $0.00478
Haiku 4.5 $0.00021 $0.00239

Measured 11d ago against content hash b5a718092a0a, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

twig-component scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

skills/twig-component/SKILL.md · 353 lines

How it starts

The opening of the file, as written. The whole thing — 353 lines — stays where its author put it; the contents beside it link to each section on GitHub.

TwigComponent

Reusable UI components with PHP classes + Twig templates. Think React/Vue components, but server-rendered with zero JavaScript.

Two flavors exist: class components (PHP class + Twig template) for components that need logic, services, or computed properties, and anonymous components (Twig-only, no PHP class) for simple presentational elements.

When to Use TwigComponent

Use TwigComponent when you need reusable markup with props but no server re-rendering after the initial render. If the component needs to react to user input (re-render via AJAX, data binding, actions), use LiveComponent instead.

Good candidates: buttons, alerts, cards, badges, icons, form widgets, layout sections, navigation items, table rows, modals (structure only).

Installation

composer require symfony/ux-twig-component

Class Component

A PHP class annotated with #[AsTwigComponent] paired with a Twig template.

// src/Twig/Components/Alert.php
namespace App\Twig\Components;

use Symfony\UX\TwigComponent\Attribute\AsTwigComponent;

#[AsTwigComponent]
final class Alert
{
    public string $type = 'info';
    public string $message;
    public bool $dismissible = false;
}
{# templates/components/Alert.html.twig #}
<div class="alert alert-{{ type }}" {{ attributes }}>
    {{ message }}
    {% if dismissible %}
        <button type="button" class="close">&times;</button>
    {% endif %}
</div>
{# Usage #}
<twig:Alert type="success" message="Saved!" />
<twig:Alert type="danger" message="Error occurred" dismissible />

{# With block content instead of message prop #}
<twig:Alert type="warning">
    <strong>Warning:</strong> Check your input
</twig:Alert>

Anonymous Component (Twig Only)

No PHP class needed. Props are declared with {% props %} directly in the template. Use for simple presentational components with no logic.

{# templates/components/Button.html.twig #}
{% props variant = 'primary', size = 'md', disabled = false %}

<button
    class="btn btn-{{ variant }} btn-{{ size }}"
    {{ disabled ? 'disabled' }}
    {{ attributes }}
>
    {% block content %}{% endblock %}
</button>

Read the full file on GitHub · 353 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 11d ago First seen · 353 lines · 209 tokens per session scan A b5a718092a0a

Subscribe to this mod's changes

twig-component is a skill published in the GitHub repository smnandre/symfony-ux-skills (171 stars, last pushed 2mo ago), licensed MIT. It adds 209 tokens to every session and 2,391 once invoked, about $0.0010 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

baoyu-markdown-to-html

Converts Markdown to styled HTML with WeChat-compatible themes. Supports code highlighting, math, Mermaid (rendered to PNG via headless Chrome), PlantUML, footnotes, alerts, infographics, and optional bottom citations for external links. Use when user asks for "markdown to html", "convert md to html", "md 转 html"…

JimLiu/baoyu-skills · 94 tokens

frontend-specialist

A front-end development workflow for building or improving web pages, components, layouts, forms, dashboards, and responsive interfaces. It covers common tools and frameworks such as React, Vue, Next.js, Tailwind, and CSS.

huangwb8/skills · 61 tokens

migrate-elementor-to-gutenberg

Use when the user says 'migrate elementor to gutenberg', 'convert elementor to blocks', 'remove the elementor dependency', or 'go back to native wordpress'. Maps Elementor widgets to core blocks and creates draft duplicates for review.

respira-press/agent-skills-wordpress · 58 tokens

migrate-beaver-builder-to-gutenberg

Use when the user says 'migrate beaver builder to gutenberg', 'convert beaver builder to blocks', or 'move beaver builder to the block editor'. Reads the Beaver Builder flat node map, maps modules to core blocks, and creates draft duplicates for review.

respira-press/agent-skills-wordpress · 65 tokens

migrate-divi-to-breakdance

Use when the user says 'migrate divi to breakdance', 'convert divi to breakdance', or 'rebuild divi pages in breakdance'. Parses Divi shortcodes, maps modules to Breakdance elements, and creates draft duplicates for review.

respira-press/agent-skills-wordpress · 61 tokens

migrate-divi-to-bricks

Use when the user says 'migrate divi to bricks', 'convert divi to bricks', or 'rebuild divi pages in bricks'. Parses Divi shortcode content, maps modules to Bricks elements, and generates draft duplicates for review.

respira-press/agent-skills-wordpress · 58 tokens