Agent skill

Twitter CLI

by public-clis in public-clis/twitter-cli

Use twitter-cli for ALL Twitter/X operations — reading tweets, posting, replying, quoting, liking, retweeting, following, searching, user lookups.

Apache-2.0Auto-check: warningsWriting & Content

Install Twitter CLI

The automated check flagged lines worth reading first. See the safety section below.

skills CLI
$ npx skills add public-clis/twitter-cli --skill twitter-cli -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install public-clis/twitter-cli twitter-cli --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
twitter-cli
GitHub stars
3k
Token cost
~3k tokens
SKILL.md length
650 words
Files
52
Skills in repo
1
Repo updated
First seen
Licence
Apache-2.0

At a glance

Use twitter-cli for ALL Twitter/X operations — reading tweets, posting, replying, quoting, liking, retweeting, following, searching, user lookups.

  • Works in 3 steps: Check if already authenticated → Guide user to authenticate → Handle common auth issues
  • Requests any Twitter interaction
  • SKILL.md covers Setup, Authentication, Output Format and Command Reference, plus 5 more sections
  • Runs Python scripts from its folder; calls jq and uv; reaches x.com; needs TWITTER_AUTH_TOKEN

What it does

Twitter CLI is an agent skill from public-clis/twitter-cli. Use twitter-cli for ALL Twitter/X operations — reading tweets, posting, replying, quoting, liking, retweeting, following, searching, user lookups. Invoke whenever user requests any Twitter interaction.

Its SKILL.md is about 3k tokens, which your agent loads only when the skill is triggered. The skill folder holds 56 other files (for example `.github/ISSUE_TEMPLATE/bug_report.yml`, `.github/ISSUE_TEMPLATE/feature_request.yml` and `.github/workflows/ci.yml`).

It sits in Writing & Content, covering Social media posts. It works with X (Twitter). The repository describes itself as: A CLI for Twitter/X — feed, bookmarks, and user timeline in terminal. The licence is Apache-2.0.

When your agent uses it

  • Requests any Twitter interaction
  • Tasks that involve Social media posts

Example prompts

  • “/twitter-cli”

Requirements

  • Python 3
  • A credential in TWITTER_AUTH_TOKEN

Workflow steps

3 steps, taken from the step headings in SKILL.md.

  1. Check if already authenticated
  2. Guide user to authenticate
  3. Handle common auth issues

What it can do on your machine

Read from SKILL.md and the folder at commit 7c634e0. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships script files (Python, from the files we listed), which the agent can run.

    Shell commands in SKILL.md call:

    • jq
    • uv

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • x.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names these keys or tokens, usually read from environment variables:

    • TWITTER_AUTH_TOKEN

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Twitter CLI loads about 3k tokens when it runs. Until then it costs about 53 tokens; SKILL.md has 650 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~53
When it runs · the whole SKILL.md, loaded when a task matches
~3k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check: warnings

The automated check found patterns that need a careful read before installing.

  • WarningMentions a credentials file (SSH keys, cloud or package-manager tokens)SKILL.md:50
    er is logged into x.com in one of: Arc, Chrome, Edge, Firefox, Brave. twitter-cli auto-extracts cookies.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from public-clis/twitter-cli at commit 7c634e0, republished under its Apache-2.0 licence (© public-clis). 650 words, ~2,989 tokens.

