跳到正文
cccskills
免费在 GitHub 公开

workflow-automation

Architect durable, event-driven workflows using step functions, retry strategies, idempotency, fan-out patterns, and the critical differences between orchestration approaches.

中文简介正在准备中。当前显示原文说明。

集成工具Redis
查看安装方法

包含的文件(3)

  • SKILL.md5.7 KB
  • references/inngest.md2.2 KB
  • references/temporal.md1.8 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Workflow Automation

You are a workflow architect who understands the fundamental tradeoff: simplicity vs. correctness. Every workflow platform sits somewhere on that spectrum. Your job is to pick the right point for the user's situation and implement it correctly.

When to Use

  • Background jobs that must complete even if the server restarts
  • Multi-step processes where partial completion is worse than failure (payments, onboarding)
  • Event-driven architectures where one event triggers multiple independent reactions
  • Scheduled/recurring tasks that need observability and retry guarantees
  • Any process where "it probably ran" is not acceptable

When NOT to Use

  • Simple fire-and-forget tasks (use a queue or a delay)
  • Synchronous request-response flows
  • Tasks under 100ms that don't involve external services

Ecosystem-Specific References

After reading the methodology below, read the reference matching your orchestration platform:

PlatformReferenceBest For
Inngestreferences/inngest.mdServerless, event-driven, fast shipping
Temporalreferences/temporal.mdComplex orchestration, human-in-the-loop
BullMQreferences/bullmq.mdSimple job queues, rate limiting, Redis stack

Core Concept: Durable Execution

Wrap each unit of work in a step, so the system can retry, resume, and checkpoint independently.

Without durable execution:
  fetch data → process → save → send email
           ↑ server crashes here
           ↓ entire pipeline reruns from scratch
           ↓ customer gets duplicate email

With durable execution:
  step("fetch")   ✓ saved
  step("process") ✓ saved
  step("save")    ← server crashes here
  step("save")    ← retries ONLY this step
  step("email")   ✓ runs once

Platform Decision Matrix

FactorInngestTemporalBullMQ
ComplexityLow (serverless functions)High (workers + server)Medium (Redis-backed)
DurabilitySteps checkpointedFull workflow replayJob-level retry
InfrastructureManaged or self-hostedRequires Temporal ServerRequires Redis
Best forServerless, event-drivenComplex orchestrationSimple job queues
Learning curve1-2 days1-2 weeks1-2 days
Language supportTS, Python, GoTS, Go, Java, Python, .NETTS/JS only

Decision Rules

  1. Serverless + event-driven? → Inngest
  2. Complex orchestration, human-in-the-loop, multi-day? → Temporal
  3. Simple job queue, Redis already in stack? → BullMQ
  4. Team of 1-3, shipping fast? → Inngest
  5. Enterprise, compliance-heavy, Java/.NET stack? → Temporal

Pattern 1: Sequential Steps

Each step depends on the previous result. Steps checkpoint independently.

step("create-db-record")       → returns user
step("create-stripe-customer") → uses user.email
step("send-welcome-email")     → uses user.email

If step 2 fails, only step 2 retries. Steps 1 and 3 are not re-executed.


Pattern 2: Fan-Out (Parallel Execution)

One event triggers multiple independent workflows. Each runs and retries independently.

Event: user/signup.completed
  → Workflow A: send-welcome-email   (independent)
  → Workflow B: create-stripe-trial  (independent)
  → Workflow C: provision-workspace  (independent)

If Workflow B fails, Workflows A and C are unaffected.


Pattern 3: Idempotency

Prevent duplicate execution when the same event fires twice.

Rule: Idempotency at the workflow level AND the external call level. Belt and suspenders.

  • Workflow level: Deduplicate by event ID or business key (e.g., order ID)
  • External call level: Use idempotency keys on payment APIs, email sends, etc.

Pattern 4: Scheduled/Recurring

Cron-triggered workflows with observability:

  • Scheduled trigger (e.g., daily at 9am)
  • Steps checkpoint independently
  • Failed runs are visible, retriable, and alertable

Pattern 5: Human-in-the-Loop

Workflows that pause and wait for external input — approval flows, multi-day processes.

workflow: purchaseWorkflow(amount)
  if amount > threshold:
    pause and wait for approval signal (up to 72h)
    if no approval → deny
  continue with purchase

Sharp Edges

IssueSeverityRule
No idempotency keys on external callsCriticalALWAYS use idempotency keys for payments, emails, mutations
Side effects in workflow code (Temporal)CriticalWorkflows must be deterministic — no I/O, no random, no clock
Giant payloads in step resultsHighSteps serialize data — keep under 256KB
No timeouts on activitiesHighALWAYS set timeouts — default infinite hangs forever
Linear retry without backoffMediumALWAYS use exponential backoff
Missing dead letter handlingHighFailed-after-all-retries jobs need a destination
Monolithic workflowsMediumBreak workflows >10 steps into child workflows

Anti-Patterns

Don'tDo
setTimeout(fn, 3600000) for delaysPlatform sleep — survives restarts
Global variables for workflow stateStep results and explicit state passing
Retry loops in application codePlatform-level retry policies
Polling in a loop for completionEvent-driven triggers or workflow signals
One giant function with all logicDecompose into steps/activities

Related Skills

Works with: error-handling-patterns, deployment-procedures

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Audit and improve web accessibility following WCAG 2.1 guidelines. Use when asked to "improve accessibility", "a11y audit", "WCAG compliance", "screen reader support", "keyboard navigation", or "make accessible".

中文简介正在准备中。当前显示原文说明。

RepairYourTech/cfsa-antigravity62026年8月16日 更新

Structured methodology for adversarial thinking — generating attack scenarios, abuse cases, race conditions, and security edge cases against specs and implementations. Produces spec-level gap items, not code-level fixes.

中文简介正在准备中。当前显示原文说明。

RepairYourTech/cfsa-antigravity62026年8月16日 更新

Orchestrate multiple Antigravity skills through guided workflows for SaaS MVP delivery, security audits, AI agent builds, and browser QA.

中文简介正在准备中。当前显示原文说明。

RepairYourTech/cfsa-antigravity62026年8月16日 更新

Master REST and GraphQL API design principles to build intuitive, scalable, and maintainable APIs that delight developers. Use when designing new APIs, reviewing API specifications, or establishing API design standards.

中文简介正在准备中。当前显示原文说明。

RepairYourTech/cfsa-antigravity62026年8月16日 更新

Manage API versioning and evolution with URL/header/query strategies, deprecation workflows, breaking change classification, sunset headers, and consumer-driven contract testing. Use when designing versioning strategy, deprecating endpoints, or evolving API contracts.

中文简介正在准备中。当前显示原文说明。

RepairYourTech/cfsa-antigravity62026年8月16日 更新

Analyzes codebase structure, data flow, module relationships, and key patterns to generate and maintain a living architecture document (ARCHITECTURE.md).

中文简介正在准备中。当前显示原文说明。

RepairYourTech/cfsa-antigravity62026年8月16日 更新

查看 RepairYourTech 的全部技能

报告此技能的问题