workers

Generate Go background workers with Start/Stop lifecycle and cron scheduling.

4|1|Updated Apr 12, 2026
One-click install
npx skills add https://github.com/reliant-labs/forge --skill workers-reliant-labs
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: workers
Source: https://github.com/reliant-labs/forge/tree/main/internal/templates/project/skills/forge/workers
Command: npx skills add https://github.com/reliant-labs/forge --skill workers-reliant-labs

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It removes the repetitive setup work of building long-running background workers by providing a consistent lifecycle contract, test scaffolding, and configuration wiring in a single-binary Go project.

Core Features & Use Cases

  • Worker scaffolding with lifecycle contract: Generates a worker implementation with Start(ctx) that blocks until context cancellation and a Stop(ctx) hook for graceful shutdown cleanup.
  • Scheduled (cron) workers: Creates cron-based workers using a standard cron expression and ensures the scheduler is started and stopped inside Start.
  • Dependency wiring and project integration: Adds the worker to forge.yaml and instructs you to run generation so wiring is handled by pkg/app/bootstrap.go.
  • Testing support: Generates a basic lifecycle test and provides patterns for verifying message processing using mock dependencies.

Quick Start

Add a cron-scheduled worker named cleanup by running the command: forge add worker cleanup --kind cron --schedule "0 */6 * * *".

Frequently Asked Questions about workers

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I scaffold a Go background worker with graceful shutdown and context cancellation?▼

You can scaffold a Go background worker with graceful shutdown by generating an implementation where Start(ctx) blocks until context cancellation and Stop(ctx) performs deadline-bound cleanup. This enforces a consistent lifecycle contract for long-running tasks.

How do I create a cron-scheduled worker in a single-binary Go project?▼

Create a cron-scheduled worker by specifying a cron expression during scaffolding. The generated code starts and stops the scheduler inside the Start(ctx) block, allowing periodic maintenance jobs to participate cleanly in the single-binary runtime.

Does generated worker scaffolding include test patterns for Go background tasks?▼

Yes, worker scaffolding includes testing support by generating a basic lifecycle test and providing patterns for verifying message processing using mock dependencies, ensuring your background tasks behave correctly during startup and shutdown.

How do I wire a new background worker into my Go project's bootstrap configuration?▼

Wiring a new background worker involves adding its metadata to forge.yaml and running the generation command. This process integrates the worker's lifecycle hooks directly through pkg/app/bootstrap.go for automatic dependency injection.

What's the best way to handle queue consumers and periodic batch processing in Go?▼

The best way to handle queue consumers and periodic batch processing is using a consistent Start/Stop lifecycle contract. This ensures long-running Go tasks block correctly during execution and perform deadline-bound cleanup upon context cancellation.