agentleFS
nagisanzeninnagisanzenin/modal-skill/skills/modal/SKILL.md

modal

Skill0 starsChanged 44 days agoMITView on GitHub

Field-tested playbook for agents that run GPU/CPU workloads on Modal (modal.com) on a small budget. Use when writing or launching a Modal app or job (training, eval, batch inference), estimating or capping Modal spend, reserving and reconciling Modal bills, adding watchdogs or deadlines to cloud runs, debugging a failed or hung Modal run, choosing a GPU class, shipping code/data payloads to Modal, or driving Modal from a cloud agent session.

17 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use torch-geometric, get-available-resources and 9 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • Hongyu-yuSkill

    torch-geometric

    Graph Neural Networks (PyG). Node/graph classification, link prediction, GCN, GAT, GraphSAGE, heterogeneous graphs, molecular property prediction, for geometric deep learning.

    Also in 3 projects that use this

  • SoljournerSkill

    get-available-resources

    Enumerate installed packages, databases, and tools for engineering workflows

    Also in 3 projects that use this

  • garri333Skill

    scientific-schematics

    Create publication-quality scientific diagrams using Nano Banana Pro AI with smart iterative refinement. Uses Gemini 3 Pro for quality review. Only regenerates if quality is below threshold for your document type. Specialized in neural network architectures, system diagrams, flowcharts, biological pathways, and complex scientific visualizations.

    Also in 3 projects that use this

  • Hugging FaceSkill

    transformers

    Agent-invokable Transformers commands. Pass `--format json` at the top level (e.g. `transformers --format json classify ...`) to receive the structured output documented in each capability's `outputs` schema.

    Also in 3 projects that use this

  • ZanderRussSkill

    seaborn

    Statistical visualization. Scatter, box, violin, heatmaps, pair plots, regression, correlation matrices, KDE, faceted plots, for exploratory analysis and publication figures.

    Also in 3 projects that use this

  • silvainfmSkill

    polars

    Lightning-fast DataFrame library written in Rust for high-performance data manipulation and analysis. Use when user wants blazing fast data transformations, working with large datasets, lazy evaluation pipelines, or needs better performance than pandas. Ideal for ETL, data wrangling, aggregations, joins, and reading/writing CSV, Parquet, JSON files.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

4 rules. 0 are common, 2 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 16 edited versions we read keep these.

  • 2

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

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

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

    Spend needs a human yes and a dollar cap: Before the first paid job of a session, get an explicit authorization with a $ cap from the …

    line 25
  2. Very specific:

    Reserve before you spend, hold until the bill: Every paid job gets a worst-case reservation first (ledger.py reserve).

    line 27
  3. Distinctive:

    Receipts come local, checkpoints stay on the Volume: Never download weights to "complete" a job.

    line 36
  4. Distinctive:

    Read the reference fully before acting.

    line 56

“Common” is measured: kept by at least 6 in 10 of the 16 edited versions of this file we could read. “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

Modal — run it detached, bounded in the cloud, and paid for on purpose

You are operating paid cloud GPUs on someone else's money. The local client (you, your shell, your laptop) can die at any moment; every guarantee must therefore live on Modal's side or in a ledger on disk, never in your memory.

0 · Resolve the skill directory

