← Back to list

backend-async-tasks
by lmiguelvargasf
🌟 Modern full-stack template using Python (Litestar) and TypeScript (Next.js).
⭐ 2🍴 0📅 Jan 20, 2026
SKILL.md
name: backend-async-tasks description: > Use when creating or updating Celery tasks, async job logic, or Beat schedules in the backend.
Backend async tasks (Celery)
When to use
- You are adding or changing a Celery task in
backend/src/backend/apps/**/tasks.py. - You need to update the Celery Beat schedule in
backend/src/backend/celery_app.py. - You are adding DB access inside a Celery worker process.
Steps
- Define tasks only in a
tasks.pyfile under the relevant app module. - Decorate tasks with
@app.taskimported frombackend.celery_app. - Return a typed result (
int,None, etc.). Keep task-specific parameters local unless they must be environment-configured. - For DB access:
- Use
asyncio.run()to bridge async work. - Always acquire a session via
get_task_session()frombackend.celery_app.
- Use
- For periodic jobs, update
app.conf.beat_scheduleinbackend/src/backend/celery_app.pyand usecelery.schedules.crontab.
Constraints and guardrails
- Never use the global
alchemy_configengine inside a task; it is not fork-safe for Celery workers. - Always use
get_task_session()to manage DB connections safely across worker processes.
References
backend/src/backend/apps/**/tasks.pybackend/src/backend/celery_app.pybackend/tests/apps/users/test_tasks.py
Score
Total Score
65/100
Based on repository quality metrics
✓SKILL.md
SKILL.mdファイルが含まれている
+20
✓LICENSE
ライセンスが設定されている
+10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
✓最近の活動
1ヶ月以内に更新
+10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
✓タグ
1つ以上のタグが設定されている
+5
Reviews
💬
Reviews coming soon

