django-celery-expert by vintasoftware/django-ai-plugins
npx skills add https://github.com/vintasoftware/django-ai-plugins --skill django-celery-expert根据请求识别任务类别:
references/django-integration.mdreferences/task-design-patterns.mdreferences/configuration-guide.mdreferences/error-handling.mdreferences/periodic-tasks.mdreferences/monitoring-observability.md广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
references/production-deployment.md如果请求涉及多个类别,请在继续之前阅读所有相关的参考文件。
阅读在步骤 1 中确定的每个参考文件。未阅读相关参考文件前,请勿继续实施。
应用参考文件中的模式。在呈现解决方案之前,请验证:
请求: "在用户注册后在后台发送欢迎邮件"
# tasks.py
from celery import shared_task
from django.core.mail import send_mail
@shared_task(bind=True, max_retries=3)
def send_welcome_email(self, user_id):
from users.models import User
try:
user = User.objects.get(id=user_id)
send_mail(
subject="Welcome!",
message=f"Hi {user.name}, welcome to our platform!",
from_email="noreply@example.com",
recipient_list=[user.email],
)
except User.DoesNotExist:
pass
except Exception as exc:
raise self.retry(exc=exc, countdown=60 * (2 ** self.request.retries))
# views.py — 仅在事务提交后入队
from django.db import transaction
def register(request):
user = User.objects.create(...)
transaction.on_commit(lambda: send_welcome_email.delay(user.id))
return redirect("dashboard")
请求: "处理一个大型 CSV 导入,并提供进度更新"
@shared_task(bind=True)
def import_csv(self, file_path, total_rows):
from myapp.models import Record
with open(file_path) as f:
reader = csv.DictReader(f)
for i, row in enumerate(reader):
Record.objects.create(**row)
if i % 100 == 0:
self.update_state(
state="PROGRESS",
meta={"current": i, "total": total_rows},
)
return {"status": "complete", "processed": total_rows}
# 轮询进度
result = import_csv.AsyncResult(task_id)
if result.state == "PROGRESS":
progress = result.info.get("current", 0) / result.info.get("total", 1)
请求: "处理订单:验证库存、扣款支付、然后发送确认"
from celery import chain
@shared_task
def validate_inventory(order_id):
order = Order.objects.get(id=order_id)
if not order.items_in_stock():
raise ValueError("Items out of stock")
return order_id
@shared_task
def charge_payment(order_id):
order = Order.objects.get(id=order_id)
order.charge()
return order_id
@shared_task
def send_confirmation(order_id):
Order.objects.get(id=order_id).send_confirmation_email()
def process_order(order_id):
chain(
validate_inventory.s(order_id),
charge_payment.s(),
send_confirmation.s(),
).delay()
每周安装量
336
代码仓库
GitHub 星标数
30
首次出现
2026年1月21日
安全审计
安装于
opencode265
codex259
gemini-cli258
github-copilot251
amp211
cursor211
Identify the task category from the request:
references/django-integration.mdreferences/task-design-patterns.mdreferences/configuration-guide.mdreferences/error-handling.mdreferences/periodic-tasks.mdreferences/monitoring-observability.mdreferences/production-deployment.mdIf the request spans multiple categories, read all relevant reference files before continuing.
Read each reference file identified in Step 1. Do not proceed to implementation without reading the relevant reference.
Apply the patterns from the reference file. Before presenting the solution, verify:
Request: "Send welcome emails in the background after user registration"
# tasks.py
from celery import shared_task
from django.core.mail import send_mail
@shared_task(bind=True, max_retries=3)
def send_welcome_email(self, user_id):
from users.models import User
try:
user = User.objects.get(id=user_id)
send_mail(
subject="Welcome!",
message=f"Hi {user.name}, welcome to our platform!",
from_email="noreply@example.com",
recipient_list=[user.email],
)
except User.DoesNotExist:
pass
except Exception as exc:
raise self.retry(exc=exc, countdown=60 * (2 ** self.request.retries))
# views.py — queue only after the transaction commits
from django.db import transaction
def register(request):
user = User.objects.create(...)
transaction.on_commit(lambda: send_welcome_email.delay(user.id))
return redirect("dashboard")
Request: "Process a large CSV import with progress updates"
@shared_task(bind=True)
def import_csv(self, file_path, total_rows):
from myapp.models import Record
with open(file_path) as f:
reader = csv.DictReader(f)
for i, row in enumerate(reader):
Record.objects.create(**row)
if i % 100 == 0:
self.update_state(
state="PROGRESS",
meta={"current": i, "total": total_rows},
)
return {"status": "complete", "processed": total_rows}
# Poll progress
result = import_csv.AsyncResult(task_id)
if result.state == "PROGRESS":
progress = result.info.get("current", 0) / result.info.get("total", 1)
Request: "Process an order: validate inventory, charge payment, then send confirmation"
from celery import chain
@shared_task
def validate_inventory(order_id):
order = Order.objects.get(id=order_id)
if not order.items_in_stock():
raise ValueError("Items out of stock")
return order_id
@shared_task
def charge_payment(order_id):
order = Order.objects.get(id=order_id)
order.charge()
return order_id
@shared_task
def send_confirmation(order_id):
Order.objects.get(id=order_id).send_confirmation_email()
def process_order(order_id):
chain(
validate_inventory.s(order_id),
charge_payment.s(),
send_confirmation.s(),
).delay()
Weekly Installs
336
Repository
GitHub Stars
30
First Seen
Jan 21, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode265
codex259
gemini-cli258
github-copilot251
amp211
cursor211
agent-browser 浏览器自动化工具 - Vercel Labs 命令行网页操作与测试
140,500 周安装
React useEffect 使用指南:何时需要与何时避免 Effect 的最佳实践
272 周安装
Seedance 2.0 分镜提示词生成器 - AI视频创作助手,多模态输入生成专业分镜
272 周安装
App Store Connect ASO 审核工具:自动化元数据检查和关键词差距分析
272 周安装
SQLAlchemy Alembic 专家最佳实践与代码审查指南 - 生产级数据库迁移优化
272 周安装
Django部署Google Cloud SQL PostgreSQL教程:10分钟快速配置与生产环境设置
272 周安装
代码复杂度分析工具:Python/Go代码质量检测与重构指南
273 周安装