AgentSkillsCN

delijn-cli

通过delijn CLI查询比利时弗拉芒公共交通运输(De Lijn)。当用户希望获取实时公交/电车发车时间、站点查询、线路搜索,或开启直播更新模式时使用此功能。可通过提及De Lijn、弗拉芒巴士、电车、比利时公共交通运输,或站点时刻表来触发该操作。

SKILL.md
--- frontmatter
name: delijn-cli
description: >
  Query Belgian Flemish public transport (De Lijn) via the delijn CLI. Use when the user wants
  real-time bus/tram departures, stop lookups, line searches, or watch mode for live updates.
  Triggered by mentions of De Lijn, Flanders buses, trams, Belgian public transport, or stop schedules.

delijn-cli

CLI for De Lijn - Flemish public transport (buses and trams).

Quick Start

bash
# Verify auth
delijn auth status

# Get departures by stop number
delijn departures 200552

# Search stops
delijn stops search "Gent Sint-Pieters"

Authentication

Requires De Lijn API key from data.delijn.be (free registration).

bash
# Store API key in system keyring
delijn auth set-key

# Verify setup
delijn auth status

If not authenticated, user must run delijn auth set-key interactively. Do not attempt auth setup on behalf of the user.

Core Rules

  1. Always use --json when parsing output programmatically
  2. Stop numbers are 6 digits - e.g., 200552
  3. Use favorites with @prefix - e.g., delijn departures @home
  4. Watch mode blocks - --watch refreshes every 30s; avoid in scripts

Output Formats

FlagFormatUse case
(default)TableUser-facing display
--jsonJSONAgent parsing, scripting
--plainTSVPipe to awk/cut

Workflows

Get Departures

bash
# By stop number
delijn departures 200552

# By stop name (searches and picks)
delijn departures "Gent Sint-Pieters"

# Filter by line
delijn departures 200552 --line 1

# Limit results
delijn departures 200552 --limit 5

# JSON output for parsing
delijn departures 200552 --json

Watch Mode (Live Updates)

bash
# Auto-refresh every 30 seconds
delijn departures 200552 --watch

Note: Watch mode is interactive and blocks - use for user display only, not scripting.

Search Stops

bash
# Search by name
delijn stops search "Gent Sint-Pieters"

# Get stop details by number
delijn stops get 200552

# JSON for scripting
delijn stops search "Brugge" --json

Search Lines

bash
# Search lines
delijn lines search "1"

# Get line details (entity + line number)
delijn lines get 1 1

Favorites

bash
# Save a favorite stop
delijn config set-favorite home 200552
delijn config set-favorite work 301234

# Use favorites with @ prefix
delijn departures @home
delijn departures @work

# List all favorites
delijn config list-favorites

Scripting Examples

bash
# Get next departure time
delijn departures 200552 --limit 1 --json | jq -r '.[0].time'

# Find stop ID from name
delijn stops search "Gent" --json | jq -r '.[0].number'

# List all stops matching pattern
delijn stops search "station" --json | jq -r '.[] | "\(.number) \(.name)"'

Environment Variables

VariableDescription
DELIJN_API_KEYAPI key (overrides keyring)
DELIJN_KEYRING_BACKENDKeyring backend: keychain, file, pass
NO_COLORDisable colored output

Rate Limits

De Lijn API has two rate limits:

  • Core API: 240 requests/minute (stops, lines, realtime)
  • Search API: 6000 requests/minute

The CLI handles rate limiting automatically with backoff.

Common Issues

"API key not configured"

Run delijn auth set-key to store the API key interactively.

Stop not found

Use 6-digit stop numbers. Search with delijn stops search "name" to find the correct number.

Guidelines

  • Never expose or log API keys
  • Favorites require user setup - do not create favorites without user consent
  • Watch mode is blocking - inform user it runs continuously