12306 Skill logo

12306 Skill

Community
Joooook
12306-skill

使用 Python 脚本调用 12306 接口,查询车票、车站和列车信息。

Overview

PublisherJoooook
Repository12306-skill
Skill name12306-skill
Stars
60
Forks
12
Bundled files
1
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 1 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by Joooook on GitHub. Read the source before you install it.

Installation

Install the 12306 Skill AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/Joooook/12306-skill/tree/main
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/Joooook/12306-skill.git \
  .claude/skills/12306-skill
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable 12306 Skill in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads 12306 Skill on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so 12306 Skill is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

12306 Skill

Quick Start

  • 先进入目录:12306-skill
  • 查看可用工具:python scripts/12306_apis.py list-tools
  • 调用工具:python scripts/12306_apis.py <tool-name> [--arg value ...]

Tool Commands

  • refresh-cache: 刷新本地缓存(站点数据与 lcquery 路径),非特殊情况不调用。
  • get-current-date: 获取当前日期,以上海时区(Asia/Shanghai, UTC+8)为准,返回格式 yyyy-MM-dd。主要用于解析相对日期。
  • get-stations-code-in-city: 通过中文城市名查询该城市所有火车站的名称及其对应的 station_code。
  • get-station-code-of-citys: 通过中文城市名查询代表该城市的 station_code。
  • get-station-code-by-names: 通过具体中文车站名查询其 station_code 和车站名。
  • get-station-by-telecode: 通过 station_telecode 查询车站详细信息(名称、拼音、所属城市等),常用于补充查询与调试。
  • get-tickets: 查询 12306 直达余票信息。
  • get-interline-tickets: 查询 12306 中转余票信息。
  • get-train-route-stations: 查询特定车次在指定日期的经停站、到发时间和停留信息。

函数调用参数说明

refresh-cache

  • 无参数。

get-current-date

  • 无参数。

get-stations-code-in-city

  • city (必填, string): 城市名,例如 北京。

get-station-code-of-citys

  • citys (必填, string): 一个或多个城市名,使用 | 分隔,例如 北京|上海。

get-station-code-by-names

  • station_names (必填, string): 一个或多个车站名,使用 | 分隔,例如 北京南|上海虹桥。

get-station-by-telecode

  • station_telecode (必填, string): 车站电报码,例如 BJP。

get-tickets

  • date (必填, string): 出发日期,格式 YYYY-MM-DD,且不能早于当天。
  • from_station (必填, string): 出发站,可传站名(如 北京南)或电报码(如 VNP)。
  • to_station (必填, string): 到达站,可传站名或电报码。
  • train_filter_flags (可选, string, 默认 ""): 车次过滤标记,可组合(如 GD)。支持:
    • G 高铁/城际
    • D 动车
    • Z 直达
    • T 特快
    • K 快速
    • O 其他
    • F 复兴号
    • S 智能动车组
  • earliest_start_time (可选, int, 默认 0): 最早发车小时(含),范围建议 0-23。
  • latest_start_time (可选, int, 默认 24): 最晚发车小时(不含),范围建议 1-24。
  • sort_flag (可选, string, 默认 ""): 排序字段,可选 startTime / arriveTime / duration。
  • sort_reverse (可选, bool, 默认 false): 是否倒序。
  • limited_num (可选, int, 默认 0): 返回数量限制,0 表示不限制。
  • format (可选, string, 默认 text): 输出格式,可选 text / csv / json。

get-interline-tickets

  • date (必填, string): 出发日期,格式 YYYY-MM-DD,且不能早于当天。
  • from_station (必填, string): 出发站,站名或电报码。
  • to_station (必填, string): 到达站,站名或电报码。
  • middle_station (可选, string, 默认 ""): 指定中转站,站名或电报码;留空表示自动推荐中转站。
  • show_wz (可选, bool, 默认 false): 是否显示无座方案。
  • train_filter_flags (可选, string, 默认 ""): 过滤规则同 get-tickets。
  • earliest_start_time (可选, int, 默认 0): 最早发车小时(含)。
  • latest_start_time (可选, int, 默认 24): 最晚发车小时(不含)。
  • sort_flag (可选, string, 默认 ""): 排序字段,可选 startTime / arriveTime / duration。
  • sort_reverse (可选, bool, 默认 false): 是否倒序。
  • limited_num (可选, int, 默认 10): 返回数量限制。
  • format (可选, string, 默认 text): 输出格式,可选 text / json。

get-train-route-stations

  • train_code (必填, string): 车次号,例如 G1033。
  • depart_date (必填, string): 运行日期,格式 YYYY-MM-DD。
  • format (可选, string, 默认 text): 输出格式,可选 text / json。

Args Examples

bash
python scripts/12306_apis.py get-current-date
python scripts/12306_apis.py get-stations-code-in-city --city "北京"
python scripts/12306_apis.py get-tickets --date "2026-03-09" --from_station "北京" --to_station "上海" --train_filter_flags "G" --format text
python scripts/12306_apis.py get-interline-tickets --date "2026-03-09" --from_station "成都" --to_station "广州" --limited_num 5
python scripts/12306_apis.py get-train-route-stations --train_code "G1033" --depart_date "2026-03-09"

Execution Rules

  • 请尽量使用接口的筛选功能,来筛选必要的信息,以此节省Token。

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the 12306 Skill AI skill do?

使用 Python 脚本调用 12306 接口,查询车票、车站和列车信息。

Why use 12306 Skill on TypingMind?

Because you install it once and use it with any model. 12306 Skill is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install 12306 Skill in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/Joooook/12306-skill/tree/main. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use 12306 Skill?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with 12306 Skill?

As many as you like. As long as a model supports skills, you can use 12306 Skill with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the 12306 Skill AI skill free?

It is published on GitHub by Joooook. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