agentleFS
vladcheckvladcheck/agentic/skills/mirea-moodle-download/SKILL.md

mirea-moodle-download

Skill1 starsChanged 12 days agoMITView on GitHub

Use for Moodle pluginfile.php downloads using MoodleSession, including resume/PDF checks. Not for public files, credentials, or administration.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Ask the user for a fresh MoodleSession cookie value from browser DevTools: Application → Cookies.

    line 12
  2. Very specific:

    If the server cuts the connection early, resume the same output file.

    line 20
  3. Very specific:

    Stop when a pass reports HTTP:200 and bytes:0.

    line 29
  4. Distinctive:

    Verify the downloaded file:

    line 30

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Authenticated Moodle File Download

Download authentication-protected pluginfile.php resources from <moodle-host> without mistaking login HTML or truncated data for the requested file.

Procedure

  1. Ask the user for a fresh MoodleSession cookie value from browser DevTools: Application → Cookies. Treat the value as a secret and do not persist it in files or logs. If requests redirect with HTTP 303 to /login/index.php, ask for a fresh value.
  2. Download with HTTP/1.1:

    curl -sS --http1.1 -b "MoodleSession=<moodle-session>" -o "<out.pdf>" "<pluginfile-url>"

    URL-encode non-ASCII path segments, including Cyrillic text. Keep ?forcedownload=1 in the URL.

  3. If the server cuts the connection early, resume the same output file. Symptoms include curl: (18), HTTP/2 INTERNAL_ERROR, pdfinfo reporting Invalid XRef entry, or Couldn't read xref table.

    for i in $(seq 1 8); do
      curl -sS --http1.1 -C - -b "MoodleSession=<moodle-session>" -o "<out.pdf>" "<pluginfile-url>" -w 'HTTP:%{http_code} bytes:%{size_download}\n'
      sleep 1
    done

    Stop when a pass reports HTTP:200 and bytes:0. If eight passes do not complete the file, report the incomplete transfer instead of treating it as valid.

  4. Verify the downloaded file:

    pdfinfo "<out.pdf>"
    pdftotext -l 1 -q "<out.pdf>" - | head -c 600
    file "<out.pdf>"

    Require pdfinfo to exit 0 with a plausible page count, the text sample to be readable, and file to identify a PDF document rather than HTML. HTML output, often approximately 39 KB and identified as HTML document text, indicates an expired session; obtain a fresh cookie and repeat the download.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.