agentleFS
abhaylaabhayla/claude-best-practices/.claude/skills/twitter-x/SKILL.md

twitter-x

Skill9 starsChanged 7 months agoMITView on GitHub

Read, capture, compose, analyze, or post Twitter/X content. ALWAYS use this skill the moment a Twitter/X link is shared or mentioned — any x.com or twitter.com URL (a tweet/status, thread, profile, or X-native article), or any reference to a tweet, thread, retweet, DM, X post, or a Twitter @handle. Also use for every Twitter/X task: reading or summarizing a post, capturing a tweet's text + images, composing tweets/threads, scoring viral potential, searching/discovering, monitoring keywords, posting or engaging via API, growing an audience, and content strategy. If the user shares an x.com / twitter.com link with no other instruction, default to reading and capturing it with this skill.

  • Reads credentials
  • Sends data out

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Mode 1 (Read): no credential required — the fetch ladder handles it.

    line 69
  2. Very specific:

    Modes 2/3/9 (Compose/Score/Strategy): no external prerequisite — proceed directly.

    line 71
  3. Very specific:

    If a needed credential is missing with no declared fallback for that mode: report every missing item in ONE list and ask the user to supply …

    line 72
  4. Distinctive:

    After fetching, do whatever the user asked: summarize, analyze, extract key points, translate, etc.

    line 125

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Twitter/X Comprehensive Skill

Request: $ARGUMENTS


Determine which mode to use based on the user's request, then follow that section.


Prerequisites

  • Tools/CLIs: curl (all modes); jq (Mode 5 thread/media posting only)
  • Credentials/env (mode-dependent):
    • Mode 1 Option B only — JINA_API_KEY
    • Modes 4/5/6/7/8 (API search, post/engage, social, health, monitor) — X_API_KEY, X_API_SECRET, X_ACCESS_TOKEN, X_ACCESS_TOKEN_SECRET; optional X_API_BEARER_TOKEN (full-archive search, trends)
    • Mode 4 no-API fallback — rnet installed + browser cookies configured
  • Services/network: reachable adhx.com, fxtwitter/fixupx mirrors, r.jina.ai, api.x.com; a logged-in Claude-in-Chrome/Playwright session as the declared last-resort fetch fallback (Mode 1)
  • User inputs & decisions: which mode to run (see QUICK REFERENCE); for Mode 5, explicit approval before any POST/DELETE call (CRITICAL RULE 4)
  • Declared fallbacks: Mode 1 fetch ladder ADHX → fxtwitter mirror → Jina Reader → logged-in browser; Mode 4 API search → cookie-based rnet search when no API keys — both legal, no mid-run user input needed

STEP 0: Preflight

Determine the mode from the request first, then verify only what that mode needs:

  • Mode 1 (Read): no credential required — the fetch ladder handles it; check JINA_API_KEY only if the user has pre-selected Option B.
  • Modes 4/5/6/7/8 (API-based): confirm X_API_KEY/X_API_SECRET/X_ACCESS_TOKEN/X_ACCESS_TOKEN_SECRET are set and non-empty. If missing and the request is Mode 4 (search), check for the rnet + cookies fallback before treating it as missing.
  • Modes 2/3/9 (Compose/Score/Strategy): no external prerequisite — proceed directly.
  • If a needed credential is missing with no declared fallback for that mode: report every missing item in ONE list and ask the user to supply it now. Modes 5/6/7/8 HARD-STOP without credentials — posting/social/monitoring actions cannot proceed on guesses.

STEP 1: Read Post

Fetch any X/Twitter post as structured data for analysis.

Option A: ADHX API (no auth required)

Extract username and statusId from URL patterns:

  • x.com/{user}/status/{id}
  • twitter.com/{user}/status/{id}
curl -s "https://adhx.com/api/share/tweet/{username}/{statusId}"

Response schema:

{
  "id": "statusId",
  "url": "original URL",
  "text": "tweet body (empty if article)",
  "author": { "name": "...", "username": "...", "avatarUrl": "..." },
  "createdAt": "timestamp",
  "engagement": { "replies": 0, "retweets": 0, "likes": 0, "views": 0 },
  "article": {
    "title": "...", "previewText": "...",
    "coverImageUrl": "...", "content": "full markdown"
  }
}

Option B: Jina Reader (free, requires JINA_API_KEY)

curl -s -H "Authorization: Bearer $JINA_API_KEY" \
  "https://r.jina.ai/https://x.com/{user}/status/{id}"

Returns plain-text extraction including author, timestamp, text, images, and thread replies.

Fallback order & limits

Direct WebFetch of an x.com URL returns HTTP 402 (login wall) — never rely on it for X. Try, in order:

  1. ADHX (Option A) — best first choice; structured JSON incl. full article.content for X-native long-form articles.
  2. fxtwitter / fixupx mirror — api.fxtwitter.com/{user}/status/{id} for text + media; direct media at d.fxtwitter.com/{user}/status/{id}/photo/N.jpg, text-only at t.fxtwitter.com.
  3. Jina Reader (Option B) — r.jina.ai/<url> for clean extraction incl. thread replies.
  4. Logged-in browser (Claude-in-Chrome / Playwright) — the only fully reliable path for multi-tweet threads and anything steps 1–3 truncate (mirrors often return only the root tweet); use when the others come back incomplete.

For a NON-X public article, prefer Jina Reader (r.jina.ai/<url>) or plain WebFetch — ADHX/fxtwitter are X-only. Images in a post still need vision OCR after download; treat OCR as best-effort, not character-exact.

After fetching, do whatever the user asked: summarize, analyze, extract key points, translate, etc.


STEP 2: Compose Tweet

Craft an optimized tweet or thread. Apply these rules:

Read: references/compose-tweet.md for detailed step 2: compose tweet reference material.

STEP 3: Viral Potential Scoring

Score a tweet's viral potential using the 19-element system based on X's open-source recommendation algorithm.

Read: references/viral-potential-scoring.md for detailed step 3: viral potential scoring reference material.

Score: XX/100 (Grade: X)

Breakdown

FactorScoreNotes
Reply PotentialX/22...
.........

Penalties Applied

(if any)

Top 3 Improvements

  1. [Specific actionable improvement]
  2. [Specific actionable improvement]
  3. [Specific actionable improvement]

Optimized Version

[Rewritten tweet applying the improvements]


---

## STEP 4: Search & Discover

Search tweets, users, and trends. Requires API credentials.

### Environment Variables Required

X_API_KEY, X_API_SECRET, X_ACCESS_TOKEN, X_ACCESS_TOKEN_SECRET Optional: X_API_BEARER_TOKEN (for full-archive search)


### Search Commands (via Twitter API v2)

