davila7/claude-code-templates/modal
- community
Checking that the SKILL.md file is still in the repository.
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.
Install
npx vskill@latest install davila7/claude-code-templates/modalSKILL.md
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
This creates a token stored in ~/.modal.toml. The token authenticates all Modal operations.
Verify Setup
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.
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.
Call functions:
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.
Available GPU types:
T4,L4- Cost-effective inferenceA10,A100,A100-80GB- Standard training/inferenceL40S- Excellent cost/performance balance (48GB)H100,H200- High-performance trainingB200- Flagship performance (most powerful)
Request multiple GPUs:
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.
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:
Configure autoscaling:
See references/scaling.md for autoscaling configuration, concurrency, and scaling limits.
6. Store Data Persistently
Use Volumes for persistent storage across function invocations.
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.
Create secrets in Modal dashboard or via CLI:
See references/secrets.md for secret management and authentication patterns.
8. Deploy Web Endpoints
Serve HTTP endpoints, APIs, and webhooks with @modal.web_endpoint().
Deploy with:
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.
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
Batch Process Large Dataset
Train Model on GPU
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
- Pin dependencies in
.uv_pip_install()for reproducible builds - Use appropriate GPU types - L40S for inference, H100/A100 for training
- Leverage caching - Use Volumes for model weights and datasets
- Configure autoscaling - Set
max_containersandmin_containersbased on workload - Import packages in function body if not available locally
- Use `.map()` for parallel processing instead of sequential loops
- Store secrets securely - Never hardcode API keys
- 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.function(timeout=3600) - Default timeout is 5 minutes
Volume changes not persisting:
- Call
volume.commit()after writing files - Verify volume mounted correctly in function decorator
For additional help, see Modal documentation at https://modal.com/docs or join Modal Slack community.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingcli-tool/components/skills/scientific/modal/SKILL.md
Popularity
- Repository stars
- 24,147
- Repository forks
- 2,374
- Repository npm downloads, 7 days
- 6,374
- 7-day trend score
- 71
Stars and forks are for the whole GitHub repository, not this skill alone. Downloads are for the repository's npm package. Refreshed 5 Apr 2026, 6 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/davila7/claude-code-templates/modal)