home / skills / windmill-labs / windmill / write-script-graphql
This skill helps you write GraphQL queries and mutations accurately by guiding structure, variables, and binding with your scripts.
npx playbooks add skill windmill-labs/windmill --skill write-script-graphqlReview the files below or copy the command above to add this skill to your agents.
---
name: write-script-graphql
description: MUST use when writing GraphQL 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.
# GraphQL
## Structure
Write GraphQL queries or mutations. Arguments can be added as query parameters:
```graphql
query GetUser($id: ID!) {
user(id: $id) {
id
name
email
}
}
```
## Variables
Variables are passed as script arguments and automatically bound to the query:
```graphql
query SearchProducts($query: String!, $limit: Int = 10) {
products(search: $query, first: $limit) {
edges {
node {
id
name
price
}
}
}
}
```
## Mutations
```graphql
mutation CreateUser($input: CreateUserInput!) {
createUser(input: $input) {
id
name
createdAt
}
}
```
This skill helps you write and integrate GraphQL queries and mutations into scripts for a workflow platform. It focuses on correct operation structure, variable binding from script arguments, and the deployment steps required to make GraphQL-backed scripts runnable and self-hostable.
You author GraphQL queries or mutations in script files and declare variables as operation parameters. The script runner automatically binds script arguments to GraphQL variables, so inputs flow directly into queries and mutations. After writing, generate metadata and lock files with a CLI command and push the script to deploy it to the platform.
How are GraphQL variables passed to the script?
Variables are passed as script arguments; the platform automatically binds those arguments to the GraphQL operation parameters.
How do I deploy a GraphQL-backed script?
After writing the script, run `wmill script generate-metadata` to create metadata and lock files, then `wmill sync push` to deploy to the platform.