Post To X
Apps & Automationpost-to-xPost To X is an Agent Skill for apps & automation published in the AIDotNet/OpenCowork repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.
Post tweets to X.com (Twitter) using the system browser's login state
QUICK START
How to use this skill
Bring this guide into your coding agent with a prompt tailored to the tool you use.
- Open your project in Codex.
- Copy and paste the prompt below.
- Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/AIDotNet/OpenCowork/blob/HEAD/resources/skills/post-to-x/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/post-to-x, but wait for my approval before writing files or running scripts.
Copying this prompt does not install or run the skill. Review third-party files before use.
Post to X
Automatically post tweets to X.com (Twitter) using the system Edge/Chrome browser's login state.
Features
- Automatic login state reuse - Directly uses system browser user data, no need to log in each time
- Smart login detection - Automatically detects login status, prompts user if not logged in
- Multi-line content support - Can post tweets containing line breaks
- Edge/Chrome compatible - Prefers Edge, falls back to Chrome
Prerequisites
pip install playwright
playwright install chromium
Usage
Basic usage
python scripts/post_to_x.py "Your tweet content"
Multi-line content
python scripts/post_to_x.py "First line\nSecond line\n#hashtag"
Examples
# Simple tweet
python scripts/post_to_x.py "Hello X! š"
# Multi-line tweet
python scripts/post_to_x.py "š New product launch!\n\n⨠Feature 1: xxx\n⨠Feature 2: yyy\n\n#ProductLaunch #NewFeature"
Workflow
- Close any running Edge/Chrome browser
- Script reads system browser user data directory
- Launches browser and navigates to x.com
- Detects login status (skips if already logged in)
- Opens the tweet compose interface
- Enters content and posts
First-time usage
If using for the first time:
- Close all Edge browser windows
- Run the script, it will prompt for login
- Log in to X.com in the pop-up browser
- After successful login, the script continues automatically
- Next time you use it, the login state is already saved, no need to log in again
Troubleshooting
| Issue | Solution |
|---|---|
| Prompts for login every time | Close Edge browser before running the script |
| Post button click fails | Script automatically uses JavaScript click |
| Page load timeout | Check network connection, or add --wait flag |
Technical details
- Uses Playwright to control Chromium
- Directly reads
%LOCALAPPDATA%\Microsoft\Edge\User Data - Login credentials are saved in the original browser data
- Supports Windows systems