Sk?netrafiken 行程规划器:AI 公共交通指南 - Openclaw Skills

作者:互联网

2026-04-17

AI快讯

什么是 Sk?netrafiken 行程规划器?

Sk?netrafiken 行程规划器是专门为 AI 智能体设计的工具,直接集成了瑞典南部和丹麦东部的区域交通网络。它使智能体能够通过对话界面查询公交、火车、地铁和轮渡时刻表,提供包括站台编号和实时交通状态在内的高精度数据。作为 Openclaw Skills 库的功能补充,它通过处理复杂的地点解析和多模式出行段,简化了区域导航。

该技能专为希望赋予其 AI 智能体计算行程时间、建议最佳出发时段并监控实时干扰能力的开发者而设计。通过弥合原始交通 API 与智能体工作流之间的差距,它提供了一种将本地物流无缝融入任何 AI 编码环境或自动化管道的方式。

下载入口:https://github.com/openclaw/skills/tree/main/skills/rezkam/skanetrafiken

安装与下载

1. ClawHub CLI

从源直接安装技能的最快方式。

npx clawhub@latest install skanetrafiken

2. 手动安装

将技能文件夹复制到以下位置之一

全局模式 ~/.openclaw/skills/ 工作区 /skills/

优先级:工作区 > 本地 > 内置

3. 提示词安装

将此提示词复制到 OpenClaw 即可自动安装。

请帮我使用 Clawhub 安装 skanetrafiken。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。

Sk?netrafiken 行程规划器 应用场景

  • 规划从马尔默到隆德的通勤并进行实时延迟监控。
  • 导航从瑞典到哥本哈根机场或中央火车站的跨境行程。
  • 查找前往特定公交站或地标(如旋转大楼)的最佳步行路线。
  • 安排基于到达时间的行程,以确保准时参加会议或活动。
Sk?netrafiken 行程规划器 工作原理
  1. 智能体识别用户的起点、终点和时间意图,例如立即出行、稍后出发或在特定时间到达。
  2. 它利用 search-location.sh 命令将纯文本名称解析为官方站点 ID 或地理坐标。
  3. 智能体验证搜索结果,为行程计算选择最合适的 STOP_AREA 或 LOCATION 类型。
  4. 它执行 journey.sh 来获取实时路线选项,包括详细的步行段、换乘和特定站台分配。
  5. 该技能处理实时延迟和交通中断等交通数据,向用户呈现清晰且带有表情符号的行程单。

Sk?netrafiken 行程规划器 配置指南

该技能需要主机系统安装 curl 和 jq,以便处理 API 请求和 JSON 响应。

# 安装依赖 (Ubuntu/Debian)
sudo apt-get install curl jq

# 搜索地点以获取 ID 或坐标
./search-location.sh "Malm? C"

# 使用 ID 或坐标规划行程
./journey.sh    

Sk?netrafiken 行程规划器 数据架构与分类体系

该技能对交通数据采用结构化方法,对地点和行程段进行分类以实现精确导航。

