Install
openclaw skills install trein-plusQuery Dutch Railways (NS) for TRAIN travel only - train departures, time-based trip planning (depart-at/arrive-by), disruptions, and station search via the trein CLI. NOT for car, bus, or other transport.
openclaw skills install trein-plusA CLI for the NS (Dutch Railways) API with real-time train departures, train trip planning, disruptions, and station search.
npm (recommended):
npm i -g trein
Or download a standalone binary from GitHub Releases.
Get an API key from https://apiportal.ns.nl/ and set it:
export NS_API_KEY="your-api-key"
Or create ~/.config/trein/trein.config.json:
{ "apiKey": "your-api-key" }
trein departures "Amsterdam Centraal"
trein d amsterdam
trein d amsterdam --json # structured output
trein trip "Utrecht" "Den Haag Centraal"
trein t utrecht denhaag --json
trein t amsterdam rotterdam --via utrecht # route via specific station
trein t hoofddorp "den haag" --arrive-by 09:30 --json # arrive by 09:30 TODAY
trein t hoofddorp "den haag" --depart-at 09:00 --json # depart at 09:00 TODAY
trein t utrecht amsterdam --date 2026-02-05 --depart-at 14:30 --json # specific FUTURE date and time
trein disruptions
trein disruptions --json
trein stations rotterdam
trein s rotterdam --json
trein alias set home "Amsterdam Centraal"
trein alias set work "Rotterdam Centraal"
trein alias list
trein d home # uses alias
This skill should be used when users ask about TRAIN TRAVEL in the Netherlands:
First: Confirm the user wants TRAIN travel. If they want car/bus/other transport, do NOT use this skill.
Then select the appropriate command:
departurestriptrip with --arrive-by or --depart-atdisruptionsstations first to resolvetrip with --date{
"trips": [{
"departure": "08:05",
"arrival": "08:35",
"duration": "30 min",
"transfers": 0,
"status": "ON_TIME",
"legs": [{
"from": "Schiphol Airport",
"to": "Den Haag Centraal",
"trainType": "IC",
"platform": "5"
}]
}]
}
{
"departures": [{
"time": "14:23",
"delay": "0 min",
"destination": "Amsterdam Centraal",
"platform": "3",
"trainType": "IC"
}]
}
{
"disruptions": [{
"title": "Werkzaamheden Amsterdam-Utrecht",
"type": "MAINTENANCE",
"routes": ["Amsterdam Centraal", "Utrecht Centraal"],
"active": true,
"expectedEnd": "2026-02-05 23:59"
}]
}
--json for machine-readable outputstations command--date flag for today's travel; only add --date for future datestrein t hoofddorp amsterdam --arrive-by 09:30 --json (today)
OR: trein t hoofddorp amsterdam --date 2026-02-05 --arrive-by 09:30 --json (future date)trein d <current-station> --jsontrein t utrecht "den haag" --date 2026-02-04 --depart-at 14:00 --jsontrein t amsterdam utrecht --jsontrein disruptions --jsontrein stations <query> --json to find correct nameNS_API_KEY environment variable is set--via, route may not be possible via that station--json flag for all commands to get structured output for parsing--via with trip planning to specify a specific route through an intermediate station--depart-at HH:mm to plan trips departing at a specific time (defaults to TODAY)--arrive-by HH:mm to plan trips arriving before a specific time (defaults to TODAY)--date YYYY-MM-DD is OPTIONAL - only needed for future dates (omit for today)npm i -g trein