Integrate with Moodle AI Subsystem (4.5+). Create custom Actions, Providers, and Placements for AI-powered features.
/plugin marketplace add astoeffer/plugin-marketplace/plugin install moodle-dev-pro@astoeffer-dev-pluginsThis skill inherits all available tools. When active, it can use any tool Claude has access to.
Integrate with Moodle's AI Subsystem (4.5+).
Placement (UI) ──▶ Manager ──▶ Provider (AI)
│ │ │
▼ ▼ ▼
User sees Coordinates Calls OpenAI,
AI features & logs Claude, etc.
Key: Placements and Providers are decoupled!
// classes/aiactions/my_action.php
namespace mod_myplugin\aiactions;
class my_action extends \core_ai\aiactions\base {
public function __construct(
int $contextid,
protected string $prompttext
) {
parent::__construct($contextid);
}
public function store(): int {
global $DB;
return $DB->insert_record('ai_action_my_action', [
'contextid' => $this->contextid,
'prompttext' => $this->prompttext,
'timecreated' => time(),
]);
}
}
// classes/aiactions/responses/my_action_response.php
namespace mod_myplugin\aiactions\responses;
class my_action_response extends \core_ai\aiactions\responses\response_base {
public ?string $result = null;
public function set_response_data(array $response): void {
$this->result = $response['result'] ?? null;
}
public function get_response_data(): array {
return ['result' => $this->result];
}
}
$action = new \mod_myplugin\aiactions\my_action(
contextid: $context->id,
prompttext: $userprompt
);
$response = (new \core_ai\manager())->process_action($action);
if ($response->get_success()) {
$data = $response->get_response_data();
}
// Check policy
if (!\core_ai\manager::get_user_policy_status($USER->id)) {
// Show policy acceptance UI
}
// Record acceptance
\core_ai\manager::user_policy_accepted($USER->id, $context->id);
<!-- db/install.xml -->
<TABLE NAME="ai_action_my_action">
<FIELD NAME="id" TYPE="int" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="contextid" TYPE="int" NOTNULL="true"/>
<FIELD NAME="prompttext" TYPE="text" NOTNULL="true"/>
<FIELD NAME="timecreated" TYPE="int" NOTNULL="true"/>
</TABLE>
core_ai_get_policy_status - Check acceptancecore_ai_set_policy_status - Record acceptancestore() methodset_response_data()This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.