write-script-rlang

Writes Windmill R scripts with main functions, parameters, resources, and CLI preview commands.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing R scripts for the Windmill platform requires knowing its specific conventions: a mandatory main function, type mappings between R and Windmill, built-in helpers for variables and resources, and the correct CLI commands for previewing versus deploying. This Skill encodes all of those rules so generated scripts work on the first run. ## Core Features & Use Cases - Convention-compliant R scripts: Generates scripts with a required main function, correct parameter defaults, and JSON-serializable return values. - Platform integration guidance: Shows how to use get_variable and get_resource helpers, library() auto-resolution, and execution annotations like sandbox mode. - Correct CLI workflow: Distinguishes wmill script preview for local iteration from wmill script run and wmill sync push for deployed code, preventing accidental deploys of untested changes. - Use Case: A data analyst asks for an R script that reads a Postgres resource and transforms a dataset; the Skill produces a valid Windmill R script and offers to run wmill script preview with sample arguments. ## Quick Start Write a Windmill R script that fetches a database resource and returns a summary, then preview it locally with sample arguments.

Frequently Asked Questions about write-script-rlang

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

FAQPage Schema
How do I write an R script for Windmill?

Define a main function using <- or = assignment; its parameters become the script inputs and its return value becomes the step result. Load packages with library() and ensure the return value is JSON-serializable, since jsonlite is used internally for argument parsing.

How do I test a Windmill R script locally without deploying?

Use wmill script preview <script_path> to run the local file without deploying it to the workspace. Reserve wmill script run for scripts already deployed, and only use wmill sync push when you explicitly want to publish changes.

How do R types map to Windmill parameter types?

R numeric maps to float/int, character to string, logical to bool, list to object/dict, and NULL to null. Default values in the main function signature are inferred automatically, so count = 10 becomes an optional integer input defaulting to 10.

Can R scripts access Windmill variables and resources?

Yes, R scripts use the built-in get_variable and get_resource helpers with no import needed. get_resource returns a list you can index with $, for example db$host after calling get_resource("f/my_folder/postgres_config").

Why should I avoid wmill sync push just to test a script?

Pushing deploys your local edits to the workspace, overwriting the deployed version with untested changes. Use wmill script preview instead, which executes the local file without modifying workspace state.