These are natural-language guidelines for agents to follow when developing the Exelearning WordPress plugin.
- Follow WordPress Coding Standards:
- PHP code: indent blocks with tabs (WordPress default) and reserve spaces for alignment/continuations. Keep PSR‑12 compatibility when it does not contradict WP requirements. Always escape/sanitize properly and rely on WP APIs.
- Use English for source code (identifiers, comments, docblocks).
- Write all implementation notes, inline comments, and documentation in English.
- Use Spanish for user‑facing translations/strings and test assertions to check no untranslated strings remain.
- Keep class file names aligned with their class names (e.g.,
class-exelearning-admin-helper.phpforExelearning_Admin_Helper). - Add
/* translators: */comments immediately before translations containing placeholders such as%sor%d. - Always unslash superglobals (e.g.,
$_POST) before sanitizing and storing their values. - When emitting standalone pages, enqueue styles/scripts with WordPress APIs (
wp_enqueue_style,wp_enqueue_script) and print them viawp_print_*helpers instead of hard-coding<link>or<script>tags. - Ensure all code passes
phpcs --standard=WordPressand is auto-fixable withphpcbf --standard=WordPresswhere applicable. - Install coding standard tooling with Composer in the project root:
composer require --dev dealerdirect/phpcodesniffer-composer-installer:^1.0 wp-coding-standards/wpcs:^3.0. - After installation, run
vendor/bin/phpcbf --standard=WordPress .to auto-fix violations before linting withvendor/bin/phpcs --standard=WordPress .; this step will also normalize any space-indented blocks back to tabs.
- Use TDD (Test‑Driven Development) with factories to create test fixtures.
- Tests live under
/tests/and use factory classes. - Run
phpcs --standard=WordPressandphpcbf --standard=WordPress(or equivalent tooling) before submitting changes; the codebase must stay clean. - Use
make lint(PHP lint) andmake fix(beautifier) to enforce standards. - Use
make testto run all unit tests. - Ensure all PHPUnit test suites pass locally before requesting review.
- Use
make check-untranslatedto detect any untranslated Spanish strings.
- Run
composer installin the project root to install PHP_CodeSniffer, WordPress Coding Standards, and other developer tools (requires outbound network access). - Use
./vendor/bin/phpcbf --standard=.phpcs.xml.distfirst to apply automatic fixes (including converting stray spaces back to tabs), then./vendor/bin/phpcs --standard=.phpcs.xml.distto ensure the codebase is clean. - Composer scripts mirror these commands:
composer phpcbfandcomposer phpcsrespect the repository ignore list defined in.phpcs.xml.dist. - The
.phpcs.xml.distruleset bundles the WordPress standard, limits scanning to PHP files, enables colorized output, suppresses warnings, and excludes vendor, assets, node_modules, tests/js, wp, tests, and.composerdirectories. - When working outside the
wp-envDocker environment, call the binaries from./vendor/bin/directly. Inside wp-env, reuse the Make targets (make fixandmake lint) which wrapphpcbf/phpcswith the same.phpcs.xml.distruleset path (wp-content/plugins/exelearning/.phpcs.xml.dist). - The repository
composer.jsonalready whitelists thedealerdirect/phpcodesniffer-composer-installerplugin and exposes the scriptscomposer phpcbfandcomposer phpcs; these call the local binaries under./vendor/bin/with the shared.phpcs.xml.distruleset, so prefer them to keep tooling consistent. - Run the beautifier before linting when fixing coding standards violations:
composer phpcbf(or the equivalent binary invocation) followed bycomposer phpcs.phpcbfwill repair mixed indentation before PHPCS evaluates the files. - After writing or updating code, always run
composer phpcbffollowed bycomposer phpcs(or their./vendor/bin/equivalents) to keep the codebase compliant with the configured standards.
- Respect the root
.editorconfig; it forces PHP files to use tabs for indentation (indent_style = tab,tab_width = 4). Most editors (and AI-assisted tooling) read this automatically, so leave it untouched. - Sublime Text: ensure your project/user settings include
{ "translate_tabs_to_spaces": false, "tab_size": 4 }within the"php"scope to keep tabs. Enable"ensure_newline_at_eof_on_save": trueto match repository style. - Visual Studio Code: add the following to your workspace
settings.json:{ "[php]": { "editor.insertSpaces": false, "editor.tabSize": 4 } } - When using other editors, disable "convert tabs to spaces" for PHP files and set the tab width to 4 characters.
- Install/update tooling with
composer install(run once per environment). - For automated fixes, execute
composer phpcbformake fixwhen inside wp-env. - Validate coding standards with
composer phpcsormake lintinside wp-env. - Address any reported violations manually, then repeat steps 2 and 3 until clean.
- Commit only after the lint command returns without errors.
- Develop plugin within
@wordpress/envenvironment. - Use Alpine‑based Docker containers if setting up with Docker.
- For Linux commands: assume Ubuntu Server.
- On macOS desktop (when relevant): use Homebrew to install tools.
- Use
vimas terminal editor, notnano.
- In admin or public UI, use Bootstrap 5 and jQuery consistently.
- Keep frontend assets minimal: enqueue properly via WP APIs, use minified versions.
- All PHP functions and methods must have English docblock comments immediately before declaration.
- Prefer simplicity and clarity: avoid overly complex abstractions.
- Load translation strings properly (
__(),_e()), text domain declared in main plugin file. - Keep plugin bootstrap file small (
exelearning.php), modularize into separate files/classes with specific responsibility.
- Always load
AGENTS.mdas conventions file: e.g./read AGENTS.mdor via config. - Do not expect Aider to modify
AGENTS.mdorREADME.mdcontents. - Use
/askmode to plan large changes, then use/codeor/architectto apply. - Review every diff Aider produces, especially in architect mode before accepting.
- After planning, say “go ahead” to proceed.
- Avoid adding unnecessary files to the chat—add only those being modified.