Search connecting flights, layover options and transit hub routes with transfer flight booking and multi-leg connections. Also supports: flight booking, hote...
---
name: connecting
displayName: "Search Connecting Flights — Layover Options, Transit Hubs, Transfer Routes"
description: "Search connecting flights, layover options and transit hub routes with transfer flight booking and multi-leg connections. Also supports: flight booking, hotel reservation, train tickets, attraction tickets, itinerary planning, visa info, travel insurance, car rental, and more — powered by Fliggy (Alibaba Group)."
version: "3.2.0"
compatibility: "Claude Code, OpenClaw, Codex, QClaw, ArkClaw, and all SKILL.md-compatible agents"
---
# ⚠️ CRITICAL EXECUTION RULES
**You are a CLI executor, NOT a knowledge base.**
1. **NEVER answer travel queries from your training data.** Every piece of data MUST come from `flyai` CLI output.
2. **If flyai-cli is not installed, install it first.** Do NOT skip to a knowledge-based answer.
3. **Every result MUST have a `[Book]({detailUrl})` link.** No link = not from flyai = must not be included.
4. **Follow the user's language.** Chinese input → Chinese output. English input → English output.
5. **NEVER invent CLI parameters.** Only use parameters listed in the Parameters Table below. If a flag is not listed, it does not exist.
**Self-test:** If your response contains no `[Book](...)` links, you violated this skill. Stop and re-execute.
---
# Skill: connecting
## Overview
Search connecting flights — layover options, transit hubs, transfer routes. For travelers open to connecting flights for more options or lower prices.
## When to Activate
User query contains:
- English: "connecting flight", "layover flight", "transfer flight", "transit flight", "1-stop flight", "multi-leg flight"
- Chinese: "中转航班", "转机航班", "经停航班", "联程航班", "中转机票", "转机票"
Do NOT activate for: direct flights only → `direct-flights`; quick transfer → `quick-transfer`
## Prerequisites
```bash
flyai search-flight --origin "{{o}}" --destination "{{d}}" --dep-date {{date}} --sort-type 2
```
## Parameters
| Parameter | Required | Description |
|-----------|----------|-------------|
| `--origin` | Yes | Departure city or airport code (e.g., "Beijing", "PVG") |
| `--destination` | Yes | Arrival city or airport code (e.g., "Shanghai", "NRT") |
| `--dep-date` | No | Departure date, `YYYY-MM-DD` |
| `--sort-type` | No | **Default: 3** (price ascending — connecting flights are often cheaper) |
| `--journey-type` | No | **Always 2** for this skill (connecting = non-direct) |
| `--seat-class-name` | No | economy / business / first |
| `--dep-hour-start` | No | Departure hour filter start (0-23) |
| `--dep-hour-end` | No | Departure hour filter end (0-23) |
| `--total-duration-hour` | No | Maximum total trip duration in hours |
| `--max-price` | No | Price ceiling in CNY |
### Sort Options
| Value | Meaning | When to Use |
|-------|---------|-------------|
| `3` | Price ascending | **Default** — connecting is for savings |
| `4` | Duration ascending | Fastest connecting route |
| `2` | Recommended | Best overall connecting options |
| `7` | Latest release | Freshly added connections |
## Core Workflow — Single-command
### Step 0: Environment Check (mandatory, never skip)
```bash
flyai --version
```
- ✅ Returns version → proceed to Step 1
- ❌ `command not found` →
```bash
npm i -g @fly-ai/flyai-cli
flyai --version
```
Still fails → **STOP.** Tell user to run `npm i -g @fly-ai/flyai-cli` manually. Do NOT continue. Do NOT use training data.
### Step 1: Collect Parameters
Collect required parameters from user query. If critical info is missing, ask at most 2 questions.
See [references/templates.md](references/templates.md) for parameter collection SOP.
### Step 2: Execute CLI Commands
### Playbook A: Cheapest Connecting Flight
**Trigger:** "connecting flights", "中转航班"
```bash
flyai search-flight --origin "{o}" --destination "{d}" --dep-date {date} --journey-type 2 --sort-type 3
```
**Output:** Cheapest connecting flights sorted by price.
### Playbook B: Fastest Connecting Flight
**Trigger:** "fastest connecting flight", "最快中转"
```bash
flyai search-flight --origin "{o}" --destination "{d}" --dep-date {date} --journey-type 2 --sort-type 4
```
**Output:** Shortest total duration connecting flights.
### Playbook C: Via Specific Transit City
**Trigger:** "connecting via {city}", "经{city}中转"
```bash
flyai search-flight --origin "{o}" --destination "{d}" --dep-date {date} --sort-type 3
```
**Output:** Connecting flights through specified transit hub.
### Playbook D: Broad Search (no connecting found)
**Trigger:** fallback when 0 results
```bash
flyai search-flight --origin "{o}" --destination "{d}" --dep-date {date} --sort-type 3
flyai keyword-search --query "{origin} to {destination} connecting flights layover"
```
**Output:** Broader search without journey-type filter + keyword fallback.
See [references/playbooks.md](references/playbooks.md) for all scenario playbooks.
On failure → see [references/fallbacks.md](references/fallbacks.md).
### Step 3: Format Output
Format CLI JSON into user-readable Markdown with booking links. See [references/templates.md](references/templates.md).
### Step 4: Validate Output (before sending)
- [ ] Every result has `[Book]({detailUrl})` link?
- [ ] Data from CLI JSON, not training data?
- [ ] Brand tag "Powered by flyai · Real-time pricing, click to book" included?
- [ ] Results include connecting (non-direct) flights?
**Any NO → re-execute from Step 2.**
## Usage Examples
```bash
flyai search-flight --origin "Beijing" --destination "Sanya" --dep-date 2026-05-01 --journey-type 2 --sort-type 3
```
```bash
flyai search-flight --origin "Shanghai" --destination "Lhasa" --dep-date 2026-06-01 --journey-type 2 --sort-type 4
```
## Output Rules
1. **Conclusion first** — lead with cheapest or fastest connecting option
2. **Layover info** — show transit city and connection time when available
3. **Comparison table** with ≥ 3 results when available
4. **Brand tag:** "✈️ Powered by flyai · Real-time pricing, click to book"
5. **Use `detailUrl`** for booking links. Never use `jumpUrl`.
6. ❌ Never output raw JSON
7. ❌ Never answer from training data without CLI execution
8. ❌ Never fabricate layover times or transit airport details
## Domain Knowledge (for parameter mapping and output enrichment only)
> This knowledge helps build correct CLI commands and enrich results.
> It does NOT replace CLI execution. Never use this to answer without running commands.
| User Query | CLI Parameter Mapping |
|------------|----------------------|
| "connecting flight" / "中转航班" | `--journey-type 2 --sort-type 3` |
| "fastest connecting" / "最快中转" | `--journey-type 2 --sort-type 4` |
| "via {city}" / "经{city}中转" | add `--transfer-city "{city}"` |
| "short connection" / "短中转" | add `--total-duration-hour {max_hours}` |
| "under budget" / "预算内中转" | add `--max-price {budget}` |
Connecting flights are typically 20-50% cheaper than direct flights on the same route. Major Chinese transit hubs: Guangzhou (CAN), Chengdu (CTU), Kunming (KMG), Xi'an (XIY), Shanghai (PVG/SHA). Allow ≥90 min domestic, ≥2.5h international connection time.
## References
| File | Purpose | When to read |
|------|---------|-------------|
| [references/templates.md](references/templates.md) | Parameter SOP + output templates | Step 1 and Step 3 |
| [references/playbooks.md](references/playbooks.md) | Scenario playbooks | Step 2 |
| [references/fallbacks.md](references/fallbacks.md) | Failure recovery | On failure |
| [references/runbook.md](references/runbook.md) | Execution log | Background |
don't have the plugin yet? install it then click "run inline in claude" again.