drupal-sdc-twig
Installation
SKILL.md
Drupal SDC + Twig Best Practices
Use this skill whenever you are creating, reviewing, or refactoring a Drupal Single Directory Component, or writing the Twig template that ships inside one. SDC has been part of Drupal core since 10.3, so assume it is available unless the user explicitly states an older version.
Anatomy of an SDC
Every component lives in its own folder inside a top-level components/ directory of a theme or module:
components/
└── card/
├── card.component.yml # Metadata + schema (props, slots, libraryOverrides)
├── card.twig # Template — note: .twig, NOT .html.twig
├── card.css # Auto-attached as a library asset
├── card.js # Auto-attached as a library asset
└── thumbnail.png # Optional preview image
Subdirectories are allowed (components/molecules/card/...). Components are referenced by namespace theme_or_module:component_name, e.g. my_theme:card.