A serverless Python platform for GPU-accelerated computing, batch processing, and scalable APIs.

Install

mkdir -p .claude/skills/modal && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/372" && unzip -o skill.zip -d .claude/skills/modal && rm skill.zip

Installs to .claude/skills/modal

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Run Python code in the cloud with serverless containers, GPUs, and autoscaling. Use when deploying ML models, running batch processing jobs, scheduling compute-intensive tasks, or serving APIs that require GPU acceleration or dynamic scaling.
242 chars✓ has a “when” trigger
Intermediate

Key capabilities

  • Deploy Python functions to serverless containers
  • Attach GPU hardware to compute tasks
  • Scale containers automatically based on demand
  • Persist data across invocations using Volumes
  • Schedule periodic jobs with cron expressions

How it works

Modal executes Python functions in serverless containers by defining compute requirements and dependencies declaratively. It manages infrastructure, autoscaling, and hardware allocation automatically.

Inputs & outputs

You give it
Python function code and resource requirements
You get back
Cloud-deployed endpoint or execution result

When to use modal

  • Deploying LLMs and embedding models
  • Running GPU-accelerated rendering tasks
  • Processing large datasets in parallel
  • Scheduling compute-intensive data jobs

About this skill

Modal

Overview

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.

When to Use This Skill

Use Modal for:

  • Deploying and serving ML models (LLMs, image generation, embedding models)
  • Running GPU-accelerated computation (training, inference, rendering)
  • Batch processing large datasets in parallel
  • Scheduling compute-intensive jobs (daily data processing, model training)
  • Building serverless APIs that need automatic scaling
  • Scientific computing requiring distributed compute or specialized hardware

Authentication and Setup

Modal requires authentication via API token.

Initial Setup

# Install Modal
uv uv pip install modal

# Authenticate (opens browser for login)
modal token new

This creates a token stored in ~/.modal.toml. The token authenticates all Modal operations.

Verify Setup

import modal

app = modal.App("test-app")

@app.function()
def hello():
    print("Modal is working!")

Run with: modal run script.py

Core Capabilities

Modal provides serverless Python execution through Functions that run in containers. Define compute requirements, dependencies, and scaling behavior declaratively.

1. Define Container Images

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:

  • Install Python packages: .uv_pip_install("pandas", "scikit-learn")
  • Install system packages: .apt_install("ffmpeg", "git")
  • Use existing Docker images: modal.Image.from_registry("nvidia/cuda:12.1.0-base")
  • Add local code: .add_local_python_source("my_module")

See references/images.md for comprehensive image building documentation.

2. Create Functions

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.

3. Request GPUs

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 inference
  • A10, A100, A100-80GB - Standard training/inference
  • L40S - Excellent cost/performance balance (48GB)
  • H100, H200 - High-performance training
  • B200 - Flagship performance (most powerful)

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.

4. Configure Resources

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.

5. Scale Automatically

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.

6. Store Data Persistently

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.

7. Manage Secrets

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.

8. Deploy Web Endpoints

Serve HTTP endpoints, APIs, and webhooks with @modal.web_endpoint().

@app.function()
@modal.web_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.

9. Schedule Jobs

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.

Common Workflows

Deploy ML Model for Inference

import modal

# Define dependencies
image = modal.Image.debian_slim().uv_pip_install("torch", "transformers")
app = modal.App("llm-inference", image=image)

# Download model at build time
@app.function()
def download_model():
    from transformers import AutoModel
    AutoModel.from_pretrained("bert-base-uncased")

# Serve model
@app.cls(gpu="L40S")
class Model:
    @modal.enter()
    def load_model(self):
        from transformers import pipeline
        self.pipe = pipeline("text-classification", 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)

Batch Process Large Dataset

@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")

Train Model on GPU

@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

Reference Documentation

Detailed documentation for specific features:

  • references/getting-started.md - Authentication, setup, basic concepts
  • references/images.md - Image building, dependencies, Dockerfiles
  • references/functions.md - Function patterns, deployment, parameters
  • references/gpu.md - GPU types, CUDA, multi-GPU configuration
  • references/resources.md - CPU, memory, disk management
  • references/scaling.md - Autoscaling, parallel execution, concurrency
  • references/volumes.md - Persistent storage, data management
  • references/secrets.md - Environment variables, authentication
  • references/web-endpoints.md - APIs, webhooks, endpoints
  • references/scheduled-jobs.md - Cron jobs, periodic tasks
  • references/examples.md - Common patterns for scientific computing

Best Practices

  1. Pin dependencies in .uv_pip_install() for reproducible builds
  2. Use appropriate GPU types - L40S for inference, H100/A100 for training
  3. Leverage caching - Use Volumes for model weights and datasets
  4. Configure autoscaling - Set max_containers and min_containers based on workload
  5. Import packages in function body if not available locally
  6. Use .map() for parallel processing instead of sequential loops
  7. Store secrets securely - Never hardcode API keys
  8. Monitor costs - Check Modal dashboard for usage and billing

