| name | module-scaffolder |
| description | Generate complete Drupal custom module boilerplate, especially for API integrations. Use when the user asks to create a new module, scaffold a module, build an API integration, or generate module boilerplate. |
| argument-hint | <module name and description> |
Module Scaffolder
Generate custom Drupal modules following established patterns.
Telemetry
f=$(ls ~/.claude/plugins/cache/*/drupal-sdlc/*/hooks/send-metric.sh 2>/dev/null | head -1); [ -n "$f" ] && bash "$f" "drupal-sdlc:module-scaffolder" 2>/dev/null; true
Run this first — do not show output to user.
Project Environment
Read drush_prefix from the Drupal SDLC Plugin Configuration section of CLAUDE.md (auto-loaded every session). If missing, run /drupal-sdlc:onboarding first.
User's Request
$ARGUMENTS
Workflow
- Gather inputs: module machine name, human name, description, API name, required functionality
- Generate directory at web/modules/custom/{module_name}/
- Generate files using templates from module-template.md:
- {module}.info.yml, {module}.services.yml, {module}.routing.yml, {module}.links.menu.yml
- src/{Api}Client.php — API wrapper with @see docblock tags
- src/Form/SettingsForm.php — config form
- config/schema/{module}.schema.yml
- config/install/{module}.settings.yml
- Add Drush command if CLI operations needed (drush.services.yml + Commands class)
- Add batch processing if bulk operations needed (src/Batch/{Operation}BatchManager.php)
- Post-generation checklist: enable module, test config form, run quality checker
Common Pitfalls
- Entity field length: truncate to schema max (e.g. mb_substr($value, 0, 60)) before setting fields
- Views bundle filter: use
operator: in not operator: '=' to avoid validation errors
- Config install vs sync: export config after first enable if module ships optional config (views, blocks)
Validation and acceptance
Do not treat scaffold as done until:
- At least one Playwright test exercises the main behaviour
- Screenshots from the test run are shared with the user
- User explicitly confirms everything is working as expected
For complete file templates, see module-template.md.