Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new GitHub Copilot custom instruction file intended to guide code generation for Moodle project development, and registers it in the instructions catalog.
Changes:
- Added
instructions/moodle.instructions.mdwith Moodle-oriented project context and coding/generation guidance. - Updated
docs/README.instructions.mdto include the new Moodle instructions entry.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| instructions/moodle.instructions.md | Introduces Moodle-specific Copilot guidance (frontmatter + standards/rules/examples). |
| docs/README.instructions.md | Adds the Moodle instructions link to the instructions index table. |
instructions/moodle.instructions.md
Outdated
| - PHP must be compatible with the core version (e.g., PHP 7.4 / 8.0 / 8.1). | ||
| - Do not use modern syntax that is not supported by core if it breaks compatibility. | ||
| - Class naming must use Moodle namespaces. | ||
| - Use the MVC structure in plugins (classes/output, classes/form, db/, lang/, templates/…). |
There was a problem hiding this comment.
Referring to Moodle plugins as using an "MVC structure" is misleading—Moodle doesn’t follow a formal MVC architecture. Consider describing the expected plugin directory/layout and common class locations (e.g., classes/output, classes/form, db, lang, templates) without labeling it MVC.
| - Use the MVC structure in plugins (classes/output, classes/form, db/, lang/, templates/…). | |
| - Follow Moodle’s standard plugin directory layout (for example: classes/output, classes/form, db/, lang/, templates/…). |
instructions/moodle.instructions.md
Outdated
| # Examples of What Copilot Should Be Able to Answer | ||
|
|
||
| - "Generate a basic local plugin with version.php, settings.php, and lib.php." | ||
| - "Create a new table in install.xml and an upgrade script in upgrade.php." |
There was a problem hiding this comment.
In Moodle plugins, install.xml and upgrade.php live under the db/ directory (i.e., db/install.xml and db/upgrade.php). Updating the example to include the correct paths will prevent Copilot from generating incorrectly located files.
| - "Create a new table in install.xml and an upgrade script in upgrade.php." | |
| - "Create a new table in db/install.xml and an upgrade script in db/upgrade.php." |
instructions/moodle.instructions.md
Outdated
| @@ -0,0 +1,57 @@ | |||
| --- | |||
| applyTo: '*.php, *.js, *.mustache, *.xml, *.css, *.scss' | |||
There was a problem hiding this comment.
The applyTo glob only matches files in the repository root (e.g., *.php) and will miss typical Moodle code under subdirectories. Please switch to recursive patterns (e.g., **/*.php, **/*.js, ...) to match the convention described in instructions/instructions.instructions.md (multiple patterns examples).
| applyTo: '*.php, *.js, *.mustache, *.xml, *.css, *.scss' | |
| applyTo: '**/*.php, **/*.js, **/*.mustache, **/*.xml, **/*.css, **/*.scss' |
instructions/moodle.instructions.md
Outdated
|
|
||
| # Project Context | ||
|
|
||
| This repository contains a Moodle project. It is based on Moodle version XXXX (specify version). |
There was a problem hiding this comment.
This file includes an unresolved placeholder (Moodle version XXXX (specify version)), which makes the instructions feel incomplete and may confuse users. Consider rephrasing to either remove the placeholder or explicitly instruct the user to replace it with their Moodle version (and optionally link to where to find it).
| This repository contains a Moodle project. It is based on Moodle version XXXX (specify version). | |
| This repository contains a Moodle project. Ensure that any generated code is compatible with the specific Moodle version used in this project (for example, Moodle 3.11, 4.1 LTS, or later). |
instructions/moodle.instructions.md
Outdated
|
|
||
| # Code Generation Rules | ||
|
|
||
| - When creating new classes, use the namespace `vendor\pluginname`. |
There was a problem hiding this comment.
Moodle plugin classes typically use the component (Frankenstyle) namespace (e.g., local_pluginname, mod_forum) rather than a generic vendor\\pluginname. Updating this guidance will help Copilot generate code that matches Moodle’s autoloading and naming conventions.
| - When creating new classes, use the namespace `vendor\pluginname`. | |
| - When creating new PHP classes in plugins, use the Moodle component (Frankenstyle) namespace that matches the plugin's component name, e.g. `local_myplugin`, `mod_forum`, `block_mycatalog`, `tool_mytool`. |
bhect0
left a comment
There was a problem hiding this comment.
I agree with all the tips. I submitted a commit that addresses all of the points :)
instructions/moodle.instructions.md
Outdated
| # Examples of What Copilot Should Be Able to Answer | ||
|
|
||
| - "Generate a basic local plugin with version.php, settings.php, and lib.php." | ||
| - "Create a new table in install.xml and an upgrade script in upgrade.php." |
| @@ -143,6 +143,7 @@ Team and project-specific instructions to enhance GitHub Copilot's behavior for | |||
| | [Power Platform MCP Custom Connector Development](../instructions/power-platform-mcp-development.instructions.md)<br />[](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fpower-platform-mcp-development.instructions.md)<br />[](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fpower-platform-mcp-development.instructions.md) | Instructions for developing Power Platform custom connectors with Model Context Protocol (MCP) integration for Microsoft Copilot Studio | | |||
There was a problem hiding this comment.
I agree with all the tips. I submitted a commit that addresses all of the points :)
Pull Request Checklist
npm startand verified thatREADME.mdis up to date.Description
This pull request adds Moodle development instructions for GitHub Copilot. The instructions are completely understandable for everyone, no matter if it's familiar with Moodle ecosystem or not.
Type of Contribution
Additional Notes
By submitting this pull request, I confirm that my contribution abides by the Code of Conduct and will be licensed under the MIT License.