$npx -y skills add microsoft/power-platform-skills --skill diagnose-flowDeep autonomous diagnosis of a failed flow run. Provide environment, flow, and run IDs. Use when the user asks to diagnose or deeply investigate a specific failed flow run.
| 1 | # Deep Flow Diagnostic Agent |
| 2 | |
| 3 | You are an autonomous diagnostic agent. Given environment, flow, and run IDs, perform a comprehensive failure analysis. |
| 4 | |
| 5 | ## Input |
| 6 | |
| 7 | Parse `$ARGUMENTS` for: environment ID, flow ID, run ID. |
| 8 | |
| 9 | ## Tools |
| 10 | |
| 11 | This skill uses the **FlowAgent MCP tools**, referred to by bare name (clients |
| 12 | surface them as `mcp__flowagent__<tool>` in Claude Code or `flowagent-<tool>` in |
| 13 | Copilot CLI). If MCP tools aren't available, run `/setup` to wire the FlowAgent |
| 14 | MCP server. |
| 15 | |
| 16 | ## Workflow |
| 17 | |
| 18 | 1. **Triage with `diagnose_run`**, then gather full context in parallel: |
| 19 | - `diagnose_run` — classified failed/timed-out actions with a remediation each (start here) |
| 20 | - `get_run_details` for overall run status |
| 21 | - `get_run_actions` for the full action-level execution trace |
| 22 | - `get_flow` for definition context |
| 23 | - For a failed loop, `get_run_action_repetitions` on an action **inside** the loop (the container returns none) to find the failing iteration |
| 24 | |
| 25 | 2. **Build execution graph**: Map each action's `runAfter` dependencies. Identify parallel branches. |
| 26 | |
| 27 | 3. **Identify failed actions**: Filter for status != Succeeded. Classify each as: |
| 28 | - **Root failure**: dependencies all Succeeded but this action failed |
| 29 | - **Cascading skip**: skipped because a dependency failed |
| 30 | |
| 31 | 4. **Analyze each root failure** against common patterns: |
| 32 | - Authorization/Connection errors |
| 33 | - Expression evaluation failures |
| 34 | - HTTP 4xx/5xx from external services |
| 35 | - Timeout errors |
| 36 | - Parameter validation failures (empty required fields, wrong enum values) |
| 37 | - Action type mismatches (OpenApiConnection vs OpenApiConnectionWebhook) |
| 38 | |
| 39 | 5. **Cross-reference with definition**: Check if the action's parameters, connection references, or expressions have issues visible in the definition. |
| 40 | |
| 41 | 6. **Write diagnosis report** with: |
| 42 | - Execution timeline |
| 43 | - Root cause identification |
| 44 | - Specific fix with code changes |
| 45 | - Confidence level (high/medium/low) |
| 46 | |
| 47 | 7. **Optionally generate fixed definition**: If the fix is a definition change, apply it with `edit_flow` (surgical, one action/parameter) — fall back to `update_flow` only for large rewrites. |