write-workflow-as-code

Write Windmill Workflow-as-Code scripts using task, step, sleep, and approval primitives.

Updated May 28, 2026
One-click install
npx skills add https://github.com/kma-core/windmill --skill write-workflow-as-code-kma-core
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: write-workflow-as-code
Source: https://github.com/kma-core/windmill/tree/main/system_prompts/auto-generated/skills/write-workflow-as-code
Command: npx skills add https://github.com/kma-core/windmill --skill write-workflow-as-code-kma-core

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires windmill-client, wmill.

What problem does it solve? Writing Windmill Workflow-as-Code (WAC) scripts requires following strict checkpoint/replay rules, correct SDK naming, and the right CLI commands for previewing versus deploying, and mistakes cause broken suspension or non-deterministic replays. ## Core Features & Use Cases - WAC Authoring Rules: Enforces correct file shape, SDK imports, and naming for Bun TypeScript (windmill-client) and Python (wmill) workflow scripts. - Checkpoint/Replay Guidance: Ensures side effects, API calls, and non-deterministic values are wrapped in task() or step() so workflow replays stay deterministic. - CLI Workflow Discipline: Distinguishes wmill script preview for local iteration from wmill script run and wmill sync push for deployed versions. - Use Case: A developer asks to build a workflow that enriches customer data, waits for manager approval, then notifies a channel; the Skill produces a deterministic @workflow script with taskScript calls, getResumeUrls inside step(), and waitForApproval, then previews it locally. ## Quick Start Write a Windmill workflow-as-code script in Python that processes a list of items in parallel with a concurrency limit and then waits for an approval before finishing.

Frequently Asked Questions about write-workflow-as-code

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write a Windmill workflow-as-code script in Python?

Import workflow, task, step, and related helpers from wmill, decorate an async main function with @workflow, and define tasks as top-level async functions decorated with @task. Never call main directly; the workflow entrypoint is dispatched by Windmill.

How do I test a Windmill script locally without deploying?

Run wmill script preview <script_path> with -d '<args>' to execute the local file without deploying. Use wmill script run only for scripts already deployed in the workspace, and wmill sync push only when explicitly asked to deploy.

What is the difference between task, taskScript, and taskFlow in Windmill?

task wraps an inline async function as a workflow step, taskScript dispatches to an existing Windmill script or relative module file, and taskFlow dispatches to an existing Windmill flow. All three run as child jobs when called inside a workflow.

Why does my Windmill workflow replay produce wrong results?

The workflow body reruns after suspensions, so non-deterministic values like timestamps, random data, or API calls placed at the top level change between replays. Capture those values inside step() or move side effects into task() so results are checkpointed.

How do I add an approval step to a Windmill workflow?

Call getResumeUrls inside step() to obtain the approval page URL, send it via a notification step, then call waitForApproval with an optional timeout. The workflow suspends until an approver resumes or cancels it.

Can I catch exceptions around Windmill WAC SDK calls?

In Python, except Exception is safe because internal suspension inherits from BaseException, and TaskError can be caught for failed child tasks. In TypeScript, avoid broad try/catch around SDK calls since catching the internal suspension error breaks workflow suspension.