twitter ยท diff
v1.4.2 to v2.0.0
76 added, 187 removed. Audit A to A.
---
name: twitter
- version: 1.4.2
- description: "Twitter/X (x.com) data lookup \u2014 fetch tweets by URL or ID, search\
- \ tweets, user profiles, followers, replies. Use for ANY x.com or twitter.com URL."
- tools:
- - twitter_search_tweets
- - twitter_get_tweets
- - twitter_user_info
- - twitter_user_tweets
- - twitter_user_followers
- - twitter_user_followings
- - twitter_tweet_replies
- - twitter_tweet_retweeters
- - twitter_search_users
- - twitter_get_article
- - twitter_tweet_thread_context
- - twitter_tweet_quote
- - twitter_get_trends
+ version: 2.0.0
+ description: "Twitter/X (x.com) data lookup โ fetch tweets by URL or ID, search tweets, user profiles, followers, replies. Use for ANY x.com or twitter.com URL."
+ delivery: script
+ protected: true
+
metadata:
starchild:
- emoji: "\U0001F426"
+ emoji: "๐ฆ"
skillKey: twitter
requires:
env:
- - TWITTER_API_KEY
+ - TWITTER_API_KEY
+
user-invocable: false
disable-model-invocation: false
---
- ## ๐ด Routing Rule โ Composio vs Native Twitter Tools
-
- **If the user has connected Twitter via Composio (OAuth), use Composio for account actions on their own profile:**
-
- | User intent | Use |
- |-------------|-----|
- | **Post a tweet / ๅๆจ** | Composio `TWITTER_CREATION_OF_A_POST` |
- | **Query own profile / ๆฅ่ชๅทฑ็่ตๆ** | Composio `TWITTER_USER_LOOKUP_ME` |
- | **Delete own tweet / ๅ ่ชๅทฑ็ๆจ** | Composio `TWITTER_POST_DELETE_BY_POST_ID` |
- | Lookup someone else's profile or tweets | This skill (`twitter_user_info`, `twitter_user_tweets`) |
- | Search tweets about a topic | This skill (`twitter_search_tweets`) |
- | Fetch tweets by URL or ID | This skill (`twitter_get_tweets`) |
-
- Rationale: Composio uses the user's **own OAuth-connected Twitter account**, so it can post, delete, and access self-endpoints. This skill uses a separate API key that is **read-only** and cannot act on the user's behalf.
-
- ## ๐ด HARD LIMITS โ READ FIRST
- > **โ CALL AT MOST 3 TWITTER TOOLS PER RESPONSE. STOP AFTER 3 CALLS.**
- > After each tool call, check: "Do I have enough data to answer?" If yes โ STOP AND REPLY.
- > **โ NEVER call `bash` or `write_file` for any twitter task** โ reason inline, no scripts.
- > **โ NEVER paginate unless user explicitly asks for more** โ first page is enough.
- > **โ NEVER call `lunar_coin`, `lunar_coin_time_series`, or any LunarCrush/CoinGecko tool** โ Twitter sentiment ้ฎ้ขๅช็จ `twitter_search_tweets` ๅ็ญ๏ผไธ่ทจ skillใ
- > **โ NEVER call `coin_price`, `cg_trending`, `cg_coins_markets`** โ ไปทๆ ผๆฐๆฎ่ถ
ๅบ Twitter skill ่ๅดใ
-
- ## ๐ URL Handling โ x.com / twitter.com
- > **โ NEVER use `web_fetch` for x.com or twitter.com URLs** โ Twitter blocks scraping, you'll only get a login wall.
- > **โ
ALWAYS extract the tweet ID from the URL and use `twitter_get_tweets`.**
-
- | URL pattern | Extract | Tool call |
- |-------------|---------|-----------|
- | `x.com/{user}/status/{id}` | tweet ID = `{id}` | `twitter_get_tweets(tweet_ids=["{id}"])` |
- | `twitter.com/{user}/status/{id}` | tweet ID = `{id}` | `twitter_get_tweets(tweet_ids=["{id}"])` |
- | `x.com/{user}` | username = `{user}` | `twitter_user_info(username="{user}")` |
-
- **Example:** User sends `https://x.com/zerohedge/status/2042670029548794219`
- โ Extract ID: `2042670029548794219`
- โ Call: `twitter_get_tweets(tweet_ids=["2042670029548794219"])`
- โ Never: `web_fetch("https://x.com/...")`
-
- ## ๐ก Few-Shot Examples
- **Q: ๆพ 3 ไธชๅ
ณไบ BTC ETF ็้ซ่ตๆจๆ๏ผๅช่ฆ ID ๅ็น่ตๆฐ**
- โ PLAN: 1 call `twitter_search_tweets("BTC ETF min_faves:100")` โ pick top 3 from results โ reply JSON
- โ STOP after 1 call. Total tools: 1
-
- **Q: @elonmusk ๆ่ฟๅ็ๆจๆๅชๆก็น่ตๆๅค๏ผๅช่ฆๆฐๅญ**
- โ PLAN: 1 call `twitter_user_tweets("elonmusk")` โ find max likes in results โ reply number
- โ STOP after 1 call. Total tools: 1
-
- **Q: ๆ็ดข solana ๆจๆ๏ผๆพ็น่ตๆๅค้ฃๆก็ไฝ่
**
- โ PLAN: 1 call `twitter_search_tweets("solana")` โ find tweet with most likes โ extract username
- โ STOP after 1 call. Total tools: 1
-
- **Q: ๅฏนๆฏ @A ๅ @B ่ฐ็ฒไธๅค๏ผๅ็็ฒไธๅค็ๆๆฐๆจๆ**
- โ PLAN: call `twitter_user_info("A")` + `twitter_user_info("B")` โ determine winner โ call `twitter_user_tweets(winner)`
- โ Total tools: 3. STOP.
-
- ## โก FAST PATHS (act immediately, no clarification needed)
- | Trigger keywords | Action |
- |-----------------|--------|
- | x.com or twitter.com URL with `/status/{id}` | Extract tweet ID โ `twitter_get_tweets(tweet_ids=["{id}"])` โ **never web_fetch** |
- | x.com or twitter.com URL with `/{username}` only | Extract username โ `twitter_user_info(username="{username}")` |
- | crypto sentiment / ๆ
็ปชๆซๆ / market mood / BTC ETH SOL ่ฎจ่ฎบ | Call `twitter_search_tweets` once per coin: `"$BTC"`, `"$ETH"`, `"$SOL"` โ summarize tone, **no user profile lookups** |
- | search tweets about X | Call `twitter_search_tweets` with the topic |
- | who is @username | Call `twitter_user_info` |
- | what did @username post | Call `twitter_user_tweets` |
-
- ## Tool Decision Tree
- **"Search for tweets about a topic"** โ `twitter_search_tweets`
- Advanced query with operators: keywords, from:user, #hashtag, $cashtag, min_faves, date ranges.
-
- **"Look up a specific tweet or set of tweets"** โ `twitter_get_tweets`
- Pass one or more tweet IDs directly.
-
- **"Who is this Twitter account?"** โ `twitter_user_info`
- Profile data: bio, follower count, tweet count, verification.
+ # Twitter / X (script-mode)
- **"What has this account been posting?"** โ `twitter_user_tweets`
- Recent tweets from a specific user.
+ Read-only access to twitterapi.io endpoints. 13 functions covering tweets,
+ users, followers, replies, threads, quotes, articles, and trends.
- **"Who follows this account?"** โ `twitter_user_followers`
- List of followers for a user.
+ All requests go through sc-proxy via `core.http_client.proxied_get`. The
+ `TWITTER_API_KEY` env var is auto-injected server-side, no local key needed
+ on the agent machine.
- **"Who does this account follow?"** โ `twitter_user_followings`
- List of accounts a user follows.
+ ## Script Usage
- **"What are people saying in reply to this tweet?"** โ `twitter_tweet_replies`
- Replies to a specific tweet by ID.
+ Standard invocation pattern:
- **"Who retweeted this?"** โ `twitter_tweet_retweeters`
- Users who retweeted a specific tweet.
+ ```bash
+ python3 - <<'EOF'
+ import sys, json
+ sys.path.insert(0, "/data/workspace/skills/twitter")
+ from exports import twitter_user_info, twitter_user_tweets
- **"Find accounts related to a topic"** โ `twitter_search_users`
- Search users by name or keyword.
+ profile = twitter_user_info(username="vitalikbuterin")
+ print(json.dumps(profile, indent=2))
- **"Read a long X article"** โ `twitter_get_article`
- Pass the article tweet ID. Returns title, preview, cover, and content blocks.
+ recent = twitter_user_tweets(username="vitalikbuterin")
+ print(f"got {len(recent.get('tweets', []))} tweets")
+ EOF
+ ```
- **"Get full thread context"** โ `twitter_tweet_thread_context`
- One call returns parent chain + direct replies for the target tweet.
+ Tweet ID extraction from URL: the last path segment of any
+ `x.com/{user}/status/{id}` or `twitter.com/{user}/status/{id}` URL is the
+ tweet ID. Pass it as a string (Python int will lose precision on long IDs).
- **"Who quoted this tweet?"** โ `twitter_tweet_quote`
- Get quote tweets for a specific tweet ID.
+ ## Function Reference (signatures)
- **"What is trending now?"** โ `twitter_get_trends`
- Get trends with optional `woeid`, `country`, `category`, `limit`.
+ All 13 functions live in `exports.py`. Returns are dicts straight from
+ twitterapi.io โ keys vary per endpoint, inspect once before scripting.
- **"Crypto sentiment scan / ๆ
็ปชๆซๆ / market mood"** โ `twitter_search_tweets` (call once per coin)
- For BTC/ETH/SOL sentiment: search `"$BTC"`, `"$ETH"`, `"$SOL"` separately, then summarize tone inline.
- โ NEVER call `twitter_user_info`, `twitter_user_followers`, or `twitter_user_tweets` during a sentiment scan โ text analysis only.
+ ### Tweet endpoints
- ## Available Tools
- | Tool | Description | Key Params |
- |------|-------------|------------|
- | `twitter_search_tweets` | Advanced tweet search | `query` (required), `cursor` |
- | `twitter_get_tweets` | Get tweets by ID | `tweet_ids` (array, required) |
- | `twitter_user_info` | User profile lookup | `username` (required) |
- | `twitter_user_tweets` | User's recent tweets | `username` (required), `cursor` |
- | `twitter_user_followers` | User's followers | `username` (required), `cursor` |
- | `twitter_user_followings` | User's followings | `username` (required), `cursor` |
- | `twitter_tweet_replies` | Replies to a tweet | `tweet_id` (required), `cursor` |
- | `twitter_tweet_retweeters` | Who retweeted | `tweet_id` (required), `cursor` |
- | `twitter_search_users` | Search for users | `query` (required), `cursor` |
- | `twitter_get_article` | Get long-form article | `tweet_id` (required) |
- | `twitter_tweet_thread_context` | Get full thread context | `tweet_id` (required) |
- | `twitter_tweet_quote` | Get quote tweets | `tweet_id` (required), `cursor` |
- | `twitter_get_trends` | Get trends | `woeid`, `country`, `category`, `limit` |
+ | Function | Description |
+ |---|---|
+ | `twitter_search_tweets(query, cursor=None)` | Advanced search. Operators: `from:user`, `to:user`, `#tag`, `$cashtag`, `lang:en`, `has:media`, `has:links`, `is:reply`, `min_faves:N`, `since:YYYY-MM-DD`, `until:YYYY-MM-DD`. |
+ | `twitter_get_tweets(tweet_ids)` | Fetch one or more tweets by ID. `tweet_ids` = list of strings (also accepts comma-string). |
+ | `twitter_tweet_replies(tweet_id, cursor=None)` | Replies to a tweet. |
+ | `twitter_tweet_retweeters(tweet_id, cursor=None)` | Users who retweeted. |
+ | `twitter_tweet_thread_context(tweet_id)` | Full thread context (parents + direct replies). |
+ | `twitter_tweet_quote(tweet_id, cursor=None)` | Quote tweets. |
+ | `twitter_get_article(tweet_id)` | Long-form X article body. |
+ | `twitter_get_trends(woeid=None, country=None, category=None, limit=None)` | Trending topics; all filters optional. |
- ## Usage Patterns
- ### โ ๏ธ Token Budget Rules
- - Sentiment scan: max **3 `twitter_search_tweets` calls** (one per coin), then summarize. Stop.
- - Account research: max **2 tool calls total** unless user asks for more depth.
- - Never chain more than 5 Twitter tool calls in one response.
+ ### User endpoints
- ### Research an account
- 1. `twitter_user_info` โ get profile, follower count, bio
- 2. `twitter_user_tweets` โ see what they've been posting
- 3. `twitter_user_followings` โ who they follow (reveals interests)
+ | Function | Description |
+ |---|---|
+ | `twitter_user_info(username)` | Profile: bio, follower/following counts, tweet count, verified. |
+ | `twitter_user_tweets(username, cursor=None)` | User's recent tweets. |
+ | `twitter_user_followers(username, cursor=None)` | Follower list. |
+ | `twitter_user_followings(username, cursor=None)` | Accounts followed. |
+ | `twitter_search_users(query, cursor=None)` | Search users by name/keyword. |
- ### Track a topic or token
- 1. `twitter_search_tweets` with query like `"$SOL min_faves:50"` โ find popular tweets
- 2. `twitter_search_users` with the topic โ find relevant accounts
+ `username` is the handle WITHOUT `@` (e.g. `"elonmusk"`, not `"@elonmusk"`).
+ Pagination: when a response includes `next_cursor`, pass it back as `cursor`
+ on the next call.
- ## Output Constraints (IMPORTANT for small models)
- - **Max 1 `twitter_search_tweets` call per coin/topic** โ do not repeat searches for same query. First result set is sufficient.
- - **Max 3 `twitter_user_info` calls per response** โ only look up the most relevant accounts.
- - **Never call `bash` or `write_file` for Twitter data** โ reason inline directly from tool results.
- - **Sentiment summaries**: after 1 search call, summarize tone inline in 3โ5 sentences. Done.
- - **Pagination**: only fetch next page if user explicitly asks for more results.
- - **After getting search results: sort/filter in your head, do not call bash to sort.**
+ ## When to use this skill
- ### Analyze engagement on a tweet
- 1. `twitter_get_tweets` โ get the tweet and its metrics
- 2. `twitter_tweet_replies` โ see the conversation
- 3. `twitter_tweet_retweeters` โ see who amplified it
+ - ANY `x.com/...` or `twitter.com/...` URL โ start here, NOT `web_fetch`
+ (Twitter blocks scrapers).
+ - Single tweet detail โ `twitter_get_tweets([tweet_id])`.
+ - "What's @user been posting?" โ `twitter_user_tweets`.
+ - KOL discovery / cashtag mentions โ `twitter_search_tweets("$SOL min_faves:50")`.
+ - Trending topics โ `twitter_get_trends`.
- ### Find influencers in a space
- 1. `twitter_search_users` with keyword (e.g. "DeFi analyst")
- 2. `twitter_user_info` on top results to compare follower counts
- 3. `twitter_user_tweets` to check content quality
+ ## Error handling
- ## Search Query Operators
- The `twitter_search_tweets` tool supports advanced operators:
+ - `402 Credits is not enough` โ upstream proxy credits exhausted; tell user
+ to top up. Don't retry.
+ - `429` โ rate limited; surface to user, don't auto-retry.
+ - `404 user not found` โ suggest verifying the handle spelling.
- | Operator | Example | Description |
- |----------|---------|-------------|
- | keyword | `bitcoin` | Tweets containing the word |
- | exact phrase | `"ethereum merge"` | Exact phrase match |
- | `from:` | `from:elonmusk` | Tweets by a specific user |
- | `to:` | `to:elonmusk` | Tweets replying to a user |
- | `#hashtag` | `#crypto` | Tweets with hashtag |
- | `$cashtag` | `$BTC` | Tweets with cashtag |
- | `lang:` | `lang:en` | Filter by language |
- | `has:media` | `has:media` | Tweets with images/video |
- | `has:links` | `has:links` | Tweets with URLs |
- | `is:reply` | `is:reply` | Only replies |
- | `min_faves:` | `min_faves:100` | Minimum likes |
- | `min_retweets:` | `min_retweets:50` | Minimum retweets |
- | `since:` | `since:2024-01-01` | Tweets after date |
- | `until:` | `until:2024-12-31` | Tweets before date |
+ ## Version Policy (hard rule)
- Combine operators: `from:VitalikButerin $ETH min_faves:100 since:2024-01-01`
+ This skill is **script-mode** (`delivery: script`). It does NOT register
+ runtime tools โ agent must `read_file` SKILL.md and call functions via
+ `bash` + `python3`. The legacy `tools.py` / `__init__.py` files are kept
+ for backward compatibility but are no longer the preferred entry point.
- ## Pagination
- Most endpoints support cursor-based pagination. When a response includes a cursor value, pass it as the `cursor` parameter to get the next page. If no cursor is returned, you've reached the end.
+ Bump rules:
+ - Any signature change, env-var change, or sc-proxy contract change โ MAJOR
+ - New function added, response schema clarified โ MINOR
+ - Bug fix or doc-only change โ PATCH
- ## Notes
- - **API key required**: Set `TWITTER_API_KEY` environment variable. Tools will error without it.
- - **Read-only**: These tools only retrieve data. No posting, liking, or following.
- - **For posting, deleting, or accessing the user's own Twitter account**: use the **composio** skill (see `TWITTER_CREATION_OF_A_POST`, `TWITTER_USER_LOOKUP_ME`, `TWITTER_POST_DELETE_BY_POST_ID`). This skill cannot act on the user's behalf.
- - **Usernames**: Always pass without the `@` prefix (e.g. `"elonmusk"` not `"@elonmusk"`).
- - **Tweet IDs**: Use string format for tweet IDs to avoid integer overflow issues.
- - **Rate limits**: The API has rate limits. If you get rate-limited, wait before retrying.