agentleFS
dperezcabreradperezcabrera/pico-skills/.claude/skills/add-celery-task/SKILL.md

add-celery-task

Skill4 starsChanged 4 months agoMITView on GitHub

Add a Celery task with pico-celery. Use when creating background tasks, async workers, or task clients.

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Create a Celery task: $ARGUMENTS

    line 10
  2. Distinctive:

    Read the codebase to understand existing tasks and patterns, then create the task.

    line 12

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Add Celery Task

Create a Celery task: $ARGUMENTS

Read the codebase to understand existing tasks and patterns, then create the task.

Worker-Side Task

Worker methods must be async def. They are auto-registered by PicoTaskRegistrar at startup.

from pico_ioc import component
from pico_celery import task

@component
class ${ARGUMENTS}Worker:
    def __init__(self, service: SomeService):
        self.service = service

    @task("tasks.$ARGUMENTS")
    async def process(self, item_id: int) -> dict:
        result = await self.service.process(item_id)
        return {"status": "done", "item_id": item_id}

Client-Side Task Sender

The method body is never executed — calling it sends the task to the Celery broker and returns an AsyncResult.

from pico_celery import celery, send_task, CeleryClient

@celery
class ${ARGUMENTS}Client(CeleryClient):
    @send_task("tasks.$ARGUMENTS")
    def process(self, item_id: int):
        pass

Complete Example

# worker.py
from pico_ioc import component
from pico_celery import task

@component
class EmailWorker:
    def __init__(self, email_service: EmailService):
        self.email_service = email_service

    @task("notifications.send_email")
    async def send_email(self, to: str, subject: str, body: str) -> dict:
        await self.email_service.send(to=to, subject=subject, body=body)
        return {"sent_to": to}

# client.py
from pico_celery import celery, send_task, CeleryClient

@celery
class EmailClient(CeleryClient):
    @send_task("notifications.send_email")
    def send_email(self, to: str, subject: str, body: str):
        pass

# usage.py
@component
class OrderService:
    def __init__(self, email_client: EmailClient):
        self.email_client = email_client

    async def complete_order(self, order: Order):
        # ... business logic ...
        self.email_client.send_email(
            to=order.customer_email,
            subject="Order confirmed",
            body=f"Order {order.id} is confirmed",
        )

Checklist

  • Unique task name matching between @task and @send_task (e.g., "domain.action")
  • Worker method is async def
  • Client class extends CeleryClient and uses @celery decorator
  • Celery broker/backend configured in CelerySettings

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.