Automates browsing, searching, and posting on X (Twitter).

Install

mkdir -p .claude/skills/x-sigcli && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/13422" && unzip -o skill.zip -d .claude/skills/x-sigcli && rm skill.zip

Installs to .claude/skills/x-sigcli

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Interact with X (Twitter) — view profiles, read tweets and threads, search posts, check trending topics, view followers, post tweets, like, retweet, follow users, and bookmark tweets. Use this skill whenever the user mentions X, Twitter, tweets, @handles, wants to browse X posts, search X, view user profiles, or interact with X content. Also trigger when the user pastes an x.com or twitter.com URL.
401 chars✓ has a “when” triggerlonger than Claude Code's old 250-char listing cap (fine on current versions)
Intermediate

Key capabilities

  • View user profiles on X (Twitter)
  • Read tweets and threads
  • Search posts by query and type (top/latest)
  • Check trending topics
  • View followers or following lists
  • Post tweets and reply to existing ones

How it works

The skill interacts with X (Twitter) through CLI scripts, performing setup to ensure valid configuration and proxy detection, then executing read or write operations based on user requests.

Inputs & outputs

You give it
User request to view profiles, read tweets, search, post, like, retweet, follow, or bookmark on X (Twitter)
You get back
X (Twitter) data (profiles, tweets, trends) or confirmation of social actions

When to use x

  • Searching for trending topics
  • Archiving tweets
  • Managing follow lists
  • Posting social updates

About this skill

X (Twitter)

Skill Directory

<SKILL_DIR> is the directory containing this SKILL.md file. To find it, look at the path where this skill was loaded from. It is typically ~/.claude/skills/x (installed) or wherever this file lives. Determine it ONCE at the start and reuse it.

Setup (run FIRST — every time, before any operation)

You MUST complete this setup before running any script. Do NOT skip this step.

sig status x 2>&1

Check the JSON output fields configured and valid:

  • configured: false → run Provider Setup below. Do NOT proceed without completing it.
  • valid: false (but configured: true) → run sig login x, then re-check.
  • valid: true → detect proxy (see below), then execute the user's request.

Provider Setup

  1. Read <SKILL_DIR>/references/provider-config.yaml
  2. Append the provider block to ~/.sig/config.yaml under providers:
  3. Ask the user: "Do you need a proxy to access this site?" — if yes, add networkProxy: <url> under the provider in config.yaml
  4. Run sig login x (with --network-proxy <url> if proxy was specified)
  5. Verify: run sig status x again — must show valid: true before proceeding

Proxy Detection (after provider is valid)

grep -A15 "^\s*x:" ~/.sig/config.yaml | grep networkProxy | awk '{print $2}'

