Guide · Agent skill
How to use the Twitter/X Scraping with twscrape agent skill
Updated · written with AI from the project's own documentation and checked against our catalogue data
The twscrape agent skill teaches an AI agent how to use twscrape, a Python library that collects public Twitter/X data such as searches, user profiles, followers, tweet replies and trends. It is for developers and analysts who want the agent to write working scraping scripts or run the twscrape command-line tool. After this guide you will know what the skill does, how to install it, how to ask for help with natural requests, and what safety points to check before you run anything.
Quick start
- 1Download and unzip the skill. Download the ZIP from this page and unzip it into ~/.claude/skills/ or a project's .claude/skills/ folder, or upload it under Settings, Capabilities, Skills in the Claude apps.
- 2Install Python and twscrape. Make sure Python with pip is available, then run pip install twscrape. Confirm with twscrape --help.
- 3Prepare your accounts. Gather the Twitter/X accounts you are permitted to use, preferably with session cookies, and any email details needed for verification.
- 4Ask for the data in plain language. Describe the search, profile, follower or trend data you need and mention Twitter or X so the skill loads.
- 5Add accounts and proxies if needed. Let the agent add accounts to the pool and set a proxy with the per-account, global or TWS_PROXY option.
- 6Run and review the output. Run the generated script or CLI command, check the results and confirm the output matches what you asked for.
What the twscrape skill makes the agent do
An agent skill is a folder of instructions and reference files that Claude loads when a task matches it. The twscrape skill is focused on one tool: the twscrape Python library, which calls Twitter/X's internal GraphQL web API rather than the official paid API.
With the skill loaded, the agent knows how to add logged-in accounts, rotate between them when rate limits are hit, and configure proxies. It can then write scripts that search tweets, look up user profiles, collect followers or replies, and fetch trends, or run the twscrape CLI for you.
- Search tweets by query, with optional Top-tweet ordering
- Look up users by username or ID and read profile counts
- Collect followers, following, tweet replies, retweeters and user media
- Fetch trending topics by category such as news or sport
- Manage accounts and proxies through Python or the CLI
Install the twscrape skill
Download the ZIP for the skill from this page and unzip it. The folder contains SKILL.md, plus a references folder with installation.md, examples.md and index.md.
You can install it in one of two ways. For your personal Claude setup, unzip it into ~/.claude/skills/. For a single project, unzip it into that project's .claude/skills/ folder. Alternatively, in the Claude apps open Settings, then Capabilities, then Skills, and upload the skill there.
Set up the Python library the skill depends on
The skill needs Python with pip and the twscrape package. The library's own install instructions use the following command, and the skill's reference files repeat it.
The source lists Python 3.7 or newer, asyncio support and an internet connection as requirements. Verification is done with the twscrape --help command and a short Python import check.
- Dependencies such as httpx and aiosqlite are installed automatically
- The default account database is accounts.db in your current working directory
pip install twscrapeTrigger the skill with natural requests
You do not need special syntax. Describe the data you want and mention Twitter or X. The skill is meant to load when you ask for Twitter/X extraction, monitoring, follower collection or an alternative to the official API.
Be specific about the target and the output. Say what you want to find, how many items, and whether you want a script or a one-off CLI command. The agent will then ask for any missing details it needs, such as which accounts to use.
- Write a Python script that collects the latest 100 tweets about a topic and saves them to JSON
- Get the follower list for this username and count how many have verified status
- Show me how to add two Twitter accounts with cookies and rotate between them
- Run twscrape to fetch the replies to this tweet ID with a limit of 50
Add accounts, proxies and rate-limit handling
The skill explains two ways to add accounts. Cookies are described as the more stable option. Login with username and password is described as less stable. Accounts can also be listed, re-logged-in or retried from the CLI.
Proxies can be set per account, globally in the API, or with the TWS_PROXY environment variable. The source gives the priority order as api.proxy first, then TWS_PROXY, then the account-specific proxy. Rate limits reset every 15 minutes per endpoint, and accounts rotate automatically when limits are reached.
- Use an account file in the form username:password:email:email_password with twscrape add_accounts
- Run twscrape login_accounts, or add --manual for manual email verification
- Check status with twscrape accounts
export TWS_PROXY=socks5://user:pass@127.0.0.1:1080
twscrape search "elon musk" --limit=20Safety, scope and limits to know first
This skill runs scripts and makes network requests to Twitter/X. Review any generated code before running it, and only run it with accounts you are allowed to use. The library uses an unofficial interface, so it can break when Twitter changes it, and accounts may be suspended.
The skill is built for bulk collection of profiles and followers. Do not use it to collect private data or other people's personal information without a lawful basis. The source also notes that user_tweets and user_tweets_and_replies return about 3,200 tweets maximum per user, a platform limit.
- Rate limits vary with account age, verification status and activity history
- Email verification needs IMAP access or manual entry, and the default wait is 30 seconds (TWS_WAIT_EMAIL_CODE)
What people use it for
- A social media team writing a script that tracks mentions of a brand and saves them for review
- A data analyst collecting follower lists for a research project, within a lawful basis
- A developer building an analytics dashboard that pulls user profile counts and recent tweets
- A researcher checking replies or retweeters for a set of tweet IDs using the twscrape CLI
Frequently asked questions
How do I install the twscrape agent skill?
Download the ZIP from this page and unzip it into ~/.claude/skills/ for personal use or a project's .claude/skills/ folder for one project. You can also upload it in the Claude apps under Settings, Capabilities, Skills.
What do I need to use the twscrape skill?
You need Python with pip, the twscrape package installed with pip install twscrape, and one or more Twitter/X accounts. Accounts can be added with session cookies or with username, password and email details. A proxy and IMAP access are optional.
Is twscrape free to use?
The source does not state a price or licence terms for the library beyond the skill's listed MIT licence, so check the licence of the twscrape project itself before relying on it. The skill does not mention any paid tier.
Is twscrape an alternative to the official Twitter API?
Yes, the source describes it as an alternative to the official Twitter API. It calls Twitter's internal GraphQL web API, which is unofficial, so it can break when Twitter changes its interface and may get accounts suspended.
Why does twscrape need multiple accounts?
The library rotates between accounts when rate limits are reached. Rate limits reset every 15 minutes per endpoint, and each account has separate limits for different operations.
Why is my twscrape login or account failing?
The source suggests using cookies, which it calls more stable than username and password login. For failed logins, run twscrape relogin_failed, check status with twscrape accounts, and use twscrape login_accounts --manual if email verification is needed.
New agent skills, repos and AI tools — every week
The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.
Our verdict
Use this skill if you are a developer or analyst who needs bulk Twitter/X data and is comfortable with Python and running an unofficial scraper with your own accounts. Pick an official or policy-compliant data source if you need guaranteed access, or if you only want a quick one-off lookup and do not want to set up Python.
Download the skill