moodle-mirror

Mirror Moodle course/module pages to local folders (e.g., Obsidian vaults), preserving structure, extracting page text/Markdown, and downloading attachments. Use for authenticated Moodle crawling, Cloudflare/SSO handling, and repeatable offline search across course content.

16 stars

Best use case

moodle-mirror is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Mirror Moodle course/module pages to local folders (e.g., Obsidian vaults), preserving structure, extracting page text/Markdown, and downloading attachments. Use for authenticated Moodle crawling, Cloudflare/SSO handling, and repeatable offline search across course content.

Teams using moodle-mirror should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/moodle-mirror/SKILL.md --create-dirs "https://raw.githubusercontent.com/diegosouzapw/awesome-omni-skill/main/skills/devops/moodle-mirror/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/moodle-mirror/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How moodle-mirror Compares

Feature / Agentmoodle-mirrorStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Mirror Moodle course/module pages to local folders (e.g., Obsidian vaults), preserving structure, extracting page text/Markdown, and downloading attachments. Use for authenticated Moodle crawling, Cloudflare/SSO handling, and repeatable offline search across course content.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Moodle Mirror

## Overview

Mirror Moodle course pages + attachments to a local directory (HTML/MD/TXT), with retry logic and manual/assisted SSO handling. This is built for Moodle sites that require login and occasionally redirect to external URLs.

## Workflow Decision Tree

1) Default: prefer CDP to reuse a real Chrome session (best for anti-bot)
2) If CDP is unstable for downloads, use `--persistent --channel chrome`
3) If SSO appears, use `--auto-login` to auto-click saved account tiles (MFA may still require manual action)
4) For `mod/url/view.php`, mirror the Moodle wrapper page (`forceview=1`) to avoid external 502s

## Quick Start

1) Start or reuse a logged-in Chrome (CDP mode recommended).
2) Run the crawler with a bounded scope and output folder.
3) Check `_status.md`; remediate any remaining errors with targeted runs.
4) Keep auth state in user profile (default), not inside the Obsidian vault.
5) Default behavior overwrites page files when a URL is (re-)saved. This is intentional to avoid duplicates when re-running to fix errors or fill gaps. If you want versioned snapshots, use a new output folder per run (e.g., append a date).

## Speed + Incremental Updates

- The crawler now extracts links from the *main content* area when possible (avoids pulling in global header/footer links like notifications and unrelated courses).
- Use `--resume` to skip already-saved URLs.
- Use `--update-on-change` so that when a previously-saved page is revisited (typically the course homepage / start URLs), it is only re-saved if the local content changed.
- For faster runs on Moodle, set `--networkidle-wait-ms 0` (default) and keep `--polite-delay-ms` low (even `0` is often fine).

## Prerequisites (Tooling)

- Python with Playwright installed
- Chrome (for CDP or persistent profile)
- Optional: a dedicated Chrome profile for Moodle to avoid impacting daily browsing

If Playwright or browsers are missing, install once:

```powershell
pip install playwright
python -m playwright install
```

Start Chrome with CDP (if not already running):

```powershell
chrome.exe --remote-debugging-port=9222 --user-data-dir=%USERPROFILE%\.codex\state\moodle_profile_cdp
```

## Commands (Primary)

CDP mode (reuses an existing Chrome). Run from the skill folder or replace the script path with an absolute path:

```powershell
python .\scripts\moodle_mirror.py `
  --cdp-url http://127.0.0.1:9222 `
  --start-url "https://moodle.ucl.ac.uk/course/view.php?id=55684" `
  --out-dir "E:\path\to\Obsidian\Course Folder\Moodle Mirror" `
  --format md --rewrite-links `
  --allow-prefix https://moodle.ucl.ac.uk/course/ `
  --allow-prefix https://moodle.ucl.ac.uk/mod/ `
  --allow-prefix https://moodle.ucl.ac.uk/pluginfile.php/ `
  --resume --update-on-change `
  --max-pages 120 --max-downloads 200 `
  --polite-delay-ms 0 --networkidle-wait-ms 0 `
  --block-wait-seconds 180
```

Persistent profile mode (good for downloads if CDP fails):

```powershell
python .\scripts\moodle_mirror.py `
  --persistent --headful --channel chrome `
  --start-url "https://moodle.ucl.ac.uk/course/view.php?id=55684" `
  --out-dir "E:\path\to\Obsidian\Course Folder\Moodle Mirror" `
  --format md --rewrite-links `
  --allow-prefix https://moodle.ucl.ac.uk/course/ `
  --allow-prefix https://moodle.ucl.ac.uk/mod/ `
  --allow-prefix https://moodle.ucl.ac.uk/pluginfile.php/ `
  --resume --update-on-change `
  --max-pages 120 --max-downloads 200 `
  --polite-delay-ms 0 --networkidle-wait-ms 0 `
  --block-wait-seconds 180
```