If this outputs a URL, prefix ALL python3 commands with HTTPS_PROXY=<url> HTTP_PROXY=<url>. If using socks5, convert to socks5h for python (e.g. socks5://...socks5h://...). If empty, no proxy needed.

Running Scripts

All scripts require setup to be completed first (see above).


Scripts Reference

Read Operations

ScriptPurposeArgs
x_user.pyUser profile--username NAME
x_tweets.pyUser's tweet timeline--username NAME [--limit N]
x_tweet.pySingle tweet + thread--id ID_OR_URL [--limit N]
x_search.pySearch tweets--query TEXT [--limit N] [--type top|latest]
x_trending.pyTrending topics[--limit N]
x_followers.pyFollowers or following--username NAME [--limit N] [--mode followers|following]

Write Operations

ScriptPurposeArgs
x_post.pyCreate a tweet--cookie COOKIE --text TEXT [--reply-to ID]
x_delete.pyDelete a tweet--cookie COOKIE --id ID_OR_URL
x_like.pyLike or unlike--cookie COOKIE --id ID_OR_URL [--undo]
x_retweet.pyRetweet or unretweet--cookie COOKIE --id ID_OR_URL [--undo]
x_follow.pyFollow or unfollow--cookie COOKIE --username NAME [--undo]
x_bookmark.pyBookmark or unbookmark--cookie COOKIE --id ID_OR_URL [--undo]

Command Examples

All examples assume you've cd'd into <SKILL_DIR> and set proxy if needed.

Search tweets

sig run x -- bash -c 'cd <SKILL_DIR> && python3 scripts/x_search.py --query "Claude AI" --type top --limit 10'

View user profile

sig run x -- bash -c 'cd <SKILL_DIR> && python3 scripts/x_user.py --username elonmusk'

Read recent tweets

sig run x -- bash -c 'cd <SKILL_DIR> && python3 scripts/x_tweets.py --username elonmusk --limit 10'

Read a tweet thread

sig run x -- bash -c 'cd <SKILL_DIR> && python3 scripts/x_tweet.py --id "https://x.com/user/status/12345678"'

Post a tweet (ALWAYS confirm with user first)

sig run x -- bash -c 'cd <SKILL_DIR> && python3 scripts/x_post.py --cookie "$SIG_X_COOKIE" --text "Hello from sigcli!"'

Reply to a tweet

sig run x -- bash -c 'cd <SKILL_DIR> && python3 scripts/x_post.py --cookie "$SIG_X_COOKIE" --text "Great point!" --reply-to 2050336207561724307'

Delete a tweet (confirm with user first — irreversible)

sig run x -- bash -c 'cd <SKILL_DIR> && python3 scripts/x_delete.py --cookie "$SIG_X_COOKIE" --id 2050417089987711033'

Like / unlike

sig run x -- bash -c 'cd <SKILL_DIR> && python3 scripts/x_like.py --cookie "$SIG_X_COOKIE" --id 12345'
sig run x -- bash -c 'cd <SKILL_DIR> && python3 scripts/x_like.py --cookie "$SIG_X_COOKIE" --id 12345 --undo'

Follow / unfollow

sig run x -- bash -c 'cd <SKILL_DIR> && python3 scripts/x_follow.py --cookie "$SIG_X_COOKIE" --username elonmusk'
sig run x -- bash -c 'cd <SKILL_DIR> && python3 scripts/x_follow.py --cookie "$SIG_X_COOKIE" --username elonmusk --undo'

Bookmark / unbookmark

sig run x -- bash -c 'cd <SKILL_DIR> && python3 scripts/x_bookmark.py --cookie "$SIG_X_COOKIE" --id 12345'
sig run x -- bash -c 'cd <SKILL_DIR> && python3 scripts/x_bookmark.py --cookie "$SIG_X_COOKIE" --id 12345 --undo'

Safety Rules

  1. ALWAYS show tweet text to user and get explicit confirmation before posting. Tweets are public.
  2. Tweets and replies must be ≤ 280 characters. Check length before posting. URLs count as ~23 characters (t.co shortening). If the text exceeds 280 characters, shorten it or split into a thread.
  3. Like, retweet, follow, bookmark are reversible — use --undo to reverse.
  4. Delete is irreversible — confirm with user before deleting.

Error Recovery

When a command fails, follow this decision tree:

ErrorMeaningAction
ConnectionErrorCan't reach x.comAsk user for proxy URL, then retry with HTTPS_PROXY=<url>
TimeoutNetwork too slowRetry once. If still fails, check proxy.
AUTH_REQUIRED / 401Cookie missing or expiredAuto-run sig login x (do NOT ask user), then retry the failed command.
HTTP_403IP blocked or query IDs staleRetry once (auto-refresh kicks in). If still 403, change proxy or wait.
HTTP_429Rate limitedWait 30 seconds, then retry.
NOT_FOUNDUser/tweet doesn't existVerify the ID or username with the user.
POST_FAILEDTweet creation failedShow error details to user. May be duplicate or policy violation.
Query ID / GraphQL errorStale query IDs, refresh failedClear cache (restart script), retry. If persistent, bundles changed.

Key principle: if ANY command fails on first run, do NOT silently proceed. Diagnose using this table, fix the issue, and re-validate before continuing with the user's request.


Technical Notes

  • Query ID caching: Query IDs are cached to a file (scripts/.query_id_cache.json) so they persist across script calls. First script invocation fetches from X's JS bundles (~3s), all subsequent calls within 1 hour read from disk instantly. The file auto-refreshes when the TTL expires.
  • Transaction ID: X requires x-client-transaction-id header. Generated automatically using the XClientTransaction library.
  • Pagination: Timeline endpoints paginate internally (up to 5 pages).
  • Cookie TTL: Cookies typically last 7 days. After that, re-authenticate.

When not to use it

  • When the user does not want to interact with X (Twitter)
  • When the user prefers to use the official X (Twitter) application directly
  • When the user does not have a valid cookie for write operations

Limitations

  • Requires setup to be completed before any operation.
  • Write operations (post, delete, like, retweet, follow, bookmark) require a valid cookie.
  • Does not automatically handle all error recovery scenarios without user intervention.

How it compares

This skill provides CLI-based interaction with X (Twitter), including setup for authentication and proxy, unlike direct web interface usage.

Compared to similar skills

x side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
x (this skill)03moReviewIntermediate
baoyu-post-to-x52moReviewIntermediate
twitter04moReviewIntermediate
skills04moReviewBeginner

Try saying

Example prompts that trigger this skill in your AI assistant.

Search skills

Search the agent skills registry