# Moodle amd JavaScript

> Moodle amd JavaScript is an open-source agent skill for developer tools. Guides writing Moodle browser JavaScript as AMD modules with grunt builds and tests. 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-amd-javascript
- **Repository:** https://github.com/saadrahman01/claude-moodle-dev
- **GitHub stars:** 44
- **License:** MIT
- **Skill name:** moodle-amd-javascript
- **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 covers front-end JavaScript for Moodle plugins. It explains the AMD layout that separates ES6 source in amd/src from the generated minified files in amd/build, how module IDs map to plugin component paths, and how PHP code loads a module with js_call_amd. It also walks through a sample module that binds click handlers, calls a web service and re-renders a Mustache fragment.

The guidance includes the grunt commands for building, linting and watching AMD code, along with a table of common Moodle core helpers such as core/ajax, core/str, core/templates, core/modal, core/notification and core/pending. It also points out pitfalls like editing build output by hand, using the deprecated modal factory on Moodle 4.3 and later, and leaving async work unmarked so Behat tests flake.

Users need a Moodle codebase with Node and npm available so the grunt tasks can run, and web services must be declared in db/services.php to be callable from the browser. Testing options listed are manual checks, Behat browser tests and Jest on Moodle 4.4 and later.

## When your agent uses it

> Use when writing JavaScript for Moodle — AMD modules, ES6 source, grunt build, RequireJS loading, core/ajax + core/str + core/templates + core/modal + core/notification, Mustache template hydration, and AMD unit tests.

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

## Features

- **AMD module structure:** Explains the amd/src and amd/build layout and how module IDs are derived from file paths.
- **Core helper modules:** Reference table of Moodle core modules for AJAX, strings, templates, modals and notifications.
- **Mustache and JS pairing:** Shows how a PHP-rendered template is hydrated and wired to a module's init function.
- **Grunt build workflow:** Commands for building, linting and watching AMD code from the Moodle root.
- **Behat-safe async handling:** Describes marking pending work so browser tests wait for asynchronous requests.
- **AMD unit testing options:** Summarises manual, Behat and Jest approaches to testing Moodle AMD modules.

## Good for

- Add an interactive button to a Moodle plugin that updates a row without reloading
- Call a plugin web service from browser JavaScript and display the results
- Render a Mustache template on the client after an AJAX response
- Show a confirmation modal before deleting a record in a Moodle plugin
- Set up grunt to build and lint a plugin's AMD modules

## 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-amd-javascript`:

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

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

### Codex

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

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

### Cursor

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

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

Or copy the folder to `~/.gemini/skills/moodle-amd-javascript` yourself.

### VS Code

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

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

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

## FAQ

### What does Moodle amd JavaScript need to be used?

It assumes a Moodle codebase with Node and npm, where grunt can run from the Moodle root using the repository's .nvmrc.

### Should generated build files be edited?

No. The skill says to edit amd/src files and rebuild with grunt, and to commit both source and build output.

### Which modal module should be used on newer Moodle versions?

From Moodle 4.3 the skill recommends core/modal, which replaces the deprecated core/modal_factory.

### How are web service methods made callable from JavaScript?

They must be declared with 'ajax' => true in db/services.php, and the session token is attached automatically.

### How do I install Moodle amd JavaScript in Claude Code?

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

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 amd JavaScript?

The closest alternatives to Moodle amd JavaScript are Moodle behat testing, Moodle accessibility, Moodle plugin development, Moodle theme development and Moodle phpunit testing.

## Where this comes from

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

## Alternatives

- [Moodle behat testing](https://ai-powered.com/skills/moodle-behat-testing): Moodle behat testing 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.
- [Moodle plugin development](https://ai-powered.com/skills/moodle-plugin-development): Moodle plugin development is an open-source agent skill for developer tools.
- [Moodle theme development](https://ai-powered.com/skills/moodle-theme-development): Moodle theme development 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 mobile app](https://ai-powered.com/skills/moodle-mobile-app): Moodle mobile app 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 upgrade migration](https://ai-powered.com/skills/moodle-upgrade-migration): Moodle upgrade migration is an open-source agent skill for developer tools.

---
Source: https://ai-powered.com/skills/moodle-amd-javascript
