| name | temporal-workflow |
| description | Create, manage, and monitor Temporal workflows with AI agent orchestration. Use when developing workflow definitions, monitoring execution, or troubleshooting workflow issues. |
| argument-hint | [action] [workflowName] [parameters] |
| disable-model-invocation | false |
| user-invocable | true |
| allowed-tools | ["Bash","Read","Write","Grep"] |
Temporal Workflow Skill
Comprehensive Temporal workflow management for the AI Agents sandbox. This skill provides end-to-end workflow lifecycle management from creation to monitoring and debugging.
Usage
/temporal-workflow create my-workflow "Go workflow for data processing"
/temporal-workflow status my-workflow
/temporal-workflow monitor my-workflow --live
/temporal-workflow debug my-workflow --history=50
/temporal-workflow test my-workflow --unit
Core Capabilities
1. Workflow Creation & Development
/temporal-workflow create order-processing "Handles e-commerce order lifecycle"
/temporal-workflow scaffold payment-workflow --activities=validate,process,notify
/temporal-workflow add-activity my-workflow data-validation
2. Workflow Monitoring
/temporal-workflow monitor my-workflow --live
/temporal-workflow history my-workflow --days=7
/temporal-workflow metrics my-workflow --detailed
3. Debugging & Troubleshooting
/temporal-workflow debug my-workflow --error=timeout
/temporal-workflow query my-workflow currentState
/temporal-workflow replay my-workflow --run-id=12345
Workflow Templates
Standard Workflow Pattern
func StandardWorkflow(ctx workflow.Context, input WorkflowInput) error {
logger := workflow.GetLogger(ctx)
logger.Info("Starting workflow", "input", input)
retryOptions := workflow.RetryOptions{
InitialInterval: time.Second * 1,
BackoffCoefficient: 2.0,
MaximumInterval: time.Second * 30,
MaximumAttempts: 5,
}
result, err := workflow.ExecuteActivity(ctx, retryOptions, ProcessActivity, input.Data)
if err != nil {
return err
}
logger.Info("Workflow completed", "result", result)
return nil
}
Workflow with Compensation
func CompensationWorkflow(ctx workflow.Context, input WorkflowInput) error {
ctx = workflow.WithActivityOptions(ctx, workflow.ActivityOptions{
StartToCloseTimeout: time.Minute * 10,
})
var compensation workflow.Compensation
workflow.SetCompensationHook(ctx, func(ctx workflow.Context) error {
return compensation(ctx)
})
err := workflow.ExecuteActivity(ctx, CreateResourceActivity, input.Resource)
if err != nil {
return err
}
compensation = func(ctx workflow.Context) error {
return workflow.ExecuteActivity(ctx, DeleteResourceActivity, input.Resource)
}
return nil
}
Integration Points
Backend Integration
- Workflows:
backend/workflows/
- Activities:
backend/activities/
- Main Entry:
backend/main.go
- Tests:
backend/workflows/*_test.go
API Endpoints
curl -X POST http://localhost:8081/api/v1/workflows/start \
-H "Content-Type: application/json" \
-d '{"workflow": "my-workflow", "input": {...}}'
curl http://localhost:8081/api/v1/workflows/{workflow-id}/status
curl -X DELETE http://localhost:8081/api/v1/workflows/{workflow-id}
Development Workflow
1. Create Workflow Definition
/temporal-workflow create my-new-workflow "Description of workflow purpose"
2. Define Activities
func MyActivity(ctx context.Context, input ActivityInput) (ActivityOutput, error) {
return result, nil
}
3. Register Workflow
worker.RegisterWorkflow(MyNewWorkflow)
worker.RegisterActivity(MyActivity)
4. Test Implementation
/temporal-workflow test my-new-workflow --unit
/temporal-workflow test my-new-workflow --integration
Monitoring Dashboard
Key Metrics
- Workflow Success Rate: Percentage of successful executions
- Average Execution Time: Performance tracking
- Activity Latency: Per-activity performance metrics
- Error Rates: Failure analysis by category
Real-time Status
/temporal-workflow dashboard --refresh=5s
/temporal-workflow topology --workflow=my-workflow
Error Handling Patterns
Retry Strategies
retryOptions := workflow.RetryOptions{
InitialInterval: time.Second,
BackoffCoefficient: 2.0,
MaximumInterval: time.Minute,
MaximumAttempts: 10,
}
retryOptions := workflow.RetryOptions{
InitialInterval: time.Second * 5,
BackoffCoefficient: 1.0,
MaximumAttempts: 5,
}
Circuit Breaker Pattern
func CircuitBreakerWorkflow(ctx workflow.Context, input WorkflowInput) error {
failureCount := 0
maxFailures := 3
for attempt := 0; attempt < 5; attempt++ {
err := workflow.ExecuteActivity(ctx, RiskyActivity, input)
if err == nil {
failureCount = 0
return nil
}
failureCount++
if failureCount >= maxFailures {
return workflow.NewContinueAsNewError(ctx, FallbackWorkflow, input)
}
workflow.Sleep(ctx, time.Duration(attempt)*time.Second)
}
return errors.New("max attempts exceeded")
}
Best Practices
- Idempotent Activities: Design activities to be safely retryable
- Proper Logging: Use structured logging with workflow context
- Timeout Management: Set appropriate timeouts for workflows and activities
- Error Handling: Implement comprehensive error handling and retries
- Testing: Write unit tests for workflows and integration tests for activities
- Monitoring: Set up alerts for workflow failures and performance issues
Troubleshooting Guide
Common Issues
- Workflow Not Starting: Check worker registration and activity availability
- Activity Timeouts: Review timeout configurations and activity performance
- Memory Leaks: Monitor workflow state and ensure proper cleanup
- Deadlocks: Check for circular dependencies in activity calls
Debug Commands
/temporal-workflow worker-status
/temporal-workflow validate my-workflow
/temporal-workflow activities --list
Related Skills
/workflow-management: Orchestrate multiple workflows
/ai-agent-orchestration: Coordinate AI agent interactions
/compliance-check: Validate workflow compliance
/cost-optimization: Optimize workflow resource usage
OpenAI Codex Integration
This section documents the OpenAI Codex-style temporal workflow management that has been integrated into the Claude skills framework.
Basic Workflow Management Steps
When working with Temporal workflows, always follow these steps:
1. Workflow Analysis
- Examine the current workflow definition in
backend/workflows/
- Check for existing activities in
backend/activities/
- Review workflow configuration and dependencies
2. Workflow Creation
- Create new workflow files following Go Temporal patterns
- Define proper workflow interfaces and input/output structs
- Implement error handling and retry policies
- Add appropriate logging and monitoring
3. Activity Integration
- Connect workflows to appropriate activities
- Ensure activity functions are properly registered
- Handle activity timeouts and heartbeats
4. Testing and Validation
- Create unit tests for workflows
- Test workflow execution paths
- Validate error handling scenarios
5. Monitoring and Debugging
- Use Temporal UI to monitor workflow execution
- Check workflow history for troubleshooting
- Analyze workflow performance metrics
Basic Commands
go run backend/main.go
go test ./backend/workflows/...
Common Patterns
- Use workflow.Sleep for retries with exponential backoff
- Implement proper cancellation handling
- Use workflow.ExecuteActivity for activity calls
- Log workflow events with structured logging
File Locations
- Workflows:
backend/workflows/
- Activities:
backend/activities/
- Main entry:
backend/main.go
- Tests:
backend/workflows/*_test.go