moodle-coding-standards
Moodle Coding Standards
Write compliant Moodle plugin code following PSR-12 and Moodle-specific conventions.
When to Use This Skill
- Creating new Moodle plugins
- Writing PHP code for Moodle
- Code review and quality checks
- Understanding Frankenstyle naming
See reference.md for complete standards.
Key Rules
Frankenstyle Naming
plugintype_pluginname
local_mymodule
mod_assignment
block_myblock
File Headers
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software...
namespace local_mymodule;
defined('MOODLE_INTERNAL') || die();
Class Naming
// Class in local/mymodule/classes/helper.php
namespace local_mymodule;
class helper {
// Methods use snake_case
public function get_user_data() {
}
}
Quick Checks
- File header with license
-
defined('MOODLE_INTERNAL') || die(); - Proper namespace
- PSR-12 formatting
- No direct DB queries (use DML)
More from astoeffer/plugin-marketplace
psr12-moodle
Automatically validate and fix Moodle PHP code for PSR-12 compliance with Moodle-specific exceptions (lowercase_with_underscores naming, frankenstyle prefixes). Activates when working with Moodle plugin PHP files or when code standards issues are detected.
4h5p-patterns
Create interactive H5P content for Moodle and web platforms. Use when building interactive exercises, quizzes, or multimedia learning content.
2ai-gateway
Build AI gateway services for routing and managing LLM requests. Use when implementing API proxies, rate limiting, or multi-provider AI services.
2design-tokens
Manage design tokens for consistent theming across platforms. Use when defining colors, typography, spacing, or other design system values.
1chatbot-widget
Build embeddable chatbot widgets for web applications. Use when creating chat UIs, iframe embeds, or widget-based AI interfaces.
1plugin-structure
Claude Code plugin structure and requirements. Use when creating, validating, or troubleshooting plugins. Covers plugin.json schema, SKILL.md format, command frontmatter, and agent configuration.
1