drupal-coding-standards

Enforce Drupal coding standards and DrupalPractice sniff compliance in generated PHP code.

1|Updated Mar 11, 2026
One-click install
npx skills add https://github.com/proofoftom/drupal-skills --skill drupal-coding-standards
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: drupal-coding-standards
Source: https://github.com/proofoftom/drupal-skills/tree/main/skills/drupal-coding-standards
Command: npx skills add https://github.com/proofoftom/drupal-skills --skill drupal-coding-standards

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill enforces Drupal's strict coding standards, preventing common errors and ensuring code is maintainable, readable, and passes automated checks like phpcs.

Core Features & Use Cases

  • Code Formatting: Enforces cuddled brace style, docblock requirements, and nullable type hints.
  • DrupalPractice Compliance: Catches common Drupal-specific anti-patterns, like incorrect service injection.
  • Use Case: When generating any Drupal code, use this skill as a baseline to guarantee adherence to best practices and avoid tedious manual corrections later.

Quick Start

Generate a new Drupal module and ensure all generated code adheres to Drupal coding standards.

Frequently Asked Questions about drupal-coding-standards

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I ensure my generated Drupal code passes phpcs static analysis?

Ensuring generated Drupal code passes phpcs requires enforcing cuddled brace styles, docblock formatting, and nullable type hints. This compliance prevents common errors and guarantees the PHP output is production-ready for automated checks.

What coding standards are needed for DrupalPractice sniff compliance?

DrupalPractice sniff compliance requires addressing common Drupal-specific anti-patterns, such as incorrect service injection. Enforcing these standards alongside general PHP formatting ensures maintainable and readable code.

Do I need service injection patterns for production-ready Drupal modules?

Production-ready Drupal modules require correct service injection patterns to avoid anti-patterns. Enforcing proper injection alongside docblock formatting and nullable types ensures the generated PHP code passes static analysis tools.

How do I fix docblock formatting and brace style issues in Drupal PHP code?

Fixing docblock formatting and brace style issues in Drupal PHP code involves enforcing cuddled braces and required docblock structures. Automating these formatting rules prevents tedious manual corrections later in development.

Why does my generated Drupal code fail automated coding standards checks?

Generated Drupal code fails automated checks when it lacks proper nullable type hints, docblock formatting, or cuddled brace styles. Enforcing these specific standards ensures the code meets phpcs requirements and passes static analysis.