home / skills / jinfanzheng / kode-sdk-csharp / rail

This skill helps you retrieve China-focused rail timetables, available tickets, and delays from official sources with source links and local update times.

npx playbooks add skill jinfanzheng/kode-sdk-csharp --skill rail

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
4.6 KB
---
name: rail
description: High-speed rail / train lookup workflow (China-focused). Use for timetables, ticket availability, delays, cancellations, or “today/latest” rail updates. Prefer official sources; always include source link + local update time; NEVER fabricate.
---

# Rail skill(高铁/火车:时刻表 & 余票 & 晚点)

## 心智模型

- **时刻表 ≠ 余票 ≠ 晚点**:这三类信息的实时性和权威来源不同,输出时要明确你查的是哪一类。
- **余票/晚点是强实时**:必须带来源链接和当地更新时间;拿不到就别下结论。
- **站名/日期是关键**:同一城市多个车站;“今天/明天”一定要落到当地日期。

## 只问 1 个关键问题(仅在必要时)

缺关键信息时只问一个:
- 缺日期: “你查 **哪天(当地日期)** 的车?”
- 站名不清: “你从哪个站出发、到哪个站?(例如 深圳北 → 广州南)”
- 目标不清(时刻表/余票/晚点): “你要看 **时刻表**、**余票** 还是 **晚点/停运**?”

## 输出硬要求(强约束)

必须包含:
- 类型:时刻表 / 余票 / 晚点 / 停运
- 出发站 → 到达站 + 日期(当地日期)
- 车次(如果用户提供或来源给出)
- **来源 + 链接**
- **当地时间**(来源页面的更新时间/发布时间;拿不到就写“来源未标注”)

建议格式(Markdown):

- **深圳北 → 广州南(YYYY-MM-DD)余票/时刻表/晚点**(来源:[xxx](<https://example.com/...>);当地时间:YYYY-MM-DD HH:mm / 来源未标注)
  - 结果:最关键一两条(不要刷屏)

## 来源策略(中国为主)

### 白名单(用于下结论)

- `12306.cn`(官方售票/查询渠道;用于余票、正点/停运信息、权威时刻)

### 余票查询优先链路(首选 12306 深链)

当用户问 **余票/票价/可买性** 时,**不要把“去某个链接自己看”当成答案**。应当你自己先查到结果,再把结果 + 来源一起给用户;其中 12306 必须优先。

**执行方式(在技能内约束,不依赖自定义工具)**:
- 先打开 12306 深链页(`leftTicket/init` 或 `lcQuery/init`),在页面上完成查询/读取结果(必要时用网页阅读/浏览器工具提取列表内容)。
- 把关键结果整理成 2~5 条即可(车次/出发到达/历时/余票),避免刷屏。
- 输出时必须带对应的 12306 深链(用户可复核),并写清楚你查询的北京时间(若页面未标注更新时间,就写“以查询时刻为准”)。

**来源链接(作为引用/复核,而不是让用户代查)**:

- **直达余票/车次列表(leftTicket)**:
  - 模板:`https://kyfw.12306.cn/otn/leftTicket/init?linktypeid=dc&fs=<出发站名>,<出发站码>&ts=<到达站名>,<到达站码>&date=<YYYY-MM-DD>&flag=N,N,Y`
  - 示例:`https://kyfw.12306.cn/otn/leftTicket/init?linktypeid=dc&fs=江门,JOQ&ts=深圳北,IOQ&date=2026-01-19&flag=N,N,Y`
- **中转换乘查询(lcQuery)**(用户明确要“换乘/中转”、或直达结果不理想时优先给这个):
  - 模板:`https://kyfw.12306.cn/otn/lcQuery/init?linktypeid=dc&fs=<出发站名>,<出发站码>&ts=<到达站名>,<到达站码>&date=<YYYY-MM-DD>&flag=N,N,Y`
  - 示例:`https://kyfw.12306.cn/otn/lcQuery/init?linktypeid=dc&fs=江门,JOQ&ts=深圳北,IOQ&date=2026-01-19&flag=N,N,Y`

使用要点:
- **站码必须是 12306 站码**(如 `深圳北=IOQ`)。若用户只给站名,先用 12306 官方站名码表确认站码;站名有歧义(同城多站/旧站名)就先问清再生成深链。
- **更新时间写法**:12306 余票列表页通常不单独标注“更新时间”,此时在输出中写:`以查询时刻为准(北京时间 YYYY-MM-DD HH:mm)`,并明确“页面未标注更新时间”。
- **结论约束**:即使第三方页面显示余票/票价,也只能作为辅助;最终结论必须以该 12306 深链页(或等价官方查询页)为准。
- **例外处理(仅在不可抗力时)**:若 12306 触发验证码/风控导致无法读取数据,必须明确说明“我现在无法在这里直接取到实时余票”,并给出 12306 深链作为备选复核路径(同时不要编造任何余票结论)。

### 全网(仅作补证/交叉验证)

- 第三方站点可用于辅助检索/引导,但余票与停运/晚点类结论必须回到官方或等价权威来源。

## NEVER(绝对禁止)

- 不要编造余票数量、票价、晚点分钟数、停运信息
- 不要把历史时刻表当作当天运行情况
- 不要在没确认日期/站点时就输出具体车次与时间

Overview

This skill provides focused high-speed rail and train lookup workflows for China: timetables, ticket availability, delays, and cancellations. It prioritizes official sources, requires a clear date and station pair, and always includes a source link plus the source's local update time. Results are concise and explicitly labeled as timetable / ticket availability / delay / cancellation.

How this skill works

The skill queries official channels (12306 deep links first) to retrieve real-time ticket availability, scheduled timetables, and disruption status. It validates station names and codes, maps ambiguous station names to the correct 12306 station code, and returns 2–5 key results with the source link and local update time. If official data cannot be read (e.g., captcha or blocking), it reports the limitation and supplies the authoritative deep link for user verification.

When to use it

  • Check ticket availability for a specific date and station pair in China
  • Confirm today's/latest timetable for a particular departure→arrival pair
  • Verify reported delays or train cancellations before departure
  • Get authoritative 12306 links and local update time for decision making
  • When station name is ambiguous or multiple stations exist in one city

Best practices

  • Always provide departure station → arrival station plus the local date in results
  • If the user omits date or station, ask one clear follow-up question only
  • Prioritize 12306 deep links for ticket availability and disruption status
  • Include the source link and the source page’s local update time; if the page has no timestamp, state that explicitly
  • Limit returned items to 2–5 key trains; avoid long raw lists
  • Do not fabricate ticket counts, prices, delay minutes, or cancellation claims

Example use cases

  • User asks: “Tickets from Shenzhen North to Guangzhou South tomorrow” — returns top available trains, journey time, 12306 leftTicket link, and Beijing/local query time
  • User asks: “Is G1234 delayed today?” — checks official status, supplies delay/cancellation label, source link, and source update time
  • User asks: “Show timetable for Beijing West → Xi’an North today” — returns scheduled departures and authoritative source link
  • User asks: “I only know city names” — clarifies which station (asks one question) then performs lookup

FAQ

What source do you use for ticket availability?

I prioritize 12306 deep links (leftTicket or lcQuery) for ticket availability; third-party sites are only used for cross-checking and never as the final authority.

What if 12306 is blocked or requires a captcha?

I will report that I cannot retrieve live ticket data due to access limitations, provide the 12306 deep link for manual verification, and avoid making any ticket or status claims.