Communitygithub.com

TerminalSkills/skills

部署和配置 Xray 代理服务器,涵盖 VLESS、VMess、Trojan、Shadowsocks 协议及其现代传输方式,包括 Reality、WebSocket、gRPC、CDN 集成、路由规则、多用户管理和监控。

skills 是什么?

这个技能为开发者提供了一套完整的 Xray-core 代理部署与配置指南。Xray-core 是一个高级代理平台,支持 VLESS、VMess、Trojan 和 Shadowsocks 等多种协议,并采用 Reality、XTLS-Vision、WebSocket、gRPC 和 HTTP/2 等现代传输技术。该技能详细描述了从安装、协议选择(推荐 VLESS + Reality,无需域名和证书)、TLS/Reality 配置、基于域名/IP/地理信息的流量路由、多用户管理(包括运行时添加/删除用户和查看流量统计)、CDN 集成(如 Cloudflare)到监控的完整流程。它支持在 Linux 服务器上通过官方脚本安装 Xray,并通过命令行工具(xray uuid、xray x25519)生成密钥和 UUID,还能生成供客户端(如 v2rayNG)使用的订阅链接。该技能适用于 Cursor、Claude Code 等 AI 编码助手平台,用户只需用自然语言描述需求(如“为小团队部署一个 VLESS + Reality 代理”),AI 即可自动执行一系列操作并给出配置和分享链接。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/TerminalSkills/skills/tree/HEAD/skills/xray

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

Xray

概述

部署和配置 Xray-core — 支持 VLESS、VMess、Trojan 和 Shadowsocks 协议的高级代理平台,并采用 Reality、XTLS-Vision、WebSocket、gRPC 和 HTTP/2 等现代传输方式。本技能涵盖服务器部署、协议选择、TLS/Reality 配置、流量路由、多用户管理、CDN 集成、客户端配置和监控。

说明

步骤 1:安装

bash -c "$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)" @ install
xray version
# 二进制文件:/usr/local/bin/xray
# 配置文件:/usr/local/etc/xray/config.json

# 生成 UUID 和 X25519 密钥
xray uuid
xray x25519   # Reality 的私钥 + 公钥对

步骤 2:VLESS + Reality(推荐)

最安全的配置。Reality 模拟真实 HTTPS 网站的 TLS 握手,无需域名或 TLS 证书。

服务器配置 (/usr/local/etc/xray/config.json):

{
  "log": { "loglevel": "warning" },
  "inbounds": [{
    "listen": "0.0.0.0",
    "port": 443,
    "protocol": "vless",
    "settings": {
      "clients": [
        { "id": "YOUR-UUID", "flow": "xtls-rprx-vision", "email": "user1@proxy" }
      ],
      "decryption": "none"
    },
    "streamSettings": {
      "network": "tcp",
      "security": "reality",
      "realitySettings": {
        "dest": "www.microsoft.com:443",
        "serverNames": ["www.microsoft.com", "microsoft.com"],
        "privateKey": "YOUR-PRIVATE-KEY",
        "shortIds": ["", "0123456789abcdef"]
      }
    },
    "sniffing": { "enabled": true, "destOverride": ["http", "tls", "quic"] }
  }],
  "outbounds": [
    { "protocol": "freedom", "tag": "direct" },
    { "protocol": "blackhole", "tag": "block" }
  ],
  "routing": {
    "rules": [{ "type": "field", "ip": ["geoip:private"], "outboundTag": "block" }]
  }
}

客户端分享链接:

vless://UUID@SERVER_IP:443?encryption=none&flow=xtls-rprx-vision&security=reality&sni=www.microsoft.com&fp=chrome&pbk=PUBLIC_KEY&sid=0123456789abcdef&type=tcp#MyProxy
systemctl enable --now xray

步骤 3:VLESS + WebSocket + TLS(支持 CDN)

用于通过 Cloudflare CDN 路由流量以隐藏服务器 IP。需要域名配合 Cloudflare 代理和 TLS 证书。