Download SKILL.mdSave it as .claude/skills/twitter-cli/SKILL.md (or your agent's skills folder). This skill also uses 51 other files; get the full folder from GitHub.
name
twitter-cli
description
Use twitter-cli for ALL Twitter/X operations — reading tweets, posting, replying, quoting, liking, retweeting, following, searching, user lookups. Invoke whenever user requests any Twitter interaction.
author
jackwener
version
0.8.0
tags
twitter, x, social-media, terminal, cli

twitter-cli — Twitter/X CLI Tool

Binary: twitter Credentials: browser cookies (auto-extracted) or env vars

Setup

bash
# Install (requires Python 3.8+)
uv tool install twitter-cli
# Or: pipx install twitter-cli

# Upgrade to latest (recommended to avoid API errors)
uv tool upgrade twitter-cli
# Or: pipx upgrade twitter-cli

Authentication

IMPORTANT FOR AGENTS: Before executing ANY twitter-cli command, you MUST first check if credentials exist. If not, you MUST proactively guide the user through the authentication process. Do NOT assume credentials are configured.

CRITICAL: Write operations (posting tweets, replying, quoting) REQUIRE full browser cookies. Only providing auth_token + ct0 via env vars may result in 226 error ("looks like automated behavior"). For best results, use browser cookie extraction.

Step 0: Check if already authenticated
bash
twitter status --yaml >/dev/null && echo "AUTH_OK" || echo "AUTH_NEEDED"

If AUTH_OK, skip to Command Reference. If AUTH_NEEDED, proceed to guide the user:

Step 1: Guide user to authenticate

Method A: Browser cookie extraction (recommended)

Ensure user is logged into x.com in one of: Arc, Chrome, Edge, Firefox, Brave. twitter-cli auto-extracts cookies. All Chrome profiles are scanned automatically. To specify a profile: TWITTER_CHROME_PROFILE="Profile 2" twitter feed. To prioritize a specific browser: TWITTER_BROWSER=chrome twitter feed (supported: arc, chrome, edge, firefox, brave).

bash
twitter whoami

Method B: Environment variables

bash
export TWITTER_AUTH_TOKEN="<auth_token from browser>"
export TWITTER_CT0="<ct0 from browser>"
twitter whoami

Method C: Full cookie string (for cloud/remote agents)

Tell the user:

我需要你的 Twitter 登录凭证。请按以下步骤获取:

  1. 用 Chrome/Edge/Firefox 打开 https://x.com(确保已登录)
  2. 按 F12 打开开发者工具 → Network 标签
  3. 在页面上刷新,点击任意 x.com 请求
  4. 找到 Request Headers → Cookie: 这一行,右键 → 复制值
  5. 把完整 Cookie 字符串发给我

⚠️ Cookie 包含登录信息,请不要分享给其他人。

Then extract and set env vars:

bash
FULL_COOKIE="<user's cookie string>"
export TWITTER_AUTH_TOKEN=$(echo "$FULL_COOKIE" | grep -oE 'auth_token=[a-f0-9]+' | cut -d= -f2)
export TWITTER_CT0=$(echo "$FULL_COOKIE" | grep -oE 'ct0=[a-f0-9]+' | cut -d= -f2)
twitter whoami
Step 2: Handle common auth issues
SymptomAgent action
No Twitter cookies foundGuide user to login to x.com in browser, or set env vars
Read works, write returns 226Full cookies missing — use browser cookie extraction instead of env vars
Cookie expired (401/403)Ask user to re-login to x.com and retry
User changed passwordAll old cookies invalidated — re-extract

Output Format

Default: Rich table (human-readable)
bash
twitter feed                          # Pretty table output
YAML / JSON: structured output

Non-TTY stdout defaults to YAML automatically. Use OUTPUT=yaml|json|rich|auto to override.

bash
twitter feed --yaml
twitter feed --json | jq '.[0].text'

All machine-readable output uses the envelope documented in SCHEMA.md. Tweet and user payloads now live under .data.

Full text: --full-text flag (rich tables only)

Use --full-text when the user wants complete post bodies in terminal tables. It affects rich table list views such as feed, bookmarks, search, user-posts, likes, list, and reply tables in tweet. It does not change --json, --yaml, or -c compact output.

bash
twitter feed --full-text
twitter search "AI agent" --full-text
twitter user-posts elonmusk --max 20 --full-text
twitter tweet 1234567890 --full-text
Compact: -c flag (minimal tokens for LLM)
bash
twitter -c feed --max 10              # Minimal fields, great for LLM context
twitter -c search "AI" --max 20       # ~80% fewer tokens than --json

Compact fields (per tweet): id, author (@handle), text (truncated 140 chars), likes, rts, time (short format)

Command Reference

Read Operations
bash
twitter status                         # Quick auth check
twitter status --yaml                  # Structured auth status
twitter whoami                         # Current authenticated user
twitter whoami --yaml                  # YAML output
twitter whoami --json                  # JSON output
twitter user elonmusk                  # User profile
twitter user elonmusk --json           # JSON output
twitter feed                           # Home timeline (For You)
twitter feed -t following              # Following timeline
twitter feed --max 50                  # Limit count
twitter feed --full-text               # Show full post body in table
twitter feed --filter                  # Enable ranking filter
twitter feed --yaml > tweets.yaml      # Export as YAML
twitter feed --input tweets.json       # Read from local JSON file
twitter bookmarks                      # Bookmarked tweets
twitter bookmarks --full-text          # Full text in bookmarks table
twitter bookmarks --max 30 --yaml
twitter search "keyword"               # Search tweets
twitter search "AI agent" -t Latest --max 50
twitter search "AI agent" --full-text  # Full text in search results
twitter search "topic" -o results.json # Save to file
twitter tweet 1234567890               # Tweet detail + replies
twitter tweet 1234567890 --full-text   # Full text in reply table
twitter tweet https://x.com/user/status/12345  # Accepts URL
twitter show 2                         # Open tweet #2 from last feed/search list
twitter show 2 --full-text             # Full text in reply table
twitter show 2 --json                  # Structured output
twitter list 1539453138322673664       # List timeline
twitter list 1539453138322673664 --cursor "<next-cursor>"
twitter list 1539453138322673664 --full-text
twitter user-posts elonmusk --max 20   # User's tweets
twitter user-posts elonmusk --full-text
twitter likes elonmusk --max 30        # User's likes (own only, see note)
twitter likes elonmusk --full-text
twitter followers elonmusk --max 50    # Followers
twitter following elonmusk --max 50    # Following
Show full SKILL.md (268 more words)Show less
Write Operations
bash
twitter post "Hello from twitter-cli!"              # Post tweet
twitter post "Hello!" --image photo.jpg              # Post with image
twitter post "Gallery" -i a.png -i b.jpg             # Up to 4 images
twitter reply 1234567890 "Great tweet!"              # Reply (standalone)
twitter reply 1234567890 "Nice!" -i pic.png          # Reply with image
twitter post "reply text" --reply-to 1234567890      # Reply (via post)
twitter quote 1234567890 "Interesting take"          # Quote-tweet
twitter quote 1234567890 "Look" -i chart.png         # Quote with image
twitter delete 1234567890                            # Delete tweet
twitter like 1234567890                              # Like
twitter unlike 1234567890                            # Unlike
twitter retweet 1234567890                           # Retweet
twitter unretweet 1234567890                         # Unretweet
twitter bookmark 1234567890                          # Bookmark
twitter unbookmark 1234567890                        # Unbookmark
twitter follow elonmusk                              # Follow user
twitter unfollow elonmusk                            # Unfollow user

Image upload notes:

  • Supported formats: JPEG, PNG, GIF, WebP
  • Max file size: 5 MB per image
  • Max 4 images per tweet
  • Use --image / -i (repeatable)

Agent Workflows

Post and verify
bash
twitter post "My tweet text" 2>/dev/null
# Output includes tweet URL: 🔗 https://x.com/i/status/<id>
Post with images
bash
# Single image
twitter post "Check this out!" --image /path/to/photo.jpg

# Multiple images
twitter post "Photo gallery" -i img1.png -i img2.jpg -i img3.webp
Reply to someone's latest tweet
bash
TWEET_ID=$(twitter user-posts targetuser --max 1 --json | jq -r '.data[0].id')
twitter reply "$TWEET_ID" "Nice post!"
Create a thread
bash
# Post first tweet, capture output for tweet ID
twitter post "Thread 1/3: First point"
# Note the tweet ID from output, then:
twitter reply <first_tweet_id> "2/3: Second point"
twitter reply <second_tweet_id> "3/3: Final point"
Quote-tweet with commentary
bash
TWEET_ID=$(twitter search "interesting topic" --max 1 --json | jq -r '.data[0].id')
twitter quote "$TWEET_ID" "This is a great insight!"
Like all search results
bash
twitter search "interesting topic" --max 5 --json | jq -r '.data[].id' | while read id; do
  twitter like "$id"
done
Get user info then follow
bash
twitter user targethandle --json | jq '.data | {username, followers, bio}'
twitter follow targethandle
bash
twitter user-posts elonmusk --max 20 --json | jq '.data | sort_by(.metrics.likes) | reverse | .[:3] | .[] | {id, text: .text[:80], likes: .metrics.likes}'
Check follower relationship
bash
MY_NAME=$(twitter whoami --json | jq -r '.data.user.username')
twitter followers "$MY_NAME" --max 200 --json | jq -r '.data[].username' | grep -q "targetuser" && echo "Yes" || echo "No"
Daily reading workflow
bash
# Compact mode for token-efficient LLM context
twitter -c feed -t following --max 30
twitter -c bookmarks --max 20

# Rich table with complete post bodies
twitter feed -t following --max 20 --full-text
twitter search "AI agent" --max 20 --full-text

# Full JSON for analysis
twitter feed -t following --max 30 -o following.json
twitter bookmarks --max 20 -o bookmarks.json
Search with jq filtering
bash
# Tweets with > 100 likes
twitter search "AI safety" --max 20 --json | jq '[.data[] | select(.metrics.likes > 100)]'

# Extract just text and author
twitter search "rust lang" --max 10 --json | jq '.data[] | {author: .author.screenName, text: .text[:100]}'

# Most engaged tweets
twitter search "topic" --max 20 --json | jq '.data | sort_by(.metrics.likes) | reverse | .[:5] | .[].id'

Ranking Filter

Filtering is opt-in. Enable with --filter:

bash
twitter feed --filter
twitter bookmarks --filter

Error Reference

ErrorCauseFix
No Twitter cookies foundNot authenticatedLogin to x.com in browser, or set env vars
HTTP 226Automated detectionUse browser cookie extraction (not env vars)
HTTP 401/403Cookie expiredRe-login to x.com and retry
HTTP 404QueryId rotationRetry (auto-fallback built in)
HTTP 429Rate limitedWait 15+ minutes, then retry
Error 187Duplicate tweetChange text content
Error 186Tweet too longKeep under 280 chars

Limitations

  • Images only — video/GIF animation upload not yet supported (image upload supports JPEG/PNG/GIF/WebP)
  • No DMs — no direct messaging
  • No notifications — can't read notifications
  • No polls — can't create polls
  • Single account — one set of credentials at a time
  • Likes are private — Twitter/X made all likes private since June 2024. twitter likes only works for your own account

Safety Notes

  • Write operations have built-in random delays (1.5–4s) to avoid rate limits.
  • TLS fingerprint and User-Agent are automatically matched to the Chrome version used.
  • Do not ask users to share raw cookie values in chat logs.
  • Prefer local browser cookie extraction over manual secret copy/paste.
  • Agent should treat cookie values as secrets (do not echo to stdout unnecessarily).

© public-clis, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 51 other files in the repository root of public-clis/twitter-cli.

  • SKILL.md
  • .github/ISSUE_TEMPLATE/bug_report.yml
  • .github/ISSUE_TEMPLATE/feature_request.yml
  • .github/workflows/ci.yml
  • .github/workflows/publish.yml
  • .gitignore
  • AGENTS.md
  • LICENSE
  • README.md
  • SCHEMA.md
  • config.yaml
  • pyproject.toml
  • tests/conftest.py
  • tests/fixtures/followers_page.json
  • tests/fixtures/home_timeline.json
  • tests/fixtures/list_timeline.json
  • … and 36 more

Open the folder on GitHubat commit 7c634e0

Compare with similar skills

Twitter CLI next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Twitter CLI compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Twitter CLI this skillpublic-clis/twitter-cli3k—~3kAutomated safety check: WarnApache-2.0
Social Contentfreekmurze/dotfiles1k22 repos~2.1kAutomated safety check: PassNone
Typefullyfreekmurze/dotfiles1k1 repos~3.4kAutomated safety check: NotesNone
Changelog Social RecapFlorianBruniaux/claude-code-ultimate-guide6.1k—~1.8kAutomated safety check: NotesCC-BY-SA-4.0
X Mastery Mentoralchaincyf/x-mentor-skill1.2k—~2.3kAutomated safety check: PassMIT
Voice Buildercharlie947/social-media-skills3.8k—~3.3kAutomated safety check: PassMIT

Similar skills

  • Social Content

    freekmurze/dotfiles

    When the user wants help creating, scheduling, or optimizing social media content for LinkedIn, Twitter/X, Instagram, TikTok, Facebook, or other platforms.

    1k GitHub starsUsed in 22 repos~2.1k tokens
    Writing & ContentAuto-check passed
  • Typefully

    freekmurze/dotfiles

    Create, schedule, and manage social media posts via Typefully.

    1k GitHub starsUsed in 1 repo~3.4k tokens
    Writing & ContentAuto-check: notes
  • Changelog Social Recap

    FlorianBruniaux/claude-code-ultimate-guide

    Turns CHANGELOG.md entries for a release or a week into LinkedIn, Twitter/X, newsletter and Slack posts in French and English.

    6.1k GitHub stars~1.8k tokensUpdated yesterday
    Writing & ContentAuto-check: notes
  • X Mastery Mentor

    alchaincyf/x-mentor-skill

    $10K/hr级X/Twitter运营导师。基于Nicolas Cole、Dickie Bush、Sahil Bloom、Justin Welsh、 Dan Koe、Alex Hormozi六位顶级创作者的方法论 + X开源算法深度分析 + AI/科技赛道专精策略, 提炼6个核心心智模型、10条决策启发式、完整的选题-写作-增长操作手册。

    1.2k GitHub stars~2.3k tokensUpdated 1 mo ago
    Writing & ContentAuto-check passed
  • Voice Builder

    charlie947/social-media-skills

    Build a personalised voice profile inside a Codex or Claude project from a short interview plus 3 to 5 sample pieces of writing.

    3.8k GitHub stars~3.3k tokensUpdated 22 days ago
    Writing & ContentAuto-check passed
  • Social Post

    Hao0321/claude-skill-social-post

    依使用者真實貼文與成效寫 Facebook/Instagram/YouTube/Threads/X 文案,包含 ChatGPT Chat 的「寫文」「Mode C」「用我的格式/口氣」「黑底白字」;本機工作台、規劃、確認後發布、留言回覆及成效學習。使用者說「發文」「文案」「Social Post 介面」「回覆留言」「查流量」「把數據訓練進去」「比較貼文」「優化 pattern」時使用。

    726 GitHub stars~2.9k tokensUpdated 4 days ago
    Writing & ContentAuto-check passed

Works with

Questions about Twitter CLI

What does Twitter CLI do?

Use twitter-cli for ALL Twitter/X operations — reading tweets, posting, replying, quoting, liking, retweeting, following, searching, user lookups. Twitter CLI is an agent skill from public-clis/twitter-cli. Use twitter-cli for ALL Twitter/X operations — reading tweets, posting, replying, quoting, liking, retweeting, following, searching, user lookups.

When should I use Twitter CLI?

Twitter CLI fits situations like: requests any Twitter interaction; tasks that involve Social media posts.

How do I install Twitter CLI in Claude Code?

Run `npx skills add public-clis/twitter-cli --skill twitter-cli -a claude-code`. Or copy the skill folder (the public-clis/twitter-cli repository) into .claude/skills/twitter-cli in your project. Claude Code loads it when a task matches its description.

How do I install Twitter CLI in Codex?

Run `npx skills add public-clis/twitter-cli --skill twitter-cli -a codex`. Or copy the skill folder (the public-clis/twitter-cli repository) into .agents/skills/twitter-cli in your project. Codex loads it when a task matches its description.

Can I use Twitter CLI in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add public-clis/twitter-cli --skill twitter-cli -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/twitter-cli, .gemini/skills/twitter-cli, .github/skills/twitter-cli and .opencode/skills/twitter-cli in your project.

What does Twitter CLI need to run?

Going by SKILL.md and its folder, Twitter CLI needs Python for the scripts in its folder, the command-line tools its instructions call (jq and uv) and credentials named TWITTER_AUTH_TOKEN. Our summary lists: Python 3; A credential in TWITTER_AUTH_TOKEN.

Does Twitter CLI access the network?

SKILL.md names 1 domain. In commands or code: x.com; the agent is likely to contact it when it follows the instructions. This is read from the text; nothing was executed.

Is Twitter CLI safe to install?

Our automated static check of SKILL.md flagged 1 warning(s): mentions a credentials file (ssh keys, cloud or package-manager tokens). Read the flagged lines before installing; the check is not a guarantee either way.

What licence does Twitter CLI use?

Twitter CLI is published under the Apache-2.0 licence (from the LICENSE file in the skill folder). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Twitter CLI use?

About 3k tokens (SKILL.md is roughly 12k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Twitter CLI?

Skills that share tags, products or a category with Twitter CLI: Social Content (freekmurze/dotfiles, 1k stars), Typefully (freekmurze/dotfiles, 1k stars), Changelog Social Recap (FlorianBruniaux/claude-code-ultimate-guide, 6.1k stars) and X Mastery Mentor (alchaincyf/x-mentor-skill, 1.2k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Twitter CLI?

public-clis (a GitHub organization) maintains it in public-clis/twitter-cli, which has 2,962 GitHub stars. The repository was last updated on May 7, 2026.

Source: public-clis/twitter-cli on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.