workflow-orchestration-patterns
Skill này làm gì
Skill này giúp bạn hiểu cách tổ chức và quản lý các quy trình phức tạp có nhiều bước hoặc nhiều dịch vụ. Nó dạy các mẫu để đảm bảo những quy trình này chạy đáng tin cậy, ngay cả khi có lỗi xảy ra.
Khi nào nên dùng
- ✓Khi bạn cần tổ chức các tác vụ phụ thuộc lẫn nhau.
- ✓Để đảm bảo các quy trình dài không thất bại hoàn toàn nếu một bước bị lỗi.
- ✓Khi xây dựng các hệ thống mà nhiều phần cần làm việc cùng nhau một cách đáng tin cậy.
Liên kết skill
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/workflow-orchestration-patterns/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Làm sao để đảm bảo quy trình đặt hàng trực tuyến vẫn hoạt động ngay cả khi hệ thống kho hàng bị lỗi tạm thời?”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Skill giải thích các khái niệm về ‘workflows’ (logic điều phối) và ‘activities’ (các tác vụ bên ngoài). Bằng cách làm theo các mẫu như ‘Saga’ hoặc ‘Entity Workflows’, bạn có thể xây dựng các hệ thống vững chắc có khả năng phục hồi sau lỗi.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
Workflow Orchestration Patterns
Master workflow orchestration architecture with Temporal, covering fundamental design decisions, resilience patterns, and best practices for building reliable distributed systems.
Use this skill when
- Working on workflow orchestration patterns tasks or workflows
- Needing guidance, best practices, or checklists for workflow orchestration patterns
Do not use this skill when
- The task is unrelated to workflow orchestration patterns
- You need a different domain or tool outside this scope
Instructions
- Clarify goals, constraints, and required inputs.
- Apply relevant best practices and validate outcomes.
- Provide actionable steps and verification.
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)
Critical Design Decision: Workflows vs Activities
The Fundamental Rule (Source: temporal.io/blog/workflow-engine-principles):
- Workflows = Orchestration logic and decision-making
- Activities = External interactions (APIs, databases, network calls)
Workflows (Orchestration)
Characteristics:
- Contain business logic and coordination
- MUST be deterministic (same inputs → same outputs)
- Cannot perform direct external calls
- State automatically preserved across failures
- Can run for years despite infrastructure failures
Example workflow tasks:
- Decide which steps to execute
- Handle compensation logic
- Manage timeouts and retries
- Coordinate child workflows
Activities (External Interactions)
Characteristics:
- Handle all external system interactions
- Can be non-deterministic (API calls, DB writes)
- Include built-in timeouts and retry logic
- Must be idempotent (calling N times = calling once)
- Short-lived (seconds to minutes typically)
Example activity tasks:
- Call payment gateway API
- Write to database
- Send emails or notifications
- Query external services
Design Decision Framework
Does it touch external systems? → Activity
Is it orchestration/decision logic? → Workflow
Core Workflow Patterns
1. Saga Pattern with Compensation
Purpose: Implement distributed transactions with rollback capability
Pattern (Source: temporal.io/blog/compensating-actions-part-of-a-complete-breakfast-with-sagas):
For each step:
1. Register compensation BEFORE executing
2. Execute the step (via activity)
3. On failure, run all compensations in reverse order (LIFO)
Example: Payment Workflow
- Reserve inventory (compensation: release inventory)
- Charge payment (compensation: refund payment)
- Fulfill order (compensation: cancel fulfillment)
Critical Requirements:
- Compensations must be idempotent
- Register compensation BEFORE executing step
- Run compensations in reverse order
- Handle partial failures gracefully
2. Entity Workflows (Actor Model)
Purpose: Long-lived workflow representing single entity instance
Pattern (Source: docs.temporal.io/evaluate/use-cases-design-patterns):
- One workflow execution = one entity (cart, account, inventory item)
- Workflow persists for entity lifetime
- Receives signals for state changes
- Supports queries for current state
Example Use Cases:
- Shopping cart (add items, checkout, expiration)
- Bank account (deposits, withdrawals, balance checks)
- Product inventory (stock updates, reservations)
Benefits:
- Encapsulates entity behavior
- Guarantees consistency per entity
- Natural event sourcing
3. Fan-Out/Fan-In (Parallel Execution)
Purpose: Execute multiple tasks in parallel, aggregate results
Pattern:
- Spawn child workflows or parallel activities
…
Câu hỏi thường gặp
Khác biệt giữa Workflow và Activity là gì?
Workflow là phần ‘trí tuệ’ quyết định cần làm gì và theo thứ tự nào. Activity là hành động cụ thể, như gọi một dịch vụ bên ngoài hoặc lưu vào cơ sở dữ liệu.
Mẫu Saga là gì?
Đó là cách quản lý các giao dịch dài. Nếu một bước thất bại, nó sẽ cố gắng hoàn tác các bước trước đó để giữ mọi thứ nhất quán.
Vì sao Workflow cần có tính xác định (deterministic)?
Để hệ thống có thể tái tạo chính xác trạng thái của quy trình sau một lỗi, đảm bảo nó tiếp tục từ chỗ đã dừng mà không có lỗi.
Chi tiết
Mô tả gốc của tác giả
Master workflow orchestration architecture with Temporal, covering fundamental design decisions, resilience patterns, and best practices for building reliable distributed systems.
Độ phổ biến
- Sao GitHub
- 48k
- Vị trí xếp hạng
- #6201
- Giấy phép
- MIT
- Cập nhật
- 15/10/2026
Bình luận
- …
Thêm skill từ kho mã này
00-andruia-consultant
48kGiúp agent của bạn bắt đầu hoặc cải thiện các dự án AI. Phân tích mã, gợi ý công cụ và lập kế hoạch hành động bằng tiếng Tây Ban Nha.
007
48kCho phép agent của bạn thực hiện kiểm toán bảo mật và mô hình hóa mối đe dọa. Hữu ích để bảo vệ dự án khỏi các cuộc tấn công và lỗ hổng.
10-andruia-skill-smith
48kGiúp agent của bạn tạo hoặc cải thiện các công cụ AI. Xác định cách công cụ hoạt động, viết tài liệu và kiểm tra cấu trúc.
20-andruia-niche-intelligence
48kGiúp agent của bạn tạo bản tóm tắt về một ngành cụ thể. Hữu ích để hiểu bối cảnh, quy tắc, cách người dùng tương tác và rủi ro của dự án.
Skill tương tự
knowledge-automation
394kGiúp agent của bạn thiết lập tác vụ định kỳ đưa nội dung mới vào kho Knowledge theo lịch, rồi kiểm tra tác vụ có chạy không.
knowledge-source-ingest
394kGiúp agent của bạn cập nhật Knowledge vault với các mục mới từ kênh chat, nguồn tin hoặc hộp thư, mà không thêm lại những gì đã có.
benchmark
280kGiúp agent của bạn đo tốc độ và hiệu suất của code, hữu ích để đảm bảo mọi thứ nhanh và tìm ra những chỗ chậm.