drupal-conventions
Installation
SKILL.md
Drupal Conventions (JIT)
Load these conventions only when relevant to the current task.
Translation Rules
- Wrap all user-facing text in
t()orTranslatableMarkup. - Use module name as context (PHP string, not constant).
- English in code, translations in
/translations/*.pofiles withmsgctxt. - Twig:
|tfilter for strings,{% trans %}blocks for placeholders. - PO format:
msgctxt "my_module"/msgid "English"/msgstr "Translated".
CSS Conventions
- Target specific elements (
.parent .child), not parent containers. - BEM:
block__element--modifierstrictly for custom classes. - Use
{{ attach_library('my_theme/component') }}for all assets. - Every asset bundle needs a matching
*.libraries.ymlentry. - Mobile-first responsive design. Use Drupal breakpoints for responsive images.