Temporal Determinism Audit (C#)
When to use
Use this skill when the user:
- •pastes workflow code or a workflow diff
- •asks “is this safe in a workflow?”
- •gets replay / nondeterminism errors
- •reports flaky behavior that could be replay-related
Required output
Always produce:
- •Findings (bullets; severity:
breaks replay/risky/ok) - •Fix (compile-ready patch or rewritten snippet)
- •Placement (Workflow / Activity / Worker / Client)
- •Replay note (why this matters on replay)
Non-negotiable forbidden list (workflows)
- •
Task.Run,Thread.Sleep,Task.Delay - •
DateTime.UtcNow(useWorkflow.Now) - •
Guid.NewGuid()(useWorkflow.NewGuid()) - •Random number generators (unless via Temporal deterministic APIs)
- •Locks/monitors/semaphores
- •Any file/network/database IO
- •Static mutable state
Approved substitutes (workflows)
- •
Workflow.DelayAsync - •
Workflow.Now - •
Workflow.NewGuid() - •Deterministic control flow + calling Activities for side effects
Common rewrite patterns
- •Move side effects into
[Activity]methods - •Use activity retry options (don’t “hide” failures)
- •Replace timers/delays with Temporal workflow timers
If context is missing
Assume code is workflow code unless the user states otherwise, and explicitly state that assumption.