celery-config-patterns
Celery configuration templates for all frameworks (Django, Flask, FastAPI, standalone). Use when configuring Celery, setting up task queues, creating Celery apps, integrating with frameworks, or when user mentions Celery configuration, task queue setup, broker configuration, or framework integration.
What this skill does
# celery-config-patterns
Provides production-ready Celery configuration templates for all major Python frameworks (Django, Flask, FastAPI, standalone) with complete broker setup (Redis, RabbitMQ), security best practices, and framework-specific integration patterns.
## Use When
- Configuring Celery for the first time in any Python project
- Integrating Celery with Django, Flask, FastAPI, or standalone applications
- Setting up Redis or RabbitMQ as message broker
- Creating production-ready Celery configurations
- Implementing task routing and queue configurations
- Setting up monitoring and logging for Celery
- Migrating Celery configurations between frameworks
## Directory Structure
```
celery-config-patterns/
├── SKILL.md # This file
├── scripts/
│ ├── validate-config.sh # Validate Celery configuration
│ ├── detect-framework.sh # Auto-detect Python framework
│ ├── generate-config.sh # Generate framework-specific config
│ └── test-broker-connection.sh # Test broker connectivity
├── templates/
│ ├── celery-app-standalone.py # Standalone Celery app
│ ├── celery-app-django.py # Django Celery integration
│ ├── celery-app-flask.py # Flask Celery integration
│ ├── celery-app-fastapi.py # FastAPI Celery integration
│ ├── config-redis.py # Redis broker configuration
│ ├── config-rabbitmq.py # RabbitMQ broker configuration
│ ├── tasks-example.py # Sample task definitions
│ └── beat-schedule.py # Celery Beat schedule config
└── examples/
├── django-setup.md # Complete Django setup guide
├── flask-setup.md # Complete Flask setup guide
├── fastapi-setup.md # Complete FastAPI setup guide
└── standalone-setup.md # Standalone Python setup guide
```
## Instructions
### Step 1: Detect Framework
Use the detection script to identify the Python framework:
```bash
bash scripts/detect-framework.sh
```
**Detects:**
- Django (looks for `manage.py`, `settings.py`)
- Flask (looks for Flask imports, `app.py`)
- FastAPI (looks for FastAPI imports, `main.py`)
- Standalone (no framework detected)
### Step 2: Select Template
Based on framework detection, choose the appropriate template:
| Framework | Template | Integration File |
|-----------|----------|------------------|
| Django | `celery-app-django.py` | `projectname/celery.py` |
| Flask | `celery-app-flask.py` | `app/celery.py` or `celery.py` |
| FastAPI | `celery-app-fastapi.py` | `app/celery.py` or `celery.py` |
| Standalone | `celery-app-standalone.py` | `celery_app.py` |
### Step 3: Configure Broker
Choose broker configuration template:
**Redis** (Recommended for simplicity):
```python
# Use templates/config-redis.py
CELERY_BROKER_URL = 'redis://localhost:6379/0'
CELERY_RESULT_BACKEND = 'redis://localhost:6379/0'
```
**RabbitMQ** (Recommended for production):
```python
# Use templates/config-rabbitmq.py
CELERY_BROKER_URL = 'amqp://guest:guest@localhost:5672//'
CELERY_RESULT_BACKEND = 'rpc://'
```
### Step 4: Generate Configuration
Use the generation script:
```bash
bash scripts/generate-config.sh --framework=django --broker=redis
bash scripts/generate-config.sh --framework=flask --broker=rabbitmq
bash scripts/generate-config.sh --framework=fastapi --broker=redis
```
**Script will:**
1. Copy appropriate framework template
2. Apply broker configuration
3. Create environment file with placeholders
4. Add to .gitignore if needed
5. Generate setup documentation
### Step 5: Validate Configuration
Run validation script before starting Celery:
```bash
bash scripts/validate-config.sh
```
**Validates:**
- Celery app exists and is importable
- Broker connection is valid
- Configuration syntax is correct
- Required environment variables are set
- Task discovery paths are correct
### Step 6: Test Broker Connection
Verify broker connectivity:
```bash
bash scripts/test-broker-connection.sh
```
**Tests:**
- Broker URL is reachable
- Authentication credentials are valid
- Connection pool can be established
- Basic message routing works
## Template Descriptions
### celery-app-standalone.py
Standalone Celery application without web framework integration.
**Features:**
- Basic Celery app configuration
- Task autodiscovery from tasks.py
- Configurable broker and backend
- Logging setup
- Beat schedule integration
**Usage:**
```python
# celery_app.py
from celery import Celery
app = Celery('myapp')
app.config_from_object('celeryconfig')
@app.task
def add(x, y):
return x + y
```
### celery-app-django.py
Django-specific Celery configuration using Django settings.
**Features:**
- Reads configuration from Django settings
- Auto-discovers tasks in all installed apps
- Uses Django's database for result backend (optional)
- Integrates with Django logging
- Supports Django-celery-beat for periodic tasks
**Usage:**
```python
# myproject/celery.py
import os
from celery import Celery
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myproject.settings')
app = Celery('myproject')
app.config_from_object('django.conf:settings', namespace='CELERY')
app.autodiscover_tasks()
```
### celery-app-flask.py
Flask-specific Celery configuration with Flask app context.
**Features:**
- Flask app factory pattern support
- Celery app context integration
- Uses Flask configuration
- Compatible with Flask-Celery extensions
- Request context handling for tasks
**Usage:**
```python
# celery.py
from celery import Celery
def make_celery(app):
celery = Celery(app.import_name)
celery.conf.update(app.config)
return celery
# app.py
celery = make_celery(app)
```
### celery-app-fastapi.py
FastAPI-specific Celery configuration with async support.
**Features:**
- FastAPI lifespan event integration
- Async task support
- Pydantic model validation in tasks
- Background task coordination
- API endpoint integration examples
**Usage:**
```python
# celery.py
from celery import Celery
celery_app = Celery('fastapi_app')
celery_app.config_from_object('celeryconfig')
# main.py
from fastapi import FastAPI
from celery_app import celery_app
```
### config-redis.py
Redis broker and result backend configuration.
**Features:**
- Connection pooling
- SSL/TLS support
- Sentinel configuration
- Health checks
- Connection retry logic
**Configuration:**
```python
CELERY_BROKER_URL = 'redis://localhost:6379/0'
CELERY_RESULT_BACKEND = 'redis://localhost:6379/0'
CELERY_BROKER_CONNECTION_RETRY_ON_STARTUP = True
CELERY_REDIS_MAX_CONNECTIONS = 50
```
### config-rabbitmq.py
RabbitMQ broker configuration with advanced routing.
**Features:**
- Virtual host configuration
- Exchange and queue declarations
- Routing keys and bindings
- Dead letter queues
- Priority queues
**Configuration:**
```python
CELERY_BROKER_URL = 'amqp://user:pass@localhost:5672//'
CELERY_RESULT_BACKEND = 'rpc://'
CELERY_TASK_ROUTES = {
'app.tasks.critical': {'queue': 'critical'},
'app.tasks.normal': {'queue': 'default'},
}
```
### tasks-example.py
Example task definitions with best practices.
**Features:**
- Basic task examples
- Task with retry logic
- Task with rate limiting
- Task with time limits
- Task with custom routing
- Task with result expiration
**Examples:**
```python
@app.task(bind=True, max_retries=3)
def process_data(self, data):
try:
# Process data
return result
except Exception as exc:
raise self.retry(exc=exc, countdown=60)
@app.task(rate_limit='10/m')
def send_email(to, subject, body):
# Send email
pass
```
### beat-schedule.py
Celery Beat periodic task scheduling.
**Features:**
- Crontab schedules
- Interval schedules
- Solar schedules
- Task arguments and kwargs
- Timezone support
**Examples:**
```python
CELERY_BEAT_SCHEDULE = {
'cleanup-every-midnight': {
'task': 'app.tasks.cleanup',
'schedule': crontab(hour=0, minute=0),
},
'reRelated in Backend & APIs
jfrog
IncludedInteract with the JFrog Platform via the JFrog CLI and REST/GraphQL APIs. Use this skill when the user wants to manage Artifactory repositories, upload or download artifacts, manage builds, configure permissions, manage users and groups, work with access tokens, configure JFrog CLI servers, search artifacts, manage properties, set up replication, manage JFrog Projects, run security audits or scans, look up CVE details, query exposures scan results from JFrog Advanced Security, manage release bundles and lifecycle operations, aggregate or export platform data, or perform any JFrog Platform administration task. Also use when the user mentions jf, jfrog, artifactory, xray, distribution, evidence, apptrust, onemodel, graphql, workers, mission control, curation, advanced security, exposures, or any JFrog product name.
cupynumeric-migration-readiness
IncludedPre-migration readiness assessor for porting NumPy to cuPyNumeric. Use BEFORE substantial porting work begins when the user asks whether code will scale on GPU, whether they should migrate to cuPyNumeric, which NumPy patterns transfer cleanly, what must be refactored before porting, or mentions pre-port assessment, scaling analysis, or refactor planning. Inspect the user's source code, look up NumPy usage, cross-reference the cuPyNumeric API support manifest, and distinguish distributed-scaling-friendly patterns from blockers such as unsupported APIs, scalar synchronization, host round-trips, Python/object-heavy control flow, shape/data-dependent branching, and in-place mutation hazards. Produce a verdict of READY, LIGHT REFACTOR, SIGNIFICANT REFACTOR, or NOT RECOMMENDED, with concrete refactor pointers.
alibabacloud-data-agent-skill
IncludedInvoke Alibaba Cloud Apsara Data Agent for Analytics via CLI to perform natural language-driven data analysis on enterprise databases. Data Agent for Analytics is an intelligent data analysis agent developed by Alibaba Cloud Database team for enterprise users. It automatically completes requirement analysis, data understanding, analysis insights, and report generation based on natural language descriptions. This tool supports: discovering data resources (instances/databases/tables) managed in DMS, initiating query or deep analysis sessions, real-time progress tracking, and retrieving analysis conclusions and generated reports. Use this Skill when users need to query databases, analyze data trends, generate data reports, ask questions in natural language, or mention "Data Agent", "data analysis", "database query", "SQL analysis", "data insights".
token-optimizer
IncludedReduce OpenClaw token usage and API costs through smart model routing, heartbeat optimization, budget tracking, and native 2026.2.15 features (session pruning, bootstrap size limits, cache TTL alignment). Use when token costs are high, API rate limits are being hit, or hosting multiple agents at scale. The 4 executable scripts (context_optimizer, model_router, heartbeat_optimizer, token_tracker) are local-only — no network requests, no subprocess calls, no system modifications. Reference files (PROVIDERS.md, config-patches.json) document optional multi-provider strategies that require external API keys and network access if you choose to use them. See SECURITY.md for full breakdown.
resend-cli
IncludedUse this skill when the task is specifically about operating Resend from an AI agent, terminal session, or CI job via the official resend CLI: installing/authenticating the CLI, sending/listing/updating/cancelling emails, batch sends, domains and DNS, webhooks and local listeners, inbound receiving, contacts, topics, segments, broadcasts, templates, API keys, profiles, or debugging Resend CLI/API failures. Trigger on mentions of Resend CLI, `resend`, `resend doctor`, `resend emails send`, `resend domains`, `resend webhooks listen`, `resend emails receiving`, or agent-friendly terminal automation.
alibabacloud-odps-maxframe-coding
IncludedUse this skill for MaxFrame SDK development and documentation navigation on Alibaba Cloud MaxCompute (ODPS). Helps answer MaxFrame API, concept, official example, and supported pandas API questions; create data processing programs; read/write MaxCompute tables; debug jobs (remote or local); and build custom DPE runtime images. Trigger when users mention MaxFrame, MaxCompute with MaxFrame, ODPS table processing, DPE runtime, MaxFrame docs/examples, DataFrame/Tensor operations, or GPU runtime setup. Works for both English and Chinese queries about Alibaba Cloud data processing with MaxFrame.