twitter-cli

A Twitter/X CLI with an agent skill: feeds, bookmarks, search and profiles in the terminal, plus posting, replies and likes with no API keys

  • 3,005 ★ on the repository
  • Last commit
  • Apache-2.0
CLI

Broad access

Why this level

  • The tool reads your account cookies from the browser and acts as you: posts, deletes, likes and follows
  • Unofficial access can get an account blocked, especially with frequent requests
  • The tool handles account authorization tokens through the environment and files
All reasons and checks
Needs a VPN

public-clis/twitter-cli

Install

Works in

In your terminal, with SkillFoxx CLI

npx skillfoxx add cli/twitter-cli

Detects the agents on your machine, shows the access level and pins the version.

Other ways to install

Access and checks

How we review

Broad accessThe tool can change data, run commands or handle secrets.

  • The tool reads your account cookies from the browser and acts as you: posts, deletes, likes and follows
  • Unofficial access can get an account blocked, especially with frequent requests
  • The tool handles account authorization tokens through the environment and files

This is third-party code. Review the repository files before installing.

What it does

The twitter command reads and writes Twitter/X from the terminal with no API keys: sign-in goes through cookies from your browser. You can read For You and Following feeds, bookmarks, search with Top, Latest, Photos and Videos tabs, a tweet page with replies, lists, profiles, other users' tweets, followers and following, and export Twitter Articles to Markdown. Write commands cover posting with images (up to four), replies, quotes, deleting your own tweets, likes, retweets, bookmarks and follows. Output supports YAML and JSON. When it goes to a pipe or file, YAML is the default. The -c flag compacts a response to save tokens. An optional filter ranks tweets by weights for likes, retweets, replies, bookmarks and views from config.yaml. The CLI ships with a SKILL.md that lays out, for an agent, an auth check, a command reference and workflows: post and verify, reply to an author's latest tweet, build a thread, quote with commentary.

Who it is for. For developers and analysts who need to read feeds, search posts and publish from a terminal or through an agent.

Good fit when

  • You want to export bookmarks or the Following feed to YAML and have an agent sort them
  • You need to find posts on a topic for a period, for example twitter search with --from, --lang and --since filters
  • An agent should read a tweet with all replies from a link and summarize the discussion
  • You want to publish a post or a thread with images and check the result by its tweet link
  • A Twitter Article should be saved to a Markdown file for notes

Not a fit when

  • You need the official API with keys and quotas: the tool uses the site's internal interface, and responses can break when it changes
  • The account is critical for your work: automated actions with cookies may get it blocked
  • You want other people's likes: Twitter made them private in June 2024 and the command only shows your own
  • You are in Russia: the X service is blocked here and unavailable from the country

Example request

Use twitter-cli to find 30 recent posts about Claude Code, save them as YAML and summarize the main discussion themes

Limitations

The tool uses the site's internal requests, so a 404 sometimes means the query identifiers rotated. A retry usually helps, and the client tries to find new identifiers itself. Writing needs full browser cookies: auth_token and ct0 alone from environment variables are often not enough, and Twitter returns error 226 about automation-like behavior.

It needs Python, installed through uv or pipx. The X service is blocked in Russia. When reading many records, use small limits and do not run the tool too often: each start contacts x.com. Windows with ConPTY can lose pipe output, and Git Bash helps.

How to disable. Remove the tool with uv tool uninstall twitter-cli or pipx uninstall twitter-cli and delete the skill from the agent's skills folder, for example .agents/skills/twitter-cli. Log out of x.com in your browser if you do not want the cookies to stay available.

FAQ

How do I install twitter-cli in Claude Code?

The tool first: uv tool install twitter-cli or pipx install twitter-cli. Then the skill: npx skills add jackwener/twitter-cli, with -g for a global install and -a claude-code to pick the agent. You can also clone the repository by hand into .agents/skills/twitter-cli.

How does twitter-cli sign in without API keys?

It takes cookies from Arc, Chrome, Edge, Firefox or Brave and can read the TWITTER_AUTH_TOKEN and TWITTER_CT0 variables when needed. Writing requires full browser cookies, otherwise error 226 is possible. Check sign-in with twitter status and twitter whoami.

Which output suits an agent?

YAML, which turns on by itself when output is not a terminal. For strict JSON add --json, and for token savings use the -c flag. SCHEMA.md describes the response structure, and error codes such as not_authenticated, rate_limited and not_found arrive in structured form.

What should I do about a 404 error from Twitter?

Retry the command. A 404 can appear when the site rotates its GraphQL query identifiers, and the client then tries to find current ones itself. If the error persists, update the tool with uv tool upgrade twitter-cli.

How does the --filter ranking work?

A score is computed: likes ×1, retweets ×3, replies ×2, bookmarks ×5 and the logarithm of views with weight 0.5, which are the defaults in config.yaml. The topN, score and all modes keep the best N, tweets above a threshold or everything sorted.

Discussion

No questions or reviews yet.

CLI tools

Reads X tweets, replies, timelines, lists and articles with no login or API keys through the xtf command, with three backends and automatic fallback

SkillExtended access991Repository stars

CLI and skill that let an agent read and search Twitter, Reddit, YouTube, GitHub, Bilibili and Xiaohongshu without paid APIs

CLIExtended access101KRepository stars

The news-extractor skill pulls the title, text, images and metadata from a link on 12 news platforms and returns JSON or Markdown, with no browser

SkillExtended access633Repository stars

Turns any website into a CLI command and lets an agent drive the user's already logged-in browser via Playwright

CLIBroad access30.6KRepository stars

A CLI and MCP server that lets an agent drive your real Chrome with its logged-in sessions: 103 commands across 36 platforms plus browser automation

CLIBroad access6.2KRepository stars

A skill that reads a link and hands the agent the full text as Markdown, picking a separate route for WeChat pages, Feishu docs, PDFs and arXiv papers

SkillExtended access509Repository stars

Comparison with similar tools

Entries that share the main search query, and how they differ.

EntryOfficialRepository starsMain difference
twitter-cli (this entry)no3,005
Agent Reachno101,004a CLI and skill for reading Twitter, Reddit, YouTube, GitHub and other platforms at once
bb-browserno6,249gives an agent your real Chrome with saved logins for any site
last30daysno65,142gathers discussion of a topic over 30 days from Reddit, X, YouTube and other sources

README in short

The description, in English and Chinese, presents the tool as a terminal utility for Twitter/X with no API keys. It lists read and write features, sign-in options, installation through uv and pipx, command examples, config.yaml setup with scoring weights and tips on avoiding bans. A separate section covers connecting it as an agent skill, with error diagnostics and the project structure.

README badge

Original SKILL.md

---
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](#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.

Report a problem

Foxx AItwitter-cli
Foxx AI

I am Foxx AI and I have already vetted this tool. Ask about install, setup or anything else, and I will keep it simple.