cmd-moodle-codestyle

cmd-moodle-codestyle is a cursor rule for Cursor from SaadRahman01/claude-moodle-dev. It costs 25 tokens per session (492 once invoked), scanned A, original, MIT.

A command that checks PHP code against Moodle’s official coding style and helps fix the reported problems.

In plain words
What is it for?
Checking plugin files with PHP_CodeSniffer, correcting formatting, and reviewing documentation, naming, license, and Moodle-specific code issues.
Why use it?
It removes repetitive style checking and separates issues that can be fixed automatically from those needing manual changes.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/saadrahman01/claude-moodle-dev/cmd-moodle-codestyle
Clone the repo
git clone --depth 1 https://github.com/SaadRahman01/claude-moodle-dev

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for cmd-moodle-codestyle

README.md
[![agentmods](https://agentmods.dev/badge/rules/saadrahman01/claude-moodle-dev/cmd-moodle-codestyle.svg)](https://agentmods.dev/rules/saadrahman01/claude-moodle-dev/cmd-moodle-codestyle)
Your own site
<a href="https://agentmods.dev/rules/saadrahman01/claude-moodle-dev/cmd-moodle-codestyle"><img src="https://agentmods.dev/badge/rules/saadrahman01/claude-moodle-dev/cmd-moodle-codestyle.svg" alt="Measured on agentmods" height="20"></a>
Per session 25 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 492 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00025 $0.00492
Opus 5 $0.00013 $0.00246
Sonnet 5 $0.00005 $0.00098
Haiku 4.5 $0.00003 $0.00049

Measured 4d ago against content hash 197b786d25b1, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

cmd-moodle-codestyle scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

adapters/cursor/.cursor/rules/cmd-moodle-codestyle.mdc · 51 lines

What it actually says

You will lint and fix Moodle coding-style issues.

User's input: {user_input}

If empty, ask for a path.

Steps:

  1. Detect the linter:

    • Prefer vendor/bin/phpcs (project-local Composer)
    • Fall back to phpcs on PATH
    • If local_codechecker is installed, prefer its bundled standard
  2. Run:

    phpcs --standard=moodle --report=summary <path>
    phpcs --standard=moodle --report=full <path>
    
  3. If phpcs is not installed, instruct the user:

    composer require --dev moodlehq/moodle-cs
    # or as a Moodle plugin:
    # https://github.com/moodlehq/moodle-local_codechecker
    
  4. Categorize findings:

    • Auto-fixable — run phpcbf --standard=moodle <path> (whitespace, missing newlines, brace style)
    • Manual — missing PHPDoc, naming, missing MOODLE_INTERNAL, missing license header, etc.
  5. After auto-fix, re-run and address remaining issues:

    • License header missing — prepend GPL-3.0-or-later header (template from moodle-plugin-development skill)
    • Missing MOODLE_INTERNAL — add after license (skip if file is in classes/ PSR-4)
    • Missing PHPDoc on class/method — generate doc with @param, @return, @throws
    • Naming — convert camelCase function names to snake_case (carefully — check call sites)
    • Line length > 132 — wrap at logical breakpoints
    • Indent — convert tabs to 4 spaces
  6. After all fixes, re-run phpcs and confirm zero issues.

  7. Recommend hooking phpcs into CI:

    - run: vendor/bin/phpcs --standard=moodle --report=full --extensions=php local/example
    

Reference the moodle-plugin-development skill for coding standard details.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 51 lines · 492 tokens per session scan A 197b786d25b1

Subscribe to this mod's changes

cmd-moodle-codestyle is a cursor rule published in the GitHub repository SaadRahman01/claude-moodle-dev (35 stars, last pushed 2mo ago), licensed MIT. It adds 25 tokens to every session and 492 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.