Agent skill · software engineering · aiskillstore
moodle-external-api-development
This skill guides you through creating custom external web service APIs for Moodle LMS, following Moodle's external API framework and coding standards.
Why this skill is useful
Provides specific implementation patterns and coding standards for developing Moodle external APIs that the AI wouldn't reliably generate on its own.
What it needs
About 8k tokens when loaded. Last updated 2026-08-07. 405 stars on the source repository.
What this skill does
Moodle External API Development This skill guides you through creating custom external web service APIs for Moodle LMS, following Moodle's external API framework and coding standards. When to Use This Skill Creating custom web services for Moodle plugins Implementing REST/AJAX endpoints for course management Building APIs for quiz operations, user tracking, or reporting Exposing Moodle functionality to external applications Developing mobile app backends using Moodle Core Architecture Pattern Moodle external APIs follow a strict three-method pattern: 1. executeparameters() - Defines input parameter structure 2. execute() - Contains business logic 3. executereturns() - Defines return structure Step-by-Step Implementation Step 1: Create the External API Class File Location: /local/yourplugin/classes/external/yourapiname.php Key Points: Class must extend externalapi Namespace follows: localpluginname\external or modmodname\external Include the security check: defined('MOODLEINTERNAL') die(); Require externallib.php for base classes Step 2: Define Input Parameters Common Parameter Types: PARAMINT - Integers PARAMTEXT - Plain text (HTML stripped) PARAMRAW - Raw text (no cleaning) PARAMBOOL - Boolean values PARAMFLOAT - Floating point numbers PARAMALPHANUMEXT - Alphanumeric with extended chars Structures: externalvalue - Single value externalsinglestructure - Object with named fields externalmultiplestructure - Array of items Value Flags: VALUEREQUIRED - Parameter must be provided VALUEOPTIONAL - Parameter is optional VALUEDEFAULT, defaultvalue - Optional with default Step 3: Implement Business Logic Critical Steps: 1. Always validate parameters using validateparameters() 2. Check context using validatecontext() 3. Verify capabilities using requirecapability() 4. Use parameterized queries to prevent SQL injection 5. …
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills aiskillstore/moodle-external-api-development