X
БесплатноЗапускает вложенные скриптыНе проверенRead and post on X (Twitter) via the official X API v2. With an app bearer token: look up a profile, read an account's recent posts (optionally without…
от odrobnik1 418 установок в других каталогахОб этом скилле
X (Twitter) API v2
Look up profiles, posts and threads on X, search recent posts, read the signed-in account's bookmarks and likes, and publish posts, through the official X API v2.
Entry point: {baseDir}/scripts/x.py (Python 3 standard library only)
{baseDir} stands for this skill's folder, the one that contains this SKILL.md. Replace it with that folder's full path in every command, because commands run in the agent's workspace. In Claude Code the folder is ${CLAUDE_SKILL_DIR}, which Claude Code fills in here; OpenClaw's agent resolves {baseDir} itself; other agents use the folder where they found this file.
When to use
- The user asks to look up an X (Twitter) account or post, read someone's recent posts or a thread, search X, see their own bookmarks or likes, or publish a post on X.
- Not for other social networks, direct messages, or downloading media.
user,timeline,thread,search,tweet,tweets,bookmarksandlikesonly read.postpublishes on the user's account: run it only for a post the user asked for, and only after they approved the exact text (see How to use it).
Setup
See SETUP.md. Profiles, posts and search need an app bearer token from the X Developer Console. Bookmarks, likes and posting need a one-time sign-in with auth, which uses the app's OAuth 2.0 client ID (and secret).
Credentials are read from config.json in the config folder: ~/.openclaw/x by default, ${OPENCLAW_STATE_DIR}/x when OpenClaw's state folder is moved (an existing ~/.openclaw/x stays in use until its files move), or any folder named by X_SKILL_CONFIG_DIR. The env vars X_BEARER_TOKEN, X_CLIENT_ID and X_CLIENT_SECRET override it. The sign-in is stored in tokens.json in the same folder, readable by the owner only. Never print or share these files.
Commands
# Read (with the bearer token; without one, with the sign-in)
python3 {baseDir}/scripts/x.py user USERNAME # profile: bio, counts, verification
python3 {baseDir}/scripts/x.py timeline USERNAME [--max 5-100] [--exclude retweets,replies]
python3 {baseDir}/scripts/x.py thread POST_URL_OR_ID # the author's own posts in that conversation
python3 {baseDir}/scripts/x.py search "QUERY" [--max 10-100] # posts from the last 7 days
python3 {baseDir}/scripts/x.py tweet POST_URL_OR_ID
python3 {baseDir}/scripts/x.py tweets POST_URL_OR_ID [more ...] # up to 100 in one request
# The signed-in account (needs auth)
python3 {baseDir}/scripts/x.py home [--max 1-3200] [--exclude retweets,replies] # home timeline, newest first
python3 {baseDir}/scripts/x.py bookmarks [--max 1-100] [--contains "TEXT"] [--urls]
python3 {baseDir}/scripts/x.py likes USERNAME [--max 1-100]
python3 {baseDir}/scripts/x.py post "TEXT" [--yes] # without --yes: preview only, exit 3
# Sign in (one-time) and out
python3 {baseDir}/scripts/x.py auth # opens the browser, waits for the callback on localhost:8080
python3 {baseDir}/scripts/x.py auth --manual # prints the sign-in URL and exits
python3 {baseDir}/scripts/x.py auth --code "REDIRECT_ADDRESS"
python3 {baseDir}/scripts/x.py logout # revokes the sign-in at X, deletes tokens.json
USERNAME takes a name, @name or a profile link. POST_URL_OR_ID takes a post link from x.com or twitter.com, or the numeric ID.
JSON output (--json)
Add --json before or after the subcommand (x.py --json user NAME = x.py user NAME --json) to get machine-readable output:
- stdout carries exactly one JSON document, also for errors. Human-readable text, emoji and warnings go to stderr (discard with
2>/dev/null). - Pretty-printed (indent 2) when stdout is a terminal, compact one-line JSON when piped. UTF-8, not ASCII-escaped. Posts and users are passed through as X sends them, plus a
url. - Errors:
{"error": {"message": "...", "code": "..."}}on stdout, non-zero exit (1 = failure, 2 = usage, including bad option values).codeis X's error type (e.g.usage-capped,resource-not-found,invalid_request,rate_limited), ornot_signed_in,missing_credentials,missing_oauth_client,unknown_account,invalid_tweet,invalid_username,not_found,network_error,filesystem_error,usage;errorfor anything else.
| Command | JSON shape |
|---|---|
user |
the user from X (id, name, username, description, created_at, verified, public_metrics) plus url |
timeline, search, likes, bookmarks |
[post, ...] in X's order |
home |
[post, ...] newest first; each post also has author_username, author_name and full_text (the untruncated text: a long post's note_tweet, or for a repost RT @user: plus the original's full text) |
thread |
[post, ...], oldest first |
tweet |
one post |
tweets |
[post, ...] in the order asked; a post that can't be found is {id, found: false, error} (e |
Установить X в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл X?
Read and post on X (Twitter) via the official X API v2. With an app bearer token: look up a profile, read an account's recent posts (optionally without retweets or replies), read a thread its author wrote in the last 7 days, search posts from the last 7 days with X's search operators, and look up posts by URL or ID (up to 100 at once). With a one-time OAuth 2.0 sign-in in the browser: read the signed-in account's home timeline (newest first), list its bookmarks (filtered by text, or just their links), list liked posts, and publish a post, which only shows a preview until run again with --yes. The bearer token and the OAuth client come from env vars or config.json; the sign-in is stored owner-only (by default in ~/.openclaw/x), renewed automatically, and revoked by logout. Every command can also print JSON (--json). X bills API use per request. Use when the user asks to look someone up on X, read recent posts or a thread, search X, see their home timeline, bookmarks or likes, or post on X.
Как установить скилл X?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл X запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic