---
name: "temporal-workflow-deterministic-state"
description: "Write resilient, multi-day distributed workflows with automatic retries and durable state."
metadata:
  author: "Temporal Technologies"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "write temporal workflow"
  - "configure temporal activity retry"
  - "handle temporal workflow signal"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# Temporal Workflow Orchestration & Durable Execution

Architects distributed workflows with Temporal: ensuring deterministic workflow code, configuring activity timeouts and exponential backoff retries, handling signals and queries, and versioning workflow definitions.

## When to Invoke
Invoke this skill whenever you need to:
- write temporal workflow
- configure temporal activity retry
- handle temporal workflow signal

## Execution SOP & Rules
1. Keep workflow functions strictly deterministic; never invoke network I/O or random numbers in workflows.
2. Wrap side-effects and external API calls inside @activity.defn functions with retry policies.
3. Handle external events using @workflow.signal and expose read state using @workflow.query.
4. Use workflow.patched('change-id') when evolving running workflow definitions to prevent replay mismatches.

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
