/celery:celery-config-patternsfrom celery
Provides production-ready Celery configuration templates for Django, Flask, FastAPI, and standalone Python apps with Redis/RabbitMQ broker setup, security best practices, and framework integration patterns.
Ships in celery. 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; scripts run unread.
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.
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
Use the detection script to identify the Python framework:
bash scripts/detect-framework.sh
Detects:
manage.py, settings.py)app.py)main.py)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 |
Choose broker configuration template:
Redis (Recommended for simplicity):
# Use templates/config-redis.py
CELERY_BROKER_URL = 'redis://localhost:6379/0'
CELERY_RESULT_BACKEND = 'redis://localhost:6379/0'
RabbitMQ (Recommended for production):
# Use templates/config-rabbitmq.py
CELERY_BROKER_URL = 'amqp://guest:guest@localhost:5672//'
CELERY_RESULT_BACKEND = 'rpc://'
Use the generation script:
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:
Run validation script before starting Celery:
bash scripts/validate-config.sh
Validates:
Verify broker connectivity:
bash scripts/test-broker-connection.sh
Tests:
Standalone Celery application without web framework integration.
Features:
Usage:
# celery_app.py
from celery import Celery
app = Celery('myapp')
app.config_from_object('celeryconfig')
@app.task
def add(x, y):
return x + y
Django-specific Celery configuration using Django settings.
Features:
Usage:
# 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()
Flask-specific Celery configuration with Flask app context.
Features:
Usage:
# 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)
FastAPI-specific Celery configuration with async support.
Features:
Usage:
# 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
Redis broker and result backend configuration.
Features:
Configuration:
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
RabbitMQ broker configuration with advanced routing.
Features:
Configuration:
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'},
}
Example task definitions with best practices.
Features:
Examples:
@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
Celery Beat periodic task scheduling.
Features:
Examples:
CELERY_BEAT_SCHEDULE = {
'cleanup-every-midnight': {
'task': 'app.tasks.cleanup',
'schedule': crontab(hour=0, minute=0),
},
'report-every-monday': {
'task': 'app.tasks.weekly_report',
'schedule': crontab(day_of_week=1, hour=9),
},
}
Validates Celery configuration for errors.
Usage:
bash scripts/validate-config.sh
bash scripts/validate-config.sh --config=celeryconfig.py
bash scripts/validate-config.sh --app=myapp.celery:app
Checks:
Exit Codes:
Detects Python web framework in current project.
Usage:
bash scripts/detect-framework.sh
bash scripts/detect-framework.sh /path/to/project
Output:
{
"framework": "django",
"version": "4.2.0",
"celery_location": "myproject/celery.py",
"settings_location": "myproject/settings.py"
}
Detection Logic:
manage.py and settings.pyapp.pymain.pyGenerates framework-specific Celery configuration.
Usage:
bash scripts/generate-config.sh --framework=django --broker=redis
bash scripts/generate-config.sh --framework=flask --broker=rabbitmq --output=celery_config.py
Options:
--framework: django, flask, fastapi, standalone--broker: redis, rabbitmq--output: Custom output file path--with-beat: Include Celery Beat configuration--with-monitoring: Include monitoring configurationGenerated Files:
.env.example with broker credentialsTests message broker connectivity.
Usage:
bash scripts/test-broker-connection.sh
bash scripts/test-broker-connection.sh redis://localhost:6379/0
bash scripts/test-broker-connection.sh amqp://guest:guest@localhost:5672//
Tests:
Output:
✓ Broker host is reachable
✓ Port 6379 is open
✓ Authentication successful
✓ Message publish successful
✓ Message consume successful
✓ Connection pool working
All tests passed!
See examples/django-setup.md for complete walkthrough:
myproject/celery.pysettings.pySee examples/flask-setup.md for complete walkthrough:
See examples/fastapi-setup.md for complete walkthrough:
See examples/standalone-setup.md for complete walkthrough:
All configuration templates and examples in this skill follow strict security rules:
Environment Variables:
your_redis_password_hereExample .env.example:
# Redis Configuration
CELERY_BROKER_URL=redis://:your_redis_password_here@localhost:6379/0
CELERY_RESULT_BACKEND=redis://:your_redis_password_here@localhost:6379/0
# RabbitMQ Configuration
CELERY_BROKER_URL=amqp://your_rabbitmq_user:your_rabbitmq_password@localhost:5672//
Code Examples:
# ALWAYS read from environment
import os
CELERY_BROKER_URL = os.getenv('CELERY_BROKER_URL', 'redis://localhost:6379/0')
Security Checklist:
Production Settings:
# Task execution
CELERY_TASK_SERIALIZER = 'json'
CELERY_RESULT_SERIALIZER = 'json'
CELERY_ACCEPT_CONTENT = ['json']
CELERY_TIMEZONE = 'UTC'
CELERY_ENABLE_UTC = True
# Performance
CELERY_WORKER_PREFETCH_MULTIPLIER = 4
CELERY_WORKER_MAX_TASKS_PER_CHILD = 1000
CELERY_BROKER_POOL_LIMIT = 10
# Reliability
CELERY_TASK_ACKS_LATE = True
CELERY_TASK_REJECT_ON_WORKER_LOST = True
CELERY_TASK_TIME_LIMIT = 300
CELERY_TASK_SOFT_TIME_LIMIT = 240
Development Settings:
# Easier debugging
CELERY_TASK_ALWAYS_EAGER = True
CELERY_TASK_EAGER_PROPAGATES = True
Broker Connection Failed:
# Test broker connectivity
bash scripts/test-broker-connection.sh
# Check broker is running
# Redis: redis-cli ping
# RabbitMQ: rabbitmqctl status
Tasks Not Discovered:
# Validate configuration
bash scripts/validate-config.sh
# Check task module paths
celery -A myapp inspect registered
Import Errors:
# Verify Python path includes project
export PYTHONPATH="${PYTHONPATH}:/path/to/project"
# Check Celery app is importable
python -c "from myapp.celery import app; print(app)"
Python Packages:
Framework-Specific:
Broker Requirements:
System Tools:
Skill Version: 1.0.0 Last Updated: 2025-11-16
examples/django-setup.md (opens in a new tab)examples/fastapi-setup.md (opens in a new tab)examples/flask-setup.md (opens in a new tab)examples/standalone-setup.md (opens in a new tab)scripts/detect-framework.sh (opens in a new tab)scripts/generate-config.sh (opens in a new tab)scripts/test-broker-connection.sh (opens in a new tab)scripts/validate-config.sh (opens in a new tab)templates/beat-schedule.py (opens in a new tab)templates/celery-app-django.py (opens in a new tab)templates/celery-app-fastapi.py (opens in a new tab)templates/celery-app-flask.py (opens in a new tab)templates/celery-app-standalone.py (opens in a new tab)templates/config-rabbitmq.py (opens in a new tab)templates/config-redis.py (opens in a new tab)templates/tasks-example.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
celery, task-queue, python-frameworks, broker-configuration, celery-beat
npx claudepluginhub vanman2024/ai-dev-marketplace --plugin celery10 skills in this plugin
/beat-schedulingPeriodic task scheduling patterns with Celery Beat (crontab, interval, solar). Use when configuring periodic tasks, setting up task schedules, implementing recurring jobs, configuring django-celery-beat, or creating dynamic schedules./broker-configurationsMessage broker setup patterns (Redis, RabbitMQ, SQS) for Celery including connection strings, SSL configuration, high availability, and production best practices. Use when configuring message brokers, setting up Redis/RabbitMQ/SQS, troubleshooting broker connections, implementing HA/failover, securing broker communications with SSL, or when user mentions broker setup, connection issues, sentinel, quorum queues, or AWS SQS integration./deployment-configsProduction deployment configurations for Celery workers and beat schedulers across Docker, Kubernetes, and systemd environments. Use when deploying Celery to production, containerizing workers, orchestrating with Kubernetes, setting up systemd services, configuring health checks, implementing graceful shutdowns, or when user mentions deployment, Docker, Kubernetes, systemd, production setup, or worker containerization./framework-integrationsDjango, Flask, FastAPI integration patterns for Celery. Use when integrating Celery with Django, Flask, or FastAPI, setting up framework-specific configurations, handling application contexts, managing database transactions with tasks, configuring async workers, or when user mentions Django Celery, Flask Celery, FastAPI background tasks, framework integration, or web framework task queues./monitoring-flowerFlower monitoring setup and configuration for Celery including real-time monitoring, authentication, custom dashboards, and Prometheus metrics integration. Use when setting up Celery monitoring, configuring Flower web UI, implementing authentication, creating custom dashboards, integrating with Prometheus, or when user mentions Flower, Celery monitoring, task monitoring, worker monitoring, or real-time metrics./result-backend-patternsResult backend configuration patterns for Celery including Redis, Database, and RPC backends with serialization, expiration policies, and performance optimization. Use when configuring result storage, troubleshooting result persistence, implementing custom serializers, migrating between backends, optimizing result expiration, or when user mentions result backends, task results, Redis backend, PostgreSQL results, result serialization, or backend migration.Other plugins' skills for the same job