write-script-rust

Writes Windmill Rust scripts with cargo dependencies, typed main functions, and CLI preview workflows.

1|Updated Aug 3, 2026
One-click install
npx skills add https://github.com/vpzed-dev/smithy --skill write-script-rust-vpzed-dev
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: write-script-rust
Source: https://github.com/vpzed-dev/smithy/tree/main/windmill/local-dev/.agents/skills/write-script-rust
Command: npx skills add https://github.com/vpzed-dev/smithy --skill write-script-rust-vpzed-dev

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing Rust scripts for the Windmill platform requires specific conventions — a typed main function, inline cargo dependency blocks, and serializable return types — plus knowing which wmill CLI command to run for previewing, metadata regeneration, or deployment. This Skill encodes all of those rules so scripts compile and integrate correctly on the first attempt. ## Core Features & Use Cases - Rust script scaffolding: Generates scripts with a main function taking owned argument types and returning anyhow::Result<T> where T derives Serialize. - Dependency management: Embeds a partial cargo.toml header for crates like tokio and reqwest, with guidance on async runtimes inside a sync main. - CLI workflow discipline: Distinguishes wmill script preview (local iteration) from wmill script run (deployed version) and wmill generate-metadata (lock/schema sync), preventing accidental deploys. - Use Case: You need a Windmill script that fetches JSON from an HTTP API. The Skill produces a Rust script with reqwest and tokio pinned in the cargo header, a sync main wrapping a tokio runtime, then previews it locally with sample arguments. ## Quick Start Write a Windmill Rust script that fetches a URL and returns the response body, then preview it locally with sample arguments.

Frequently Asked Questions about write-script-rust

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

FAQPage Schema
How do I write a Rust script for Windmill?▼

Define a function called main with owned argument types that returns anyhow::Result<T>, where T derives Serialize. Declare crates in a partial cargo.toml comment block at the top of the script; serde is already included and does not need to be listed.

How do I use async code like tokio in a Windmill Rust script?▼

Keep the main function synchronous and create the tokio runtime inside it with tokio::runtime::Runtime::new(), then call block_on around your async block. Add tokio with the full feature set in the cargo header.

What is the difference between wmill script preview and wmill script run?▼

wmill script preview executes the local script file without deploying, making it the default for iterating on edits. wmill script run executes the version already deployed in the workspace and should only be used when you explicitly want the deployed version.

Why does wmill-lock.yaml show diffs after editing a script?▼

Editing script content, especially adding imports or changing main's arguments, invalidates the stored content hash and leaves the lock and input schema stale. Run wmill generate-metadata to regenerate the lock, schema, and hashes so they match the code.

Does wmill generate-metadata deploy my script?▼

No, generate-metadata only writes local files such as locks, schemas, and hashes; it never touches the workspace. However it re-resolves dependencies, which can bump unpinned versions, so pin versions in code and review the diff afterward.