workflow-orchestration-patterns
wshobson/agents
Reference guide for designing reliable, deterministic Temporal workflows and idempotent activities.
What is workflow-orchestration-patterns?
This skill provides reference guidance and best practices for designing durable workflows with Temporal, covering when to use workflow orchestration, the separation between workflows and activities, determinism constraints, saga patterns for distributed transactions, and operational concerns like monitoring and scalability. Use it when architecting long-running processes, distributed transactions, or microservice orchestration systems.
- Defines when workflow orchestration is appropriate vs when to use simpler alternatives like direct APIs or batch tools
- Explains the separation of concerns between workflows (deterministic orchestration) and activities (idempotent external calls)
- Documents determinism constraints and common workflow violations to avoid
- Covers saga pattern usage for distributed transactions
- Lists best practices for workflow design, activity design, and operational monitoring/scalability
- Points to a references/details.md file with detailed patterns and worked examples
How to install workflow-orchestration-patterns
npx skills add https://github.com/wshobson/agents --skill workflow-orchestration-patterns- Familiarity with Temporal (or similar durable workflow execution engines) concepts such as workflows, activities, and workers
- A distributed system or microservice architecture where long-running or multi-step processes need reliable orchestration
How to use workflow-orchestration-patterns
- 1.Identify whether your use case fits ideal scenarios (multi-step distributed processes, long-running workflows, distributed transactions, human-in-the-loop approvals) rather than simple CRUD or stateless APIs.
- 2.Separate your system design into workflows (deterministic orchestration logic) and activities (idempotent external calls), per the workflow vs activity boundary guidance.
- 3.Apply the workflow design best practices: keep workflows single-responsibility, use child workflows for scalability, and test locally with a time-skipping test environment.
- 4.Apply activity design best practices: make operations idempotent, keep them short-lived, configure timeouts, use heartbeats for long tasks, and classify retryable vs non-retryable errors.
- 5.Consult references/details.md for detailed patterns and worked examples (e.g., saga pattern) when the top-level guidance isn't enough.
- 6.Set up monitoring for workflow execution duration, activity failure rates, retry attempts, and pending workflow counts, and plan scalability via worker scaling, task queue partitioning, and child workflow decomposition.
Use cases
- Architecting a multi-step order fulfillment or booking process spanning multiple services with automatic state persistence
- Implementing distributed transactions with all-or-nothing semantics using the saga pattern
- Building long-running business processes (hours to years) such as campaign management or approval workflows
- Designing human-in-the-loop systems that require timeouts and escalations
- Automating infrastructure pipelines like CI/CD, provisioning, or deployments with reliable failure recovery
- Backend/distributed systems engineers building microservice orchestration
- Engineers adopting Temporal for long-running or fault-tolerant workflows
- Architects designing distributed transaction handling (saga pattern) across services
- Teams implementing CI/CD or infrastructure automation pipelines requiring durable execution
workflow-orchestration-patterns FAQ
Workflows handle orchestration logic and must be deterministic; activities perform external calls (API requests, DB writes) and must be idempotent since they can be retried.
Avoid it for simple CRUD operations, pure data processing pipelines (use Airflow/batch tools instead), stateless request/response APIs, or real-time streaming (use Kafka or event processors).
Using datetime.now() instead of workflow.now(), introducing threading/async in workflow code, calling external APIs directly from a workflow, and other non-deterministic logic.
It's referenced for implementing distributed transactions requiring all-or-nothing semantics across multiple services, with a pointer to Temporal's official saga pattern blog post.
The top-level SKILL.md provides navigation and best practices; detailed patterns and worked examples are in a separate references/details.md file included with the skill.
Full instructions (SKILL.md)
Source of truth, from wshobson/agents.
name: workflow-orchestration-patterns description: Design durable workflows with Temporal for distributed systems. Covers workflow vs activity separation, saga patterns, state management, and determinism constraints. Use when building long-running processes, distributed transactions, or microservice orchestration.
Workflow Orchestration Patterns
Master workflow orchestration architecture with Temporal, covering fundamental design decisions, resilience patterns, and best practices for building reliable distributed systems.
When to Use Workflow Orchestration
Ideal Use Cases (Source: docs.temporal.io)
- Multi-step processes spanning machines/services/databases
- Distributed transactions requiring all-or-nothing semantics
- Long-running workflows (hours to years) with automatic state persistence
- Failure recovery that must resume from last successful step
- Business processes: bookings, orders, campaigns, approvals
- Entity lifecycle management: inventory tracking, account management, cart workflows
- Infrastructure automation: CI/CD pipelines, provisioning, deployments
- Human-in-the-loop systems requiring timeouts and escalations
When NOT to Use
- Simple CRUD operations (use direct API calls)
- Pure data processing pipelines (use Airflow, batch processing)
- Stateless request/response (use standard APIs)
- Real-time streaming (use Kafka, event processors)
Detailed patterns and worked examples
Detailed pattern documentation lives in references/details.md. Read that file when the navigation tier above is insufficient.
Best Practices
Workflow Design
- Keep workflows focused - Single responsibility per workflow
- Small workflows - Use child workflows for scalability
- Clear boundaries - Workflow orchestrates, activities execute
- Test locally - Use time-skipping test environment
Activity Design
- Idempotent operations - Safe to retry
- Short-lived - Seconds to minutes, not hours
- Timeout configuration - Always set timeouts
- Heartbeat for long tasks - Report progress
- Error handling - Distinguish retryable vs non-retryable
Common Pitfalls
Workflow Violations:
- Using
datetime.now()instead ofworkflow.now() - Threading or async operations in workflow code
- Calling external APIs directly from workflow
- Non-deterministic logic in workflows
Activity Mistakes:
- Non-idempotent operations (can't handle retries)
- Missing timeouts (activities run forever)
- No error classification (retry validation errors)
- Ignoring payload limits (2MB per argument)
Operational Considerations
Monitoring:
- Workflow execution duration
- Activity failure rates
- Retry attempts and backoff
- Pending workflow counts
Scalability:
- Horizontal scaling with workers
- Task queue partitioning
- Child workflow decomposition
- Activity batching when appropriate
Additional Resources
Official Documentation:
- Temporal Core Concepts: docs.temporal.io/workflows
- Workflow Patterns: docs.temporal.io/evaluate/use-cases-design-patterns
- Best Practices: docs.temporal.io/develop/best-practices
- Saga Pattern: temporal.io/blog/saga-pattern-made-easy
Key Principles:
- Workflows = orchestration, Activities = external calls
- Determinism is non-negotiable for workflows
- Idempotency is critical for activities
- State preservation is automatic
- Design for failure and recovery
Related skills
More from wshobson/agents and the wider catalog.
tailwind-design-system
Build production-ready design systems with Tailwind CSS v4, design tokens, and component libraries.
typescript-advanced-types
Master TypeScript's advanced type system: generics, conditional types, mapped types, and utility types for type-safe applications.
nodejs-backend-patterns
Build production-ready Node.js backends with Express/Fastify, middleware patterns, auth, and database integration.
python-performance-optimization
Profile and optimize Python code using cProfile, memory profilers, and performance best practices.
brand-landingpage
Brand-first landing page designer with guided interviews and Stitch-powered iteration.
python-testing-patterns
Implement comprehensive testing strategies with pytest, fixtures, mocking, and test-driven development.