x-api

x-api is a skill for Claude Code, Codex from rockyco/claude-x-plugin. It costs 70 tokens per session (2,144 once invoked), scanned A, original, MIT.

A writing and media guide for creating posts on X (formerly Twitter) and working with its version 2 API, the interface developers use to publish posts and upload media.

In plain words
What is it for?
Use it to write post copy, create or adapt diagrams and images for X, publish posts through the API, and diagnose API problems.
Why use it?
It reduces guesswork about post formatting, image layout, authentication, and API limits when preparing or troubleshooting X content.

Skill for Claude CodeCodex

Installs and runs on its own, but its text points at files inside its plugin — anything it tells you to read at a ${CLAUDE_PLUGIN_ROOT} path is only there once the plugin is installed. Installing the plugin gets both.

Part of the x plugin — 1 skill, 3 commands shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/rockyco/claude-x-plugin/x-api
Any agent
npx skills add rockyco/claude-x-plugin --skill x-api
Clone the repo
git clone --depth 1 https://github.com/rockyco/claude-x-plugin

Made for: Claude Code, Codex.

Or install x, the plugin that ships this one along with the rest of its 1 skill, 3 commands.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for x-api

README.md
[![agentmods](https://agentmods.dev/badge/skills/rockyco/claude-x-plugin/x-api.svg)](https://agentmods.dev/skills/rockyco/claude-x-plugin/x-api)
Your own site
<a href="https://agentmods.dev/skills/rockyco/claude-x-plugin/x-api"><img src="https://agentmods.dev/badge/skills/rockyco/claude-x-plugin/x-api.svg" alt="Measured on agentmods" height="20"></a>
Per session 70 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,144 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00070 $0.02144
Opus 5 $0.00035 $0.01072
Sonnet 5 $0.00014 $0.00429
Haiku 4.5 $0.00007 $0.00214

Measured 4d ago against content hash 07e263af75b0, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

x-api scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/x-api/SKILL.md · 185 lines

How it starts

The opening of the file, as written. The whole thing — 185 lines — stays where its author put it; the contents beside it link to each section on GitHub.

X API Knowledge

Post Creation

X API v2 endpoint for creating posts:

POST https://api.x.com/2/tweets
Authorization: Bearer {access_token}
Content-Type: application/json

{"text": "Hello world"}

With media:

{
  "text": "Check this out",
  "media": {
    "media_ids": ["1234567890"]
  }
}

Authentication

X uses OAuth 2.0 with PKCE (Proof Key for Code Exchange):

  • Authorization URL: https://x.com/i/oauth2/authorize
  • Token URL: https://api.x.com/2/oauth2/token
  • Access tokens expire in 2 hours
  • Refresh tokens valid for 6 months (requires offline.access scope)
  • The plugin auto-refreshes tokens before each API call

Required scopes: tweet.read tweet.write users.read media.write offline.access

Media Upload

Single-shot upload to POST https://api.x.com/2/media/upload:

  • Format: multipart/form-data
  • Fields: media_data (base64), media_category ("tweet_image")
  • Returns data.id (media ID string)

Constraints

  • Max 4 images per post
  • Images: max 5 MB (JPG, PNG, GIF, WEBP)
  • GIFs: max 15 MB, resolution max 1280x1080
  • Videos: max 512 MB, 0.5-140 seconds (requires chunked upload)

Post Content Guidelines

  • Free tier: 280 characters per post
  • Premium/X Blue: 25,000 characters
  • Hashtags: use sparingly, 2-3 max
  • @mentions count toward character limit
  • URLs are shortened to 23 characters by t.co
  • Line breaks are preserved

Writing an attractive, readable post (ALWAYS craft, never dump raw text)

Every time you compose for X, deliberately write the post for the platform. Do NOT paste an article abstract or a LinkedIn body verbatim. Source material (a WeChat article, a LinkedIn post) is INPUT to be re-cut for X, not the post itself. Re-cut it every time.

Hook the first line. The opening line is the post: it is what shows in-feed and decides the scroll-stop. Lead with one of: a surprising/specific stat, a bold claim, a provocative question, or a concrete value proposition. Put the most counterintuitive fact first. Never open with throat-clearing ("In this post I want to talk about...").

Read the full file on GitHub · 185 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 185 lines · 70 tokens per session scan A 07e263af75b0

Subscribe to this mod's changes

x-api is a skill published in the GitHub repository rockyco/claude-x-plugin (1 stars, last pushed 2mo ago), licensed MIT. It adds 70 tokens to every session and 2,144 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

configuring-oauth2-authorization-flow

Configure secure OAuth 2.0 authorization flows including Authorization Code with PKCE, Client Credentials, and Device Authorization Grant. This skill covers flow selection, PKCE implementation, token.

26zl/cybersec-toolkit · 44 tokens

linkedin-api

Use when composing LinkedIn posts - writes post text and carousel/image assets to a local directory for manual review and publishing. Optimized for the 2026 LinkedIn algorithm (dwell time, Golden Hour, document carousel format).

rockyco/claude-linkedin-plugin · 49 tokens

configuring-oauth2-authorization-flow

Configures secure OAuth 2.0 authorization flows, including Authorization Code with PKCE, Client Credentials, and Device Authorization Grant, covering flow selection, PKCE implementation, token lifecycle management, and scope design per OAuth 2.1. Use when implementing or hardening OAuth 2.0…

Youngmaidainon/Agent-Level-Up · 84 tokens

twitter

This skill should be used when the user asks to "post a tweet", "read timeline", "check twitter", "like a tweet", "retweet", "search twitter", "manage twitter lists", "twitter auth", "get twitter user", "delete tweet", "trending topics", "what's trending", "bookmarks", "bookmark a tweet", "saved tweets", or mentions…

The-Focus-AI/twitter-skill · 105 tokens

create-site

Creates a new Power Pages code site (SPA) using React, Angular, Vue, or Astro. Guides through the full process from initial concept to deployed site: requirements discovery, scaffolding, component planning, design, implementation, validation, and deployment. Use when the user wants to create, build, or scaffold a new…

microsoft/power-platform-skills · 73 tokens

review

5-pass structured code review — correctness, security, performance, readability, consistency.

SethGammon/Citadel · 17 tokens