Drupal Coding Standards

Published by ronaldtebrake in drupal-coding-standards-skill

Review recommended37 installs

What this skill does

Review code according to Drupal's official coding standards. Provides AI agents with comprehensive guidelines for PHP, JavaScript, CSS, Twig, YAML, SQL, and markup files in Drupal projects. Uses dynamic context discovery to load only relevant standards based on file type being reviewed.

Add Drupal Coding Standards to your agent

Review the source and files first. When you are ready, copy the prompt instruction or use the CLI command supported by your environment.

Install with a prompt

Paste this into a compatible coding agent:

add this skill "drupal-coding-standards" from https://github.com/ronaldtebrake/drupal-coding-standards-skill

Install with the CLI

Run this command in a controlled environment after reviewing the repository:

npx skills add https://github.com/ronaldtebrake/drupal-coding-standards-skill --skill drupal-coding-standards

Skill instructions

Drupal Coding Standards Skill

This skill provides AI agents with the ability to review code according to Drupal's official coding standards. The standards are maintained by the Drupal community and automatically kept up-to-date via Composer dependency.

When to Use

Activate this skill when:

  • Reviewing code in Drupal projects (modules, themes, profiles)
  • Checking code for compliance with Drupal coding standards
  • Performing code reviews on PHP, JavaScript, CSS, Twig, YAML, or SQL files
  • Ensuring code follows Drupal best practices and conventions

How It Works

This skill uses dynamic context discovery to load only the relevant standards based on the file type being reviewed:

  1. Identify the file type being reviewed (.php, .js, .css, .twig, .yml, etc.)
  2. Consult the routing table in standards-index.md to find the corresponding standard file
  3. Load the specific standard from assets/standards/[category]/[file].md
  4. Apply the standards to review the code

Review Workflow

  1. Read standards-index.md to determine which standard file applies to the code being reviewed
  2. Load the relevant standard file from assets/standards/
  3. Review the code against the standards
  4. Provide specific, actionable feedback referencing the relevant sections of the standards

Files included

  • assets/standards/accessibility/accessibility.md
  • assets/standards/composer/package-name.md
  • assets/standards/css/architecture.md
  • assets/standards/css/coding.md
  • assets/standards/css/csscomb.md
  • assets/standards/css/file-organization.md
  • assets/standards/css/format.md
  • assets/standards/css/review.md
  • assets/standards/index.md
  • assets/standards/javascript/best-practice.md
  • assets/standards/javascript/coding.md
  • assets/standards/javascript/documentation.md
  • assets/standards/javascript/eslint.md
  • assets/standards/javascript/jquery.md
  • assets/standards/markup/style.md
  • assets/standards/php/coding.md
  • assets/standards/php/documentation-examples.md
  • assets/standards/php/documentation.md
  • assets/standards/php/e_all.md
  • assets/standards/php/exceptions.md
  • assets/standards/php/index.md
  • assets/standards/php/namespaces.md
  • assets/standards/php/naming-services.md
  • assets/standards/php/placeholders-delimiters.md
  • assets/standards/php/psr4.md
  • assets/standards/spelling/spelling.md
  • assets/standards/sql/conventions.md
  • assets/standards/sql/keywords.md
  • assets/standards/sql/select-from.md
  • assets/standards/twig/coding.md
  • assets/standards/yaml/configuration-files.md
  • SKILL.md
  • standards-index.md

More skills

Drupal Coding Standards: Install, Source and Security