Write, validate, and locally test Python jobs for Modal — serverless containers, on-demand GPUs, and autoscaling — then deploy to Modal's cloud. Use for ML model deployment, batch processing, scheduled tasks, or GPU-accelerated APIs.
Ships in alterlab-domain-specific. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Modal is a serverless platform for running Python code in the cloud with minimal configuration. Execute functions on powerful GPUs, scale automatically to thousands of containers, and pay only for compute used.
Modal is particularly suited for AI/ML workloads, high-performance batch processing, scheduled jobs, GPU inference, and serverless APIs. Sign up for free at https://modal.com and receive $30/month in credits.
A Modal function is ordinary Python under a decorator, so the whole job can be written and
run locally with no Modal account or token. Build the function body, validate the image /
GPU / resource / schedule configuration, and run the body on this machine with
function.local(...) — on CPU, on a reduced-size input — to confirm the logic works before
spending a cent. Only modal run / modal deploy need an account (modal token new), and
those are the one step that incurs billing.
import modal
app = modal.App("ml-job")
image = modal.Image.debian_slim(python_version="3.12").uv_pip_install("numpy")
@app.function(image=image, gpu="A100") # config is validated now; GPU is used only in the cloud
def summarize(values: list[float]) -> dict:
import statistics
return {"n": len(values), "mean": statistics.fmean(values)}
if __name__ == "__main__":
# KEYLESS: runs the function body on THIS machine (CPU), no token, no billing.
print(summarize.local([1.0, 2.0, 3.0])) # -> {'n': 3, 'mean': 2.0}
# Verified 2026-10-22: `modal` installs and .local() runs with no account.
# When ready and authenticated (modal token new): `modal run script.py` (cloud) or
# `modal deploy script.py` (persistent). Keep inputs small on the first cloud run — see
# the cost cautions in Best Practices.
Keep a plain-Python core (the summarize body above) that you can unit-test locally, and
let the Modal decorators add the cloud packaging on top. This way the skill delivers a
validated, ready-to-deploy job even when the user has no Modal account yet.
Use Modal for:
| Scenario | Use Instead |
|---|---|
| Provider-agnostic job dispatch to SLURM/HPC, RunPod, or GCP Batch (submit → poll → harvest) | alterlab-remote-compute |
| Local PyTorch training structure, multi-GPU strategies, checkpointing — no serverless deployment | alterlab-pytorch-lightning |
| Bioinformatics workflows on the Latch platform | alterlab-latchbio |
| Genomics apps/applets on DNAnexus | alterlab-dnanexus |
Hand-off rule. When the request matches a row above, open your answer by naming that skill by its exact id (for example alterlab-remote-compute) and saying in one line why it fits better, then stop applying this skill's procedure. Name it even when you also need to ask for missing input. If only part of the request is out of scope, name the skill for that part and do only the in-scope part. A brief general pointer is fine; the named skill does the work.
Installing Modal needs no account; authentication is required only to actually run or deploy
in the cloud (modal run / modal deploy). Local development and function.local(...) work
without it.
# Install Modal (SDK 1.x; current 1.5.x as of 2026-09) — no account needed to install
uv pip install modal
# Authenticate ONLY when you want to deploy/run in the cloud (opens browser for login)
modal token new
This creates a token stored in ~/.modal.toml. The token authenticates cloud Modal
operations; it is not needed to write code or run function bodies locally.
import modal
app = modal.App("test-app")
@app.function()
def hello():
print("Modal is working!")
Run with: modal run script.py
Modal provides serverless Python execution through Functions that run in containers. Define compute requirements, dependencies, and scaling behavior declaratively.
Specify dependencies and environment for functions using Modal Images.
import modal
# Basic image with Python packages
image = (
modal.Image.debian_slim(python_version="3.12")
.uv_pip_install("torch", "transformers", "numpy")
)
app = modal.App("ml-app", image=image)
Common patterns:
.uv_pip_install("pandas", "scikit-learn").apt_install("ffmpeg", "git")modal.Image.from_registry("nvidia/cuda:12.8.1-devel-ubuntu24.04", add_python="3.12") (use a full tag — NVIDIA publishes no bare 12.x.y-base tags).add_local_python_source("my_module")See references/images.md for comprehensive image building documentation.
Define functions that run in the cloud with the @app.function() decorator.
@app.function()
def process_data(file_path: str):
import pandas as pd
df = pd.read_csv(file_path)
return df.describe()
Call functions:
# From local entrypoint
@app.local_entrypoint()
def main():
result = process_data.remote("data.csv")
print(result)
Run with: modal run script.py
See references/functions.md for function patterns, deployment, and parameter handling.
Attach GPUs to functions for accelerated computation.
@app.function(gpu="H100")
def train_model():
import torch
assert torch.cuda.is_available()
# GPU-accelerated code here
Available GPU types:
T4, L4 - Cost-effective inferenceA10, A100, A100-80GB - Standard training/inferenceL40S - Excellent cost/performance balance (48GB)H100, H200 - High-performance training (H100! pins H100; plain H100 may be upgraded to H200 at the same price)RTX-PRO-6000 - Blackwell workstation-class GPUB200, B300 - Flagship Blackwell (B200+ accepts either at B200 pricing)Request multiple GPUs:
@app.function(gpu="H100:8") # 8x H100 GPUs
def train_large_model():
pass
See references/gpu.md for GPU selection guidance, CUDA setup, and multi-GPU configuration.
Request CPU cores, memory, and disk for functions.
@app.function(
cpu=8.0, # 8 physical cores
memory=32768, # 32 GiB RAM
ephemeral_disk=10240 # 10 GiB disk
)
def memory_intensive_task():
pass
Default allocation: 0.125 CPU cores, 128 MiB memory. Billing based on reservation or actual usage, whichever is higher.
See references/resources.md for resource limits and billing details.
Modal autoscales functions from zero to thousands of containers based on demand.
Process inputs in parallel:
@app.function()
def analyze_sample(sample_id: int):
# Process single sample
return result
@app.local_entrypoint()
def main():
sample_ids = range(1000)
# Automatically parallelized across containers
results = list(analyze_sample.map(sample_ids))
Configure autoscaling:
@app.function(
max_containers=100, # Upper limit
min_containers=2, # Keep warm
buffer_containers=5 # Idle buffer for bursts
)
def inference():
pass
See references/scaling.md for autoscaling configuration, concurrency, and scaling limits.
Use Volumes for persistent storage across function invocations.
volume = modal.Volume.from_name("my-data", create_if_missing=True)
@app.function(volumes={"/data": volume})
def save_results(data):
with open("/data/results.txt", "w") as f:
f.write(data)
volume.commit() # Persist changes
Volumes persist data between runs, store model weights, cache datasets, and share data between functions.
See references/volumes.md for volume management, commits, and caching patterns.
Store API keys and credentials securely using Modal Secrets.
@app.function(secrets=[modal.Secret.from_name("huggingface")])
def download_model():
import os
token = os.environ["HF_TOKEN"]
# Use token for authentication
Create secrets in Modal dashboard or via CLI:
modal secret create my-secret KEY=value API_TOKEN=xyz
See references/secrets.md for secret management and authentication patterns.
Serve HTTP endpoints, APIs, and webhooks with @modal.fastapi_endpoint().
@app.function()
@modal.fastapi_endpoint(method="POST")
def predict(data: dict):
# Process request
result = model.predict(data["input"])
return {"prediction": result}
Deploy with:
modal deploy script.py
Modal provides HTTPS URL for the endpoint.
See references/web-endpoints.md for FastAPI integration, streaming, authentication, and WebSocket support.
Run functions on a schedule with cron expressions.
@app.function(schedule=modal.Cron("0 2 * * *")) # Daily at 2 AM
def daily_backup():
# Backup data
pass
@app.function(schedule=modal.Period(hours=4)) # Every 4 hours
def refresh_cache():
# Update cache
pass
Scheduled functions run automatically without manual invocation.
See references/scheduled-jobs.md for cron syntax, timezone configuration, and monitoring.
import modal
MODEL_ID = "distilbert/distilbert-base-uncased-finetuned-sst-2-english"
def download_model():
from transformers import pipeline
pipeline("text-classification", model=MODEL_ID) # fills the HF cache
# Define dependencies; run_function executes once at image build, so the weights
# are baked into the image instead of downloaded on every cold start
image = (
modal.Image.debian_slim()
.uv_pip_install("torch", "transformers")
.run_function(download_model)
)
app = modal.App("llm-inference", image=image)
# Serve model
@app.cls(gpu="L40S")
class Model:
@modal.enter()
def load_model(self):
from transformers import pipeline
self.pipe = pipeline("text-classification", model=MODEL_ID, device="cuda")
@modal.method()
def predict(self, text: str):
return self.pipe(text)
@app.local_entrypoint()
def main():
model = Model()
result = model.predict.remote("Modal is great!")
print(result)
@app.function(cpu=2.0, memory=4096)
def process_file(file_path: str):
import pandas as pd
df = pd.read_csv(file_path)
# Process data
return df.shape[0]
@app.local_entrypoint()
def main():
files = ["file1.csv", "file2.csv", ...] # 1000s of files
# Automatically parallelized across containers
for count in process_file.map(files):
print(f"Processed {count} rows")
@app.function(
gpu="A100:2", # 2x A100 GPUs
timeout=3600 # 1 hour timeout
)
def train_model(config: dict):
import torch
# Multi-GPU training code
model = create_model(config)
train(model)
return metrics
Detailed documentation for specific features:
references/getting-started.md - Authentication, setup, basic conceptsreferences/images.md - Image building, dependencies, Dockerfilesreferences/functions.md - Function patterns, deployment, parametersreferences/gpu.md - GPU types, CUDA, multi-GPU configurationreferences/resources.md - CPU, memory, disk managementreferences/scaling.md - Autoscaling, parallel execution, concurrencyreferences/volumes.md - Persistent storage, data managementreferences/secrets.md - Environment variables, authenticationreferences/web-endpoints.md - APIs, webhooks, endpointsreferences/scheduled-jobs.md - Cron jobs, periodic tasksreferences/examples.md - Common patterns for scientific computing.uv_pip_install() for reproducible buildsmax_containers and min_containers based on workload.map() for parallel processing instead of sequential loops"Module not found" errors:
.uv_pip_install("package-name")GPU not detected:
@app.function(gpu="A100")torch.cuda.is_available()Function timeout:
@app.function(timeout=3600)Volume changes not persisting:
volume.commit() after writing filesFor additional help, see Modal documentation at https://modal.com/docs or join Modal Slack community.
Part of the AlterLab Academic Skills suite.
evals/evals.json (opens in a new tab)references/examples.md (opens in a new tab)references/functions.md (opens in a new tab)references/getting-started.md (opens in a new tab)references/gpu.md (opens in a new tab)references/images.md (opens in a new tab)references/resources.md (opens in a new tab)references/scaling.md (opens in a new tab)references/scheduled-jobs.md (opens in a new tab)references/secrets.md (opens in a new tab)references/volumes.md (opens in a new tab)references/web-endpoints.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
/alterlab-domain-specific:alterlab-modalfrom alterlab-domain-specific
npx claudepluginhub alterlab-ieu/alterlab-academic-skills --plugin alterlab-domain-specific18 skills in this plugin
/alterlab-adaptyvPrepares and validates Adaptyv Bio Foundry protein-testing submissions with no account — optimizes and pre-screens sequences locally (NetSolP/SoluProt heuristics, SolubleMPNN, ESM), assembles the experiment payload, and validates it offline against the Foundry's own type/method/sequence rules so it is ready and correct before it costs anything. Submitting to the Foundry, browsing the target catalog, tracking status and retrieving results run through the Foundry API with the user's own ADAPTYV_API_KEY (experiments cost money and take weeks). Use when designing proteins for wet-lab validation (binding/affinity, expression, thermostability, fluorescence), preparing or validating a Foundry submission, pre-screening sequences, or tracking an Adaptyv experiment. Triggers on "Adaptyv", "Foundry API", "cloud lab", "biolayer interferometry / BLI", "wet-lab validation". Part of the AlterLab Academic Skills suite./alterlab-aeonRuns time series machine learning with the aeon library — classification, regression, clustering, forecasting, anomaly detection, segmentation, and similarity search via scikit-learn compatible APIs. Use when working with temporal data, sequential patterns, or time-indexed observations (univariate or multivariate) that need specialized algorithms beyond standard ML approaches. Part of the AlterLab Academic Skills suite.2 plugins in one repository ship this exact skill · first indexed Nov 9, 2026
Other plugins' skills for the same job