Skip to content

drupal module

Paulo Maia Carvalho edited this page May 20, 2026 · 1 revision

drupal-module

Scaffold a new custom Drupal module with the standard boilerplate file structure.

Usage

/drupal-module my_module
/drupal-module name=my_module

If you don't provide a name, the agent suggests one and confirms with you.

What it creates

web/modules/custom/my_module/
├── my_module.info.yml
├── my_module.module
├── my_module.routing.yml
├── my_module.services.yml
└── src/
    └── Controller/
        └── MyModuleController.php

my_module.info.yml

name: 'My Module'
type: module
description: 'Description of my module.'
package: Custom
core_version_requirement: ^10 || ^11
dependencies: []

my_module.routing.yml

Includes a sample route pointing to the controller.

MyModuleController.php

A minimal controller extending ControllerBase with a single action method returning a render array.

After scaffolding

The agent runs drush en my_module to enable the module and then drush cr to rebuild caches.

Name validation

  • Converted to snake_case automatically (hyphens → underscores, lowercase)
  • Must start with a letter
  • Must not conflict with existing core or contrib module names (checked against installed packages)

Related skills

Clone this wiki locally