craft-php-guidelines

Enforce Craft CMS 5 PHP coding standards for plugins and modules.

66|6|Updated Apr 7, 2026
One-click install
npx skills add https://github.com/michtio/craftcms-claude-skills --skill craft-php-guidelines
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: craft-php-guidelines
Source: https://github.com/michtio/craftcms-claude-skills/tree/main/skills/craft-php-guidelines
Command: npx skills add https://github.com/michtio/craftcms-claude-skills --skill craft-php-guidelines

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Craft CMS 5 PHP coding standards and conventions provide a centralized guide for plugin and module development, ensuring consistent code quality and maintainability across projects.

Core Features & Use Cases

  • PHPDocs on everything (classes, methods, properties) to improve static analysis and collaboration.
  • Naming conventions and project-wide patterns (e.g., beforePrepare() addSelect(), strict typing, and avoiding declare(strict_types=1) in plugin source files).
  • Companion tooling guidelines (ECS, PHPStan) and scaffolding practices to streamline development.

Quick Start

Apply these standards to every PHP file in a Craft CMS 5 plugin or module.

Frequently Asked Questions about craft-php-guidelines

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

FAQPage Schema
How do I write PHP code that follows Craft CMS 5 plugin coding standards?

Craft CMS 5 plugin coding standards require comprehensive PHPDocs on classes, methods, and properties, specific naming conventions, and typed properties to ensure consistent code quality and maintainability across services, models, controllers, and elements.

What are the PHP naming conventions for Craft CMS 5 modules and plugins?

Craft CMS 5 naming conventions specify patterns like beforePrepare() and addSelect() for methods, alongside structured helper methods and project-wide rules to ensure consistent structure and documentation across plugin and module development.

Do I need declare(strict_types=1) in Craft CMS 5 plugin source files?

No, Craft CMS 5 coding guidelines explicitly advise avoiding declare(strict_types=1) in plugin source files, preferring alternative typing strategies like using ?string for nullable types to maintain consistency.

What PHPDoc requirements exist for Craft CMS 5 plugin development?

PHPDocs are required on everything in Craft CMS 5 plugin development, including classes, methods, and properties, to improve static analysis, collaboration, and overall code documentation across all plugin and module files.

Does Craft CMS 5 plugin development require specific companion tooling for code standards?

Craft CMS 5 coding standards include companion tooling guidelines for ECS and PHPStan, along with scaffolding practices, to streamline development and enforce the required PHP coding standards across plugins and modules.