[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M75F2GBAEN7EADA6Z8M2CXAH":3,"skill-same:01M75F2GBAEN7EADA6Z8M2CXAH":97},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":25,"commitSha":26,"skillDirectory":27,"forksCount":28,"repositoryHtmlUrl":29,"repositoryHomepageUrl":29,"ownerHtmlUrl":30,"ownerBlogUrl":6,"ownerDescription":31,"updatedAt":32,"install":33,"resources":46},"01M75F2GBAEN7EADA6Z8M2CXAH","modal",null,"Cloud computing platform for running Python on GPUs and serverless infrastructure. Use when deploying AI\u002FML models, running GPU-accelerated workloads, serving web endpoints, scheduling batch jobs, or scaling Python code to the cloud. Use this skill whenever the user mentions Modal, serverless GPU compute, deploying ML models to the cloud, serving inference endpoints, running batch processing in the cloud, or needs to scale Python workloads beyond their local machine. Also use when the user wants to run code on H100s, A100s, or other cloud GPUs, or needs to create a web API for a model.","Lord1Egypt\u002Fai-skillforge","Lord1Egypt","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F99746359?v=4","01M7592YDNT0XK9WJ0T2MQVPDN","Mohamed Mounir Ali AL Keshita","01M7597M9CBBVAPX1CYE1KFTSM",2,"Apache-2.0","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fai-skillforge\u002Fblob\u002Fmain\u002Fskills\u002Fgemini\u002Fmodal\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: modal\ndescription: Cloud computing platform for running Python on GPUs and serverless infrastructure. Use when deploying AI\u002FML models, running GPU-accelerated workloads, serving web endpoints, scheduling batch jobs, or scaling Python code to the cloud. Use this skill whenever the user mentions Modal, serverless GPU compute, deploying ML models to the cloud, serving inference endpoints, running batch processing in the cloud, or needs to scale Python workloads beyond their local machine. Also use when the user wants to run code on H100s, A100s, or other cloud GPUs, or needs to create a web API for a model.\nlicense: Apache-2.0\nmetadata:\n  skill-author: Lord1Egypt\n---\n\n# Modal\n\n## Overview\n\nModal is a cloud platform for running Python code serverlessly, with a focus on AI\u002FML workloads. Key capabilities:\n- **GPU compute** on demand (T4, L4, A10, L40S, A100, H100, H200, B200)\n- **Serverless functions** with autoscaling from zero to thousands of containers\n- **Custom container images** built entirely in Python code\n- **Persistent storage** via Volumes for model weights and datasets\n- **Web endpoints** for serving models and APIs\n- **Scheduled jobs** via cron or fixed intervals\n- **Sub-second cold starts** for low-latency inference\n\nEverything in Modal is defined as code — no YAML, no Dockerfiles required (though both are supported).\n\n## When to Use This Skill\n\nUse this skill when:\n- Deploy or serve AI\u002FML models in the cloud\n- Run GPU-accelerated computations (training, inference, fine-tuning)\n- Create serverless web APIs or endpoints\n- Scale batch processing jobs in parallel\n- Schedule recurring tasks (data pipelines, retraining, scraping)\n- Need persistent cloud storage for model weights or datasets\n- Want to run code in custom container environments\n- Build job queues or async task processing systems\n\n## Installation and Authentication\n\n### Install\n\n```bash\nuv pip install modal\n```\n\n### Authenticate\n\nPrefer existing credentials before creating new ones:\n\n1. Check whether `MODAL_TOKEN_ID` and `MODAL_TOKEN_SECRET` are already present in the current environment.\n2. If not, check for those values in a local `.env` file and load them if appropriate for the workflow.\n3. Only fall back to interactive `modal setup` or generating fresh tokens if neither source already provides credentials.\n\n```bash\nmodal setup\n```\n\nThis opens a browser for authentication. For CI\u002FCD or headless environments, use environment variables:\n\n```bash\nexport MODAL_TOKEN_ID=\u003Cyour-token-id>\nexport MODAL_TOKEN_SECRET=\u003Cyour-token-secret>\n```\n\nIf tokens are not already available in the environment or `.env`, generate them at https:\u002F\u002Fmodal.com\u002Fsettings\n\nModal offers a free tier with $30\u002Fmonth in credits.\n\n**Reference**: See `references\u002Fgetting-started.md` for detailed setup and first app walkthrough.\n\n## Core Concepts\n\n### App and Functions\n\nA Modal `App` groups related functions. Functions decorated with `@app.function()` run remotely in the cloud:\n\n```python\nimport modal\n\napp = modal.App(\"my-app\")\n\n@app.function()\ndef square(x):\n    return x ** 2\n\n@app.local_entrypoint()\ndef main():\n    # .remote() runs in the cloud\n    print(square.remote(42))\n```\n\nRun with `modal run script.py`. Deploy with `modal deploy script.py`.\n\n**Reference**: See `references\u002Ffunctions.md` for lifecycle hooks, classes, `.map()`, `.spawn()`, and more.\n\n### Container Images\n\nModal builds container images from Python code. The recommended package installer is `uv`:\n\n```python\nimage = (\n    modal.Image.debian_slim(python_version=\"3.11\")\n    .uv_pip_install(\"torch==2.8.0\", \"transformers\", \"accelerate\")\n    .apt_install(\"git\")\n)\n\n@app.function(image=image)\ndef inference(prompt):\n    from transformers import pipeline\n    pipe = pipeline(\"text-generation\", model=\"meta-llama\u002FLlama-3-8B\")\n    return pipe(prompt)\n```\n\nKey image methods:\n- `.uv_pip_install()` — Install Python packages with uv (recommended)\n- `.pip_install()` — Install with pip (fallback)\n- `.apt_install()` — Install system packages\n- `.run_commands()` — Run shell commands during build\n- `.run_function()` — Run Python during build (e.g., download model weights)\n- `.add_local_python_source()` — Add local modules\n- `.env()` — Set environment variables\n\n**Reference**: See `references\u002Fimages.md` for Dockerfiles, micromamba, caching, GPU build steps.\n\n### GPU Compute\n\nRequest GPUs via the `gpu` parameter:\n\n```python\n@app.function(gpu=\"H100\")\ndef train_model():\n    import torch\n    device = torch.device(\"cuda\")\n    # GPU training code here\n\n# Multiple GPUs\n@app.function(gpu=\"H100:4\")\ndef distributed_training():\n    ...\n\n# GPU fallback chain\n@app.function(gpu=[\"H100\", \"A100-80GB\", \"A100-40GB\"])\ndef flexible_inference():\n    ...\n```\n\nAvailable GPUs: T4, L4, A10, L40S, A100-40GB, A100-80GB, H100, H200, B200, B200+\n\n- Up to 8 GPUs per container (except A10: up to 4)\n- L40S is recommended for inference (cost\u002Fperformance balance, 48 GB VRAM)\n- H100\u002FA100 can be auto-upgraded to H200\u002FA100-80GB at no extra cost\n- Use `gpu=\"H100!\"` to prevent auto-upgrade\n\n**Reference**: See `references\u002Fgpu.md` for GPU selection guidance and multi-GPU training.\n\n### Volumes (Persistent Storage)\n\nVolumes provide distributed, persistent file storage:\n\n```python\nvol = modal.Volume.from_name(\"model-weights\", create_if_missing=True)\n\n@app.function(volumes={\"\u002Fdata\": vol})\ndef save_model():\n    # Write to the mounted path\n    with open(\"\u002Fdata\u002Fmodel.pt\", \"wb\") as f:\n        torch.save(model.state_dict(), f)\n\n@app.function(volumes={\"\u002Fdata\": vol})\ndef load_model():\n    model.load_state_dict(torch.load(\"\u002Fdata\u002Fmodel.pt\"))\n```\n\n- Optimized for write-once, read-many workloads (model weights, datasets)\n- CLI access: `modal volume ls`, `modal volume put`, `modal volume get`\n- Background auto-commits every few seconds\n\n**Reference**: See `references\u002Fvolumes.md` for v2 volumes, concurrent writes, and best practices.\n\n### Secrets\n\nSecurely pass credentials to functions:\n\n```python\n@app.function(secrets=[modal.Secret.from_name(\"my-api-keys\")])\ndef call_api():\n    import os\n    api_key = os.environ[\"API_KEY\"]\n    # Use the key\n```\n\nCreate secrets via CLI: `modal secret create my-api-keys API_KEY=sk-xxx`\n\nOr from a `.env` file: `modal.Secret.from_dotenv()`\n\n**Reference**: See `references\u002Fsecrets.md` for dashboard setup, multiple secrets, and templates.\n\n### Web Endpoints\n\nServe models and APIs as web endpoints:\n\n```python\n@app.function()\n@modal.fastapi_endpoint()\ndef predict(text: str):\n    return {\"result\": model.predict(text)}\n```\n\n- `modal serve script.py` — Development with hot reload and temporary URL\n- `modal deploy script.py` — Production deployment with permanent URL\n- Supports FastAPI, ASGI (Starlette, FastHTML), WSGI (Flask, Django), WebSockets\n- Request bodies up to 4 GiB, unlimited response size\n\n**Reference**: See `references\u002Fweb-endpoints.md` for ASGI\u002FWSGI apps, streaming, auth, and WebSockets.\n\n### Scheduled Jobs\n\nRun functions on a schedule:\n\n```python\n@app.function(schedule=modal.Cron(\"0 9 * * *\"))  # Daily at 9 AM UTC\ndef daily_pipeline():\n    # ETL, retraining, scraping, etc.\n    ...\n\n@app.function(schedule=modal.Period(hours=6))\ndef periodic_check():\n    ...\n```\n\nDeploy with `modal deploy script.py` to activate the schedule.\n\n- `modal.Cron(\"...\")` — Standard cron syntax, stable across deploys\n- `modal.Period(hours=N)` — Fixed interval, resets on redeploy\n- Monitor runs in the Modal dashboard\n\n**Reference**: See `references\u002Fscheduled-jobs.md` for cron syntax and management.\n\n### Scaling and Concurrency\n\nModal autoscales containers automatically. Configure limits:\n\n```python\n@app.function(\n    max_containers=100,    # Upper limit\n    min_containers=2,      # Keep warm for low latency\n    buffer_containers=5,   # Reserve capacity\n    scaledown_window=300,  # Idle seconds before shutdown\n)\ndef process(data):\n    ...\n```\n\nProcess inputs in parallel with `.map()`:\n\n```python\nresults = list(process.map([item1, item2, item3, ...]))\n```\n\nEnable concurrent request handling per container:\n\n```python\n@app.function()\n@modal.concurrent(max_inputs=10)\nasync def handle_request(req):\n    ...\n```\n\n**Reference**: See `references\u002Fscaling.md` for `.map()`, `.starmap()`, `.spawn()`, and limits.\n\n### Resource Configuration\n\n```python\n@app.function(\n    cpu=4.0,              # Physical cores (not vCPUs)\n    memory=16384,         # MiB\n    ephemeral_disk=51200, # MiB (up to 3 TiB)\n    timeout=3600,         # Seconds\n)\ndef heavy_computation():\n    ...\n```\n\nDefaults: 0.125 CPU cores, 128 MiB memory. Billed on max(request, usage).\n\n**Reference**: See `references\u002Fresources.md` for limits and billing details.\n\n## Classes with Lifecycle Hooks\n\nFor stateful workloads (e.g., loading a model once and serving many requests):\n\n```python\n@app.cls(gpu=\"L40S\", image=image)\nclass Predictor:\n    @modal.enter()\n    def load_model(self):\n        self.model = load_heavy_model()  # Runs once on container start\n\n    @modal.method()\n    def predict(self, text: str):\n        return self.model(text)\n\n    @modal.exit()\n    def cleanup(self):\n        ...  # Runs on container shutdown\n```\n\nCall with: `Predictor().predict.remote(\"hello\")`\n\n## Common Workflow Patterns\n\n### GPU Model Inference Service\n\n```python\nimport modal\n\napp = modal.App(\"llm-service\")\n\nimage = (\n    modal.Image.debian_slim(python_version=\"3.11\")\n    .uv_pip_install(\"vllm\")\n)\n\n@app.cls(gpu=\"H100\", image=image, min_containers=1)\nclass LLMService:\n    @modal.enter()\n    def load(self):\n        from vllm import LLM\n        self.llm = LLM(model=\"meta-llama\u002FLlama-3-70B\")\n\n    @modal.method()\n    @modal.fastapi_endpoint(method=\"POST\")\n    def generate(self, prompt: str, max_tokens: int = 256):\n        outputs = self.llm.generate([prompt], max_tokens=max_tokens)\n        return {\"text\": outputs[0].outputs[0].text}\n```\n\n### Batch Processing Pipeline\n\n```python\napp = modal.App(\"batch-pipeline\")\nvol = modal.Volume.from_name(\"pipeline-data\", create_if_missing=True)\n\n@app.function(volumes={\"\u002Fdata\": vol}, cpu=4.0, memory=8192)\ndef process_chunk(chunk_id: int):\n    import pandas as pd\n    df = pd.read_parquet(f\"\u002Fdata\u002Finput\u002Fchunk_{chunk_id}.parquet\")\n    result = heavy_transform(df)\n    result.to_parquet(f\"\u002Fdata\u002Foutput\u002Fchunk_{chunk_id}.parquet\")\n    return len(result)\n\n@app.local_entrypoint()\ndef main():\n    chunk_ids = list(range(100))\n    results = list(process_chunk.map(chunk_ids))\n    print(f\"Processed {sum(results)} total rows\")\n```\n\n### Scheduled Data Pipeline\n\n```python\napp = modal.App(\"etl-pipeline\")\n\n@app.function(\n    schedule=modal.Cron(\"0 *\u002F6 * * *\"),  # Every 6 hours\n    secrets=[modal.Secret.from_name(\"db-credentials\")],\n)\ndef etl_job():\n    import os\n    db_url = os.environ[\"DATABASE_URL\"]\n    # Extract, transform, load\n    ...\n```\n\n## CLI Reference\n\n| Command | Description |\n|---------|-------------|\n| `modal setup` | Authenticate with Modal |\n| `modal run script.py` | Run a script's local entrypoint |\n| `modal serve script.py` | Dev server with hot reload |\n| `modal deploy script.py` | Deploy to production |\n| `modal volume ls \u003Cname>` | List files in a volume |\n| `modal volume put \u003Cname> \u003Cfile>` | Upload file to volume |\n| `modal volume get \u003Cname> \u003Cfile>` | Download file from volume |\n| `modal secret create \u003Cname> K=V` | Create a secret |\n| `modal secret list` | List secrets |\n| `modal app list` | List deployed apps |\n| `modal app stop \u003Cname>` | Stop a deployed app |\n\n## Reference Files\n\nDetailed documentation for each topic:\n\n- `references\u002Fgetting-started.md` — Installation, authentication, first app\n- `references\u002Ffunctions.md` — Functions, classes, lifecycle hooks, remote execution\n- `references\u002Fimages.md` — Container images, package installation, caching\n- `references\u002Fgpu.md` — GPU types, selection, multi-GPU, training\n- `references\u002Fvolumes.md` — Persistent storage, file management, v2 volumes\n- `references\u002Fsecrets.md` — Credentials, environment variables, dotenv\n- `references\u002Fweb-endpoints.md` — FastAPI, ASGI\u002FWSGI, streaming, auth, WebSockets\n- `references\u002Fscheduled-jobs.md` — Cron, periodic schedules, management\n- `references\u002Fscaling.md` — Autoscaling, concurrency, .map(), limits\n- `references\u002Fresources.md` — CPU, memory, disk, timeout configuration\n- `references\u002Fexamples.md` — Common use cases and patterns\n- `references\u002Fapi_reference.md` — Key API classes and methods\n\nRead these files when detailed information is needed beyond this overview.\n","# Modal\n\n## Overview\n\nModal is a cloud platform for running Python code serverlessly, with a focus on AI\u002FML workloads. Key capabilities:\n- **GPU compute** on demand (T4, L4, A10, L40S, A100, H100, H200, B200)\n- **Serverless functions** with autoscaling from zero to thousands of containers\n- **Custom container images** built entirely in Python code\n- **Persistent storage** via Volumes for model weights and datasets\n- **Web endpoints** for serving models and APIs\n- **Scheduled jobs** via cron or fixed intervals\n- **Sub-second cold starts** for low-latency inference\n\nEverything in Modal is defined as code — no YAML, no Dockerfiles required (though both are supported).\n\n## When to Use This Skill\n\nUse this skill when:\n- Deploy or serve AI\u002FML models in the cloud\n- Run GPU-accelerated computations (training, inference, fine-tuning)\n- Create serverless web APIs or endpoints\n- Scale batch processing jobs in parallel\n- Schedule recurring tasks (data pipelines, retraining, scraping)\n- Need persistent cloud storage for model weights or datasets\n- Want to run code in custom container environments\n- Build job queues or async task processing systems\n\n## Installation and Authentication\n\n### Install\n\n```bash\nuv pip install modal\n```\n\n### Authenticate\n\nPrefer existing credentials before creating new ones:\n\n1. Check whether `MODAL_TOKEN_ID` and `MODAL_TOKEN_SECRET` are already present in the current environment.\n2. If not, check for those values in a local `.env` file and load them if appropriate for the workflow.\n3. Only fall back to interactive `modal setup` or generating fresh tokens if neither source already provides credentials.\n\n```bash\nmodal setup\n```\n\nThis opens a browser for authentication. For CI\u002FCD or headless environments, use environment variables:\n\n```bash\nexport MODAL_TOKEN_ID=\u003Cyour-token-id>\nexport MODAL_TOKEN_SECRET=\u003Cyour-token-secret>\n```\n\nIf tokens are not already available in the environment or `.env`, generate them at https:\u002F\u002Fmodal.com\u002Fsettings\n\nModal offers a free tier with $30\u002Fmonth in credits.\n\n**Reference**: See `references\u002Fgetting-started.md` for detailed setup and first app walkthrough.\n\n## Core Concepts\n\n### App and Functions\n\nA Modal `App` groups related functions. Functions decorated with `@app.function()` run remotely in the cloud:\n\n```python\nimport modal\n\napp = modal.App(\"my-app\")\n\n@app.function()\ndef square(x):\n    return x ** 2\n\n@app.local_entrypoint()\ndef main():\n    # .remote() runs in the cloud\n    print(square.remote(42))\n```\n\nRun with `modal run script.py`. Deploy with `modal deploy script.py`.\n\n**Reference**: See `references\u002Ffunctions.md` for lifecycle hooks, classes, `.map()`, `.spawn()`, and more.\n\n### Container Images\n\nModal builds container images from Python code. The recommended package installer is `uv`:\n\n```python\nimage = (\n    modal.Image.debian_slim(python_version=\"3.11\")\n    .uv_pip_install(\"torch==2.8.0\", \"transformers\", \"accelerate\")\n    .apt_install(\"git\")\n)\n\n@app.function(image=image)\ndef inference(prompt):\n    from transformers import pipeline\n    pipe = pipeline(\"text-generation\", model=\"meta-llama\u002FLlama-3-8B\")\n    return pipe(prompt)\n```\n\nKey image methods:\n- `.uv_pip_install()` — Install Python packages with uv (recommended)\n- `.pip_install()` — Install with pip (fallback)\n- `.apt_install()` — Install system packages\n- `.run_commands()` — Run shell commands during build\n- `.run_function()` — Run Python during build (e.g., download model weights)\n- `.add_local_python_source()` — Add local modules\n- `.env()` — Set environment variables\n\n**Reference**: See `references\u002Fimages.md` for Dockerfiles, micromamba, caching, GPU build steps.\n\n### GPU Compute\n\nRequest GPUs via the `gpu` parameter:\n\n```python\n@app.function(gpu=\"H100\")\ndef train_model():\n    import torch\n    device = torch.device(\"cuda\")\n    # GPU training code here\n\n# Multiple GPUs\n@app.function(gpu=\"H100:4\")\ndef distributed_training():\n    ...\n\n# GPU fallback chain\n@app.function(gpu=[\"H100\", \"A100-80GB\", \"A100-40GB\"])\ndef flexible_inference():\n    ...\n```\n\nAvailable GPUs: T4, L4, A10, L40S, A100-40GB, A100-80GB, H100, H200, B200, B200+\n\n- Up to 8 GPUs per container (except A10: up to 4)\n- L40S is recommended for inference (cost\u002Fperformance balance, 48 GB VRAM)\n- H100\u002FA100 can be auto-upgraded to H200\u002FA100-80GB at no extra cost\n- Use `gpu=\"H100!\"` to prevent auto-upgrade\n\n**Reference**: See `references\u002Fgpu.md` for GPU selection guidance and multi-GPU training.\n\n### Volumes (Persistent Storage)\n\nVolumes provide distributed, persistent file storage:\n\n```python\nvol = modal.Volume.from_name(\"model-weights\", create_if_missing=True)\n\n@app.function(volumes={\"\u002Fdata\": vol})\ndef save_model():\n    # Write to the mounted path\n    with open(\"\u002Fdata\u002Fmodel.pt\", \"wb\") as f:\n        torch.save(model.state_dict(), f)\n\n@app.function(volumes={\"\u002Fdata\": vol})\ndef load_model():\n    model.load_state_dict(torch.load(\"\u002Fdata\u002Fmodel.pt\"))\n```\n\n- Optimized for write-once, read-many workloads (model weights, datasets)\n- CLI access: `modal volume ls`, `modal volume put`, `modal volume get`\n- Background auto-commits every few seconds\n\n**Reference**: See `references\u002Fvolumes.md` for v2 volumes, concurrent writes, and best practices.\n\n### Secrets\n\nSecurely pass credentials to functions:\n\n```python\n@app.function(secrets=[modal.Secret.from_name(\"my-api-keys\")])\ndef call_api():\n    import os\n    api_key = os.environ[\"API_KEY\"]\n    # Use the key\n```\n\nCreate secrets via CLI: `modal secret create my-api-keys API_KEY=sk-xxx`\n\nOr from a `.env` file: `modal.Secret.from_dotenv()`\n\n**Reference**: See `references\u002Fsecrets.md` for dashboard setup, multiple secrets, and templates.\n\n### Web Endpoints\n\nServe models and APIs as web endpoints:\n\n```python\n@app.function()\n@modal.fastapi_endpoint()\ndef predict(text: str):\n    return {\"result\": model.predict(text)}\n```\n\n- `modal serve script.py` — Development with hot reload and temporary URL\n- `modal deploy script.py` — Production deployment with permanent URL\n- Supports FastAPI, ASGI (Starlette, FastHTML), WSGI (Flask, Django), WebSockets\n- Request bodies up to 4 GiB, unlimited response size\n\n**Reference**: See `references\u002Fweb-endpoints.md` for ASGI\u002FWSGI apps, streaming, auth, and WebSockets.\n\n### Scheduled Jobs\n\nRun functions on a schedule:\n\n```python\n@app.function(schedule=modal.Cron(\"0 9 * * *\"))  # Daily at 9 AM UTC\ndef daily_pipeline():\n    # ETL, retraining, scraping, etc.\n    ...\n\n@app.function(schedule=modal.Period(hours=6))\ndef periodic_check():\n    ...\n```\n\nDeploy with `modal deploy script.py` to activate the schedule.\n\n- `modal.Cron(\"...\")` — Standard cron syntax, stable across deploys\n- `modal.Period(hours=N)` — Fixed interval, resets on redeploy\n- Monitor runs in the Modal dashboard\n\n**Reference**: See `references\u002Fscheduled-jobs.md` for cron syntax and management.\n\n### Scaling and Concurrency\n\nModal autoscales containers automatically. Configure limits:\n\n```python\n@app.function(\n    max_containers=100,    # Upper limit\n    min_containers=2,      # Keep warm for low latency\n    buffer_containers=5,   # Reserve capacity\n    scaledown_window=300,  # Idle seconds before shutdown\n)\ndef process(data):\n    ...\n```\n\nProcess inputs in parallel with `.map()`:\n\n```python\nresults = list(process.map([item1, item2, item3, ...]))\n```\n\nEnable concurrent request handling per container:\n\n```python\n@app.function()\n@modal.concurrent(max_inputs=10)\nasync def handle_request(req):\n    ...\n```\n\n**Reference**: See `references\u002Fscaling.md` for `.map()`, `.starmap()`, `.spawn()`, and limits.\n\n### Resource Configuration\n\n```python\n@app.function(\n    cpu=4.0,              # Physical cores (not vCPUs)\n    memory=16384,         # MiB\n    ephemeral_disk=51200, # MiB (up to 3 TiB)\n    timeout=3600,         # Seconds\n)\ndef heavy_computation():\n    ...\n```\n\nDefaults: 0.125 CPU cores, 128 MiB memory. Billed on max(request, usage).\n\n**Reference**: See `references\u002Fresources.md` for limits and billing details.\n\n## Classes with Lifecycle Hooks\n\nFor stateful workloads (e.g., loading a model once and serving many requests):\n\n```python\n@app.cls(gpu=\"L40S\", image=image)\nclass Predictor:\n    @modal.enter()\n    def load_model(self):\n        self.model = load_heavy_model()  # Runs once on container start\n\n    @modal.method()\n    def predict(self, text: str):\n        return self.model(text)\n\n    @modal.exit()\n    def cleanup(self):\n        ...  # Runs on container shutdown\n```\n\nCall with: `Predictor().predict.remote(\"hello\")`\n\n## Common Workflow Patterns\n\n### GPU Model Inference Service\n\n```python\nimport modal\n\napp = modal.App(\"llm-service\")\n\nimage = (\n    modal.Image.debian_slim(python_version=\"3.11\")\n    .uv_pip_install(\"vllm\")\n)\n\n@app.cls(gpu=\"H100\", image=image, min_containers=1)\nclass LLMService:\n    @modal.enter()\n    def load(self):\n        from vllm import LLM\n        self.llm = LLM(model=\"meta-llama\u002FLlama-3-70B\")\n\n    @modal.method()\n    @modal.fastapi_endpoint(method=\"POST\")\n    def generate(self, prompt: str, max_tokens: int = 256):\n        outputs = self.llm.generate([prompt], max_tokens=max_tokens)\n        return {\"text\": outputs[0].outputs[0].text}\n```\n\n### Batch Processing Pipeline\n\n```python\napp = modal.App(\"batch-pipeline\")\nvol = modal.Volume.from_name(\"pipeline-data\", create_if_missing=True)\n\n@app.function(volumes={\"\u002Fdata\": vol}, cpu=4.0, memory=8192)\ndef process_chunk(chunk_id: int):\n    import pandas as pd\n    df = pd.read_parquet(f\"\u002Fdata\u002Finput\u002Fchunk_{chunk_id}.parquet\")\n    result = heavy_transform(df)\n    result.to_parquet(f\"\u002Fdata\u002Foutput\u002Fchunk_{chunk_id}.parquet\")\n    return len(result)\n\n@app.local_entrypoint()\ndef main():\n    chunk_ids = list(range(100))\n    results = list(process_chunk.map(chunk_ids))\n    print(f\"Processed {sum(results)} total rows\")\n```\n\n### Scheduled Data Pipeline\n\n```python\napp = modal.App(\"etl-pipeline\")\n\n@app.function(\n    schedule=modal.Cron(\"0 *\u002F6 * * *\"),  # Every 6 hours\n    secrets=[modal.Secret.from_name(\"db-credentials\")],\n)\ndef etl_job():\n    import os\n    db_url = os.environ[\"DATABASE_URL\"]\n    # Extract, transform, load\n    ...\n```\n\n## CLI Reference\n\n| Command | Description |\n|---------|-------------|\n| `modal setup` | Authenticate with Modal |\n| `modal run script.py` | Run a script's local entrypoint |\n| `modal serve script.py` | Dev server with hot reload |\n| `modal deploy script.py` | Deploy to production |\n| `modal volume ls \u003Cname>` | List files in a volume |\n| `modal volume put \u003Cname> \u003Cfile>` | Upload file to volume |\n| `modal volume get \u003Cname> \u003Cfile>` | Download file from volume |\n| `modal secret create \u003Cname> K=V` | Create a secret |\n| `modal secret list` | List secrets |\n| `modal app list` | List deployed apps |\n| `modal app stop \u003Cname>` | Stop a deployed app |\n\n## Reference Files\n\nDetailed documentation for each topic:\n\n- `references\u002Fgetting-started.md` — Installation, authentication, first app\n- `references\u002Ffunctions.md` — Functions, classes, lifecycle hooks, remote execution\n- `references\u002Fimages.md` — Container images, package installation, caching\n- `references\u002Fgpu.md` — GPU types, selection, multi-GPU, training\n- `references\u002Fvolumes.md` — Persistent storage, file management, v2 volumes\n- `references\u002Fsecrets.md` — Credentials, environment variables, dotenv\n- `references\u002Fweb-endpoints.md` — FastAPI, ASGI\u002FWSGI, streaming, auth, WebSockets\n- `references\u002Fscheduled-jobs.md` — Cron, periodic schedules, management\n- `references\u002Fscaling.md` — Autoscaling, concurrency, .map(), limits\n- `references\u002Fresources.md` — CPU, memory, disk, timeout configuration\n- `references\u002Fexamples.md` — Common use cases and patterns\n- `references\u002Fapi_reference.md` — Key API classes and methods\n\nRead these files when detailed information is needed beyond this overview.\n",{"name":5,"license":15,"metadata":24,"description":7},{"skill-author":9},"main","3f88e1b76af67701a6405069a542e21a997d2868","skills\u002Fgemini\u002Fmodal",0,"https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fai-skillforge","https:\u002F\u002Fgithub.com\u002FLord1Egypt","Unbreakable. Unstoppable. Unmatched⚡.\r\n Speaker of machine tongues 🤖  | World-builder of decentralized dreams 🌐 | Defender of the digital realm🛡️.","2026-06-05 10:16:24",{"source":8,"skillName":5,"commands":34,"prompt":44,"zipAvailable":45},[35,38,41],{"tool":36,"command":37},"npx","npx skills add Lord1Egypt\u002Fai-skillforge --skill modal",{"tool":39,"command":40},"bunx","bunx skills add Lord1Egypt\u002Fai-skillforge --skill modal",{"tool":42,"command":43},"pnpm","pnpm dlx skills add Lord1Egypt\u002Fai-skillforge --skill modal","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fai-skillforge\u002Fblob\u002Fmain\u002Fskills\u002Fgemini\u002Fmodal\u002FSKILL.md",true,[47,53,57,61,65,69,73,77,81,85,89,93],{"path":48,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":51,"sourceHtmlUrl":52},"references\u002Fapi_reference.md","REFERENCE","参考文档",5080,"https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fai-skillforge\u002Fblob\u002Fmain\u002Fskills\u002Fgemini\u002Fmodal\u002Freferences\u002Fapi_reference.md",{"path":54,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":55,"sourceHtmlUrl":56},"references\u002Fexamples.md",7089,"https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fai-skillforge\u002Fblob\u002Fmain\u002Fskills\u002Fgemini\u002Fmodal\u002Freferences\u002Fexamples.md",{"path":58,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":59,"sourceHtmlUrl":60},"references\u002Ffunctions.md",5734,"https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fai-skillforge\u002Fblob\u002Fmain\u002Fskills\u002Fgemini\u002Fmodal\u002Freferences\u002Ffunctions.md",{"path":62,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":63,"sourceHtmlUrl":64},"references\u002Fgetting-started.md",4078,"https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fai-skillforge\u002Fblob\u002Fmain\u002Fskills\u002Fgemini\u002Fmodal\u002Freferences\u002Fgetting-started.md",{"path":66,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":67,"sourceHtmlUrl":68},"references\u002Fgpu.md",4501,"https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fai-skillforge\u002Fblob\u002Fmain\u002Fskills\u002Fgemini\u002Fmodal\u002Freferences\u002Fgpu.md",{"path":70,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":71,"sourceHtmlUrl":72},"references\u002Fimages.md",6137,"https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fai-skillforge\u002Fblob\u002Fmain\u002Fskills\u002Fgemini\u002Fmodal\u002Freferences\u002Fimages.md",{"path":74,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":75,"sourceHtmlUrl":76},"references\u002Fresources.md",2581,"https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fai-skillforge\u002Fblob\u002Fmain\u002Fskills\u002Fgemini\u002Fmodal\u002Freferences\u002Fresources.md",{"path":78,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":79,"sourceHtmlUrl":80},"references\u002Fscaling.md",4556,"https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fai-skillforge\u002Fblob\u002Fmain\u002Fskills\u002Fgemini\u002Fmodal\u002Freferences\u002Fscaling.md",{"path":82,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":83,"sourceHtmlUrl":84},"references\u002Fscheduled-jobs.md",3564,"https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fai-skillforge\u002Fblob\u002Fmain\u002Fskills\u002Fgemini\u002Fmodal\u002Freferences\u002Fscheduled-jobs.md",{"path":86,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":87,"sourceHtmlUrl":88},"references\u002Fsecrets.md",2874,"https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fai-skillforge\u002Fblob\u002Fmain\u002Fskills\u002Fgemini\u002Fmodal\u002Freferences\u002Fsecrets.md",{"path":90,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":91,"sourceHtmlUrl":92},"references\u002Fvolumes.md",5806,"https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fai-skillforge\u002Fblob\u002Fmain\u002Fskills\u002Fgemini\u002Fmodal\u002Freferences\u002Fvolumes.md",{"path":94,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":95,"sourceHtmlUrl":96},"references\u002Fweb-endpoints.md",5568,"https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fai-skillforge\u002Fblob\u002Fmain\u002Fskills\u002Fgemini\u002Fmodal\u002Freferences\u002Fweb-endpoints.md",[98,106,113,120,127,134],{"skillNo":99,"name":100,"nameZh":6,"description":101,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":102,"licenseFileUrl":6,"sourceHtmlUrl":103,"categories":104,"keywords":105,"publishedAt":19},"01M75GWTHWA52GYQKS347FF6CD","zarr-python","Chunked N-D arrays for cloud storage. Compressed arrays, parallel I\u002FO, S3\u002FGCS integration, NumPy\u002FDask\u002FXarray compatible, for large-scale scientific computing pipelines.","MIT","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fai-skillforge\u002Fblob\u002Fmain\u002Fskills\u002Fscientific\u002Fzarr-python\u002FSKILL.md",[],[],{"skillNo":107,"name":108,"nameZh":6,"description":109,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":102,"licenseFileUrl":6,"sourceHtmlUrl":110,"categories":111,"keywords":112,"publishedAt":19},"01M75GW9FBP9NAFBSNVJ23RHSX","what-if-oracle","Run structured What-If scenario analysis with multi-branch possibility exploration. Use this skill when the user asks speculative questions like \"what if...\", \"what would happen if...\", \"what are the possibilities\", \"explore scenarios\", \"scenario analysis\", \"possibility space\", \"what could go wrong\", \"best case \u002F worst case\", \"risk analysis\", \"contingency planning\", \"strategic options\", or any question about uncertain futures. Also trigger when the user faces a fork-in-the-road decision, wants to stress-test an idea, or needs to think through consequences before committing.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fai-skillforge\u002Fblob\u002Fmain\u002Fskills\u002Fscientific\u002Fwhat-if-oracle\u002FSKILL.md",[],[],{"skillNo":114,"name":115,"nameZh":6,"description":116,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":102,"licenseFileUrl":6,"sourceHtmlUrl":117,"categories":118,"keywords":119,"publishedAt":19},"01M75GW351MZZQ1V7207PDCX5D","venue-templates","Access comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fai-skillforge\u002Fblob\u002Fmain\u002Fskills\u002Fscientific\u002Fvenue-templates\u002FSKILL.md",[],[],{"skillNo":121,"name":122,"nameZh":6,"description":123,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":102,"licenseFileUrl":6,"sourceHtmlUrl":124,"categories":125,"keywords":126,"publishedAt":19},"01M75GVYGMAZDV2NHWSV6PP6TK","vaex","Use this skill for processing and analyzing large tabular datasets (billions of rows) that exceed available RAM. Vaex excels at out-of-core DataFrame operations, lazy evaluation, fast aggregations, efficient visualization of big data, and machine learning on large datasets. Apply when users need to work with large CSV\u002FHDF5\u002FArrow\u002FParquet files, perform fast statistics on massive datasets, create visualizations of big data, or build ML pipelines that do not fit in memory.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fai-skillforge\u002Fblob\u002Fmain\u002Fskills\u002Fscientific\u002Fvaex\u002FSKILL.md",[],[],{"skillNo":128,"name":129,"nameZh":6,"description":130,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":102,"licenseFileUrl":6,"sourceHtmlUrl":131,"categories":132,"keywords":133,"publishedAt":19},"01M75GVS0ADH3DZ3QB564EVYC9","usfiscaldata","Query the U.S. Treasury Fiscal Data API for federal financial data including national debt, government spending, revenue, interest rates, exchange rates, and savings bonds. Access 54 datasets and 182 data tables with no API key required. Use when working with U.S. federal fiscal data, national debt tracking (Debt to the Penny), Daily Treasury Statements, Monthly Treasury Statements, Treasury securities auctions, interest rates on Treasury securities, foreign exchange rates, savings bonds, or any U.S. government financial statistics.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fai-skillforge\u002Fblob\u002Fmain\u002Fskills\u002Fscientific\u002Fusfiscaldata\u002FSKILL.md",[],[],{"skillNo":135,"name":136,"nameZh":6,"description":137,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":102,"licenseFileUrl":6,"sourceHtmlUrl":138,"categories":139,"keywords":140,"publishedAt":19},"01M75GVDTBSXRQ4Q11RVJQC56M","treatment-plans","Generate concise (3-4 page), focused medical treatment plans in LaTeX\u002FPDF format for all clinical specialties. Supports general medical treatment, rehabilitation therapy, mental health care, chronic disease management, perioperative care, and pain management. Includes SMART goal frameworks, evidence-based interventions with minimal text citations, regulatory compliance (HIPAA), and professional formatting. Prioritizes brevity and clinical actionability.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fai-skillforge\u002Fblob\u002Fmain\u002Fskills\u002Fscientific\u002Ftreatment-plans\u002FSKILL.md",[],[]]