Status report:

```powershell
python .\scripts\mirror_status.py `
  --index "E:\path\to\...\Moodle Mirror\_index.jsonl" `
  --out   "E:\path\to\...\Moodle Mirror\_status.md"
```

## SSO / Cloudflare Handling

- Use `--auto-login` to auto-click the saved Microsoft account tile.
- Provide a hint with `--auto-login-account "your.name@ucl.ac.uk"` to click the correct account.
- MFA/phone prompts still require manual confirmation; the script will wait for completion.

## Targeted Remediation (Common Issues)

1) External URL returns 502:
   - For `mod/url/view.php`, use `forceview=1` to mirror the internal Moodle page instead of the external site.
2) Resource downloads fail:
   - Use `--persistent --headful --channel chrome` to leverage browser downloads.
3) Cloudflare Verify appears:
   - Wait and complete the challenge; keep `--block-wait-seconds` high enough.

## Ask Before Running (Socratic Prompts)

- Which Moodle domain/course URLs are in scope?
- What folder should the mirror live in (Obsidian path)?
- Do you want full attachments download or a capped number?
- Are you okay with manual MFA if it appears?

## References

- See `references/lessons.md` for troubleshooting and tool choice rationale.

Related Skills

mirror-optimizer

16
from diegosouzapw/awesome-omni-skill

当用户明确要求"优化镜像源"、"配置国内镜像"、"加速部署"、"切换镜像源"或项目涉及 Docker/Python/Node.js/Go/Java/Ruby/Rust 等需要包管理器的场景时使用。自动检测项目使用的包管理器,生成适配的国内镜像源配置,确保在国内网络环境下快速部署。⚠️ 不适用:用户只是想了解镜像源概念(应直接说明)、项目已完成部署且无需优化(应直接告知无需操作)、用户明确要求使用官方源(应尊重用户选择)。

fullstack-mirror-arch

16
from diegosouzapw/awesome-omni-skill

풀스택 미러 아키텍처 규칙. BE↔FE 1:1 타입 동기화, 레이어 의존 규칙, barrel re-export, API 클라이언트 패턴, 상태관리 분리 규칙을 적용. 풀스택 프로젝트 설계 시 사용.

moodle-external-api-development

16
from diegosouzapw/awesome-omni-skill

Create custom external web service APIs for Moodle LMS. Use when implementing web services for course management, user tracking, quiz operations, or custom plugin functionality. Covers parameter va...

bgo

10
from diegosouzapw/awesome-omni-skill

Automates the complete Blender build-go workflow, from building and packaging your extension/add-on to removing old versions, installing, enabling, and launching Blender for quick testing and iteration.

Coding & Development

runpod

16
from diegosouzapw/awesome-omni-skill

Cloud GPU processing via RunPod serverless. Use when setting up RunPod endpoints, deploying Docker images, managing GPU resources, troubleshooting endpoint issues, or understanding costs. Covers all 5 toolkit images (qwen-edit, realesrgan, propainter, sadtalker, qwen3-tts).

runbook

16
from diegosouzapw/awesome-omni-skill

Generate operational runbooks for services, procedures, or incident response with step-by-step procedures, troubleshooting guides, and escalation paths

Run CI/CD Pipeline Locally

16
from diegosouzapw/awesome-omni-skill

Run the Wavecraft CI checks locally. Prefer the native `cargo xtask` commands for speed; use Docker + `act` only when validating GitHub Actions workflows or Linux-specific behavior.

router-operations

16
from diegosouzapw/awesome-omni-skill

Master orchestration for routing QA, testing, DevOps, observability, and git workflow questions through 15 operational skills

returns-reverse-logistics

16
from diegosouzapw/awesome-omni-skill

Codified expertise for returns authorisation, receipt and inspection, disposition decisions, refund processing, fraud detection, and warranty claims management.

resume-craft

16
from diegosouzapw/awesome-omni-skill

Craft tailored, honest, one-page resumes from job descriptions. Use when the user wants to create, tailor, or improve a resume for a specific job posting. Handles job description analysis, skill gap identification, resume writing, keyword optimization, and PDF generation. Triggers on resume, CV, job application, tailor my resume, craft resume, apply for this job.

resource-scout

16
from diegosouzapw/awesome-omni-skill

Search and discover Claude Code skills and MCP servers from marketplaces, GitHub repositories, and registries. Use when (1) user asks to find skills for a specific task, (2) looking for MCP servers to connect external tools, (3) user mentions "find skill", "search MCP", "discover tools", or "what skills exist for X", (4) before creating a custom skill to check if one already exists.

rails-deployment

16
from diegosouzapw/awesome-omni-skill

Deploy Rails applications to production using Kamal, Docker, and modern deployment strategies. Covers zero-downtime deployments, environment management, database migrations, SSL/TLS, and production configurations.