Everything this skill references sits next to this file: references/*.md and scripts/ (ledger.py, modal_task.py, selftest.py). If you need an absolute path:

MS="${ZCODE_PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT:-${CODEX_PLUGIN_ROOT:-${MODAL_SKILL_ROOT:-}}}}"
[ -n "$MS" ] && MS="$MS/skills/modal"   # else: the directory containing this SKILL.md

Install check (CPU only, no account, no spend): python3 "$MS/scripts/selftest.py" prints ok.

1 · Golden rules (never break these)

  1. Spend needs a human yes and a dollar cap. Before the first paid job of a session, get an explicit authorization with a $ cap from the account owner and record it in the ledger (ledger.py init --authorization "...").
  2. Reserve before you spend, hold until the bill. Every paid job gets a worst-case reservation first (ledger.py reserve). Release it only against the job's completed-hour per-app bill (ledger.py reconcile), never on elapsed time.
  3. The local client is only a launcher. Anything over a few minutes: modal run --detach under nohup, with server-side bounds: function timeout, an in-container deadline, retries=0, no warm pool. A local .get(timeout=) stops nothing in the cloud.
  4. Canary first. One job alone; check setup, numerics, speed and its first bill (≤ 1.25× estimate) before fan-out.
  5. Never auto-resubmit, never reuse a job id. A retry is a new id with a new reservation, resuming from state saved on the Volume.
  6. Receipts come local, checkpoints stay on the Volume. Never download weights to "complete" a job.
  7. Sweep before you sleep. modal app list shows nothing of yours running when you stop; stop apps by exact id, never other people's apps, never a blanket pkill modal.
  8. Exactly one driver per campaign. Two agents or schedulers dispatching the same work will double-spend.
  9. Check the clock before stating a time (date). Bills are hourly; you will need the real time.
  10. Never put credentials in payloads, logs, commits or chat. Tokens live in env vars or ~/.modal.toml.

2 · Route by task

TaskRead
First time on Modal, auth, CI tokensreferences/run-pattern.md §Onboarding
Write or launch a jobreferences/run-pattern.md → copy scripts/modal_task.py into the project's scripts/ and edit its CONFIG
Estimate cost, set a cap, reserve, reconcile, closereferences/budget-guard.md (drive scripts/ledger.py)
Make a run survive a dead laptop/agent (deadlines, watchdog, guardian)references/guardrails.md
Pick a GPU, fix OOM, benchmark latency honestlyreferences/gpu-sizing.md
Ship code/data to the container, import errors, data driftreferences/payloads-data.md
Drive Modal from a cloud agent session, hand off between drivers, macOS quirksreferences/drivers.md
Something failed or looks hungreferences/lessons.md (symptom → fix table), then the section it points to

Read the reference fully before acting; do not work from this summary.

3 · The standard job loop

First copy scripts/ledger.py and scripts/modal_task.py from this skill into the project's scripts/ (the template finds the project root one level above itself), then:

python3 scripts/ledger.py init --ledger runs/ledger_s1.json --cap 10 --workspace-left 25 \
        --authorization "owner OK 2026-09-30, cap \$10"                       # once per authorized session
python3 scripts/ledger.py reserve    --ledger runs/ledger_s1.json --job train_01 --usd 1.90
nohup modal run --detach scripts/modal_task.py --job train_01 > runs/logs/train_01.log 2>&1 &
python3 scripts/ledger.py dispatched --ledger runs/ledger_s1.json --job train_01 --app-id ap-...   # id from the log
modal volume ls <volume> train_01                                             # done when status.json exists
modal app stop -y ap-...                                                      # confirm stopped, tasks 0
# fetch receipts only (no .pt / adapters / checkpoints), then:
python3 scripts/ledger.py complete   --ledger runs/ledger_s1.json --job train_01    # or --failed "why"
python3 scripts/ledger.py reconcile  --ledger runs/ledger_s1.json --job train_01    # after the hourly bill lands

ledger.py refuses (at $0) on: cap exceeded, workspace headroom exceeded, job-id reuse, an unreconciled failed job, too many jobs in flight, or a month rollover. A refusal is the guard working; do not route around it (never raise a cap, relabel a ledger or reuse a job id to fit). Ask the owner instead.

4 · Reporting

Report four money numbers separately: estimate, reservation, metered (workspace meter delta) and final bill (reconciled). Say which jobs still hold reservations and when their bills land. Before ending a session: 0 live apps of yours, every job reconciled or listed with its bill time, watchdog stopped, ledger closed.

5 · When you learn something new

A new failure mode → add a row to references/lessons.md (symptom → fix, with the date and what it cost). If you are in a plugin-cache copy, tell the user what to upstream to github.com/nagisanzenin/modal-skill instead of editing the cache.

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.