[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7F71MVE7S9X6Q2DXD7CPWR8":3,"skill-same:01M7F71MVE7S9X6Q2DXD7CPWR8":52},{"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":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":6,"ownerDescription":30,"updatedAt":31,"install":32,"resources":45},"01M7F71MVE7S9X6Q2DXD7CPWR8","x-api",null,"X\u002FTwitter API integration for posting tweets, threads, reading timelines, search, and analytics. Covers OAuth auth patterns, rate limits, and platform-native content posting. Use when the user wants to interact with X programmatically.","lza6\u002FArmor-piercing-system-prompts","lza6","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F128880206?v=4","01M7EB3K7WPX5T28EJ2NVHE6EG","Chinese-tingfeng","01M7EB3K97E1KQ16QWKJMFNGX8",11,"MIT","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F05-技能与代理开发\u002Fx-api-ECC\u002FSKILL.md",[],[],"2026-11-16 10:05:34",false,"---\nname: x-api\ndescription: X\u002FTwitter API integration for posting tweets, threads, reading timelines, search, and analytics. Covers OAuth auth patterns, rate limits, and platform-native content posting. Use when the user wants to interact with X programmatically.\n---\n\n# X API\n\nProgrammatic interaction with X (Twitter) for posting, reading, searching, and analytics.\n\n## When to Activate\n\n- User wants to post tweets or threads programmatically\n- Reading timeline, mentions, or user data from X\n- Searching X for content, trends, or conversations\n- Building X integrations or bots\n- Analytics and engagement tracking\n- User says \"post to X\", \"tweet\", \"X API\", or \"Twitter API\"\n\n## Authentication\n\n### OAuth 2.0 Bearer Token (App-Only)\n\nBest for: read-heavy operations, search, public data.\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 (User Context)\n\nRequired for: posting tweets, managing account, DMs, and any write flow.\n\n```bash\n# Environment setup — source before use\nexport X_CONSUMER_KEY=\"your-consumer-key\"\nexport X_CONSUMER_SECRET=\"your-consumer-secret\"\nexport X_ACCESS_TOKEN=\"your-access-token\"\nexport X_ACCESS_TOKEN_SECRET=\"your-access-token-secret\"\n```\n\nLegacy aliases such as `X_API_KEY`, `X_API_SECRET`, and `X_ACCESS_SECRET` may exist in older setups. Prefer the `X_CONSUMER_*` and `X_ACCESS_TOKEN_SECRET` names when documenting or wiring new flows.\n\n```python\nimport os\nfrom requests_oauthlib import OAuth1Session\n\noauth = OAuth1Session(\n    os.environ[\"X_CONSUMER_KEY\"],\n    client_secret=os.environ[\"X_CONSUMER_SECRET\"],\n    resource_owner_key=os.environ[\"X_ACCESS_TOKEN\"],\n    resource_owner_secret=os.environ[\"X_ACCESS_TOKEN_SECRET\"],\n)\n```\n\n## Core Operations\n\n### Post a Tweet\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### Post a Thread\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### Read User Timeline\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### Search Tweets\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### Pull Recent Original Posts for Voice Modeling\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 -is:reply\",\n        \"max_results\": 25,\n        \"tweet.fields\": \"created_at,public_metrics\",\n    }\n)\nvoice_samples = resp.json()\n```\n\n### Get User by Username\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### Upload Media and Post\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## Rate Limits\n\nX API rate limits vary by endpoint, auth method, and account tier, and they change over time. Always:\n- Check the current X developer docs before hardcoding assumptions\n- Read `x-rate-limit-remaining` and `x-rate-limit-reset` headers at runtime\n- Back off automatically instead of relying on static tables in code\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## Error Handling\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## Security\n\n- **Never hardcode tokens.** Use environment variables or `.env` files.\n- **Never commit `.env` files.** Add to `.gitignore`.\n- **Rotate tokens** if exposed. Regenerate at developer.x.com.\n- **Use read-only tokens** when write access is not needed.\n- **Store OAuth secrets securely** — not in source code or logs.\n\n## Integration with Content Engine\n\nUse `brand-voice` plus `content-engine` to generate platform-native content, then post via X API:\n1. Pull recent original posts when voice matching matters\n2. Build or reuse a `VOICE PROFILE`\n3. Generate content with `content-engine` in X-native format\n4. Validate length and thread structure\n5. Return the draft for approval unless the user explicitly asked to post now\n6. Post via X API only after approval\n7. Track engagement via public_metrics\n\n## Related Skills\n\n- `brand-voice` — Build a reusable voice profile from real X and site\u002Fsource material\n- `content-engine` — Generate platform-native content for X\n- `crosspost` — Distribute content across X, LinkedIn, and other platforms\n- `connections-optimizer` — Reorganize the X graph before drafting network-driven outreach\n","# X API\n\nProgrammatic interaction with X (Twitter) for posting, reading, searching, and analytics.\n\n## When to Activate\n\n- User wants to post tweets or threads programmatically\n- Reading timeline, mentions, or user data from X\n- Searching X for content, trends, or conversations\n- Building X integrations or bots\n- Analytics and engagement tracking\n- User says \"post to X\", \"tweet\", \"X API\", or \"Twitter API\"\n\n## Authentication\n\n### OAuth 2.0 Bearer Token (App-Only)\n\nBest for: read-heavy operations, search, public data.\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 (User Context)\n\nRequired for: posting tweets, managing account, DMs, and any write flow.\n\n```bash\n# Environment setup — source before use\nexport X_CONSUMER_KEY=\"your-consumer-key\"\nexport X_CONSUMER_SECRET=\"your-consumer-secret\"\nexport X_ACCESS_TOKEN=\"your-access-token\"\nexport X_ACCESS_TOKEN_SECRET=\"your-access-token-secret\"\n```\n\nLegacy aliases such as `X_API_KEY`, `X_API_SECRET`, and `X_ACCESS_SECRET` may exist in older setups. Prefer the `X_CONSUMER_*` and `X_ACCESS_TOKEN_SECRET` names when documenting or wiring new flows.\n\n```python\nimport os\nfrom requests_oauthlib import OAuth1Session\n\noauth = OAuth1Session(\n    os.environ[\"X_CONSUMER_KEY\"],\n    client_secret=os.environ[\"X_CONSUMER_SECRET\"],\n    resource_owner_key=os.environ[\"X_ACCESS_TOKEN\"],\n    resource_owner_secret=os.environ[\"X_ACCESS_TOKEN_SECRET\"],\n)\n```\n\n## Core Operations\n\n### Post a Tweet\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### Post a Thread\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### Read User Timeline\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### Search Tweets\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### Pull Recent Original Posts for Voice Modeling\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 -is:reply\",\n        \"max_results\": 25,\n        \"tweet.fields\": \"created_at,public_metrics\",\n    }\n)\nvoice_samples = resp.json()\n```\n\n### Get User by Username\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### Upload Media and Post\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## Rate Limits\n\nX API rate limits vary by endpoint, auth method, and account tier, and they change over time. Always:\n- Check the current X developer docs before hardcoding assumptions\n- Read `x-rate-limit-remaining` and `x-rate-limit-reset` headers at runtime\n- Back off automatically instead of relying on static tables in code\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## Error Handling\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## Security\n\n- **Never hardcode tokens.** Use environment variables or `.env` files.\n- **Never commit `.env` files.** Add to `.gitignore`.\n- **Rotate tokens** if exposed. Regenerate at developer.x.com.\n- **Use read-only tokens** when write access is not needed.\n- **Store OAuth secrets securely** — not in source code or logs.\n\n## Integration with Content Engine\n\nUse `brand-voice` plus `content-engine` to generate platform-native content, then post via X API:\n1. Pull recent original posts when voice matching matters\n2. Build or reuse a `VOICE PROFILE`\n3. Generate content with `content-engine` in X-native format\n4. Validate length and thread structure\n5. Return the draft for approval unless the user explicitly asked to post now\n6. Post via X API only after approval\n7. Track engagement via public_metrics\n\n## Related Skills\n\n- `brand-voice` — Build a reusable voice profile from real X and site\u002Fsource material\n- `content-engine` — Generate platform-native content for X\n- `crosspost` — Distribute content across X, LinkedIn, and other platforms\n- `connections-optimizer` — Reorganize the X graph before drafting network-driven outreach\n",{"name":5,"description":7},"main","d69096e239f2a89aabc2cd078c47664a9d3b1e11","05-技能与代理开发\u002Fx-api-ECC",3,"https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts","https:\u002F\u002Fgithub.com\u002Flza6","个人vx：Tf00798\r\n个人✈：@TFGY999","2026-10-08 14:29:22",{"source":8,"skillName":5,"commands":33,"prompt":43,"zipAvailable":44},[34,37,40],{"tool":35,"command":36},"npx","npx skills add lza6\u002FArmor-piercing-system-prompts --skill x-api",{"tool":38,"command":39},"bunx","bunx skills add lza6\u002FArmor-piercing-system-prompts --skill x-api",{"tool":41,"command":42},"pnpm","pnpm dlx skills add lza6\u002FArmor-piercing-system-prompts --skill x-api","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F05-技能与代理开发\u002Fx-api-ECC\u002FSKILL.md",true,[46],{"path":47,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":50,"sourceHtmlUrl":51},"agents\u002Fopenai.yaml","REFERENCE","参考文档",254,"https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F05-技能与代理开发\u002Fx-api-ECC\u002Fagents\u002Fopenai.yaml",[53,60,65,72,79,86],{"skillNo":54,"name":55,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":57,"categories":58,"keywords":59,"publishedAt":19},"01M7FFG485KY83TD6HSC4YPCMC","obsidian-clipper-template-creator","Guide for creating templates for the Obsidian Web Clipper. Use when you want to create a new clipping template, understand available variables, or format clipped content.","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobsidian-clipper-template-creator\u002FSKILL.md",[],[],{"skillNo":61,"name":55,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":62,"categories":63,"keywords":64,"publishedAt":19},"01M7FFG0T6AZ0STEJPSB3CX84K","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobsidian-clipper-template-creator-antigravity-awesome-skills-main\u002FSKILL.md",[],[],{"skillNo":66,"name":67,"nameZh":6,"description":68,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":69,"categories":70,"keywords":71,"publishedAt":19},"01M7FFFY0QEM14SKWPDYGMXM2P","python-api","Programmatic Object-Detection-Metrics API guidance for BoundingBox, BoundingBoxes, Evaluator, enums, coordinate conversion, AP\u002FmAP semantics, and source-style import diagnostics.","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobject-detection-metrics\u002Fsub-skills\u002Fpython-api\u002FSKILL.md",[],[],{"skillNo":73,"name":74,"nameZh":6,"description":75,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":76,"categories":77,"keywords":78,"publishedAt":19},"01M7FFFVZQZ2GJ0C0TGP7JHD20","file-evaluation","Folder-based PASCAL VOC AP\u002FmAP evaluation from ground-truth and detection text files.","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobject-detection-metrics\u002Fsub-skills\u002Ffile-evaluation\u002FSKILL.md",[],[],{"skillNo":80,"name":81,"nameZh":6,"description":82,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":83,"categories":84,"keywords":85,"publishedAt":19},"01M7FFFSFNYSE77SJ6PE1CK2DA","object-detection-metrics","Guides legacy Object-Detection-Metrics PASCAL VOC AP\u002FmAP evaluation from detection text folders and direct Python API classes.","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobject-detection-metrics\u002FSKILL.md",[],[],{"skillNo":87,"name":88,"nameZh":6,"description":89,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":90,"categories":91,"keywords":92,"publishedAt":19},"01M7FFFP0GCK1RVXBCPQ8APBMT","nx-workspace-patterns","Configure and optimize Nx monorepo workspaces. Use when setting up Nx, configuring project boundaries, optimizing build caching, or implementing affected commands.","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fnx-workspace-patterns\u002FSKILL.md",[],[]]