twig-templating

Installation
SKILL.md

Twig Templating

Always use {{ attach_library() }} for assets — never inline CSS/JS. Always use BEM naming for custom classes. Avoid heavy logic in templates — prefer preprocess functions. Never use |raw on user input.

Template Naming Conventions

Drupal uses suggestion-based template discovery:

node.html.twig                    # Base node template.
node--article.html.twig           # Article content type.
node--article--teaser.html.twig   # Article teaser view mode.
node--42.html.twig                # Specific node by ID.

block.html.twig                   # Base block template.
block--system-branding-block.html.twig  # Specific block.
Installs
40
GitHub Stars
18
First Seen
Jul 9, 2026