apt install -y certbot
certbot certonly --standalone -d proxy.yourdomain.com
{
  "inbounds": [
    {
      "port": 443, "protocol": "vless",
      "settings": {
        "clients": [{ "id": "YOUR-UUID" }],
        "decryption": "none",
        "fallbacks": [
          { "dest": 8080 },
          { "path": "/ws-path", "dest": 8443, "xver": 1 }
        ]
      },
      "streamSettings": {
        "network": "tcp", "security": "tls",
        "tlsSettings": {
          "certificates": [{
            "certificateFile": "/etc/letsencrypt/live/proxy.yourdomain.com/fullchain.pem",
            "keyFile": "/etc/letsencrypt/live/proxy.yourdomain.com/privkey.pem"
          }]
        }
      }
    },
    {
      "listen": "127.0.0.1", "port": 8443, "protocol": "vless",
      "settings": { "clients": [{ "id": "YOUR-UUID" }], "decryption": "none" },
      "streamSettings": { "network": "ws", "wsSettings": { "path": "/ws-path" } }
    }
  ],
  "outbounds": [{ "protocol": "freedom", "tag": "direct" }]
}

在 8080 端口上设置 nginx 作为回退,并在 Cloudflare 中:SSL/TLS 设置为完全(严格),并启用 WebSocket。

步骤 4:Trojan 和 Shadowsocks

Trojan(看起来像普通 HTTPS):

{
  "inbounds": [{
    "port": 443, "protocol": "trojan",
    "settings": {
      "clients": [{ "password": "your-strong-password", "email": "user1@trojan" }],
      "fallbacks": [{ "dest": 8080 }]
    },
    "streamSettings": {
      "network": "tcp", "security": "tls",
      "tlsSettings": { "certificates": [{ "certificateFile": "...", "keyFile": "..." }] }
    }
  }]
}

Shadowsocks 2022(现代 AEAD 加密):

{
  "inbounds": [{
    "port": 8388, "protocol": "shadowsocks",
    "settings": { "method": "2022-blake3-aes-128-gcm", "password": "BASE64_KEY", "network": "tcp,udp" }
  }]
}

生成密钥:openssl rand -base64 16(或 -base64 32 用于 aes-256)

步骤 5:多用户管理

"clients": [
  { "id": "uuid-1", "email": "alice@proxy", "flow": "xtls-rprx-vision" },
  { "id": "uuid-2", "email": "bob@proxy", "flow": "xtls-rprx-vision" },
  { "id": "uuid-3", "email": "carol@proxy", "flow": "xtls-rprx-vision" }
]

每个用户的流量统计 — 启用统计 API:

{
  "stats": {},
  "policy": {
    "levels": { "0": { "statsUserUplink": true, "statsUserDownlink": true } },
    "system": { "statsInboundUplink": true, "statsInboundDownlink": true }
  },
  "api": { "tag": "api", "services": ["StatsService", "HandlerService"] },
  "inbounds": [
    { "listen": "127.0.0.1", "port": 10085, "protocol": "dokodemo-door",
      "settings": { "address": "127.0.0.1" }, "tag": "api" }
  ],
  "routing": { "rules": [{ "type": "field", "inboundTag": ["api"], "outboundTag": "api" }] }
}

运行时查询和管理用户:

xray api stats --server=127.0.0.1:10085 -name "user>>>alice@proxy>>>traffic>>>uplink"
xray api adi --server=127.0.0.1:10085 --inbound-tag proxy --id "new-uuid" --email "newuser@proxy"
xray api rmi --server=127.0.0.1:10085 --inbound-tag proxy --email "olduser@proxy"

步骤 6:路由规则和监控

按域名/IP/地理位置路由:

{
  "routing": {
    "domainStrategy": "IPIfNonMatch",
    "rules": [
      { "type": "field", "domain": ["geosite:category-ads-all"], "outboundTag": "block" },
      { "type": "field", "ip": ["geoip:private"], "outboundTag": "block" },
      { "type": "field", "network": "tcp,udp", "outboundTag": "proxy" }
    ]
  }
}

监控:

systemctl status xray
journalctl -u xray -f
grep "accepted" /var/log/xray/access.log | awk '{print $3}' | sort | uniq -c | sort -rn

防火墙:

ufw allow 443/tcp && ufw allow 443/udp && ufw enable

示例

