[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M72XJC7GCZ9QAMQN0X8JKM8N":3,"skill-same:01M72XJC7GCZ9QAMQN0X8JKM8N":48},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":25,"commitSha":26,"skillDirectory":27,"forksCount":28,"repositoryHtmlUrl":29,"repositoryHomepageUrl":6,"ownerHtmlUrl":30,"ownerBlogUrl":31,"ownerDescription":32,"updatedAt":33,"install":34,"resources":47},"01M72XJC7GCZ9QAMQN0X8JKM8N","x-api",null,"X\u002FTwitter API集成，用于发布推文、线程、读取时间线、搜索和分析。涵盖OAuth认证模式、速率限制和平台原生内容发布。当用户希望以编程方式与X交互时使用。","SriramGandhiS\u002FSkills","SriramGandhiS","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F211849986?v=4","01M72WQCW12BYX71C6WN584TTA","Sriram S","01M72WQCWTJ2RD0ET1X31AF1RC",1,"MIT","https:\u002F\u002Fgithub.com\u002FSriramGandhiS\u002FSkills\u002Fblob\u002Fmaster\u002Fdocs\u002Fzh-CN\u002Fskills\u002Fx-api\u002FSKILL.md",[],[],"2026-11-10 22:39:42",false,"---\nname: x-api\ndescription: X\u002FTwitter API集成，用于发布推文、线程、读取时间线、搜索和分析。涵盖OAuth认证模式、速率限制和平台原生内容发布。当用户希望以编程方式与X交互时使用。\norigin: ECC\n---\n\n# X API\n\n以编程方式与 X（Twitter）交互，用于发布、读取、搜索和分析。\n\n## 何时激活\n\n* 用户希望以编程方式发布推文或帖子串\n* 从 X 读取时间线、提及或用户数据\n* 在 X 上搜索内容、趋势或对话\n* 构建 X 集成或机器人\n* 分析和参与度跟踪\n* 用户提及\"发布到 X\"、\"发推\"、\"X API\"或\"Twitter API\"\n\n## 认证\n\n### OAuth 2.0 Bearer 令牌（仅应用）\n\n最佳适用场景：读取密集型操作、搜索、公开数据。\n\n```bash\n# Environment setup\nexport X_BEARER_TOKEN=\"your-bearer-token\"\n```\n\n```python\nimport os\nimport requests\n\nbearer = os.environ[\"X_BEARER_TOKEN\"]\nheaders = {\"Authorization\": f\"Bearer {bearer}\"}\n\n# Search recent tweets\nresp = requests.get(\n    \"https:\u002F\u002Fapi.x.com\u002F2\u002Ftweets\u002Fsearch\u002Frecent\",\n    headers=headers,\n    params={\"query\": \"claude code\", \"max_results\": 10}\n)\ntweets = resp.json()\n```\n\n### OAuth 1.0a（用户上下文）\n\n必需用于：发布推文、管理账户、私信。\n\n```bash\n# Environment setup — source before use\nexport X_API_KEY=\"your-api-key\"\nexport X_API_SECRET=\"your-api-secret\"\nexport X_ACCESS_TOKEN=\"your-access-token\"\nexport X_ACCESS_SECRET=\"your-access-secret\"\n```\n\n```python\nimport os\nfrom requests_oauthlib import OAuth1Session\n\noauth = OAuth1Session(\n    os.environ[\"X_API_KEY\"],\n    client_secret=os.environ[\"X_API_SECRET\"],\n    resource_owner_key=os.environ[\"X_ACCESS_TOKEN\"],\n    resource_owner_secret=os.environ[\"X_ACCESS_SECRET\"],\n)\n```\n\n## 核心操作\n\n### 发布一条推文\n\n```python\nresp = oauth.post(\n    \"https:\u002F\u002Fapi.x.com\u002F2\u002Ftweets\",\n    json={\"text\": \"Hello from Claude Code\"}\n)\nresp.raise_for_status()\ntweet_id = resp.json()[\"data\"][\"id\"]\n```\n\n### 发布一个帖子串\n\n```python\ndef post_thread(oauth, tweets: list[str]) -> list[str]:\n    ids = []\n    reply_to = None\n    for text in tweets:\n        payload = {\"text\": text}\n        if reply_to:\n            payload[\"reply\"] = {\"in_reply_to_tweet_id\": reply_to}\n        resp = oauth.post(\"https:\u002F\u002Fapi.x.com\u002F2\u002Ftweets\", json=payload)\n        tweet_id = resp.json()[\"data\"][\"id\"]\n        ids.append(tweet_id)\n        reply_to = tweet_id\n    return ids\n```\n\n### 读取用户时间线\n\n```python\nresp = requests.get(\n    f\"https:\u002F\u002Fapi.x.com\u002F2\u002Fusers\u002F{user_id}\u002Ftweets\",\n    headers=headers,\n    params={\n        \"max_results\": 10,\n        \"tweet.fields\": \"created_at,public_metrics\",\n    }\n)\n```\n\n### 搜索推文\n\n```python\nresp = requests.get(\n    \"https:\u002F\u002Fapi.x.com\u002F2\u002Ftweets\u002Fsearch\u002Frecent\",\n    headers=headers,\n    params={\n        \"query\": \"from:affaanmustafa -is:retweet\",\n        \"max_results\": 10,\n        \"tweet.fields\": \"public_metrics,created_at\",\n    }\n)\n```\n\n### 通过用户名获取用户\n\n```python\nresp = requests.get(\n    \"https:\u002F\u002Fapi.x.com\u002F2\u002Fusers\u002Fby\u002Fusername\u002Faffaanmustafa\",\n    headers=headers,\n    params={\"user.fields\": \"public_metrics,description,created_at\"}\n)\n```\n\n### 上传媒体并发布\n\n```python\n# Media upload uses v1.1 endpoint\n\n# Step 1: Upload media\nmedia_resp = oauth.post(\n    \"https:\u002F\u002Fupload.twitter.com\u002F1.1\u002Fmedia\u002Fupload.json\",\n    files={\"media\": open(\"image.png\", \"rb\")}\n)\nmedia_id = media_resp.json()[\"media_id_string\"]\n\n# Step 2: Post with media\nresp = oauth.post(\n    \"https:\u002F\u002Fapi.x.com\u002F2\u002Ftweets\",\n    json={\"text\": \"Check this out\", \"media\": {\"media_ids\": [media_id]}}\n)\n```\n\n## 速率限制\n\nX API 的速率限制因端点、认证方法和账户等级而异，并且会随时间变化。请始终：\n\n* 在硬编码假设之前，查看当前的 X 开发者文档\n* 在运行时读取 `x-rate-limit-remaining` 和 `x-rate-limit-reset` 头部信息\n* 自动退避，而不是依赖代码中的静态表格\n\n```python\nimport time\n\nremaining = int(resp.headers.get(\"x-rate-limit-remaining\", 0))\nif remaining \u003C 5:\n    reset = int(resp.headers.get(\"x-rate-limit-reset\", 0))\n    wait = max(0, reset - int(time.time()))\n    print(f\"Rate limit approaching. Resets in {wait}s\")\n```\n\n## 错误处理\n\n```python\nresp = oauth.post(\"https:\u002F\u002Fapi.x.com\u002F2\u002Ftweets\", json={\"text\": content})\nif resp.status_code == 201:\n    return resp.json()[\"data\"][\"id\"]\nelif resp.status_code == 429:\n    reset = int(resp.headers[\"x-rate-limit-reset\"])\n    raise Exception(f\"Rate limited. Resets at {reset}\")\nelif resp.status_code == 403:\n    raise Exception(f\"Forbidden: {resp.json().get('detail', 'check permissions')}\")\nelse:\n    raise Exception(f\"X API error {resp.status_code}: {resp.text}\")\n```\n\n## 安全性\n\n* **切勿硬编码令牌。** 使用环境变量或 `.env` 文件。\n* **切勿提交 `.env` 文件。** 将其添加到 `.gitignore`。\n* **如果令牌暴露，请轮换令牌。** 在 developer.x.com 重新生成。\n* **当不需要写权限时，使用只读令牌。**\n* **安全存储 OAuth 密钥** — 不要存储在源代码或日志中。\n\n## 与内容引擎集成\n\n使用 `content-engine` 技能生成平台原生内容，然后通过 X API 发布：\n\n1. 使用内容引擎生成内容（X 平台格式）\n2. 验证长度（单条推文 280 字符）\n3. 使用上述模式通过 X API 发布\n4. 通过 public\\_metrics 跟踪参与度\n\n## 相关技能\n\n* `content-engine` — 为 X 生成平台原生内容\n* `crosspost` — 在 X、LinkedIn 和其他平台分发内容\n","# X API\n\n以编程方式与 X（Twitter）交互，用于发布、读取、搜索和分析。\n\n## 何时激活\n\n* 用户希望以编程方式发布推文或帖子串\n* 从 X 读取时间线、提及或用户数据\n* 在 X 上搜索内容、趋势或对话\n* 构建 X 集成或机器人\n* 分析和参与度跟踪\n* 用户提及\"发布到 X\"、\"发推\"、\"X API\"或\"Twitter API\"\n\n## 认证\n\n### OAuth 2.0 Bearer 令牌（仅应用）\n\n最佳适用场景：读取密集型操作、搜索、公开数据。\n\n```bash\n# Environment setup\nexport X_BEARER_TOKEN=\"your-bearer-token\"\n```\n\n```python\nimport os\nimport requests\n\nbearer = os.environ[\"X_BEARER_TOKEN\"]\nheaders = {\"Authorization\": f\"Bearer {bearer}\"}\n\n# Search recent tweets\nresp = requests.get(\n    \"https:\u002F\u002Fapi.x.com\u002F2\u002Ftweets\u002Fsearch\u002Frecent\",\n    headers=headers,\n    params={\"query\": \"claude code\", \"max_results\": 10}\n)\ntweets = resp.json()\n```\n\n### OAuth 1.0a（用户上下文）\n\n必需用于：发布推文、管理账户、私信。\n\n```bash\n# Environment setup — source before use\nexport X_API_KEY=\"your-api-key\"\nexport X_API_SECRET=\"your-api-secret\"\nexport X_ACCESS_TOKEN=\"your-access-token\"\nexport X_ACCESS_SECRET=\"your-access-secret\"\n```\n\n```python\nimport os\nfrom requests_oauthlib import OAuth1Session\n\noauth = OAuth1Session(\n    os.environ[\"X_API_KEY\"],\n    client_secret=os.environ[\"X_API_SECRET\"],\n    resource_owner_key=os.environ[\"X_ACCESS_TOKEN\"],\n    resource_owner_secret=os.environ[\"X_ACCESS_SECRET\"],\n)\n```\n\n## 核心操作\n\n### 发布一条推文\n\n```python\nresp = oauth.post(\n    \"https:\u002F\u002Fapi.x.com\u002F2\u002Ftweets\",\n    json={\"text\": \"Hello from Claude Code\"}\n)\nresp.raise_for_status()\ntweet_id = resp.json()[\"data\"][\"id\"]\n```\n\n### 发布一个帖子串\n\n```python\ndef post_thread(oauth, tweets: list[str]) -> list[str]:\n    ids = []\n    reply_to = None\n    for text in tweets:\n        payload = {\"text\": text}\n        if reply_to:\n            payload[\"reply\"] = {\"in_reply_to_tweet_id\": reply_to}\n        resp = oauth.post(\"https:\u002F\u002Fapi.x.com\u002F2\u002Ftweets\", json=payload)\n        tweet_id = resp.json()[\"data\"][\"id\"]\n        ids.append(tweet_id)\n        reply_to = tweet_id\n    return ids\n```\n\n### 读取用户时间线\n\n```python\nresp = requests.get(\n    f\"https:\u002F\u002Fapi.x.com\u002F2\u002Fusers\u002F{user_id}\u002Ftweets\",\n    headers=headers,\n    params={\n        \"max_results\": 10,\n        \"tweet.fields\": \"created_at,public_metrics\",\n    }\n)\n```\n\n### 搜索推文\n\n```python\nresp = requests.get(\n    \"https:\u002F\u002Fapi.x.com\u002F2\u002Ftweets\u002Fsearch\u002Frecent\",\n    headers=headers,\n    params={\n        \"query\": \"from:affaanmustafa -is:retweet\",\n        \"max_results\": 10,\n        \"tweet.fields\": \"public_metrics,created_at\",\n    }\n)\n```\n\n### 通过用户名获取用户\n\n```python\nresp = requests.get(\n    \"https:\u002F\u002Fapi.x.com\u002F2\u002Fusers\u002Fby\u002Fusername\u002Faffaanmustafa\",\n    headers=headers,\n    params={\"user.fields\": \"public_metrics,description,created_at\"}\n)\n```\n\n### 上传媒体并发布\n\n```python\n# Media upload uses v1.1 endpoint\n\n# Step 1: Upload media\nmedia_resp = oauth.post(\n    \"https:\u002F\u002Fupload.twitter.com\u002F1.1\u002Fmedia\u002Fupload.json\",\n    files={\"media\": open(\"image.png\", \"rb\")}\n)\nmedia_id = media_resp.json()[\"media_id_string\"]\n\n# Step 2: Post with media\nresp = oauth.post(\n    \"https:\u002F\u002Fapi.x.com\u002F2\u002Ftweets\",\n    json={\"text\": \"Check this out\", \"media\": {\"media_ids\": [media_id]}}\n)\n```\n\n## 速率限制\n\nX API 的速率限制因端点、认证方法和账户等级而异，并且会随时间变化。请始终：\n\n* 在硬编码假设之前，查看当前的 X 开发者文档\n* 在运行时读取 `x-rate-limit-remaining` 和 `x-rate-limit-reset` 头部信息\n* 自动退避，而不是依赖代码中的静态表格\n\n```python\nimport time\n\nremaining = int(resp.headers.get(\"x-rate-limit-remaining\", 0))\nif remaining \u003C 5:\n    reset = int(resp.headers.get(\"x-rate-limit-reset\", 0))\n    wait = max(0, reset - int(time.time()))\n    print(f\"Rate limit approaching. Resets in {wait}s\")\n```\n\n## 错误处理\n\n```python\nresp = oauth.post(\"https:\u002F\u002Fapi.x.com\u002F2\u002Ftweets\", json={\"text\": content})\nif resp.status_code == 201:\n    return resp.json()[\"data\"][\"id\"]\nelif resp.status_code == 429:\n    reset = int(resp.headers[\"x-rate-limit-reset\"])\n    raise Exception(f\"Rate limited. Resets at {reset}\")\nelif resp.status_code == 403:\n    raise Exception(f\"Forbidden: {resp.json().get('detail', 'check permissions')}\")\nelse:\n    raise Exception(f\"X API error {resp.status_code}: {resp.text}\")\n```\n\n## 安全性\n\n* **切勿硬编码令牌。** 使用环境变量或 `.env` 文件。\n* **切勿提交 `.env` 文件。** 将其添加到 `.gitignore`。\n* **如果令牌暴露，请轮换令牌。** 在 developer.x.com 重新生成。\n* **当不需要写权限时，使用只读令牌。**\n* **安全存储 OAuth 密钥** — 不要存储在源代码或日志中。\n\n## 与内容引擎集成\n\n使用 `content-engine` 技能生成平台原生内容，然后通过 X API 发布：\n\n1. 使用内容引擎生成内容（X 平台格式）\n2. 验证长度（单条推文 280 字符）\n3. 使用上述模式通过 X API 发布\n4. 通过 public\\_metrics 跟踪参与度\n\n## 相关技能\n\n* `content-engine` — 为 X 生成平台原生内容\n* `crosspost` — 在 X、LinkedIn 和其他平台分发内容\n",{"name":5,"origin":24,"description":7},"ECC","master","d6ca01da0f24a3b0e26e4a8b7b66cbd25d429f5d","docs\u002Fzh-CN\u002Fskills\u002Fx-api",0,"https:\u002F\u002Fgithub.com\u002FSriramGandhiS\u002FSkills","https:\u002F\u002Fgithub.com\u002FSriramGandhiS","https:\u002F\u002Fsriram.website\u002F","Curious guy who keeps tinkering until something works","2026-05-20 16:21:34",{"source":8,"skillName":5,"commands":35,"prompt":45,"zipAvailable":46},[36,39,42],{"tool":37,"command":38},"npx","npx skills add SriramGandhiS\u002FSkills --skill x-api",{"tool":40,"command":41},"bunx","bunx skills add SriramGandhiS\u002FSkills --skill x-api",{"tool":43,"command":44},"pnpm","pnpm dlx skills add SriramGandhiS\u002FSkills --skill x-api","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FSriramGandhiS\u002FSkills\u002Fblob\u002Fmaster\u002Fdocs\u002Fzh-CN\u002Fskills\u002Fx-api\u002FSKILL.md",true,[],[49,57,62,68,75,82],{"skillNo":50,"name":51,"nameZh":6,"description":52,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":53,"categories":54,"keywords":55,"publishedAt":56},"01M732609EPJWV13PVTX3GT4TM","webgpu-threejs-tsl","Comprehensive guide for developing WebGPU-enabled Three.js applications using TSL (Three.js Shading Language). Covers WebGPU renderer setup, TSL syntax and node materials, compute shaders, post-processing effects, and WGSL integration. Use this skill when working with Three.js WebGPU, TSL shaders, node materials, or GPU compute in Three.js.","https:\u002F\u002Fgithub.com\u002FSriramGandhiS\u002FSkills\u002Fblob\u002Fmaster\u002Fwebgpu-threejs-tsl\u002Fskills\u002Fwebgpu-threejs-tsl\u002FSKILL.md",[],[],"2026-11-11 15:11:14",{"skillNo":58,"name":51,"nameZh":6,"description":52,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":59,"categories":60,"keywords":61,"publishedAt":56},"01M7325XM47AGWB6K6C4VXKE6B","https:\u002F\u002Fgithub.com\u002FSriramGandhiS\u002FSkills\u002Fblob\u002Fmaster\u002Fwebgpu-threejs-tsl\u002FSKILL.md",[],[],{"skillNo":63,"name":64,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":65,"categories":66,"keywords":67,"publishedAt":56},"01M7325WP6DES69JKC840VMFEP","verification-loop","https:\u002F\u002Fgithub.com\u002FSriramGandhiS\u002FSkills\u002Fblob\u002Fmaster\u002Fweb-assets\u002Fdocs\u002Fzh-TW\u002Fskills\u002Fverification-loop\u002FSKILL.md",[],[],{"skillNo":69,"name":70,"nameZh":6,"description":71,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":72,"categories":73,"keywords":74,"publishedAt":56},"01M7325TFQF1DZTQ6J3WGQQ1VR","tdd-workflow","Use this skill when writing new features, fixing bugs, or refactoring code. Enforces test-driven development with 80%+ coverage including unit, integration, and E2E tests.","https:\u002F\u002Fgithub.com\u002FSriramGandhiS\u002FSkills\u002Fblob\u002Fmaster\u002Fweb-assets\u002Fdocs\u002Fzh-TW\u002Fskills\u002Ftdd-workflow\u002FSKILL.md",[],[],{"skillNo":76,"name":77,"nameZh":6,"description":78,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":56},"01M7325RGV9AY9PK92D2V8KKPW","strategic-compact","Suggests manual context compaction at logical intervals to preserve context through task phases rather than arbitrary auto-compaction.","https:\u002F\u002Fgithub.com\u002FSriramGandhiS\u002FSkills\u002Fblob\u002Fmaster\u002Fweb-assets\u002Fdocs\u002Fzh-TW\u002Fskills\u002Fstrategic-compact\u002FSKILL.md",[],[],{"skillNo":83,"name":84,"nameZh":6,"description":85,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":86,"categories":87,"keywords":88,"publishedAt":56},"01M7325MZC28SE86E7NMCNEFS4","security-review","Use this skill when adding authentication, handling user input, working with secrets, creating API endpoints, or implementing payment\u002Fsensitive features. Provides comprehensive security checklist and patterns.","https:\u002F\u002Fgithub.com\u002FSriramGandhiS\u002FSkills\u002Fblob\u002Fmaster\u002Fweb-assets\u002Fdocs\u002Fzh-TW\u002Fskills\u002Fsecurity-review\u002FSKILL.md",[],[]]