home / skills / windmill-labs / windmill / write-script-mysql
This skill helps you write safe MySQL queries by guiding parameter placeholders, comments, and syntax for clean, maintainable database access.
npx playbooks add skill windmill-labs/windmill --skill write-script-mysqlReview the files below or copy the command above to add this skill to your agents.
---
name: write-script-mysql
description: MUST use when writing MySQL queries.
---
## CLI Commands
Place scripts in a folder. After writing, run:
- `wmill script generate-metadata` - Generate .script.yaml and .lock files
- `wmill sync push` - Deploy to Windmill
Use `wmill resource-type list --schema` to discover available resource types.
# MySQL
Arguments use `?` placeholders.
Name the parameters by adding comments before the statement:
```sql
-- ? name1 (text)
-- ? name2 (int) = 0
SELECT * FROM users WHERE name = ? AND age > ?;
```
This skill provides a concise, practical guide for writing MySQL queries when building scripts for the platform. It emphasizes parameterized statements using ? placeholders and shows how to name parameters with inline comments. It also includes the essential CLI commands to generate script metadata and deploy scripts to the platform.
When composing MySQL statements, use ? placeholders for every argument to ensure parameterization and avoid injection. Name each parameter by adding a comment line immediately before the SQL statement using the format: -- ? paramName (type) = default. After scripts are written to a folder, run the provided CLI commands to generate metadata and push deployments.
How do I declare a parameter type and default?
Add a comment line before the SQL using the format: -- ? paramName (type) = default. Type is a human-readable hint like text or int.
What CLI commands are required to deploy a script?
Run wmll script generate-metadata to create .script.yaml and .lock, then run wmll sync push to deploy the script to the platform.