示例 1:为小团队部署 VLESS + Reality 代理服务器

用户提示:“在 Debian 12 VPS(IP 198.51.100.30)上为 alice、bob、carol 设置 Xray,使用 VLESS + Reality 传输,以 microsoft.com 作为 Reality 目标,并提供 v2rayNG 分享链接。”

AI 代理将使用官方脚本安装 Xray,为每个用户生成 UUID 和 X25519 密钥对,构建一个在 443 端口监听、使用 Reality 设置并针对 www.microsoft.com 的 VLESS 入站配置,添加三个带有 xtls-rprx-vision 流的客户端条目,添加路由规则以阻止私有 IP,启用并启动 xray 服务,在防火墙中开放 443 端口,并输出三个包含服务器 IP、公钥、short ID 和 SNI 的 vless:// 分享链接。

示例 2:设置通过 Cloudflare CDN 的 VLESS 代理并带有回退网站

用户提示:“我有 proxy.mysite.com 通过 Cloudflare 指向我的服务器。配置 Xray 使用 WebSocket 在 /secret-ws 上运行 VLESS,使流量通过 Cloudflare CDN。非代理访客应看到正常的 nginx 网站。”

AI 代理将使用 certbot 获取 Let's Encrypt 证书,配置 Xray:一个主 VLESS+TLS 入站端口 443,并带有回退到 8080 端口的 nginx;添加第二个 VLESS+WebSocket 入站监听 localhost:8443,路径为 /secret-ws;设置 nginx 在 8080 端口提供静态网站;验证 Cloudflare SSL 设置为完全(严格)并启用 WebSocket;提供包含 WebSocket 路径和 Cloudflare SNI 的客户端连接字符串。

指南

  • 始终为新部署使用 VLESS + Reality;它不需要域名或证书,且是最难被检测和封锁的协议
  • 将所有 VMess 用户的 "alterId" 设置为 0,以启用强制的 AEAD 加密;非零 alterId 使用已弃用的、安全性较差的旧格式
  • 在路由规则中阻止对私有 IP 范围(geoip:private)的访问,以防止代理被用于对内部服务的 SSRF 攻击
  • 使用 xray api 命令在运行时添加和删除用户,无需重启服务,从而避免断开活跃用户的连接
  • 从流行的网站(microsoft.com、apple.com)中选择 Reality 的 dest 和 serverNames,这些网站应托管在与服务器不同的 IP 上,并确保该网站支持 TLS 1.3 和 HTTP/2
  • 启用带用户跟踪(statsUserUplink/statsUserDownlink)的统计 API,以监控带宽使用并检测滥用情况

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

TerminalSkills/skills

>- Run GitHub Actions locally with act. Use when a user asks to test GitHub Actions workflows locally, debug CI pipelines without pushing, or run workflows offline.

TerminalSkills/skills

>- You are an expert in AG2 (formerly AutoGen), the open-source multi-agent conversation framework. You help developers build systems where multiple AI agents collaborate through structured conversations — with tool use, human-in-the-loop, code execution, group chat orchestration, and nested conversations — for complex tasks like software development, research, and data analysis.

TerminalSkills/skills

>- Generate short-form videos with AI — script writing, text-to-speech narration, stock footage selection, subtitle generation, and video assembly. Use when: creating TikTok/YouTube Shorts/Reels content, automating video production, building content pipelines.

TerminalSkills/skills

>- Animate 3D objects and characters in Blender with Python. Use when the user wants to keyframe properties, create armatures and rigs, set up IK/FK chains, animate shape keys for facial animation, edit F-Curves, use the NLA editor to blend actions, add drivers for expression-based animation, or script any animation workflow in Blender.

TerminalSkills/skills

>- Automate motion capture and tracking workflows in Blender with Python. Use when the user wants to import BVH or FBX mocap data, retarget motion to armatures, track camera or object motion from video, solve camera motion, clean up motion capture data, or script any tracking pipeline in Blender.

TerminalSkills/skills

>- You are an expert in Bolt.new by StackBlitz, the AI-powered full-stack development environment that runs entirely in the browser. You help developers go from idea to deployed app in minutes using natural language prompts — Bolt generates complete applications with frontend, backend, database, and deployment, all running in a WebContainer without local setup.

