conductor-skills

Reviewing & Optimizing Workflows

When the user asks to review, optimize, simplify, or audit a workflow, walk this checklist and produce a structured report. Findings are graded:

Treat the checklist as guidance — not every item applies to every workflow. A 3-task batch job doesn’t need a failureWorkflow. Use judgment.

Review flow

  1. Load the workflow definition. Either:
    • User supplied a JSON file → read it.
    • User named a registered workflow → conductor workflow get {name} --version {v} (omit --version for the latest).
  2. For each SIMPLE task, load its task definition: conductor taskDef get {name}. Timeout/retry config lives there, not on the workflow task.
  3. (Optional, if the user asks about runtime behavior) Look at recent executions: conductor workflow search -w {name} -s FAILED -c 20 and inspect a few with get-execution.
  4. Walk the checklist below, recording findings.
  5. Report grouped by severity. Offer to apply each fix. Don’t apply silently.

Checklist

A. Structure & maintainability

B. Reliability

C. Performance & complexity

D. Security & inputs

E. Wrong tool

Sometimes the right answer is not a workflow. Smell tests:

Report template

Render findings like this:

Workflow: order_processing v3 (47 tasks)

CRITICAL (4)
  ✗ B1  SIMPLE task `charge_card`: responseTimeoutSeconds=0
        → Set responseTimeoutSeconds >= 30, pollTimeoutSeconds >= 60, timeoutSeconds = 300
  ✗ B5  DO_WHILE `retry_loop`: condition has no iteration cap
        → Add `$.retry_loop['iteration'] < 10 &&` to loopCondition
  ✗ B10 HTTP task `call_claude` posts to https://api.anthropic.com/v1/messages
        → Replace with an LLM_CHAT_COMPLETE task (llmProvider: anthropic). Set
          ANTHROPIC_API_KEY on the server if the integration isn't configured yet.
  ✗ D1  Workflow input `stripeKey` looks like a secret
        → Move to ${workflow.secrets.STRIPE_KEY} or worker env

WARN (4)
  ⚠ A1  Description is empty
  ⚠ B2  No workflow timeout. Add timeoutSeconds + timeoutPolicy.
  ⚠ B3  SIMPLE task `send_email` has retryCount=0 (transient SMTP errors will fail the workflow)
  ⚠ C1  INLINE task `compute_pricing` has 60 lines of JS — extract to a worker

INFO (2)
  • A4  47 tasks — well within the 100-task soft limit
  • A5  Task names are descriptive

Recommended Changes (priority order)
  [ ] task_def_charge_card.json  set responseTimeoutSeconds=30, pollTimeoutSeconds=60, timeoutSeconds=300
  [ ] order_processing.json:7    add `$.retry_loop['iteration'] < 10` clause to loopCondition
  [ ] order_processing.json:2    move stripeKey to ${workflow.secrets.STRIPE_KEY}
  [ ] order_processing.json:1    add description, timeoutSeconds, timeoutPolicy
  [ ] task_def_send_email.json   set retryCount=3, retryLogic=EXPONENTIAL_BACKOFF
  [ ] compute_pricing INLINE     extract to a Python worker

Then offer: “Want me to apply any of these? I can update the task definitions and re-register the workflow.”

Always end with a Recommended Changes checklist even if the findings are split by severity above. The checklist is the actionable artifact the user takes away — one bullet per fix, file/path pointer first, then the change to make. Skip findings that are INFO-only.

When the user just says “make it simpler”

A simpler workflow is one a new engineer can read in five minutes. The biggest levers:

  1. Extract sub-workflows. Group related tasks (validate-and-prep, fulfill, notify) into separate registered workflows.
  2. Replace INLINE business logic with workers. A worker has a name, version, tests, and a stack trace; INLINE has none of those.
  3. Flatten nested SWITCHes. Two-level decision trees are usually a sign that one level should be a sub-workflow.
  4. Name things. Every task ref name and variable should read as English.

Don’t over-refactor. If the workflow is already small and readable, “simpler” might be a no-op — say so.