字段 描述
ID 站点和车站的唯一标识符(用于 STOP_AREA 类型)
类型 地点分类:STOP_AREA、ADDRESS、POI 或 LOCATION
坐标 纬度和经度(格式为 lat#lon),用于精确的地址到地址路由
行程的各个路段,包括交通方式、站台和方向
状态 实时指标,如 [+X 分钟延迟]、[已通过] 或 AVVIKELSE(偏差/中断)
name: skanetrafiken
description: Sk?ne public transport trip planner (Sk?netrafiken). Plans bus/train journeys with real-time delays. Supports stations, addresses, landmarks, and cross-border trips to Copenhagen.
license: MIT
compatibility: Requires curl, jq. Works with Claude Code and compatible agents.
metadata:
  author: rezkam
  version: "1.2.0"
  region: sweden

Sk?netrafiken Trip Planner

Plan public transport journeys in Sk?ne, Sweden with real-time departure information.

Commands

1. Search Location

Search for stations, addresses, or points of interest.

./search-location.sh  [limit]
Argument Description
query Location name to search for
limit Number of results to show (default: 3, max: 10)

Output includes:

  • ID - The location identifier (use this in journey search)
  • Name - Official name of the location
  • Type - STOP_AREA (station), ADDRESS, or POI (point of interest)
  • Area - Region/municipality
  • Coordinates - Latitude, longitude

When to increase limit:

  • First result doesn't match user's intent
  • User's query is ambiguous (e.g., "station", "centrum")
  • Need to show user multiple options to choose from

Plan a journey between two locations using their IDs.

./journey.sh     [datetime] [mode]
Argument Description
from-id Origin location ID (from search) or coordinates (lat#lon)
from-type STOP_AREA, ADDRESS, POI, or LOCATION (for coordinates)
to-id Destination location ID or coordinates
to-type Type of destination
datetime Optional: "18:30", "tomorrow 09:00", "2026-01-15 09:00"
mode Optional: "depart" (default) or "arrive"

Important: The Journey API only accepts STOP_AREA and LOCATION types. For ADDRESS or POI results, use the coordinates as lat#lon with type LOCATION.


Understanding User Time Intent

Before searching, understand what the user wants:

Intent Types

User Says Intent How to Query
"now", "next bus", "how do I get to" Travel Now No datetime parameter
"in 30 minutes", "in 1 hour", "after lunch" Depart Later Calculate time, use depart mode
"around 15:00", "sometime afternoon" Around Time Query with offset (see below)
"arrive by 18:00", "need to be there at 9" Arrive By Use arrive mode
"tomorrow morning", "on Friday at 10" Future Time Use specific datetime

Handling "Around Time" Queries

When user wants options "around" a time, query 15-30 minutes earlier to show options before and after:

# User: "I want to travel around 15:00"
# Query at 14:30 to get options spanning 14:30-16:00+
./journey.sh ... "14:30" depart

Relative Time Calculations

Convert relative times to absolute:

User Says Current: 14:00 Query Time
"in 30m" "14:30"
"in 1h" "15:00"
"in 2 hours" "16:00"

LLM Response Formatting

When presenting journey results to users, use these emojis and formatting guidelines.

Emoji Reference

Emoji Use For
?? Train (P?gat?g, ?resundst?g)
?? Bus
?? Metro (Copenhagen)
?? Tram
?? Ferry
?? Walking segment
?? Time/duration
?? Departure time
?? Arrival time
?? Stop/station
?? Origin (home/start)
?? Destination
?? Delay or disruption
? On time
?? Transfer/change
??? Platform/track

Response Structure

Always include these key elements from the tool output:

  1. When to leave - The actual time user needs to start (including walking)
  2. Walking segments - Distance and time for any walking
  3. Transport departure - When the bus/train actually leaves
  4. Arrival time - When user reaches destination
  5. Any delays - Show deviation from schedule

Example Response Format

For a simple direct journey:

?? **Leave home at 09:00**

?? Walk 450m to M?llev?ngstorget (5 min)

?? **M?llev?ngstorget** → ?? **Malm? C**
?? Bus 5 departs 09:07 from M?llev?ngstorget
?? Arrives 09:18 at Malm? C

?? Total: 18 min

For a journey with transfer:

?? **Leave at 08:45**

?? Walk 300m to V?stra Hamnen (4 min)

?? **V?stra Hamnen** → ?? **Malm? C** → ?? **Lund C**

**Leg 1:**
?? Bus 2 departs 08:51 [??? L?ge A]
?? Arrives Malm? C 09:05

?? Transfer at Malm? C (6 min)

**Leg 2:**
?? P?gat?g departs 09:11 [??? Sp?r 4]
?? Arrives Lund C 09:23

?? Total: 38 min | ?? 1 change

With delays:

?? **Depart 14:30** from Triangeln

?? ?resundst?g 1042 → K?benhavn H
?? +8 min delay (expected 14:38 instead of 14:30)
?? Arrives ~15:25 (normally 15:17)

Walking Segment Details

CRITICAL: Always show walking details from the tool output:

  • Distance in meters (from line.distance)
  • Include walking in the "leave time" calculation
  • Show walking at start AND end of journey

Example tool output:

→ WALK 450m from Kalendegatan to M?llev?ngstorget

Format as:

?? Walk 450m to M?llev?ngstorget (~5 min)

Walk time estimate: ~100m per minute (normal walking speed)

Presenting Multiple Options

When showing journey options, make timing crystal clear:

I found 3 options for you:

**Option 1 - Leave now (09:00)** ? Recommended
?? 5 min walk → ?? Bus 5 at 09:07 → arrives 09:25
?? Total: 25 min

**Option 2 - Leave in 15m (09:15)**
?? 5 min walk → ?? Bus 5 at 09:22 → arrives 09:40
?? Total: 25 min

**Option 3 - Leave in 30m (09:30)**
?? 5 min walk → ?? Train at 09:37 → arrives 09:48
?? Total: 18 min | Faster but later departure

Time Offset Notation

Use clear notation for departure times:

Notation Meaning
"now" Immediately
"in 15m" 15 minutes from now
"in 1h" 1 hour from now
"at 14:30" Specific time

LLM Workflow: How to Plan a Trip

Follow this workflow when a user asks for a trip:

Step 1: Understand Time Intent

Parse what the user wants:

  • "How do I get to..." → Travel now
  • "I need to be there at 18:00" → Arrive mode
  • "Sometime around 3pm" → Query 14:30, show range
  • "In about an hour" → Calculate from current time

Step 2: Search for Both Locations

Search for origin and destination separately:

./search-location.sh "Malm? C"
./search-location.sh "Emporia"

Step 3: Validate Search Results

Check each result carefully:

  1. Exact or close match? - If the name matches what the user asked for, proceed.

  2. Multiple results returned? - The script shows up to 10 matches. If the first result isn't clearly correct, ask the user to confirm.

  3. Name significantly different? - If user asked for "the mall near Hyllie" and result shows "Emporia", confirm with user: "I found Emporia shopping center near Hyllie. Is this correct?"

  4. No results found? - Try alternative strategies (see below).

Step 4: Handle Ambiguous or Failed Searches

When results don't match or are ambiguous, ask clarifying questions:

I searched for "centrum" and found multiple locations:
1. Malm? Centrum (bus stop)
2. Lund Centrum (bus stop)
3. Helsingborg Centrum (bus stop)

Which one did you mean?

When no results are found, try these strategies:

  1. Try with city name for addresses:

    # If "Storgatan 10" fails, try:
    ./search-location.sh "Storgatan 10, Malm?"
    
  2. Try official station names:

    # If "Malm? station" fails, try:
    ./search-location.sh "Malm? C"
    
  3. Try landmark name only (without city):

    # If "Emporia, Malm?" fails, try:
    ./search-location.sh "Emporia"
    
  4. Use coordinates as last resort:

    • If you know the approximate location, use lat#lon format directly
    • Ask user: "I couldn't find that location. Can you provide the address or coordinates?"

Step 5: Convert Types for Journey API

The Journey API only accepts:

  • STOP_AREA - Bus/train stations (use ID directly)
  • LOCATION - GPS coordinates as lat#lon

If search returns ADDRESS or POI:

  • Use the coordinates from search result
  • Format as lat#lon with type LOCATION

Example:

# Search returns: ID: 123, Type: ADDRESS, Coordinates: 55.605, 13.003
# Use in journey as:
./journey.sh "55.605#13.003" LOCATION 9021012080000000 STOP_AREA

Once you have confirmed IDs/coordinates for both locations:

./journey.sh     [datetime] [mode]

Step 7: Format Response with Emojis

Use the emoji guide above to present results clearly. Always use actual numbers from the tool output - never speculate or estimate.


Query Formatting Rules

The search API is sensitive to formatting. Follow these rules:

Landmarks and POIs: Name Only

Use the landmark name WITHOUT city name.

# CORRECT
./search-location.sh "Emporia"
./search-location.sh "Triangeln"
./search-location.sh "Turning Torso"

# WRONG - city name breaks POI search
./search-location.sh "Emporia, Malm?"        # May return wrong location!
./search-location.sh "Triangeln, Malm?"      # Unnecessary, may fail

Street Addresses: Include City

Include city name for better accuracy.

# CORRECT
./search-location.sh "Kalendegatan 12, Malm?"
./search-location.sh "Storgatan 25, Lund"
./search-location.sh "Drottninggatan 5, Helsingborg"

# RISKY - may be ambiguous
./search-location.sh "Kalendegatan 12"       # Works if unambiguous

Train Stations: Use Official Names

Use "C" suffix for central stations.

# CORRECT
./search-location.sh "Malm? C"
./search-location.sh "Lund C"
./search-location.sh "Helsingborg C"
./search-location.sh "Malm? Hyllie"
./search-location.sh "Malm? Triangeln"

# WRONG
./search-location.sh "Malm?"                 # Ambiguous!
./search-location.sh "Malm? Central"         # Not official name
./search-location.sh "Lund station"          # Not official name

Copenhagen (Cross-border)

Use Danish names or common alternatives.

# All work
./search-location.sh "K?benhavn H"
./search-location.sh "N?rreport"
./search-location.sh "Copenhagen Airport"
./search-location.sh "K?penhamn"

Examples

Example 1: Travel Now

User: "How do I get from Malm? C to Lund C?"

./search-location.sh "Malm? C"
./search-location.sh "Lund C"
./journey.sh 9021012080000000 STOP_AREA 9021012080040000 STOP_AREA

Response:

?? **Leave now** from Malm? C

?? **Malm? C** → ?? **Lund C**
?? ?resundst?g 1324 departs 09:04 [??? Sp?r 2b]
?? Arrives 09:16 at Lund C [??? Sp?r 1]

?? Total: 12 min | ? Direct, no changes

Example 2: Address with Walking

User: "I need to go from Kalendegatan 12 in Malm? to Emporia"

./search-location.sh "Kalendegatan 12, Malm?"
./search-location.sh "Emporia"
./journey.sh "55.595#13.001" LOCATION "55.563#12.973" LOCATION

Response:

?? **Leave at 10:05**

?? Walk 320m to M?llev?ngstorget (~3 min)

?? **M?llev?ngstorget** → ?? **Emporia**
?? Bus 32 departs 10:10
?? Arrives 10:28 at Emporia

?? Walk 150m to destination (~2 min)

?? Total: 25 min

Example 3: Arrive By Time

User: "I need to be at Copenhagen central by 18:00 tomorrow"

./search-location.sh "Malm? C"
./search-location.sh "K?benhavn H"
./journey.sh 9021012080000000 STOP_AREA 9921000008600626 STOP_AREA "tomorrow 18:00" arrive

Response:

?? **Arrive by 18:00** at K?benhavn H

?? **Malm? C** → ?? **K?benhavn H**
?? ?resundst?g departs **17:21** [??? Sp?r 1]
?? Arrives **17:56** ? 4 min buffer

?? Journey: 35 min

?? Leave Malm? C by 17:21 to arrive on time!

Example 4: Around Time Query

User: "I want to travel to Lund around 15:00"

# Query 30 min earlier to show options around 15:00
./journey.sh 9021012080000000 STOP_AREA 9021012080040000 STOP_AREA "14:30"

Response:

Options around 15:00 for Malm? C → Lund C:

**Option 1 - Depart 14:34** (in 25m)
?? P?gat?g → arrives 14:52
?? 18 min

**Option 2 - Depart 14:49** (in 40m)
?? ?resundst?g → arrives 15:01
?? 12 min

**Option 3 - Depart 15:04** (in 55m) ? Closest to 15:00
?? P?gat?g → arrives 15:22
?? 18 min

Which works best for you?

Example 5: Relative Time

User: "I want to leave in about an hour"

# Current time: 13:00, so query for 14:00
./journey.sh ... "14:00"

Response:

Options departing around 14:00 (in ~1h):

**Leave at 13:55** (in 55m)
?? 5 min walk → ?? Bus 5 at 14:02 → arrives 14:25

**Leave at 14:10** (in 1h 10m)
?? 5 min walk → ?? Train at 14:17 → arrives 14:35

Let me know which one works!

Example 6: Journey with Delays

When tool output shows delays:

From: 14:30 Malm? C [+8 min late]

Response:

?? **Malm? C** → ?? **Lund C**
?? ?resundst?g 1042
?? **Running 8 min late**
?? Scheduled: 14:30 → Expected: ~14:38
?? Arrives ~14:50 (normally 14:42)

When to Ask Clarifying Questions

Always ask when:

  1. Search returns no results:

    • "I couldn't find [location]. Could you provide more details like the full address or nearby landmarks?"
  2. Multiple plausible matches:

    • "I found several locations matching '[query]': [list]. Which one did you mean?"
  3. Result name very different from query:

    • "You asked for '[user query]' but the closest match I found is '[result name]'. Is this correct?"
  4. User request is vague:

    • "From Malm?" - "Which location in Malm?? The central station (Malm? C), or a specific address?"
  5. Cross-border ambiguity:

    • "Copenhagen" could mean different stations - confirm if they want K?benhavn H (central), Airport, or another station.
  6. Time is unclear:

    • "When do you want to travel? Now, or at a specific time?"

DateTime Formats

All times are Swedish local time (CET/CEST).

Format Example Meaning
(empty) Travel now
HH:MM "18:30" Today at 18:30
tomorrow HH:MM "tomorrow 09:00" Tomorrow at 09:00
YYYY-MM-DD HH:MM "2026-01-15 09:00" Specific date

Output Format

Journey Option (Raw Tool Output)

══════════════════════════════════════════════════════════════
OPTION 1: Malm? C → Lund C
══════════════════════════════════════════════════════════════
Date:    2026-01-14
Depart:  09:04
Arrive:  09:16
Changes: 0

LEGS:
  → ORESUND ?resundst?g 1324
    From: 09:04 Malm? C [Sp?r 2b]
    To:   09:16 Lund C [Sp?r 1]
    Direction: mot Helsingborg C

Transport Types

Type Emoji Description
TRAIN ?? P?gat?g (regional train)
ORESUND ?? ?resundst?g (cross-border train)
BUS ?? City or regional bus
WALK ?? Walking segment
TRAM ?? Tram/light rail
METRO ?? Copenhagen Metro
FERRY ?? Ferry

Status Indicators

Indicator Emoji Meaning
(none) ? On time
[+X min late] ?? Delayed
[-X min early] ?? Running early
[PASSED] ? Already departed
AVVIKELSE ?? Service disruption

Error Handling

"No locations found"

The search returned no results.

Strategies:

  1. Check spelling (Swedish: ?, ?, ?)
  2. Try official station names with "C" for central
  3. For landmarks, remove city suffix
  4. For addresses, add city name
  5. Ask user for clarification

"No journeys found"

No routes available.

Strategies:

  1. Check if service operates at that hour (late night/early morning limited)
  2. Try different departure time
  3. Suggest alternative nearby stops

Quick Reference

Location Type Search Format Journey Type
Train station "Malm? C" STOP_AREA
Bus stop "M?llev?ngstorget" STOP_AREA
Address "Street 12, City" Use coords → LOCATION
Landmark/POI "Emporia" (no city!) Use coords → LOCATION
Coordinates 55.605#13.003 LOCATION

相关推荐