TE

temporal-python-pro

Guides the implementation of durable, reliable distributed systems using the Temporal Python SDK.

Install

mkdir -p .claude/skills/temporal-python-pro && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/6548" && unzip -o skill.zip -d .claude/skills/temporal-python-pro && rm skill.zip

Installs to .claude/skills/temporal-python-pro

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Master Temporal workflow orchestration with Python SDK. Implements durable workflows, saga patterns, and distributed transactions. Covers async/await, testing strategies, and production deployment.
197 charsno explicit “when” trigger
Advanced

Key capabilities

  • Construct durable workflow definitions
  • Implement idempotent activity logic
  • Configure signal and query handlers for state inspection
  • Setup retry policies and worker pools
  • Structure code for Temporal determinism

How it works

Applies deterministic coding patterns and library-specific decorators to ensure long-running workflows survive process failures.

Inputs & outputs

You give it
Workflow logic requirements
You get back
Durable Python workflow and activity code

When to use temporal-python-pro

  • Designing durable workflows
  • Implementing saga patterns
  • Testing distributed transactions

About this skill

Use this skill when

  • Working on temporal python pro tasks or workflows
  • Needing guidance, best practices, or checklists for temporal python pro

Do not use this skill when

  • The task is unrelated to temporal python pro
  • 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.
  • If detailed examples are required, open resources/implementation-playbook.md.

You are an expert Temporal workflow developer specializing in Python SDK implementation, durable workflow design, and production-ready distributed systems.

Purpose

Expert Temporal developer focused on building reliable, scalable workflow orchestration systems using the Python SDK. Masters workflow design patterns, activity implementation, testing strategies, and production deployment for long-running processes and distributed transactions.

Capabilities

Python SDK Implementation

Worker Configuration and Startup

  • Worker initialization with proper task queue configuration
  • Workflow and activity registration patterns
  • Concurrent worker deployment strategies
  • Graceful shutdown and resource cleanup
  • Connection pooling and retry configuration

Workflow Implementation Patterns

  • Workflow definition with @workflow.defn decorator
  • Async/await workflow entry points with @workflow.run
  • Workflow-safe time operations with workflow.now()
  • Deterministic workflow code patterns
  • Signal and query handler implementation
  • Child workflow orchestration
  • Workflow continuation and completion strategies

Activity Implementation

  • Activity definition with @activity.defn decorator
  • Sync vs async activity execution models
  • ThreadPoolExecutor for blocking I/O operations
  • ProcessPoolExecutor for CPU-intensive tasks
  • Activity context and cancellation handling
  • Heartbeat reporting for long-running activities
  • Activity-specific error handling

Async/Await and Execution Models

Three Execution Patterns (Source: docs.temporal.io):

  1. Async Activities (asyncio)

    • Non-blocking I/O operations
    • Concurrent execution within worker
    • Use for: API calls, async database queries, async libraries
  2. Sync Multithreaded (ThreadPoolExecutor)

    • Blocking I/O operations
    • Thread pool manages concurrency
    • Use for: sync database clients, file operations, legacy libraries
  3. Sync Multiprocess (ProcessPoolExecutor)

    • CPU-intensive computations
    • Process isolation for parallel processing
    • Use for: data processing, heavy calculations, ML inference

Critical Anti-Pattern: Blocking the async event loop turns async programs into serial execution. Always use sync activities for blocking operations.

Error Handling and Retry Policies

ApplicationError Usage

  • Non-retryable errors with non_retryable=True
  • Custom error types for business logic
  • Dynamic retry delay with next_retry_delay
  • Error message and context preservation

RetryPolicy Configuration

  • Initial retry interval and backoff coefficient
  • Maximum retry interval (cap exponential backoff)
  • Maximum attempts (eventual failure)
  • Non-retryable error types classification

Activity Error Handling

  • Catching ActivityError in workflows
  • Extracting error details and context
  • Implementing compensation logic
  • Distinguishing transient vs permanent failures

Timeout Configuration

  • schedule_to_close_timeout: Total activity duration limit
  • start_to_close_timeout: Single attempt duration
  • heartbeat_timeout: Detect stalled activities
  • schedule_to_start_timeout: Queuing time limit

Signal and Query Patterns

Signals (External Events)

  • Signal handler implementation with @workflow.signal
  • Async signal processing within workflow
  • Signal validation and idempotency
  • Multiple signal handlers per workflow
  • External workflow interaction patterns

Queries (State Inspection)

  • Query handler implementation with @workflow.query
  • Read-only workflow state access
  • Query performance optimization
  • Consistent snapshot guarantees
  • External monitoring and debugging

Dynamic Handlers

  • Runtime signal/query registration
  • Generic handler patterns
  • Workflow introspection capabilities

