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.5 $0.00084 $0.00956
Sonnet 5.5 $0.00042 $0.00478
Haiku 4.5 $0.00021 $0.00239

Measured 2mo ago against content hash b5a718092a0a, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 2mo 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. 2mo 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 (181 stars, last pushed 4mo ago), licensed MIT. It adds 209 tokens to every session and 2,391 once invoked, about $0.0008 per session on Opus 5.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

onboarding

Skill "onboarding" from knitli/toolshed, covering codeweaver first-run onboarding, your goal, setup flow, 1. welcome & overview and 2. embedding provider selection.

knitli/toolshed · 0 tokens

setup

Skill "setup" from knitli/toolshed, covering codeweaver setup / reconfiguration, your goal, setup flow, 1. welcome & context and 2. embedding provider selection.

knitli/toolshed · 0 tokens

.codex

Skill ".codex" from knitli/toolshed, covering context hygiene skill, name, description, instructions and 1. discovery.

knitli/toolshed · 0 tokens

hmi-design-full

Comprehensive ISA-101 design rules for Human Machine Interfaces in process automation, with detailed reference files covering color design, display hierarchy, navigation, alarms, human factors, performance, and lifecycle management. Use when designing, building, reviewing, or generating code for HMIs, control system…

timhok/hmi-design · 107 tokens

yugabytedb-sizing

Calculate and recommend optimal YugabyteDB cluster sizing based on workload inputs. Use this skill whenever the user asks about YugabyteDB cluster sizing, capacity planning, node count, vCPU requirements, storage sizing, memory recommendations, or wants to know how many nodes they need for a given workload. Trigger…

srinivasa-vasu/agent-skills · 161 tokens

yugabytedb-app-dev

Build production-grade applications that connect to YugabyteDB across any language runtime or framework. Covers JDBC/Spring Boot, Spring Boot Reactive (WebFlux + R2DBC), Quarkus (SmallRye Fault Tolerance + Agroal), Python, Node.js, Go, .NET, and more — with correct driver config, pool tuning (HikariCP/Agroal/Npgsql)…

srinivasa-vasu/agent-skills · 202 tokens