agentsclimarketplace

Drupal conventions

Skill gkastanis/drupal-workflow/skills/drupal-conventions

Load Drupal-specific conventions (translations, CSS, error handling) on demand. Use when working on theming, translations, or exception handling.From its SKILL.md

Install
npx -y skills add gkastanis/drupal-workflow --skill drupal-conventions

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
  • 15 stars15 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

1.6 KB, as published. Nobody here has run it

Drupal Conventions (JIT)

Load these conventions only when relevant to the current task.

Translation Rules

  • Wrap all user-facing text in t() or TranslatableMarkup.
  • Use module name as context (PHP string, not constant).
  • English in code, translations in /translations/*.po files with msgctxt.
  • Twig: |t filter 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--modifier strictly for custom classes.
  • Use {{ attach_library('my_theme/component') }} for all assets.
  • Every asset bundle needs a matching *.libraries.yml entry.
  • Mobile-first responsive design. Use Drupal breakpoints for responsive images.

Error Handling

  • Always use exceptions for errors, not NULL/FALSE returns.
  • Never catch \Exception — catch the narrowest exception you can handle.
  • Avoid catching just to log (unless error doesn't affect caller).
  • Always return early with clear error messages (fail fast).
// Good: specific exception, early return.
if (!$entity) {
  throw new EntityNotFoundException("Entity $id not found.");
}

// Bad: silently swallowing errors.
try {
  $result = $service->process();
} catch (\Exception $e) {
  // Never do this.
}

Keep looking

Skills are one crate of 626,194. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.