Chuyển đến nội dung
Skillpedia
API và máy chủ (backend)48k · #5956

temporal-golang-pro

Skill này làm gì

Công cụ này giúp xây dựng hệ thống phân tán vững chắc và đáng tin cậy bằng Temporal Go SDK. Nó đảm bảo các tiến trình chạy đúng ngay cả khi tạm thời bị lỗi, và giúp cấu hình bảo mật và hiệu năng.

Khi nào nên dùng

  • ✓Khi xây dựng microservice cần trạng thái bền vững và điều phối đáng tin cậy.
  • ✓Khi triển khai tiến trình chạy lâu (nhiều ngày hoặc nhiều tháng) hoặc các mẫu giao dịch phức tạp.
  • ✓Khi tối ưu bảo mật (mTLS) và hiệu năng của hệ thống.

Liên kết skill

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/temporal-golang-pro/SKILL.md

Sao 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

Hãy dùng skill này để giúp tôi: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/temporal-golang-pro/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Làm sao để thiết lập một worker an toàn với mTLS cho hệ thống phân tán của tôi bằng Go?”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Công cụ phân tích yêu cầu của bạn và áp dụng thực hành tốt nhất từ Temporal Go SDK. Nó kiểm tra mã có tính xác định (luôn cho cùng kết quả) và giúp cấu hình worker, quản lý workflow phức tạp và kiểm thử đáng tin cậy.

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.

Temporal Go SDK (temporal-golang-pro)

Overview

Expert-level guide for building resilient, scalable, and deterministic distributed systems using the Temporal Go SDK. This skill transforms vague orchestration requirements into production-grade Go implementations, focusing on durable execution, strict determinism, and enterprise-scale worker configuration.

When to Use This Skill

  • Designing Distributed Systems: When building microservices that require durable state and reliable orchestration.
  • Implementing Complex Workflows: Using the Go SDK to handle long-running processes (days/months) or complex Saga patterns.
  • Optimizing Performance: When workers need fine-tuned concurrency, mTLS security, or custom interceptors.
  • Ensuring Reliability: Implementing idempotent activities, graceful error handling, and sophisticated retry policies.
  • Maintenance & Evolution: Versioning running workflows or performing zero-downtime worker updates.

Do not use this skill when

  • Using Temporal with other SDKs (Python, Java, TypeScript) - refer to their specific -pro skills.
  • The task is a simple request/response without durability or coordination needs.
  • High-level design without implementation (use workflow-orchestration-patterns).

Step-by-Step Guide

  1. Gather Context: Proactively ask for:
    • Target Temporal Cluster (Cloud vs. Self-hosted) and Namespace.
    • Task Queue names and expected throughput.
    • Security requirements (mTLS paths, authentication).
    • Failure modes and desired retry/timeout policies.
  2. Verify Determinism: Before suggesting workflow code, verify against these 5 Rules:
    • No native Go concurrency (goroutines).
    • No native time (time.Now, time.Sleep).
    • No non-deterministic map iteration (must sort keys).
    • No direct external I/O or network calls.
    • No non-deterministic random numbers.
  3. Implement Incrementally: Start with shared Protobuf/Data classes, then Activities, then Workflows, and finally Workers.
  4. Leverage Resources: If the implementation requires advanced patterns (Sagas, Interceptors, Replay Testing), explicitly refer to the implementation playbook and testing strategies.

Capabilities

Go SDK Implementation

  • Worker Management: Deep knowledge of worker.Options, including MaxConcurrentActivityTaskPollers, WorkerStopTimeout, and StickyScheduleToStartTimeout.
  • Interceptors: Implementing Client, Worker, and Workflow interceptors for cross-cutting concerns (logging, tracing, auth).
  • Custom Data Converters: Integrating Protobuf, encrypted payloads, or custom JSON marshaling.

Advanced Workflow Patterns

  • Durable Concurrency: Using workflow.Go, workflow.Channel, and workflow.Selector instead of native primitives.
  • Versioning: Implementing safe code evolution using workflow.GetVersion and workflow.GetReplaySafeLogger.
  • Large-scale Processing: Pattern for ContinueAsNew to manage history size limits (defaults: 50MB or 50K events).
  • Child Workflows: Managing lifecycle, cancellation, and parent-child signal propagation.

Testing & Observability

  • Testsuite Mastery: Using WorkflowTestSuite for unit and functional testing with deterministic time control.
  • Mocking: Sophisticated activity and child workflow mocking strategies.
  • Replay Testing: Validating code changes against production event histories.
  • Metrics: Configuring Prometheus/OpenTelemetry exporters for worker performance tracking.

Examples

Example 1: Versioned Workflow (Deterministic)

// Note: imports omitted. Requires 'go.temporal.io/sdk/workflow', 'go.temporal.io/sdk/temporal', and 'time'.
func SubscriptionWorkflow(ctx workflow.Context, userID string) error {
    // 1. Versioning for logic evolution (v1 = DefaultVersion)
    v := workflow.GetVersion(ctx, "billing_logic", workflow.DefaultVersion, 2)

    for i := 0; i < 12; i++ {
        ao := workflow.ActivityOptions{
            StartToCloseTimeout: 5 * time.Minute,
            RetryPolicy: &temporal.RetryPolicy{MaximumAttempts: 3},
        }
        ctx = workflow.WithActivityOptions(ctx, ao)

        // 2. Activity Execution (Always handle errors)
        err := workflow.ExecuteActivity(ctx, ChargePaymentActivity, userID).Get(ctx, nil)
        if err != nil {
            workflow.GetLogger(ctx).Error("Payment failed", "Error", err)
            return err
        }


…
Câu hỏi thường gặp

Hệ thống phân tán là gì?

Đó là hệ thống gồm nhiều máy tính cùng làm việc để hoàn thành một tác vụ, như một website lớn hoặc dịch vụ thanh toán.

“Deterministic” nghĩa là gì trong ngữ cảnh này?

Nghĩa là một tiến trình, khi chạy với cùng đầu vào, sẽ luôn cho cùng kết quả, không phụ thuộc vào yếu tố bên ngoài hay ngẫu nhiên.

mTLS là gì?

Đó là một dạng bảo mật nâng cao, đảm bảo cả client và server xác thực lẫn nhau, giống như một cái bắt tay bí mật giữa hai bên trước khi giao tiếp.

Chi tiết

Mô tả gốc của tác giả

Use when building durable distributed systems with Temporal Go SDK. Covers deterministic workflow rules, mTLS worker configs, and advanced patterns.

repo: sickn33/agentic-awesome-skills

Độ phổ biến

Sao GitHub
48k
Vị trí xếp hạng
#5956
Giấy phép
MIT
Cập nhật
15/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự