12306

kirorab/12306-skill · updated May 23, 2026

MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.

$npx skills add https://github.com/kirorab/12306-skill --skill 12306
0 commentsdiscussion
summary

Query train schedules and remaining tickets from China Railway 12306.

skill.md

12306 Train Query

Query train schedules and remaining tickets from China Railway 12306.

Query Tickets

node {baseDir}/scripts/query.mjs <from> <to> [options]
  • HTML mode (default): writes file, prints path to stdout
  • Markdown mode (-f md): prints table to stdout

Examples

# All trains from Beijing to Shanghai (defaults to today)
node {baseDir}/scripts/query.mjs 北京 上海

# Markdown table output (to stdout, good for chat)
node {baseDir}/scripts/query.mjs 北京 上海 -t G -f md

# Morning departures, 2h max, with second class available
node {baseDir}/scripts/query.mjs 上海 杭州 -t G --depart 06:00-12:00 --max-duration 1h --seat ze

# Only bookable trains arriving before 6pm
node {baseDir}/scripts/query.mjs 深圳 长沙 --available --arrive -18:00

# Custom output path
node {baseDir}/scripts/query.mjs 广州 武汉 -o /tmp/tickets.html

# JSON output (to stdout)
node {baseDir}/scripts/query.mjs 广州 武汉 --json

Options

  • -d, --date <YYYY-MM-DD>: Travel date (default: today)
  • -t, --type <G|D|Z|T|K>: Filter train types (combinable, e.g. GD)
  • --depart <HH:MM-HH:MM>: Depart time range (e.g. 08:00-12:00, 18:00-)
  • --arrive <HH:MM-HH:MM>: Arrive time range (e.g. -18:00, 14:00-20:00)
  • --max-duration <duration>: Max travel time (e.g. 2h, 90m, 1h30m)
  • --available: Only show bookable trains
  • --seat <types>: Only show trains with tickets for given seat types (comma-separated: swz,zy,ze,rw,dw,yw,yz,wz)
  • -f, --format <html|md>: Output format — html (default, saves file) or md (markdown table to stdout)
  • -o, --output <path>: Output file path, html mode only (default: {baseDir}/data/<from>-<to>-<date>.html)
  • --json: Output raw JSON to stdout

Output Columns

Column Meaning
商务/特等 Business class / Premium (swz)
一等座 First class (zy)
二等座 Second class (ze)
软卧/动卧 Soft sleeper / Bullet sleeper (rw/dw)
硬卧 Hard sleeper (yw)
硬座 Hard seat (yz)
无座 Standing (wz)

Values: number = remaining seats, = available (qty unknown), = not applicable

Station Lookup

node {baseDir}/scripts/stations.mjs 杭州
node {baseDir}/scripts/stations.mjs 香港西九龙

Important Notes for AI Assistant

⚠️ Station Name Resolution Warning

CRITICAL: When querying by city name (e.g., "武汉", "上海", "深圳", "广州"), the API may return trains from/to ANY station in that city, not just the main station.

Common Pitfalls:

  • 武汉 includes: 武汉站 (main), 汉口站 (Hankou), 武昌站 (Wuchang), 武汉东站
  • 上海 includes: 上海虹桥 (Hongqiao), 上海站 (main), 上海南站, 上海松江站
  • 深圳 includes: 深圳北站 (main), 深圳站 (Luohu), 福田站, 深圳东站
  • 广州 includes: 广州南站 (main), 广州站, 广州东站, 广州北站

Best Practice - Always verify exact stations:

  1. First, use stations.mjs to list all stations in the city:
    node {baseDir}/scripts/stations.mjs 武汉
    
  2. Then, query with exact station names for accurate results:
    node {baseDir}/scripts/query.mjs 武汉 上海虹桥 -f md
    

🔄 Transfer/Connection Guidelines

When planning transfers (中转):

  • Use JSON output (--json) to verify exact station names
  • Ensure both segments use the SAME station (e.g., both use 武汉站, not 武汉→汉口)
  • Recommended minimum transfer time: 20-30 minutes for same station
  • Different stations in same city require additional travel time (e.g., 武汉→汉口 = 30+ min by subway)

📋 Query Workflow Recommendation

For accurate results, follow this workflow:

  1. List stations in departure city:

    node {baseDir}/scripts/stations.mjs 北京
    
  2. List stations in arrival city:

    node {baseDir}/scripts/stations.mjs 上海
    
  3. Query with exact station names (e.g., 北京南 → 上海虹桥):

    node {baseDir}/scripts/query.mjs 北京南 上海虹桥 -d 2026-03-05 -f md
    
  4. For transfers: Always verify both segments use the same station by checking fromStation and toStation in JSON output.

Technical Notes

  • Data comes directly from 12306 official API (no key needed)
  • Station data is cached for 7 days in {baseDir}/data/stations.json
  • Works for all train types: G (高铁), D (动车), Z (直达), T (特快), K (快速)
how to use 12306

How to use 12306 on Cursor

AI-first code editor with Composer

1

Prerequisites

Before installing skills in Cursor, ensure your development environment meets these requirements:

  • Cursor installed and configured on your development machine
  • Node.js version 16.0+ with npm package manager (verify with node --version)
  • Active project directory or workspace where you want to add 12306
2

Execute installation command

Execute the skills CLI command in your project's root directory to begin installation:

$npx skills add https://github.com/kirorab/12306-skill --skill 12306

