Skip to content

drupal fix

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

drupal-fix

Auto-fix coding standard violations in your custom code using PHPCBF (PHP Code Beautifier and Fixer).

Usage

/drupal-fix
/drupal-fix path=web/modules/custom/my_module

What it fixes

PHPCBF can automatically correct a subset of PHPCS violations:

  • Indentation (tabs → 2 spaces)
  • Trailing whitespace
  • Missing blank lines between methods
  • Brace placement
  • Spacing around operators and keywords
  • Doc comment formatting (some cases)

Issues that require human judgement (logic errors, naming, PHPStan findings) are reported but not modified.

Scope

By default fixes:

web/modules/custom/
web/themes/custom/

Pass path= to target a specific directory.

Workflow

The recommended workflow is:

  1. /drupal-analyze — see all issues
  2. /drupal-fix — auto-fix what's fixable
  3. /drupal-analyze again — review what remains
  4. Fix remaining issues manually or ask the agent for help

Prerequisites

Requires drupal/coder to be installed:

composer require --dev drupal/coder

Related skills

Clone this wiki locally