TerminalSkills/skills

>- Assists with using Bun as an all-in-one JavaScript/TypeScript runtime, package manager, bundler, and test runner. Use when building HTTP servers, managing packages, running tests, or migrating from Node.js. Trigger words: bun, bun serve, bun install, bun test, bun build, javascript runtime, bun runtime.

TerminalSkills/skills

>- Self-host customer support with Chatwoot. Use when a user asks to set up open-source customer support, add live chat without SaaS costs, build a multi-channel inbox, or deploy a free Intercom alternative.

TerminalSkills/skills

>- You are an expert in Chi, the lightweight, idiomatic Go HTTP router built on `net/http`. You help developers build composable HTTP services using Chi's middleware stack, route groups, URL parameters, sub-routers, and context-based request scoping — providing Express-like ergonomics while staying 100% compatible with Go's standard library.

TerminalSkills/skills

When the user wants to edit, review, or improve existing marketing copy. Also use when the user mentions 'edit this copy,' 'review my copy,' 'copy feedback,' 'proofread,' 'polish this,' 'make this better,' or 'copy sweep.' This skill provides a systematic approach to editing marketing copy through multiple focused passes.

TerminalSkills/skills

>- Add live chat and customer support with Crisp. Use when a user asks to add a chat widget, implement live customer support, set up a help desk, create a knowledge base, or add a chatbot to a website.

TerminalSkills/skills

>- Assists with building custom interactive data visualizations using D3.js. Use when creating charts, graphs, maps, force layouts, or hierarchical diagrams that require fine-grained control beyond what charting libraries provide. Trigger words: d3, data visualization, chart, svg, scales, force graph, treemap, choropleth.

TerminalSkills/skills

dbt (data build tool) transforms data in your warehouse using SQL SELECT statements. Learn project setup, models, tests, documentation, incremental materializations, and integration with data warehouses like PostgreSQL, BigQuery, and Snowflake.

TerminalSkills/skills

>- You are an expert in dlt, the open-source Python library for building data pipelines. You help developers load data from any API, file, or database into warehouses and lakes using simple Python decorators — with automatic schema inference, incremental loading, and built-in data contracts. dlt is the "requests library for data pipelines.

TerminalSkills/skills

Data Version Control for ML projects. Track large datasets and models alongside Git, build reproducible ML pipelines, and run experiments with metric comparison. Works with any storage backend including S3, GCS, Azure, and local filesystems.

TerminalSkills/skills

>- You are an expert in E2B, the cloud platform for running AI-generated code in secure sandboxes. You help developers give AI agents the ability to execute code, install packages, read/write files, and run long processes in isolated cloud environments — each sandbox is a lightweight VM that boots in ~150ms with full Linux, filesystem, and networking.

TerminalSkills/skills

>- Transcode, convert, edit, and process audio and video with FFmpeg. Use when a user asks to convert video formats (webm to mp4, mkv to mp4), extract audio from video, compress video files, trim or cut clips, concatenate videos, add subtitles, create thumbnails, apply filters, change resolution or bitrate, re-encode media, create GIFs from video, add watermarks, normalize audio, stream media, or build automated media processing pipelines.

TerminalSkills/skills

>- Create advanced animations with GSAP. Use when building complex timelines, scroll-driven animations, SVG morphing, text animations, or high-performance web animations beyond CSS capabilities.

TerminalSkills/skills

>- Generate deterministic MP4 videos from HTML, CSS, media, and seekable animations using HeyGen's HyperFrames framework. Use when someone asks to "render HTML to video", "make a video with HyperFrames", "create a programmatic video", "turn an animation into MP4", "build a launch/product video from HTML", "render GSAP/Lottie/Three.js to video", or set up an agent-driven video pipeline. Covers init/preview/render/add/lint/inspect commands, data-* timing attributes, animation adapters, and the component catalog.

TerminalSkills/skills

When the user wants to perform load testing, stress testing, or performance testing of APIs and websites using k6. Also use when the user mentions "k6," "load test," "performance test," "stress test," "spike test," "soak test," "thresholds," "virtual users," or "VUs." For browser-based testing, see selenium.

相关技能