write-script-rust

Write Rust scripts with a serializable main return type and partial Cargo.toml dependencies.

17.5k|1.1k|Updated May 5, 2022
One-click install
npx skills add https://github.com/windmill-labs/windmill --skill write-script-rust
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: write-script-rust
Source: https://github.com/windmill-labs/windmill/tree/main/system_prompts/auto-generated/skills/write-script-rust
Command: npx skills add https://github.com/windmill-labs/windmill --skill write-script-rust

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill standardizes the creation of Rust scripts by enforcing a clear entry point (main) and a serializable return type, enabling automated execution and reliable integration in internal workflows.

Core Features & Use Cases

  • Enforces a Rust script structure with a main function signature returning anyhow::Result<ReturnType> and a serializable ReturnType.
  • Allows declaring dependencies at the top of the script with a partial cargo.toml snippet, making builds deterministic and repeatable.
  • Use cases include internal CLI tools, data processing tasks, and automation workflows that require typed outputs and easy testing.

Quick Start

Create a Rust script that defines a main function and a ReturnType that derives Serialize, then declare dependencies at the top with a partial cargo.toml. Place the script in the scripts/ folder and execute the Windmill workflow commands to generate metadata and deploy.

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 with a structured entry point and serializable output?

Write a Rust script with a main function returning anyhow::Result<ReturnType>, where ReturnType derives Serialize. Declare dependencies in a partial Cargo.toml at the top of the script. This structure enables deterministic builds and reliable integration in automation workflows.

Can I use Rust to automate internal CLI tools and data processing tasks?

Yes. Rust scripts with a main function and serializable return types are ideal for internal automation, CLI tools, and data processing. The enforced structure ensures typed outputs and straightforward testing within your workflow.

What's the best way to declare dependencies in a Rust script for automation?

Include a partial Cargo.toml snippet at the top of your script. This makes dependency declarations explicit and builds deterministic and repeatable, eliminating version drift across automation runs.

Do I need to know Rust's serde and anyhow libraries to use this pattern?

Yes. The pattern requires ReturnType to derive Serialize (from serde) and main to return anyhow::Result<T>. These libraries handle serialization and error propagation, which are core to the structured script design.

What problem does enforcing a main function signature solve in Rust scripts?

Enforcing a deterministic main entry point and serializable return type standardizes script execution, enabling automated result capture, reliable integration into workflows, and consistent error handling across internal tools.

Can I test Rust scripts built with this pattern before deployment?

Yes. The typed return value and structured main function make scripts straightforward to test. Results are serializable and predictable, supporting unit and integration testing within your automation pipeline.