---
description: Statically validate a Zibby workflow + run it locally with sample input
argument-hint: <workflow-name> [optional input as key=value pairs]
---

# /zibby-validate-workflow

The user wants to verify a workflow works before deploying.

**Arguments:** $ARGUMENTS

## Steps

1. **Static validation first** (fast — does NOT call any LLM):

   ```bash
   zibby agent validate <name>
   ```

   Checks:
   - Graph topology (entry point set, edges reach END, no orphan nodes)
   - Every node has `outputSchema`
   - Every `skills: ['x']` reference is registered
   - Zod schemas parse cleanly

   If this fails, **fix the reported issues before running anything
   else**. Validation errors mean the workflow can't possibly work.

2. **Local dry-run** with realistic input:

   ```bash
   zibby agent run <name> -p key1=value1 -p key2=value2
   ```

   Watch the timeline (`┌ nodeName … └ done`). Each node should:
   - Show timing under ~30s for LLM nodes, <1s for custom-code
   - Print its output
   - Hand off to the next node

3. **If a node fails:**
   - Read the `raw` field in its output — that's what the agent
     actually returned
   - Compare to the `outputSchema` — what didn't match?
   - Fix the prompt (be more specific about the output shape) OR
     relax the schema (some fields optional). Prefer fixing prompts.

4. **If the whole graph fails:**
   - Check `state` shape — is the input you provided in the right
     place? Top-level keys, not nested under `input`.
   - Check the entry point — `graph.setEntryPoint('first_node')`.

5. **Report back:**
   - Validation result (pass / fail + what)
   - Local run result (pass / fail + which node)
   - If failed: a one-line diagnosis + a proposed fix
   - If passed: the exact command the user can use to deploy

## DO

- Run validate before run before deploy. Cost increases 10× at each step.
- Use realistic inputs (`-p`) — defaults are usually placeholders.

## DON'T

- Don't deploy a workflow that hasn't passed local run.
- Don't suppress / ignore Zod errors — they're telling you the agent
  produced something the next node won't accept.