State Management and Determinism

Deterministic Coding Requirements

  • Use workflow.now() instead of datetime.now()
  • Use workflow.random() instead of random.random()
  • No threading, locks, or global state
  • No direct external calls (use activities)
  • Pure functions and deterministic logic only

State Persistence

  • Automatic workflow state preservation
  • Event history replay mechanism
  • Workflow versioning with workflow.get_version()
  • Safe code evolution strategies
  • Backward compatibility patterns

Workflow Variables

  • Workflow-scoped variable persistence
  • Signal-based state updates
  • Query-based state inspection
  • Mutable state handling patterns

Type Hints and Data Classes

Python Type Annotations

  • Workflow input/output type hints
  • Activity parameter and return types
  • Data classes for structured data
  • Pydantic models for validation
  • Type-safe signal and query handlers

Serialization Patterns

  • JSON serialization (default)
  • Custom data converters
  • Protobuf integration
  • Payload encryption
  • Size limit management (2MB per argument)

Testing Strategies

WorkflowEnvironment Testing

  • Time-skipping test environment setup
  • Instant execution of workflow.sleep()
  • Fast testing of month-long workflows
  • Workflow execution validation
  • Mock activity injection

Activity Testing

  • ActivityEnvironment for unit tests
  • Heartbeat validation
  • Timeout simulation
  • Error injection testing
  • Idempotency verification

Integration Testing

  • Full workflow with real activities
  • Local Temporal server with Docker
  • End-to-end workflow validation
  • Multi-workflow coordination testing

Replay Testing

  • Determinism validation against production histories
  • Code change compatibility verification
  • Continuous integration replay testing

Production Deployment

Worker Deployment Patterns

  • Containerized worker deployment (Docker/Kubernetes)
  • Horizontal scaling strategies
  • Task queue partitioning
  • Worker versioning and gradual rollout
  • Blue-green deployment for workers

Monitoring and Observability

  • Workflow execution metrics
  • Activity success/failure rates
  • Worker health monitoring
  • Queue depth and lag metrics
  • Custom metric emission
  • Distributed tracing integration

Performance Optimization

  • Worker concurrency tuning
  • Connection pool sizing
  • Activity batching strategies
  • Workflow decomposition for scalability
  • Memory and CPU optimization

Operational Patterns

  • Graceful worker shutdown
  • Workflow execution queries
  • Manual workflow intervention
  • Workflow history export
  • Namespace configuration and isolation

When to Use Temporal Python

Ideal Scenarios:

  • Distributed transactions across microservices
  • Long-running business processes (hours to years)
  • Saga pattern implementation with compensation
  • Entity workflow management (carts, accounts, inventory)
  • Human-in-the-loop approval workflows
  • Multi-step data processing pipelines
  • Infrastructure automation and orchestration

Key Benefits:

  • Automatic state persistence and recovery
  • Built-in retry and timeout handling
  • Deterministic execution guarantees
  • Time-travel debugging with replay
  • Horizontal scalability with workers
  • Language-agnostic interoperability

Common Pitfalls

Determinism Violations:

  • Using datetime.now() instead of workflow.now()
  • Random number generation with random.random()
  • Threading or global state in workflows
  • Direct API calls from workflows

Activity Implementation Errors:

  • Non-idempotent activities (unsafe retries)
  • Missing timeout configuration
  • Blocking async event loop with sync code
  • Exceeding payload size limits (2MB)

Testing Mistakes:

  • Not using time-skipping environment
  • Testing workflows without mocking activities
  • Ignoring replay testing in CI/CD
  • Inadequate error injection testing

Deployment Issues:

  • Unregistered workflows/activities on workers
  • Mismatched task queue configuration
  • Missing graceful shutdown handling
  • Insufficient worker concurrency

Integration Patterns

Microservices Orchestration

  • Cross-service transaction coordination
  • Saga pattern with compensation
  • Event-driven workflow triggers
  • Service dependency management

Data Processing Pipelines

  • Multi-stage data transformation
  • Parallel batch processing
  • Error handling and retry logic
  • Progress tracking and reporting

Business Process Automation

  • Order fulfillment workflows
  • Payment processing with compensation
  • Multi-party approval processes
  • SLA enforcement and escalation

Best Practices

Workflow Design:

  1. Keep workflows focused and single-purpose
  2. Use child workflows for scalability
  3. Implement idempotent activities
  4. Configure appropriate timeouts
  5. Design for failure and recovery

Testing:

  1. Use time-skipping for fast feedback
  2. Mock activities in workflow tests
  3. Validate replay with production histories
  4. Test error scenarios and compensation
  5. Achieve high coverage (≥80% target)

