Analyze Flow SDK workflow structure before migration. Use to map inputs, outputs, steps, control flow, and dependencies.
This skill helps analyze a Flow SDK workflow before migration to understand its structure, dependencies, and conversion requirements. This is the first step in any migration.
Before Migration:
During Migration:
src/workflows/my_workflow/
├── activities.ts # Activity functions (→ steps.ts)
├── helpers.ts # Optional helper functions
├── prompts.ts # Prompt templates (→ .prompt files)
├── prompts.xml # XML prompts (→ .prompt files)
├── readme.xml # Workflow documentation
├── types.ts # Type definitions (keep)
└── workflow.ts # Workflow definition (convert)
| File | Purpose | Migration Target |
|---|---|---|
workflow.ts | Workflow class | workflow() function |
activities.ts | Activity functions | steps.ts |
types.ts | Type definitions | Keep, add Zod schemas |
prompts.ts | JS prompt arrays | .prompt files |
prompts.xml | XML prompts | .prompt files |
readme.xml | Documentation | Reference during migration |
helpers.ts | Utility functions | Keep or inline |
ls -la src/workflows/my_workflow/
# Find the workflow class
grep -n "class.*Workflow" src/workflows/my_workflow/workflow.ts
grep -n "execute(" src/workflows/my_workflow/workflow.ts
# Find interface definitions
grep -n "interface.*Input" src/workflows/my_workflow/*.ts
grep -n "interface.*Output" src/workflows/my_workflow/*.ts
# Find Zod schemas
grep -n "z.object" src/workflows/my_workflow/types.ts
# Find exported functions in activities.ts
grep -n "export.*async function" src/workflows/my_workflow/activities.ts
grep -n "export function" src/workflows/my_workflow/activities.ts
For each activity, note:
# View activity signatures
grep -A5 "export.*function" src/workflows/my_workflow/activities.ts
# Find completion calls
grep -n "completion(" src/workflows/my_workflow/activities.ts
grep -n "await.*completion" src/workflows/my_workflow/activities.ts
# Find prompt usage
grep -n "Prompt" src/workflows/my_workflow/activities.ts
Read workflow.ts to understand:
# Find external imports
grep -n "^import" src/workflows/my_workflow/*.ts | grep -v "\./"
# Find API calls
grep -n "fetch(" src/workflows/my_workflow/*.ts
grep -n "axios" src/workflows/my_workflow/*.ts
cat src/workflows/my_workflow/readme.xml
Create a migration analysis document:
# Workflow Migration Analysis: [workflow_name]
## Overview
- **Location**: src/workflows/my_workflow/
- **Purpose**: [from readme.xml]
- **Complexity**: [low/medium/high]
## Files to Migrate
| File | Status | Notes |
|------|--------|-------|
| workflow.ts | Needs conversion | Class → function |
| activities.ts | Needs conversion | 5 activities → steps |
| types.ts | Partial | Add Zod schemas |
| prompts.ts | Needs conversion | 3 prompts |
## Workflow Input/Output
### Input
```typescript
interface WorkflowInput {
userId: string;
options: ProcessOptions;
}
interface WorkflowOutput {
success: boolean;
resultId: string;
}
| Activity | Parameters | Return Type | LLM Call |
|---|---|---|---|
| fetchUser | userId: string | User | No |
| analyzeData | data: Data, options: Options | Analysis | Yes |
| saveResults | results: Results | SaveResult | No |
| Name | Location | Variables | Target File |
|---|---|---|---|
| analyzePrompt | prompts.ts | data, options | [email protected] |
## Quick Analysis Commands
### Get workflow overview
```bash
# Count activities
grep -c "export.*function" src/workflows/my_workflow/activities.ts
# Count prompts
grep -c "role:" src/workflows/my_workflow/prompts.ts
# Check for Handlebars syntax
grep -c "{{#if" src/workflows/my_workflow/prompts.ts
# Check for zod imports (need conversion)
grep "from 'zod'" src/workflows/my_workflow/*.ts
grep "export.*function" src/workflows/my_workflow/activities.ts | \
sed 's/export async function /- /' | \
sed 's/export function /- /' | \
sed 's/(.*//'
After migration, the folder should look like:
src/workflows/my_workflow/
├── workflow.ts # Converted workflow() function
├── steps.ts # Converted step() definitions
├── types.ts # Types with Zod schemas
├── [email protected] # Converted prompts
├── [email protected]
└── scenarios/ # NEW: Test scenarios
└── basic_input.json
flow-analyze-prompts - Detailed prompt analysisflow-convert-activities-to-steps - Activity conversionflow-convert-workflow-definition - Workflow conversionflow-conventions-folder-structure - Target structure