# Moodle upgrade migration

> Moodle upgrade migration is an open-source agent skill for developer tools. Guides an agent through upgrading Moodle plugins to newer Moodle and PHP versions. 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-upgrade-migration
- **Repository:** https://github.com/saadrahman01/claude-moodle-dev
- **GitHub stars:** 44
- **License:** MIT
- **Skill name:** moodle-upgrade-migration
- **Collection:** https://github.com/SaadRahman01/claude-moodle-dev
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-02

## About

This skill gives the agent a migration playbook for moving a Moodle plugin forward across releases. It lists deprecated functions and their replacements, such as print_error, add_to_log and the bare external_api class, and notes which changes arrived in each Moodle 4.x and 5.x release, including the Hooks API, the /public document root and the Routing Engine.

The material also walks through PHP 8.1 to 8.4 changes that affect plugin code, such as implicit nullable parameters and deprecated CSV and XML helpers. It shows how to write a db/upgrade.php file with cumulative version blocks, how to maintain upgrade.txt or per-component UPGRADING.md notes, and how to write compatibility shims for plugins that support several Moodle versions.

The skill suggests running phpcs with the Moodle standard, phpcompatinfo and phpstan as part of the check. It expects a Moodle plugin codebase and the relevant Moodle and PHP versions as input.

## When your agent uses it

> Use when upgrading a Moodle plugin across versions, fixing deprecated API usage, or migrating to Moodle 4.x/5.x (incl. 5.1/5.2) conventions — print_error, add_to_log, formslib changes, external_api namespace, Hooks API, /public doc-root, Routing Engine, PSR-4 migration, PHP 8.1–8.4 upgrades, and required upgrade.txt notes.

## 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-upgrade-migration)
- [License: MIT](https://github.com/SaadRahman01/claude-moodle-dev/tree/HEAD/skills/moodle-upgrade-migration)

## Features

- **Deprecated API replacements:** A table mapping old Moodle functions and classes to their current equivalents, with the version each change arrived in.
- **Moodle 4 and 5 changes:** Notes on Hooks API, external API namespaces, Bootstrap 5 class renames and 5.1 and 5.2 requirements.
- **PHP 8.x upgrade notes:** Summaries of PHP 8.0 through 8.4 changes that affect plugin code and need fixing.
- **Database upgrade steps:** An example db/upgrade.php with cumulative version blocks, field and index guards and savepoints.
- **Upgrade notes documentation:** Format and placement guidance for upgrade.txt and per-component UPGRADING.md files.
- **Multi-version compatibility shims:** Patterns for aliasing classes and branching on the Moodle major version.
- **Lint and analysis commands:** Example commands for phpcs with the Moodle standard, phpcompatinfo and phpstan.

## Good for

- Upgrade a Moodle plugin so it runs on Moodle 5.1
- Replace print_error and add_to_log calls with current APIs
- Prepare a plugin for PHP 8.4 compatibility
- Write a db/upgrade.php step that adds a field safely
- Draft upgrade.txt notes for a new plugin release

## 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-upgrade-migration`:

```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-upgrade-migration &&
cp -R "$tmp/skills/moodle-upgrade-migration" ~/.claude/skills/moodle-upgrade-migration &&
rm -rf "$tmp"
```

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

### Codex

Copy the skill folder to `~/.agents/skills/moodle-upgrade-migration` 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-upgrade-migration &&
cp -R "$tmp/skills/moodle-upgrade-migration" ~/.agents/skills/moodle-upgrade-migration &&
rm -rf "$tmp"
```

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

### Cursor

Copy the skill folder to `~/.cursor/skills/moodle-upgrade-migration` 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-upgrade-migration &&
cp -R "$tmp/skills/moodle-upgrade-migration" ~/.cursor/skills/moodle-upgrade-migration &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/moodle-upgrade-migration` 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-upgrade-migration
```

Or copy the folder to `~/.gemini/skills/moodle-upgrade-migration` yourself.

### VS Code

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

```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-upgrade-migration &&
cp -R "$tmp/skills/moodle-upgrade-migration" ~/.copilot/skills/moodle-upgrade-migration &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/moodle-upgrade-migration` 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-upgrade-migration` into your agent's skills folder as `moodle-upgrade-migration`. Agents that support SKILL.md read one folder per skill.

## FAQ

### Which Moodle and PHP versions does Moodle upgrade migration cover?

It covers Moodle 3.x to 5.x, including 5.1 and 5.2, and PHP 7.2 changes plus PHP 8.0 through 8.4.

### Does Moodle upgrade migration change Moodle core or only plugins?

It targets plugin code. Its steps apply to a plugin's own files, such as db/upgrade.php, upgrade.txt and its class files.

### What tools does Moodle upgrade migration use?

It refers to phpcs with the Moodle coding standard, phpcompatinfo and phpstan for checking code.

### How do I install Moodle upgrade migration in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/moodle-upgrade-migration to use it in all your projects, or to .claude/skills/moodle-upgrade-migration 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 upgrade migration 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 upgrade migration?

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 upgrade migration?

The closest alternatives to Moodle upgrade migration are Moodle plugin development, Moodle hooks API, Moodle security audit, Moodle phpunit testing and Moodle mobile app.

## 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 hooks API](https://ai-powered.com/skills/moodle-hooks-api): Moodle hooks API 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 phpunit testing](https://ai-powered.com/skills/moodle-phpunit-testing): Moodle phpunit testing 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 performance](https://ai-powered.com/skills/moodle-performance): Moodle performance is an open-source agent skill for developer tools.
- [Moodle accessibility](https://ai-powered.com/skills/moodle-accessibility): Moodle accessibility is an open-source agent skill for developer tools.
- [Dependency upgrade](https://ai-powered.com/skills/dependency-upgrade): Dependency upgrade is an open-source agent skill for developer tools.

---
Source: https://ai-powered.com/skills/moodle-upgrade-migration