**Search recent tweets (last 7 days):**
```bash
curl -s -H "Authorization: Bearer $X_API_BEARER_TOKEN" \
  "https://api.x.com/2/tweets/search/recent?query=QUERY&max_results=100&tweet.fields=created_at,public_metrics,author_id"

Search with filters:

  • "AI agents" lang:en -is:retweet — English original tweets only
  • "claude code" has:links min_faves:10 — With links, 10+ likes
  • from:username since:2025-01-01 — From specific user since date

Get trending topics:

curl -s -H "Authorization: Bearer $X_API_BEARER_TOKEN" \
  "https://api.x.com/2/trends/by/woeid/1"

User lookup:

curl -s -H "Authorization: Bearer $X_API_BEARER_TOKEN" \
  "https://api.x.com/2/users/by/username/USERNAME?user.fields=public_metrics,description,created_at"

Cookie-Based Search (no API key — uses rnet)

If no API keys are available and rnet + browser cookies are configured:

# Search via GraphQL (returns 200+ tweets per query)
python rnet_twitter.py search "keyword" --mode top --count 200
python rnet_twitter.py search "keyword" --mode latest --min_faves 50

Analysis After Search

  • Sort by engagement (likes, retweets, impressions, quotes)
  • Identify top-performing content patterns
  • Extract common hooks, formats, and topics
  • Generate trend report with posting recommendations

STEP 5: Post & Engage

Post tweets, reply, like, retweet, and manage engagement. Requires API credentials.

Post a Tweet

curl -s -X POST "https://api.x.com/2/tweets" \
  -H "Authorization: OAuth ..." \
  -H "Content-Type: application/json" \
  -d '{"text": "Your tweet text here"}'

Post a Thread

Post tweets sequentially, each replying to the previous:

# Tweet 1 (get the ID from response)
TWEET1_ID=$(curl -s -X POST "https://api.x.com/2/tweets" \
  -H "Authorization: OAuth ..." \
  -d '{"text": "1/N: Thread opener"}' | jq -r '.data.id')

# Tweet 2 (reply to tweet 1)
curl -s -X POST "https://api.x.com/2/tweets" \
  -H "Authorization: OAuth ..." \
  -d "{\"text\": \"2/N: Next point\", \"reply\": {\"in_reply_to_tweet_id\": \"$TWEET1_ID\"}}"

Engagement Actions

ActionMethodEndpoint
LikePOST/2/users/:id/likes with {"tweet_id": "..."}
UnlikeDELETE/2/users/:id/likes/:tweet_id
RetweetPOST/2/users/:id/retweets with {"tweet_id": "..."}
UnretweetDELETE/2/users/:id/retweets/:tweet_id
BookmarkPOST/2/users/:id/bookmarks with {"tweet_id": "..."}
ReplyPOST/2/tweets with {"text": "...", "reply": {"in_reply_to_tweet_id": "..."}}
QuotePOST/2/tweets with {"text": "...", "quote_tweet_id": "..."}
Hide replyPUT/2/tweets/:id/hidden with {"hidden": true}
DeleteDELETE/2/tweets/:id

Post with Media

# Step 1: Upload media
MEDIA_ID=$(curl -s -X POST "https://upload.twitter.com/1.1/media/upload.json" \
  -F "media=@image.jpg" \
  -H "Authorization: OAuth ..." | jq -r '.media_id_string')

# Step 2: Post with media
curl -s -X POST "https://api.x.com/2/tweets" \
  -H "Authorization: OAuth ..." \
  -d "{\"text\": \"Check this out\", \"media\": {\"media_ids\": [\"$MEDIA_ID\"]}}"

Post with Poll

curl -s -X POST "https://api.x.com/2/tweets" \
  -H "Authorization: OAuth ..." \
  -d '{"text": "Which is better?", "poll": {"options": ["Option A", "Option B"], "duration_minutes": 1440}}'

Rate Limits

ActionLimit
Post tweets300 / 15 min
Like1000 / 24 hr
Follow400 / 24 hr
DM1000 / 15 min
Search450 / 15 min (app), 180 / 15 min (user)

STEP 6: Follower & Social Management

Follower Analysis

# Get followers
curl -s -H "Authorization: Bearer $X_API_BEARER_TOKEN" \
  "https://api.x.com/2/users/:id/followers?max_results=1000&user.fields=public_metrics,created_at"

# Get following
curl -s -H "Authorization: Bearer $X_API_BEARER_TOKEN" \
  "https://api.x.com/2/users/:id/following?max_results=1000&user.fields=public_metrics,created_at"

Follow / Unfollow

# Follow
curl -s -X POST "https://api.x.com/2/users/:id/following" \
  -H "Authorization: OAuth ..." -d '{"target_user_id": "TARGET_ID"}'

# Unfollow
curl -s -X DELETE "https://api.x.com/2/users/:source_id/following/:target_id" \
  -H "Authorization: OAuth ..."

Mute / Block

# Mute
curl -s -X POST "https://api.x.com/2/users/:id/muting" \
  -H "Authorization: OAuth ..." -d '{"target_user_id": "TARGET_ID"}'

# Block
curl -s -X POST "https://api.x.com/2/users/:id/blocking" \
  -H "Authorization: OAuth ..." -d '{"target_user_id": "TARGET_ID"}'

Unfollow Recommendations (Growth Hygiene)

Flag accounts to unfollow based on:

  • Inactive: No tweets in 90+ days
  • Non-engagers: Never liked/replied to your content
  • Low-value ratio: Following/follower ratio > 10
  • Bot indicators: Default avatar, <5 tweets, created recently

STEP 7: Account Health & Growth

Read: references/account-health-growth.md for detailed step 7: account health & growth reference material.

STEP 8: Keyword Monitoring

Set up ongoing monitoring for keywords, competitors, or brand mentions.

Manual Check

curl -s -H "Authorization: Bearer $X_API_BEARER_TOKEN" \
  "https://api.x.com/2/tweets/search/recent?query=KEYWORD%20-is:retweet&max_results=100&tweet.fields=created_at,public_metrics&sort_order=relevancy"

Monitoring Report Format

## Keyword Monitor: "KEYWORD"
Period: [date range]
Total mentions: X
Sentiment: Positive X% / Neutral X% / Negative X%

### Top Tweets (by engagement)
1. @user (XX likes, XX RTs): "tweet text..."
2. ...

### Trends
- Volume: [increasing/stable/decreasing] vs last period
- Key themes: [list emerging topics]
- Notable accounts discussing: [list]

### Recommended Actions
- [Reply to high-engagement tweets about X]
- [Create content addressing trending subtopic Y]

STEP 9: Content Strategy & Planning

Generate a content calendar or strategy plan.

Weekly Content Template

DayTypeFocus
MonValue threadIn-depth tutorial or guide
TueEngagement tweetQuestion, poll, or hot take
WedBuild in publicProgress update, lesson learned
ThuValue tweetQuick tip or insight
FriEngagement tweetWeekend discussion starter
SatCurated threadBest resources or tools roundup
SunLight / personalStory, reflection, or meme

Content Pillar Framework

Define 3-5 content pillars (topics you consistently post about):

Pillar 1: [Core expertise] — 40% of content
Pillar 2: [Industry insights] — 25% of content
Pillar 3: [Personal journey] — 20% of content
Pillar 4: [Community / engagement] — 15% of content

Repurposing Strategy

SourceTwitter Format
Blog postThread (key points as tweets)
YouTube videoThread summary + video link in reply
Podcast episode3-5 standalone quote tweets
NewsletterBest insight as single tweet
GitHub releaseBuild-in-public announcement thread

CRITICAL RULES

  1. Character limits are sacred — Never exceed 280 chars per tweet. Always show count.
  2. No hashtag spam — Max 2 hashtags, at the end. Zero is often better.
  3. Links kill reach — Put URLs in the first reply, not the main tweet.
  4. Confirm before posting — Always show the user what will be posted and get explicit approval before any POST/DELETE API call.
  5. Rate limit awareness — Track API usage and warn before hitting limits.
  6. No credential exposure — Never log or display API keys, tokens, or cookies.
  7. Disclose AI authorship — If asked, note the tweet was AI-assisted.
  8. Score before posting — When composing, always run the viral scoring (Mode 3) and suggest improvements before the user posts.

QUICK REFERENCE

User SaysMode
"Read/summarize this tweet" + URLMode 1: Read
"Write/compose/draft a tweet about..."Mode 2: Compose
"Score/check/rate this tweet"Mode 3: Score
"Search Twitter for..."Mode 4: Search
"Post/tweet/reply/like/retweet..."Mode 5: Post & Engage
"Show my followers / who to unfollow"Mode 6: Social
"Check my account health / shadowban"Mode 7: Health
"Monitor keyword X"Mode 8: Monitor
"Create a content plan / strategy"Mode 9: Strategy

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.