Files
windmill/system_prompts/base/script-base.md
centdix 31e002ad41 feat(ai): standardize and improve system prompts (#7346)
* init

* test in frontend

* copy files

* use in cli

* better

* add desc to sdks

* better

* fix ts parsing

* add docs to ts client

* add docs to python client

* use script prompt in frontend

* regen

* use in flow

* rm

* use in cli, create AGENTS.md instead of cursor rules

* remove apply

* better

* better

* simplify cli

* more docs

* cleaning

* update readme

* generate cli file

* better folder names

* fix ts

* fix multiline
2025-12-12 17:26:19 +00:00

1.2 KiB

Windmill Script Writing Guide

General Principles

  • Scripts must export a main function (do not call it)
  • Libraries are installed automatically - do not show installation instructions
  • Credentials and configuration are stored in resources and passed as parameters
  • The windmill client (wmill) provides APIs for interacting with the platform

Function Naming

  • Main function: main (or preprocessor for preprocessor scripts)
  • Must be async for TypeScript variants

Return Values

  • Scripts can return any JSON-serializable value
  • Return values become available to subsequent flow steps via results.step_id

Preprocessor Scripts

Preprocessor scripts process raw trigger data from various sources (webhook, custom HTTP route, SQS, WebSocket, Kafka, NATS, MQTT, Postgres, or email) before passing it to the flow. This separates the trigger logic from the flow logic and keeps the auto-generated UI clean.

The returned object determines the parameter values passed to the flow. e.g., { b: 1, a: 2 } calls the flow with a = 2 and b = 1, assuming the flow has two inputs called a and b.

The preprocessor receives a single parameter called event.