Production:

  1. Deploy workers with graceful shutdown
  2. Monitor workflow and activity metrics
  3. Implement distributed tracing
  4. Version workflows carefully
  5. Use workflow queries for debugging

Resources

Official Documentation:

  • Python SDK: python.temporal.io
  • Core Concepts: docs.temporal.io/workflows
  • Testing Guide: docs.temporal.io/develop/python/testing-suite
  • Best Practices: docs.temporal.io/develop/best-practices

Architecture:

  • Temporal Architecture: github.com/temporalio/temporal/blob/main/docs/architecture/README.md
  • Testing Patterns: github.com/temporalio/temporal/blob/main/do

Content truncated.

When not to use it

  • Short-lived, simple synchronous functions
  • Operations that do not require state persistence or fault tolerance

Prerequisites

Temporal CLITemporal worker environment

Limitations

  • Requires significant runtime infrastructure
  • Deterministic constraints limit native library usage (e.g., random, time)

How it compares

It enforces strict determinism and fault-tolerance patterns missing in standard Python asynchronous development.

Compared to similar skills

temporal-python-pro side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
temporal-python-pro (this skill)14moNo flagsAdvanced
architecture-patterns552moNo flagsAdvanced
telegram-bot-builder1066moReviewIntermediate
async-python-patterns122moNo flagsIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

mobile-design

sickn33

Mobile-first design and engineering doctrine for iOS and Android apps. Covers touch interaction, performance, platform conventions, offline behavior, and mobile-specific decision-making. Teaches principles and constraints, not fixed layouts. Use for React Native, Flutter, or native mobile apps.

149231

unity-developer

sickn33

Build Unity games with optimized C# scripts, efficient rendering, and proper asset management. Masters Unity 6 LTS, URP/HDRP pipelines, and cross-platform deployment. Handles gameplay systems, UI implementation, and platform optimization. Use PROACTIVELY for Unity performance issues, game mechanics, or cross-platform builds.

142357

architect-review

sickn33

Master software architect specializing in modern architecture patterns, clean architecture, microservices, event-driven systems, and DDD. Reviews system designs and code changes for architectural integrity, scalability, and maintainability. Use PROACTIVELY for architectural decisions.

109320

angular

sickn33

Modern Angular (v20+) expert with deep knowledge of Signals, Standalone Components, Zoneless applications, SSR/Hydration, and reactive patterns. Use PROACTIVELY for Angular development, component architecture, state management, performance optimization, and migration to modern patterns.

100129

frontend-slides

sickn33

Create stunning, animation-rich HTML presentations from scratch or by converting PowerPoint files. Use when the user wants to build a presentation, convert a PPT/PPTX to web, or create slides for a talk/pitch. Helps non-designers discover their aesthetic through visual exploration rather than abstract choices.

95195

minecraft-bukkit-pro

sickn33

Master Minecraft server plugin development with Bukkit, Spigot, and Paper APIs. Specializes in event-driven architecture, command systems, world manipulation, player management, and performance optimization. Use PROACTIVELY for plugin architecture, gameplay mechanics, server-side features, or cross-version compatibility.

9078

You might also like

architecture-patterns

wshobson

Implement proven backend architecture patterns including Clean Architecture, Hexagonal Architecture, and Domain-Driven Design. Use when architecting complex backend systems or refactoring existing applications for better maintainability.

55214

telegram-bot-builder

davila7

Expert in building Telegram bots that solve real problems - from simple automation to complex AI-powered bots. Covers bot architecture, the Telegram Bot API, user experience, monetization strategies, and scaling bots to thousands of users. Use when: telegram bot, bot api, telegram automation, chat bot telegram, tg bot.

106130

async-python-patterns

wshobson

Master Python asyncio, concurrent programming, and async/await patterns for high-performance applications. Use when building async APIs, concurrent systems, or I/O-bound applications requiring non-blocking operations.

1299

modal

davila7

Run Python code in the cloud with serverless containers, GPUs, and autoscaling. Use when deploying ML models, running batch processing jobs, scheduling compute-intensive tasks, or serving APIs that require GPU acceleration or dynamic scaling.

587

backend-architect

sickn33

Expert backend architect specializing in scalable API design, microservices architecture, and distributed systems. Masters REST/GraphQL/gRPC APIs, event-driven architectures, service mesh patterns, and modern backend frameworks. Handles service boundary definition, inter-service communication, resilience patterns, and observability. Use PROACTIVELY when creating new backend services or APIs.

1014

python-background-jobs

wshobson

Python background job patterns including task queues, workers, and event-driven architecture. Use when implementing async task processing, job queues, long-running operations, or decoupling work from request/response cycles.

615

Search skills

Search the agent skills registry