# Moodle web services

> Moodle web services is an open-source agent skill for developer tools. Guides building and calling Moodle web services: external functions, tokens and schemas. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf, Goose
- **Website:** https://github.com/SaadRahman01/claude-moodle-dev/tree/main/skills/moodle-web-services
- **Repository:** https://github.com/saadrahman01/claude-moodle-dev
- **GitHub stars:** 44
- **License:** MIT
- **Skill name:** moodle-web-services
- **Collection:** https://github.com/SaadRahman01/claude-moodle-dev
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-03

## About

This skill walks the agent through exposing Moodle plugin code as web services. It covers registering functions and services in db/services.php, writing external function classes under classes/external/, and declaring typed parameter and return structures so inputs and outputs are checked.

The guidance stresses a fixed order inside each external function: validate parameters, validate the context, check capabilities, run the business logic, then format output. It also describes calling the same function over REST, AJAX from the browser, and SOAP or XMLRPC, along with token issuance, file upload and download flows, and tests that clean return values against their schema.

Working with it assumes a Moodle codebase and PHP plugin development. The skill notes that UI-only plugin code without remote callers belongs to a different plugin development skill.

## When your agent uses it

> Use when adding/calling Moodle web services or external functions — db/services.php, classes/external/, REST/SOAP/AJAX protocols, tokens, capabilities, parameters/returns schemas, file uploads, and rate limiting.

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/SaadRahman01/claude-moodle-dev/tree/HEAD/skills/moodle-web-services)
- [License: MIT](https://github.com/SaadRahman01/claude-moodle-dev/tree/HEAD/skills/moodle-web-services)

## Features

- **Service registration:** Defines functions and services in db/services.php, including capabilities, mobile exposure and AJAX access.
- **External function classes:** Shows the structure of execute, parameter and return definitions for external API classes.
- **Parameter type reference:** Lists Moodle PARAM_* types and value flags for validating inputs.
- **Token and REST calls:** Covers issuing tokens and calling functions through the REST server with curl examples.
- **File upload and download:** Describes moving draft uploads into plugin file areas and serving files through pluginfile.php.
- **Security checklist:** Lists common mistakes such as missing context validation and unformatted output.

## Good for

- Add a new web service function that a mobile app can call
- Define a service bundle with restricted users and token access
- Debug an 'Invalid response value' error from a Moodle external function
- Accept a file upload through a web service and save it to a plugin file area
- Write a PHPUnit test that validates a function's return schema

## Install

### Claude Code

This skill ships in the `moodle-dev` plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

```sh
/plugin marketplace add SaadRahman01/claude-moodle-dev
/plugin install moodle-dev@moodle-dev
```

Or copy only this skill to `~/.claude/skills/moodle-web-services`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/SaadRahman01/claude-moodle-dev.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/moodle-web-services &&
cp -R "$tmp/skills/moodle-web-services" ~/.claude/skills/moodle-web-services &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/moodle-web-services` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/moodle-web-services` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/SaadRahman01/claude-moodle-dev.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/moodle-web-services &&
cp -R "$tmp/skills/moodle-web-services" ~/.agents/skills/moodle-web-services &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/moodle-web-services` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/moodle-web-services` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/SaadRahman01/claude-moodle-dev.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/moodle-web-services &&
cp -R "$tmp/skills/moodle-web-services" ~/.cursor/skills/moodle-web-services &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/moodle-web-services` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/SaadRahman01/claude-moodle-dev.git --path skills/moodle-web-services
```

Or copy the folder to `~/.gemini/skills/moodle-web-services` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/moodle-web-services`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/SaadRahman01/claude-moodle-dev.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/moodle-web-services &&
cp -R "$tmp/skills/moodle-web-services" ~/.copilot/skills/moodle-web-services &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/moodle-web-services` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/SaadRahman01/claude-moodle-dev.git
```

Then copy `claude-moodle-dev/skills/moodle-web-services` into your agent's skills folder as `moodle-web-services`. Agents that support SKILL.md read one folder per skill.

## FAQ

### Which Moodle version does Moodle web services cover for namespaces?

It lists the namespace difference: Moodle 4.2 and later use core_external\external_api, while 4.1 and earlier use the bare external_api class.

### Does Moodle web services add a built-in rate limit for tokens?

No. The skill states there is no built-in per-token rate limit and suggests custom middleware or a reverse-proxy limit instead.

### What must be done after changing db/services.php?

Bump version.php and run the Moodle upgrade script so the service registers.

### Does Moodle web services need any scripts or tools to run?

The skill itself ships as a single SKILL.md file with no scripts; it is guidance for an agent working in a Moodle codebase.

### How do I install Moodle web services in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/moodle-web-services to use it in all your projects, or to .claude/skills/moodle-web-services in one project. Or install the moodle-dev plugin, which includes it: /plugin marketplace add SaadRahman01/claude-moodle-dev, then /plugin install moodle-dev@moodle-dev.

### Does Moodle web services run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use Moodle web services?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

### What are the best alternatives to Moodle web services?

The closest alternatives to Moodle web services are Moodle plugin development, Moodle mobile app, Moodle phpunit testing, Moodle security audit and Moodle accessibility.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [Moodle plugin development](https://ai-powered.com/skills/moodle-plugin-development): Moodle plugin development is an open-source agent skill for developer tools.
- [Moodle mobile app](https://ai-powered.com/skills/moodle-mobile-app): Moodle mobile app is an open-source agent skill for developer tools.
- [Moodle phpunit testing](https://ai-powered.com/skills/moodle-phpunit-testing): Moodle phpunit testing is an open-source agent skill for developer tools.
- [Moodle security audit](https://ai-powered.com/skills/moodle-security-audit): Moodle security audit is an open-source agent skill for security.
- [Moodle accessibility](https://ai-powered.com/skills/moodle-accessibility): Moodle accessibility is an open-source agent skill for developer tools.
- [Moodle behat testing](https://ai-powered.com/skills/moodle-behat-testing): Moodle behat testing is an open-source agent skill for developer tools.
- [Moodle performance](https://ai-powered.com/skills/moodle-performance): Moodle performance is an open-source agent skill for developer tools.
- [Moodle privacy gdpr](https://ai-powered.com/skills/moodle-privacy-gdpr): Moodle privacy gdpr is an open-source agent skill for developer tools.

---
Source: https://ai-powered.com/skills/moodle-web-services
