Source profileQuality 87/100

lobehub/lobehub/.agents/skills/upstash-workflow/SKILL.md

upstash-workflow

LobeHub Upstash Workflow and QStash guide. Use for async workflows, process/paginate/execute fan-out, serve handlers, context.run/call/sleep, or workflow triggers.

Source repository stars
81,246
Declared platforms
0
Static risk flags
1
Last source update
2026-08-04
Source checked
2026-08-04

Decision brief

What it does—and where it fits

Standard patterns for implementing Upstash Workflow + QStash async workflows in the LobeHub codebase.

Best for

    Not for

    • Tasks that require unconfirmed production actions or broad system permissions.
    • Environments where the pinned source and install steps cannot be inspected.

    Compatibility matrix

    Platform support, with evidence labels

    PlatformStatusEvidenceWhat to check
    CodexNot declaredNo explicit evidencePortability before use
    Claude CodeNot declaredNo explicit evidencePortability before use
    CursorNot declaredNo explicit evidencePortability before use
    Gemini CLINot declaredNo explicit evidencePortability before use
    Open the compatibility checker

    Installation

    Inspect first. Install second.

    The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.

    Source-detected install commandSource
    npx skills add https://github.com/lobehub/lobehub --skill ".agents/skills/upstash-workflow"
    Safe inspection promptEditorial

    Inspect the Agent Skill "upstash-workflow" from https://github.com/lobehub/lobehub/blob/eb65d06d050732503da3be00f2902dc4483f53bd/.agents/skills/upstash-workflow/SKILL.md at commit eb65d06d050732503da3be00f2902dc4483f53bd. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.

    Workflow

    What the source asks the agent to do

    1. 01

      Implementation

      [ ] Define payload types with TypeScript interfaces

      [ ] Define payload types with TypeScript interfaces[ ] Create workflow class with static trigger methods[ ] Layer 1: entry point with dry-run support
    2. 02

      🎯 The Three Core Patterns

      Every workflow in LobeHub combines these three patterns. They exist because the platform constrains you in three ways: rate limits make blind fan-out dangerous, step limits cap a single workflow's size, and idempotency demands that retries don't double-process.

      🔍 Dry-Run Mode — get statistics without triggering actual execution🌟 Fan-Out Pattern — split large batches into smaller chunks for parallel processing🎯 Single Task Execution — each workflow execution processes exactly ONE item
    3. 03

      Architecture Overview

      All workflows follow the same 3-layer architecture:

      All workflows follow the same 3-layer architecture:Real examples in this codebase: welcome-placeholder, agent-welcome — see references/examples.md.
    4. 04

      The Three Patterns in 60 Seconds

      Short-circuit Layer 1 before any side effects so callers can preview what would happen:

      Short-circuit Layer 1 before any side effects so callers can preview what would happen:Use case: check how many items will be processed before committing.Layer 2 splits oversized batches into chunks and recursively re-triggers itself with each chunk. This avoids hitting workflow step limits when one page contains too many items:
    5. 05

      1. Dry-Run Mode

      Short-circuit Layer 1 before any side effects so callers can preview what would happen:

      Short-circuit Layer 1 before any side effects so callers can preview what would happen:Use case: check how many items will be processed before committing.

    Permission review

    Static risk signals and limitations

    Network access

    medium · line 139

    The documentation includes network, browsing, or remote request actions.

    APP_URL=https://your-app.com # Base URL for workflow endpoints

    Network access

    medium · line 143

    The documentation includes network, browsing, or remote request actions.

    QSTASH_URL=https://custom-qstash.com

    Evidence record

    Why each signal appears

    EvidenceSourceComputedTestedEditorial
    SignalValueEvidence typeMeaning
    Quality score87/100ComputedDocumentation, specificity, maintenance, and trust rules
    Repository stars81,246SourceRepository attention, not individual Skill quality
    Compatibility0 platformsSourceDeclared in the catalog source record
    Usage guideautomated source guideEditorialGenerated or reviewed according to the visible evidence level

    Pinned source

    Provenance and original SKILL.md

    Repository
    lobehub/lobehub
    Skill path
    .agents/skills/upstash-workflow/SKILL.md
    Commit
    eb65d06d050732503da3be00f2902dc4483f53bd
    License
    NOASSERTION
    Collected
    2026-08-04
    Default branch
    canary
    View the original SKILL.md

    Upstash Workflow Implementation Guide

    Standard patterns for implementing Upstash Workflow + QStash async workflows in the LobeHub codebase.

    🎯 The Three Core Patterns

    Every workflow in LobeHub combines these three patterns. They exist because the platform constrains you in three ways: rate limits make blind fan-out dangerous, step limits cap a single workflow's size, and idempotency demands that retries don't double-process.

    1. 🔍 Dry-Run Mode — get statistics without triggering actual execution
    2. 🌟 Fan-Out Pattern — split large batches into smaller chunks for parallel processing
    3. 🎯 Single Task Execution — each workflow execution processes exactly ONE item

    Architecture Overview

    All workflows follow the same 3-layer architecture:

    Layer 1: Entry Point (process-*)
      ├─ Validates prerequisites
      ├─ Calculates total items to process
      ├─ Filters existing items
      ├─ Supports dry-run mode (statistics only)
      └─ Triggers Layer 2 if work is needed
    
    Layer 2: Pagination (paginate-*)
      ├─ Handles cursor-based pagination
      ├─ Implements fan-out for large batches
      ├─ Recursively processes all pages
      └─ Triggers Layer 3 for each item
    
    Layer 3: Single Task Execution (execute-* / generate-*)
      └─ Performs actual business logic for ONE item
    

    Real examples in this codebase: welcome-placeholder, agent-welcome — see references/examples.md.


    The Three Patterns in 60 Seconds

    1. Dry-Run Mode

    Short-circuit Layer 1 before any side effects so callers can preview what would happen:

    if (dryRun) {
      return {
        ...result,
        dryRun: true,
        message: `[DryRun] Would process ${itemsNeedingProcessing.length} items`,
      };
    }
    

    Use case: check how many items will be processed before committing.

    2. Fan-Out Pattern

    Layer 2 splits oversized batches into chunks and recursively re-triggers itself with each chunk. This avoids hitting workflow step limits when one page contains too many items:

    const CHUNK_SIZE = 20;
    
    if (itemIds.length > CHUNK_SIZE) {
      const chunks = chunk(itemIds, CHUNK_SIZE);
      await Promise.all(
        chunks.map((ids, idx) =>
          context.run(`workflow:fanout:${idx + 1}/${chunks.length}`, () =>
            WorkflowClass.triggerPaginateItems({ itemIds: ids }),
          ),
        ),
      );
    }
    

    Defaults: PAGE_SIZE = 50 (items per page), CHUNK_SIZE = 20 (items per fan-out chunk).

    3. Single Task Execution

    Layer 3 always processes exactly one item per invocation. Parallelism comes from Layer 2 fanning out to many Layer 3 invocations, controlled by flowControl:

    export const { POST } = serve<ExecutePayload>(
      async (context) => {
        const { itemId } = context.requestPayload ?? {};
        if (!itemId) return { success: false, error: 'Missing itemId' };
    
        const item = await context.run('workflow:get-item', () => getItem(itemId));
        const result = await context.run('workflow:execute', () => processItem(item));
        await context.run('workflow:save', () => saveResult(itemId, result));
    
        return { success: true, itemId, result };
      },
      {
        flowControl: { key: 'workflow.execute', parallelism: 10, ratePerSecond: 5 },
      },
    );
    

    File Structure

    src/
    ├── app/(backend)/api/workflows/
    │   └── {workflow-name}/
    │       ├── process-{entities}/route.ts      # Layer 1
    │       ├── paginate-{entities}/route.ts     # Layer 2
    │       └── execute-{entity}/route.ts        # Layer 3
    │
    └── server/workflows/
        └── {workflowName}/
            └── index.ts                          # Workflow class
    

    Where to Go Next

    Pick the reference that matches what you're doing:

    You want to...Read
    Write the Workflow class + 3 routes from scratchreferences/implementation.md
    Tune flowControl, error handling, logging, testingreferences/best-practices.md
    See two real workflows end-to-endreferences/examples.md
    Deploy on lobehub-cloud (re-exports, cloud-only ops)references/cloud.md

    Environment Variables

    # Required for all workflows
    APP_URL=https://your-app.com # Base URL for workflow endpoints
    QSTASH_TOKEN=qstash_xxx      # QStash authentication token
    
    # Optional (for custom QStash URL)
    QSTASH_URL=https://custom-qstash.com
    

    Checklist for New Workflows

    Planning

    • Identify the entity to process (users, agents, items, …)
    • Define the per-item business logic
    • Determine filtering logic (Redis cache, database state, …)

    Implementation

    • Define payload types with TypeScript interfaces
    • Create workflow class with static trigger methods
    • Layer 1: entry point with dry-run support
    • Layer 1: filtering logic to avoid duplicate work
    • Layer 2: pagination with fan-out
    • Layer 3: single-task execution (ONE item per run)
    • Configure appropriate flowControl for each layer
    • Consistent logging with workflow prefixes
    • Validate all required payload parameters
    • Unique context.run() step names

    Quality & Deployment

    • Return consistent response shapes
    • Configure cloud deployment (references/cloud.md if on lobehub-cloud)
    • Write integration tests (dryRun path + full path)
    • Smoke-test with dry-run first
    • Test with a small batch before full rollout

    Additional Resources

    Alternatives

    Compare before choosing

    Computed 9647,525

    prisma/prisma

    prisma-8-migration-review

    Review what Prisma Next migrations will run on merge or deploy, render the migration graph, resolve concurrent / diamond-convergence conflicts, and configure environment refs for CI. Use for "what migrations are going to run", "what runs on deploy", merge conflict, diamond convergence, concurrent migrations, migration status, ref management, staging, production, MIGRATION.DIVERGED, MIGRATION.NO_MARKER, MIGRATION.MARKER_NOT_IN_HISTORY, prisma migrate status, prisma migrate diff, prisma migrate re

    Computed 9618,447

    teng-lin/notebooklm-py

    notebooklm

    Complete API for Google NotebookLM - full programmatic access including features not in the web UI. Create notebooks, add sources, generate all artifact types, download in multiple formats. Activates on explicit /notebooklm or intent like "create a podcast about X"

    Computed 9614,225

    wanshuiyin/Auto-claude-code-research-in-sleep

    grant-proposal

    Use it for deployment and design tasks; the detail page covers purpose, installation, and practical steps.

    Computed 9610,895

    huggingface/skills

    huggingface-lora-space-builder

    Build and publish a Gradio demo on Hugging Face Spaces for a user-provided LoRA. Use when someone asks to create, generate, ship, or publish a Space, demo, Gradio app, or playground for a LoRA — including LoRAs for Qwen-Image, Qwen-Image-Edit, LTX-Video, Wan, FLUX, SDXL, or other diffusion base models. Also triggers when someone describes a LoRA they trained or hosts on the Hub and wants to share it. Covers picking the right base pipeline and `diffusers` inference recipe, designing a UI tailored