x-composer
Original:🇺🇸 English
Translated
2 scripts
Compose and post to X.com using Chrome CDP automation. Use when user asks to "post to X", "tweet", "draft a tweet", "share on X", or "write a thread". Handles Chrome launch, text input with emoji/unicode support, and multi-paragraph formatting via real browser automation (no API costs, bypasses anti-bot detection).
7installs
Sourcejunghoonghae/skills
Added on
NPX Install
npx skill4agent add junghoonghae/skills x-composerTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →X Composer
Post to X.com via Chrome DevTools Protocol (CDP). Uses real Chrome to bypass anti-bot detection.
Prerequisites
- Google Chrome installed
- npm package
chrome-remote-interface
Install if missing:
bash
npm install -g chrome-remote-interfaceWorkflow
Posting to X involves these steps:
- Launch Chrome with CDP (run )
scripts/cdp-launch.js - Wait for X.com compose page to load (~3s)
- Type draft text (run )
scripts/cdp-type.js - User reviews and clicks Post manually
Step 1: Launch Chrome
Run with optional URL argument:
scripts/cdp-launch.jsbash
NODE_PATH=$(npm root -g) node scripts/cdp-launch.js| URL | Purpose |
|---|---|
| (default) | |
| Open home feed |
| Search posts |
Reuses existing Chrome CDP instance if running. First run requires manual X.com login — session persists in .
~/.chrome-cdp-profileWait ~3 seconds after launch before typing.
Step 2: Type Draft
Pipe JSON segments to via stdin:
scripts/cdp-type.jsbash
echo '[{"text":"Hello world!"}]' | NODE_PATH=$(npm root -g) node scripts/cdp-type.jsSegment Format
| Segment | Effect |
|---|---|
| Insert text (emoji/unicode safe) |
| Single line break |
| Multiple line breaks |
Example: Multi-paragraph post
bash
cat << 'EOF' | NODE_PATH=$(npm root -g) node scripts/cdp-type.js
[
{"text": "Hook line with emoji"},
{"enter": 2},
{"text": "Main content paragraph."},
{"enter": 2},
{"text": "- Point one"},
{"enter": true},
{"text": "- Point two"},
{"enter": 2},
{"text": "https://example.com"},
{"enter": true},
{"text": "#hashtag #tags"}
]
EOFStep 3: User Posts
Draft is entered in browser. User reviews and clicks "Post" manually. Never auto-post.
Troubleshooting
| Issue | Fix |
|---|---|
| Chrome not connecting | |
| No X.com tab found | Launch Chrome first, wait 3s |
| Text not typing | Click compose box in browser first |
| Module not found | |
| Login required | Use default profile path ( |
Notes
- resolves globally installed
NODE_PATH=$(npm root -g)chrome-remote-interface - handles emoji/unicode reliably (not character-by-character)
Input.insertText() - Fixed preserves login across Chrome restarts
--user-data-dir - If text appears scrambled, restart Chrome and retry