The skills CLI fetches 12306 from GitHub repository kirorab/12306-skill and configures it for Cursor.

3

Select Cursor when prompted

The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:

◆ Which agents do you want to install to?
│ ── Universal (.agents/skills) ── always included ────
│ • Amp
│ • Antigravity
│ • Cline
│ • Codex
│ ●Cursor(selected)
│ • Cursor
│ • Windsurf
4

Verify installation

Confirm successful installation by checking the skill directory location:

.cursor/skills/12306

Reload or restart Cursor to activate 12306. Access the skill through slash commands (e.g., /12306) or your agent's skill management interface.

Security & Verification Notice

We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.

Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment.

List & Monetize Your Skill

Submit your Claude Code skill and start earning

GET_STARTED →

Use Cases

User Story & Requirements Generation

Create detailed user stories, acceptance criteria, and feature specs

Example

Generate user stories for 'password reset feature' with acceptance criteria, edge cases, and test scenarios

Reduce spec writing time by 50%, ensure comprehensive coverage

Competitive Analysis

Research competitors, compare features, identify gaps

Example

Analyze 5 competitor products, create feature comparison matrix, suggest differentiation opportunities

Complete competitive research in 2 hours instead of 2 days

Roadmap Prioritization

Evaluate features using frameworks (RICE, ICE, Kano) and create prioritized backlogs

Example

Score 20 feature ideas using RICE framework, generate prioritized roadmap with rationale

Make data-driven prioritization decisions faster

Stakeholder Communication

Draft PRDs, status updates, and stakeholder presentations

Example

Create executive summary of Q3 roadmap, monthly progress report, feature launch announcement

Save 3-5 hours/week on communication overhead

Implementation Guide

Prerequisites

  • Claude Desktop or compatible AI client
  • Access to product documentation and roadmap tools (Jira, Notion, etc.)
  • Understanding of product management frameworks (RICE, Jobs-to-be-Done, etc.)
  • Stakeholder contact information and communication channels

Time Estimate

30-60 minutes to see productivity improvements

Installation Steps

  1. 1.Install product management skill
  2. 2.Start with user story generation for known feature
  3. 3.Progress to competitive analysis: research 2-3 competitors
  4. 4.Use for roadmap prioritization: apply RICE/ICE scoring
  5. 5.Draft stakeholder communications and refine based on feedback
  6. 6.Build template library for recurring PM tasks
  7. 7.Share effective prompts with product team

Common Pitfalls

  • Not validating competitive research—verify facts before sharing
  • Accepting user stories without involving engineering team
  • Over-relying on frameworks without qualitative judgment
  • Not customizing outputs to company culture and communication style
  • Skipping stakeholder validation of generated requirements

Best Practices

✓ Do

  • +Validate research and competitive analysis with real data
  • +Collaborate with engineering when generating technical requirements
  • +Customize frameworks and templates to your company context
  • +Use skill for first drafts, refine with stakeholder input
  • +Document successful prompt patterns for PM tasks
  • +Combine AI efficiency with human judgment and intuition

✗ Don't

  • Don't publish competitive analysis without fact-checking
  • Don't finalize user stories without engineering review
  • Don't make prioritization decisions solely on AI scoring
  • Don't skip customer validation of generated requirements
  • Don't ignore company-specific context and culture

💡 Pro Tips

  • Provide context: company goals, constraints, customer feedback
  • Ask for alternatives: 'Show 3 ways to prioritize this roadmap'
  • Request stakeholder-specific formatting: 'Executive summary vs. engineering spec'
  • Use skill for 70% generation + 30% customization to company needs

When to Use This

✓ Use When

Use for user story writing, competitive research, roadmap prioritization, stakeholder communication, and PRD drafting. Best for reducing repetitive documentation and research work.

✗ Avoid When

Avoid for strategic product vision (requires deep customer empathy), pricing decisions (needs market and financial expertise), or when face-to-face customer discovery is more valuable than speed.

Learning Path

  1. 1Basic: user stories, feature specs, status updates
  2. 2Intermediate: competitive analysis, prioritization frameworks, PRDs
  3. 3Advanced: product strategy, go-to-market planning, OKR setting
  4. 4Expert: product vision, market positioning, business model innovation

Discussion

Product Hunt–style comments (not star reviews)
  • No comments yet — start the thread.
general reviews

Ratings

4.545 reviews
  • Yuki Singh· Dec 20, 2024

    Useful defaults in 12306 — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.

  • Hassan Choi· Dec 16, 2024

    Keeps context tight: 12306 is the kind of skill you can hand to a new teammate without a long onboarding doc.

  • Diya Abebe· Dec 16, 2024

    We added 12306 from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.

  • Yusuf Sharma· Nov 15, 2024

    I recommend 12306 for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.

  • James Kim· Nov 11, 2024

    We added 12306 from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.

  • James Chen· Nov 7, 2024

    12306 is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.

  • Diya Chawla· Nov 7, 2024

    Useful defaults in 12306 — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.

  • Chinedu Diallo· Oct 26, 2024

    12306 fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.

  • Diya Malhotra· Oct 26, 2024

    12306 has been reliable in day-to-day use. Documentation quality is above average for community skills.

  • Aisha Mensah· Oct 6, 2024

    12306 reduced setup friction for our internal harness; good balance of opinion and flexibility.

showing 1-10 of 45

1 / 5