Troubleshooting

"Module not found" errors:

  • Add packages to image with .uv_pip_install("package-name")
  • Import packages inside function body if not available locally

GPU not detected:

  • Verify GPU specification: @app.function(gpu="A100")
  • Check CUDA availability: torch.cuda.is_available()

Function timeout:

  • Increase timeout: `@app.functio

Content truncated.

When not to use it

  • When code must run on-premises or on local hardware
  • When the task does not require cloud-based scaling or GPU acceleration

Prerequisites

Modal accountAPI token authentication

Limitations

  • Default function timeout is 5 minutes
  • Requires explicit volume commits to persist data changes

How it compares

Unlike manual server management, this workflow uses declarative decorators to handle infrastructure, scaling, and GPU provisioning automatically.

Compared to similar skills

modal side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
modal (this skill)57moReviewIntermediate
senior-computer-vision127moReviewAdvanced
machine-learning-ops-ml-pipeline44moNo flagsAdvanced
hugging-face-jobs16moCautionAdvanced

Try saying

Example prompts that trigger this skill in your AI assistant.

software-architecture

davila7

Guide for quality focused software architecture. This skill should be used when users want to write code, design architecture, analyze code, in any case that relates to software development.

333868

planning-with-files

davila7

Implements Manus-style file-based planning for complex tasks. Creates task_plan.md, findings.md, and progress.md. Use when starting complex multi-step tasks, research projects, or any task requiring >5 tool calls.

233106

telegram-bot-builder

davila7

Expert in building Telegram bots that solve real problems - from simple automation to complex AI-powered bots. Covers bot architecture, the Telegram Bot API, user experience, monetization strategies, and scaling bots to thousands of users. Use when: telegram bot, bot api, telegram automation, chat bot telegram, tg bot.

106130

scroll-experience

davila7

Expert in building immersive scroll-driven experiences - parallax storytelling, scroll animations, interactive narratives, and cinematic web experiences. Like NY Times interactives, Apple product pages, and award-winning web experiences. Makes websites feel like experiences, not just pages. Use when: scroll animation, parallax, scroll storytelling, interactive story, cinematic website.

101142

humanizer

davila7

Remove signs of AI-generated writing from text. Use when editing or reviewing text to make it sound more natural and human-written. Based on Wikipedia's comprehensive "Signs of AI writing" guide. Detects and fixes patterns including: inflated symbolism, promotional language, superficial -ing analyses, vague attributions, em dash overuse, rule of three, AI vocabulary words, negative parallelisms, and excessive conjunctive phrases. Credits: Original skill by @blader - https://github.com/blader/humanizer

90175

game-development

davila7

Game development orchestrator. Routes to platform-specific skills based on project needs.

70195

You might also like

senior-computer-vision

davila7

World-class computer vision skill for image/video processing, object detection, segmentation, and visual AI systems. Expertise in PyTorch, OpenCV, YOLO, SAM, diffusion models, and vision transformers. Includes 3D vision, video analysis, real-time processing, and production deployment. Use when building vision AI systems, implementing object detection, training custom vision models, or optimizing inference pipelines.

1256

machine-learning-ops-ml-pipeline

sickn33

Design and implement a complete ML pipeline for: $ARGUMENTS

436

hugging-face-jobs

patchy631

This skill should be used when users want to run any workload on Hugging Face Jobs infrastructure. Covers UV scripts, Docker-based jobs, hardware selection, cost estimation, authentication with tokens, secrets management, timeout configuration, and result persistence. Designed for general-purpose compute workloads including data processing, inference, experiments, batch jobs, and any Python-based tasks. Should be invoked for tasks involving cloud compute, GPU workloads, or when users mention running jobs on Hugging Face infrastructure without local setup.

14

latchbio-integration

davila7

Latch platform for bioinformatics workflows. Build pipelines with Latch SDK, @workflow/@task decorators, deploy serverless workflows, LatchFile/LatchDir, Nextflow/Snakemake integration.

10

vastai-core-workflow-a

jeremylongshore

Execute Vast.ai primary workflow: Core Workflow A. Use when implementing primary use case, building main features, or core integration tasks. Trigger with phrases like "vastai main workflow", "primary task with vastai".

01

senior-prompt-engineer

davila7

World-class prompt engineering skill for LLM optimization, prompt patterns, structured outputs, and AI product development. Expertise in Claude, GPT-4, prompt design patterns, few-shot learning, chain-of-thought, and AI evaluation. Includes RAG optimization, agent design, and LLM system architecture. Use when building AI products, optimizing LLM performance, designing agentic systems, or implementing advanced prompting techniques.

743

Search skills

Search the agent skills registry