Communitygithub.com

TerminalSkills/skills

部署和配置 Xray 代理伺服器。當使用者要求設定 VLESS、VMess、Trojan 或 Shadowsocks 代理、配置 Reality 或 TLS 傳輸、部署 Xray with XTLS、設定回退路由、管理多使用者存取、配置流量路由規則、建立基於 CDN 的隧道、為客戶端應用程式建立訂閱連結、監控 Xray 流量或繞過網路限制時使用。涵蓋所有主要的 Xray 協定、傳輸和部署模式。

skills 是什麼?

這個「Xray」技能專為 AI 代理設計,用於部署、配置和管理 Xray-core 代理伺服器。它支援 VLESS、VMess、Trojan 和 Shadowsocks 等協定,並涵蓋 Reality、XTLS-Vision、WebSocket、gRPC 和 HTTP/2 等現代傳輸方式。此技能的主要用途是幫助使用者繞過網路限制、建立安全的代理通道,並根據需要進行流量路由和監控。它支援在 Debian/Ubuntu 等 Linux 發行版上操作,並可透過 systemd 管理服務。技能文件提供了從安裝、基本配置(如 VLESS + Reality 和 VLESS + WebSocket + TLS)、多使用者管理、進階路由規則到監控和防火牆設定的逐步說明。它特別強調使用 VLESS + Reality 協定作為最安全且難以偵測的選擇,並提供使用 `xray api` 指令進行執行時期使用者管理的功能。

相容平台~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 完全(嚴格)、WebSockets 開啟。

步驟 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(或用於 aes-256 的 -base64 32)

步驟 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" }
]

每位使用者的流量統計——啟用 stats 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)上,使用 VLESS 和 Reality 傳輸設定 Xray。為 alice、bob 和 carol 建立帳戶。使用 microsoft.com 作為 Reality 目標,並提供 v2rayNG 的分享連結。」

代理程式將透過官方腳本安裝 Xray,為每個使用者產生 UUID 和 X25519 金鑰對,建立一個 config.json,其中包含在連接埠 443 上使用 Reality 設定(目標為 www.microsoft.com)的 VLESS 傳入連線,新增三個帶有 xtls-rprx-vision 流程的客戶端條目,新增用於封鎖私有 IP 的路由規則,啟用並啟動 xray 服務,在防火牆中開啟連接埠 443,並輸出三個包含伺服器 IP、公鑰、short ID 和 SNI 的 vless:// 分享連結。

範例 2:搭配 Cloudflare 和回退網站設定 CDN 前端 VLESS 代理

使用者提示:「我有一個指向我們伺服器(透過 Cloudflare)的 proxy.mysite.com 網域。在 /secret-ws 上配置 VLESS over WebSocket 的 Xray,讓流量通過 Cloudflare 的 CDN。非代理訪客應該看到一個普通的 nginx 網站。」

代理程式將使用 certbot 取得 Let's Encrypt 憑證,配置 Xray 在連接埠 443 上設定主要的 VLESS+TLS 傳入連線,並帶有回退到連接埠 8080 的 nginx,在 localhost:8443 上新增第二個帶有路徑 /secret-ws 的 VLESS+WebSocket 傳入連線,設定 nginx 在連接埠 8080 上提供靜態網站,驗證 Cloudflare SSL 設定為完全(嚴格)且 WebSockets 已啟用,並提供帶有 WebSocket 路徑和 Cloudflare SNI 的客戶端連線字串。

指南

  • 對於新的部署,始終使用 VLESS + Reality;它不需要網域或憑證,並且是最難偵測和封鎖的協定
  • 為所有 VMess 使用者設定 "alterId": 0,以啟用強制性 AEAD 加密;非零的 alterId 使用已棄用且安全性較低的舊版格式
  • 在路由規則中封鎖對私有 IP 範圍(geoip:private)的存取,以防止代理被用於針對內部服務的 SSRF 攻擊
  • 使用 xray api 指令在執行時期新增和移除使用者,而無需重新啟動服務,這樣可以避免中斷活躍使用者的連線
  • 從一個託管在與伺服器不同 IP 上的熱門網站(microsoft.com、apple.com)選擇 Reality 的 dest 和 serverNames,並確保該網站支援 TLS 1.3 和 HTTP/2
  • 啟用帶有每位使用者追蹤(statsUserUplink/statsUserDownlink)的 stats 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.

相關技能