write-script-rust

Standardize Rust scripts with a serializable return type and anyhow::Result.

Updated Feb 21, 2026
One-click install
npx skills add https://github.com/adamkingsbury/unified-data-model --skill write-script-rust-adamkingsbury
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: write-script-rust
Source: https://github.com/adamkingsbury/unified-data-model/tree/main/.claude/skills/write-script-rust
Command: npx skills add https://github.com/adamkingsbury/unified-data-model --skill write-script-rust-adamkingsbury

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Standardizes Rust script development by enforcing a consistent main signature and a serializable return type.

Core Features & Use Cases

  • Enforces a main function named main with a signature that uses owned parameter types and returns a serializable type wrapped in anyhow::Result.
  • Provides a canonical ReturnType struct annotated with #[derive(Serialize)] to ensure JSON-serializable output.
  • Documents and demonstrates how to declare dependencies at the top of the script and how to handle asynchronous code by creating a Tokio runtime inside main when needed.

Quick Start

Create a Rust script with a main function that takes owned parameters and returns an anyhow::Result<T> where T is a serializable type.

Frequently Asked Questions about write-script-rust

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

FAQPage Schema
How do I standardize Rust script output for deterministic CI environments?

Standardize Rust script output by enforcing a main signature with owned parameters and a serializable return type wrapped in anyhow::Result. This ensures deterministic results across local and CI environments.

What's the best way to return JSON-serializable data from a Rust script?

Use a canonical ReturnType struct annotated with #[derive(Serialize)] to ensure JSON-serializable output. This approach standardizes the return type so scripts produce consistent, parseable data.

How do I handle async code in a Rust script that uses a standardized main signature?

Handle async code in standardized Rust scripts by creating a Tokio runtime inside main when needed. The main signature remains synchronous while the runtime executes asynchronous operations internally.

Do I need anyhow and serde to write deterministic Rust scripts?

Yes, the standardized main signature requires returning an anyhow::Result wrapper and a serializable type using serde. These dependencies provide the error handling and serialization needed for deterministic output.

Why does my Rust script fail to produce deterministic results in CI pipelines?

Rust scripts fail to produce deterministic results when they lack a consistent main signature, owned parameter types, or a serializable ReturnType. Enforcing an anyhow::Result wrapper standardizes execution and output.