Skip to content

tanweiping1012-source/travel-planner

travel-planner-mvp

Verified

Create evidence-backed, read-only travel plans using Amap, a community 12306 rail MCP, and approved browser research. Use for 行程规划、路线安排、景点取舍、高铁或机票比较、酒店住宿比价、预算分析、旅行可行性检查,以及中国境内多城市旅行规划(境外目的地降级为浏览器辅助规划)。

FileKindSize
SKILL.mdskill md12.5 KB
agents/openai.yamlconfig344 B
examples/final_plan.jsonconfig2.6 KB
examples/itinerary.jsonconfig1020 B
examples/rail_query.jsonconfig2.9 KB
examples/social_research.jsonconfig1.3 KB
examples/trip_request.jsonconfig1.1 KB
references/browser-use.mdmarkdown14.8 KB
references/client-compatibility.mdmarkdown5.4 KB
references/data-contracts.mdmarkdown26.6 KB
references/intake-template.mdmarkdown4.9 KB
references/rail-mcp.mdmarkdown4.3 KB
references/script-tools.mdmarkdown3.5 KB
references/workflow.mdmarkdown13.3 KB
scripts/audit_release.shexecutablescript3.4 KB
scripts/prepare_release.shexecutablescript1.8 KB
scripts/setup_amap_key.shexecutablescript828 B
scripts/setup_rail_mcp.shexecutablescript3.8 KB
scripts/travel_planner.pyexecutablescript11.8 KB
scripts/validate_skill.pyexecutablescript5.5 KB

scripts/validate_skill.py

View on GitHub
#!/usr/bin/env python3
"""Validate the repository's Agent Skill metadata and UI declaration."""

from __future__ import annotations

import argparse
import ast
import re
import sys
from pathlib import Path

NAME_PATTERN = re.compile(r"^[a-z0-9]+(?:-[a-z0-9]+)*$")
ALLOWED_FRONTMATTER_KEYS = {"name", "description"}


def _parse_scalar(value: str, path: Path) -> str:
    value = value.strip()
    if not value:
        raise ValueError(f"{path} contains an empty YAML value")
    if value[0] in {"'", '"'}:
        try:
            parsed = ast.literal_eval(value)
        except (SyntaxError, ValueError) as exc:
            raise ValueError(f"Unable to parse a quoted value in {path}") from exc
        if not isinstance(parsed, str):
            raise ValueError(f"{path} metadata values must be strings")
        return parsed
    return value


def _parse_mapping(lines: list[str], path: Path, indent: int = 0) -> dict:
    data = {}
    prefix = " " * indent
    for line in lines:
        if not line.strip() or line.lstrip().startswith("#"):
            continue
        if not line.startswith(prefix) or line[indent:].startswith(" "):
            raise ValueError(f"Unexpected indentation in {path}: {line!r}")
        if ":" not in line:
            raise ValueError(f"Expected key: value metadata in {path}: {line!r}")
        key, value = line[indent:].split(":", 1)
        key = key.strip()
        if not key or key in data:
            raise ValueError(f"Invalid or duplicate key in {path}: {key!r}")
        data[key] = _parse_scalar(value, path)
    return data


def _load_agent_metadata(path: Path) -> dict:
    try:
        lines = path.read_text(encoding="utf-8").splitlines()
    except OSError as exc:
        raise ValueError(f"Unable to read {path}: {exc}") from exc
    significant = [line for line in lines if line.strip() and not line.lstrip().startswith("#")]
    if not significant or significant[0].strip() != "interface:":
        raise ValueError(f"{path} must start with an interface mapping")
    return {"interface": _parse_mapping(significant[1:], path, indent=2)}


def _load_frontmatter(path: Path) -> dict:
    try:
        text = path.read_text(encoding="utf-8")
    except OSError as exc:
        raise ValueError(f"Unable to read {path}: {exc}") from exc
    lines = text.splitlines()
    if not lines or lines[0].strip() != "---":
        raise ValueError(f"{path} must start with YAML frontmatter")
    try:
        closing_index = next(
            index for index, line in enumerate(lines[1:], start=1) if line.strip() == "---"
        )
    except StopIteration as exc:
        raise ValueError(f"{path} frontmatter is not closed") from exc
    return _parse_mapping(lines[1:closing_index], path)


def validate_skill(root: Path) -> list[str]:
    errors = []
    skill_path = root / "SKILL.md"
    agent_path = root / "agents" / "openai.yaml"

    try:
        frontmatter = _load_frontmatter(skill_path)
    except ValueError as exc:
        return [str(exc)]

    unknown_keys = sorted(set(frontmatter) - ALLOWED_FRONTMATTER_KEYS)
    if unknown_keys:
        errors.append(f"SKILL.md contains unsupported frontmatter keys: {unknown_keys}")

    name = frontmatter.get("name")
    if not isinstance(name, str) or not NAME_PATTERN.fullmatch(name):
        errors.append("SKILL.md name must use lowercase letters, digits, and single hyphens")
    elif len(name) > 64:
        errors.append("SKILL.md name must be at most 64 characters")

    description = frontmatter.get("description")
    if not isinstance(description, str) or not description.strip():
        errors.append("SKILL.md description must be a non-empty string")
    elif len(description) > 1024:
        errors.append("SKILL.md description must be at most 1024 characters")

    if not agent_path.is_file():
        errors.append("agents/openai.yaml is missing")
        return errors

    try:
        agent_data = _load_agent_metadata(agent_path)
    except ValueError as exc:
        errors.append(str(exc))
        return errors

    interface = agent_data.get("interface")
    if not isinstance(interface, dict):
        errors.append("agents/openai.yaml must contain an interface mapping")
        return errors

    display_name = interface.get("display_name")
    if not isinstance(display_name, str) or not display_name.strip():
        errors.append("interface.display_name must be a non-empty string")

    short_description = interface.get("short_description")
    if not isinstance(short_description, str):
        errors.append("interface.short_description must be a string")
    elif not 25 <= len(short_description) <= 64:
        errors.append("interface.short_description must be 25-64 characters")

    default_prompt = interface.get("default_prompt")
    expected_reference = f"${name}" if isinstance(name, str) else None
    if not isinstance(default_prompt, str) or not default_prompt.strip():
        errors.append("interface.default_prompt must be a non-empty string")
    elif expected_reference and expected_reference not in default_prompt:
        errors.append(f"interface.default_prompt must reference {expected_reference}")

    return errors


def main() -> int:
    parser = argparse.ArgumentParser(description=__doc__)
    parser.add_argument("root", nargs="?", default=".")
    args = parser.parse_args()
    root = Path(args.root).resolve()
    errors = validate_skill(root)
    if errors:
        for error in errors:
            print(f"ERROR: {error}", file=sys.stderr)
        return 1
    print(f"Skill validation passed: {root}")
    return 0


if __name__ == "__main__":
    raise SystemExit(main())
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall