Post, search, read timelines, and analyze data via the X API.
Copy the install command and let the AI configure it · recommended for beginners
Please install the "x-api" skill from askskill: 1. Download https://raw.githubusercontent.com/affaan-m/ECC/main/skills/x-api/SKILL.md 2. Save it as ~/.claude/skills/x-api/SKILL.md 3. Reload skills and tell me it's ready
Using the X API, create a sample workflow that authenticates with OAuth and publishes the following four text blocks as a thread, including retry logic and rate-limit handling recommendations.
An implementation outline or sample code for posting a thread, including auth, posting order, and error handling.
Use the X API to design a search workflow that collects posts from the last 7 days containing our brand and competitor keywords, returning author, publish time, engagement metrics, and source links.
An actionable search and extraction plan for monitoring brand mentions and competitor activity.
Based on the X API, provide a script approach to fetch the last 30 days of posts from a specified account, summarize impressions, likes, reposts, and replies, and identify the top 10 posts by engagement rate.
An account analytics plan or script example that outputs key metrics and a list of top-performing posts.
Drift-prone skill. X API endpoints, access tiers, quotas, and write permissions change frequently. Verify current developer docs and account access before quoting rate limits or implementing a posting/search flow.
Programmatic interaction with X (Twitter) for posting, reading, searching, and analytics.
Best for: read-heavy operations, search, public data.
# Environment setup
export X_BEARER_TOKEN="your-bearer-token"
import os
import requests
bearer = os.environ["X_BEARER_TOKEN"]
headers = {"Authorization": f"Bearer {bearer}"}
# Search recent tweets
resp = requests.get(
"https://api.x.com/2/tweets/search/recent",
headers=headers,
params={"query": "claude code", "max_results": 10}
)
tweets = resp.json()
Required for: posting tweets, managing account, DMs, and any write flow.
# Environment setup — source before use
export X_CONSUMER_KEY="your-consumer-key"
export X_CONSUMER_SECRET="your-consumer-secret"
export X_ACCESS_TOKEN="your-access-token"
export X_ACCESS_TOKEN_SECRET="your-access-token-secret"
Legacy 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.
import os
from requests_oauthlib import OAuth1Session
oauth = OAuth1Session(
os.environ["X_CONSUMER_KEY"],
client_secret=os.environ["X_CONSUMER_SECRET"],
resource_owner_key=os.environ["X_ACCESS_TOKEN"],
resource_owner_secret=os.environ["X_ACCESS_TOKEN_SECRET"],
)
resp = oauth.post(
"https://api.x.com/2/tweets",
json={"text": "Hello from Claude Code"}
)
resp.raise_for_status()
tweet_id = resp.json()["data"]["id"]
def post_thread(oauth, tweets: list[str]) -> list[str]:
ids = []
reply_to = None
for text in tweets:
payload = {"text": text}
if reply_to:
payload["reply"] = {"in_reply_to_tweet_id": reply_to}
resp = oauth.post("https://api.x.com/2/tweets", json=payload)
tweet_id = resp.json()["data"]["id"]
ids.append(tweet_id)
reply_to = tweet_id
return ids
resp = requests.get(
f"https://api.x.com/2/users/{user_id}/tweets",
headers=headers,
params={
"max_results": 10,
"tweet.fields": "created_at,public_metrics",
}
)
resp = requests.get(
"https://api.x.com/2/tweets/search/recent",
headers=headers,
params={
"query": "from:affaanmustafa -is:retweet",
"max_results": 10,
"tweet.fields": "public_metrics,created_at",
}
)
resp = requests.get(
"https://api.x.com/2/tweets/search/recent",
headers=headers,
params={
"query": "from:affaanmustafa -is:retweet -is:reply",
"max_results": 25,
"tweet.fields": "created_at,public_metrics",
}
)
voice_samples = resp.json()
resp = requests.get(
"https://api.x.com/2/users/by/username/affaanmustafa",
headers=headers,
params={"user.fields": "public_metrics,description,created_at"}
)
# Media upload uses v1.1 endpoint
# Step 1: Upload media
media_resp = oauth.post(
"https://upload.twitter.com/1.1/media/upload.json",
files={"media": open("image.png", "rb")}
)
media_id = media_resp.json()["media_id_string"]
…
Run repo tasks, debug CI, and deliver fixes with verified evidence.
Process documents with OCR, conversion, extraction, redaction, signing, and form filling.
Build robust Django tests with pytest-django, TDD, mocks, factories, and API coverage.
Research prediction market signals for products, dashboards, agents, and decision intelligence.
Learn frontend patterns for React, Next.js, state, performance, and UI best practices.
Handle HIPAA privacy, security, PHI, and breach compliance tasks correctly.
Post, read, search, and analyze X data through the Twitter API.
Read X/Twitter posts, threads, replies, and search results without API keys.
Access X from the CLI for posting, search, DMs, and API calls.
Download tweets and optimize X content with hashtags, hooks, and revenue insights.
Automate Twitter/X interactions, posting, and management with AI agents.
Search public X/Twitter posts and retrieve tweet details through a read-only MCP tool.