moodle-cli について
moodle-cliは、`moodle`コマンドラインからMoodle学習管理システムのAPIを操作する方法を案内するスキルです。認証、コース、課題、フォーラムを扱い、コマンドリファレンスと`jq`によるJSON出力の絞り込み例も含みます。
主な機能
- 01Moodle APIコマンドの案内
- 02認証とコース操作
- 03課題のアップロードと提出
- 04フォーラムの閲覧と投稿
- 05JSON出力と`jq`での絞り込み
- 06コマンドリファレンスの参照
活用シーン
- 01ログインして履修コースを確認
- 02課題のアップロードと提出
- 03コースや課題のファイルを取得
- 04コースフォーラムの閲覧や投稿
インストール
コマンドをコピーしてターミナルで実行します。
npx skills add https:/ / github.com/ nathanfredericks/ moodle-cli --skill moodle-cliインストール後、Claude Code で/moodle-cliを入力して読み込まれたか確認します。
同梱ファイル
SKILL.md と一緒にインストールされる参考資料やスクリプト。
references/moodle_assignment_download.mdmoodle_assignment_due.mdmoodle_assignment_get.mdmoodle_assignment_list.mdmoodle_assignment_status.mdmoodle_assignment_submit.mdmoodle_assignment_text.mdmoodle_assignment_upload.mdmoodle_assignment.mdmoodle_auth_login.mdmoodle_auth_logout.mdmoodle_auth_status.mdmoodle_auth_token.mdmoodle_auth.mdmoodle_config_get.mdmoodle_config_list.mdmoodle_config_set.mdmoodle_config.mdmoodle_course_content.mdmoodle_course_download.mdmoodle_course_get.mdmoodle_course_grades.mdmoodle_course_list.mdmoodle_course_module.mdmoodle_course_search.mdmoodle_course.mdmoodle_forum_delete.mdmoodle_forum_discussions.mdmoodle_forum_edit.mdmoodle_forum_list.md詳細
Moodle CLI スキル
ユーザーが Moodle Learning Management System API と連携する CLI ツールである moodle を実行できるよう支援します。
コマンドツリー
moodle
├── auth # Manage authentication
│ ├── login # Log in to a Moodle instance
│ ├── logout # Log out of the Moodle instance
│ ├── status # Show authentication status
│ └── token # Print the authentication token
├── course # Manage courses
│ ├── list # List enrolled courses
│ ├── get <id> # Get course details
│ ├── search <query> # Search courses
│ ├── content <id> # Get course contents (sections, modules)
│ ├── module <id> # Get course module details
│ ├── grades <id> # View your course grades
│ └── download <id> # Download module files
├── assignment # Manage assignments
│ ├── list # List assignments (--course to filter)
│ ├── get <id> # Get assignment details
│ ├── status <id> # Check submission status
│ ├── upload <id> <file> # Upload files to an assignment
│ ├── submit <id> # Submit assignment for grading
│ ├── text <id> # View or update online text submission
│ └── download <id> # Download submission files (-R for resources)
├── forum # Manage forums
│ ├── list # List forums in a course (--course)
│ ├── discussions <id> # List discussions in a forum
│ ├── read <id> # Read a discussion thread
│ ├── post <id> # Create a new discussion
│ ├── reply <id> # Reply to a post
│ ├── edit <id> # Edit a post
│ └── delete <id> # Delete a post
├── user # Manage users
│ ├── whoami # Show current user info
│ ├── list # List users enrolled in a course (--course)
│ └── get <id> # Get user by ID
├── config # Manage configuration
│ ├── list # List all configuration settings
│ ├── get <key> # Get a configuration value
│ └── set <key> <value> # Set a configuration value
└── version # Print the version
グローバルフラグ
すべてのコマンドで次のフラグを使用できます。
| フラグ | 説明 |
|---|---|
-f, --format <fmt> | 出力形式:table、json、csv、yaml、plain |
--no-color | カラー出力を無効にします |
-v, --verbose | 詳細出力を有効にします |
-h, --help | コマンドのヘルプを表示します |
ガイドライン
JSON 出力をデフォルトにする
コマンドを提案する際は、機械可読な出力を得られる -f json を優先してください。フィルタリングには jq にパイプする方法をユーザーに示します。
# List courses as JSON
moodle course list -f json
# Get a specific field
moodle course list -f json | jq '.[].fullname'
# Filter assignments by course
moodle assignment list --course 42 -f json | jq '.[] | {id, name, duedate}'
人が読みやすい形式で手早く出力する場合は、デフォルトの table 形式が便利です。フラグは必要ありません。
よくあるワークフロー
初回セットアップ:
moodle auth login --url https://moodle.example.com
moodle auth status # verify login
moodle course list # see enrolled courses
課題のワークフロー:
moodle assignment list --course 42 # find assignment ID
moodle assignment get 101 # check details and due date
moodle assignment upload 101 report.pdf # upload file
moodle assignment submit 101 --accept-statement # submit for grading
moodle assignment status 101 # verify submission
フォーラムのワークフロー:
moodle forum list --course 42 # find forum ID
moodle forum discussions 5 # list discussions
moodle forum read 100 # read a thread
moodle forum reply 200 --message "Thanks!" # reply to a post
moodle forum post 5 --subject "Question" --message "Hello" # new discussion
課題のリソースをダウンロードする:
moodle assignment get 101 # see attached resources
moodle assignment download 101 --resources # download instructor-attached files
moodle assignment download 101 -R -o ./resources # download to a directory
コースのファイルをダウンロードする:
moodle course content 42 # browse course sections
moodle course download 500 # download a module's files
フィルタリング
--course <id>を使うと、課題、フォーラム、ユーザーをコースで絞り込めます- 特定のリソース(コース、課題、フォーラム、ユーザー、モジュール)を指定する場合は、位置引数
<id>を使います - JSON 出力の高度なフィルタリングには
jqを組み合わせます
設定
フラグを繰り返し指定せずに済むよう、ユーザーはデフォルト値を設定できます。
moodle config set format json # always output JSON
moodle config list # see current settings
リファレンスドキュメント
特定のコマンドの詳細(フラグ、オプション、例)については、references/ ディレクトリにある対応ファイルを参照してください。
- ルートコマンド:
references/moodle.md - Auth グループ:
references/moodle_auth.md、references/moodle_auth_login.mdなど - Course グループ:
references/moodle_course.md、references/moodle_course_list.mdなど - Assignment グループ:
references/moodle_assignment.md、references/moodle_assignment_list.mdなど - Forum グループ:
references/moodle_forum.md、references/moodle_forum_list.mdなど - User グループ:
references/moodle_user.md、references/moodle_user_whoami.mdなど - Config グループ:
references/moodle_config.md、references/moodle_config_set.mdなど - Version:
references/moodle_version.md
ファイル名のパターンは references/moodle_<group>_<command>.md です。ユーザーから特定のコマンドについて質問された場合は、正確なフラグ名と使用方法を案内できるよう、まずリファレンスファイルを確認してください。