Back to Marketing & Growth

baoyu-post-to-x

twitterxsocial mediaautomationmarketingcontent publishingai agentbun
21.7k🕒 2026-06-13Source ↗

Install this skill

npx skills add jimliu/baoyu-skills

Works across Claude Code, Cursor, Codex, Copilot & Antigravity

The baoyu-post-to-x skill provides automated X publishing via a live Chrome browser instance. By running scripts locally, it circumvents standard API limitations and bot-detection filters. The tool handles various content types including plain text, multimedia posts, quote tweets, and long-form articles. Users initiate tasks through a CLI-driven workflow that requires an initial manual login to establish a persistent session profile. The system emphasizes safety through a mandatory preview-first design, ensuring posts are verified before the final --submit flag executes the action. It is intended for developers or content creators needing to script their social media presence directly from local machine resources or automated CI/CD environments, keeping all operational logic within their control.

When to Use This Skill

  • Scheduling regular status updates from a local Markdown file
  • Posting recurring video clips or product demos to a brand account
  • Automating the publication of research notes or technical articles
  • Engaging with community content via automated quote tweeting
  • Integrating social media updates into a terminal-based publishing workflow

How to Invoke This Skill

Example prompts that trigger this skill in Claude Code, Cursor, or Antigravity:

  • Post this text to my X account
  • Share this video on X with a caption
  • Quote this tweet with a comment about its findings
  • Convert this Markdown article into an X post
  • Automate my Twitter workflow for new content

Pro Tips

  • 💡Ensure Google Chrome and `bun` are installed on the execution environment and perform a manual login to X on the first run to avoid automation blocks.
  • 💡Leverage the `x-article.ts` script for in-depth content distribution, transforming your Markdown into engaging long-form posts directly on X.
  • 💡Integrate this skill with content generation agents to create a full pipeline from content creation to automated social media publishing.

What this skill does

  • Automated publishing of text and up to 4 image attachments
  • Video file processing for standard and long-form tweet content
  • Quote tweet generation with customized commentary
  • Direct transformation and publishing of Markdown files into X Articles
  • Browser session management via persistent Chrome profile directories

When not to use it

  • If your account requires high-frequency API-based analytics tracking
  • When you need to interact with platform-native polling or specific X ad campaign features
  • If running on a headless server without a local environment for Chromium and session persistence

Example workflow

  1. Ensure Google Chrome and Bun runtime are installed
  2. Execute the relevant script in preview mode to confirm content formatting
  3. Verify the output within the opened browser window
  4. Add the --submit flag to the command to finalize the post
  5. Review the resulting URL or post confirmation

Prerequisites

  • Google Chrome or Chromium browser
  • Bun runtime environment
  • Existing X account with valid session access

Pitfalls & limitations

  • !Requires manual login during the first run to authenticate the browser profile
  • !Video publishing is subject to native X duration limits based on account tier
  • !The browser window opens on the host machine, which may interrupt local focus
  • !No built-in error recovery if X updates its DOM structure or anti-bot layout

FAQ

Do I need an X API key?
No, this tool operates by controlling a browser instance directly. You only need to be logged into your account in the browser session.
How do I avoid posting mistakes?
Always run the command without the --submit flag first. This allows the script to open the browser and render your content for final verification.
Does this work on headless servers?
This tool is optimized for environments where a display can be accessed for initial setup and persistent login sessions, making standard headless environments potentially difficult to configure.

How it compares

Unlike generic API-based tools that face strict rate limits and developer costs, this approach uses standard browser automation to interact with the site as a human user would.

Source & trust

22k stars🕒 Updated 2026-06-13
📄 Full skill instructions — original source: jimliu/baoyu-skills
# Post to X (Twitter)

Post content, images, videos, and long-form articles to X using real Chrome browser (bypasses anti-bot detection).

## Script Directory

**Important**: All scripts are located in the scripts/ subdirectory of this skill.

**Agent Execution Instructions**:
1. Determine this SKILL.md file's directory path as SKILL_DIR
2. Script path = ${SKILL_DIR}/scripts/<script-name>.ts
3. Replace all ${SKILL_DIR} in this document with the actual path

**Script Reference**:
| Script | Purpose |
|--------|---------|
| scripts/x-browser.ts | Regular posts (text + images) |
| scripts/x-video.ts | Video posts (text + video) |
| scripts/x-quote.ts | Quote tweet with comment |
| scripts/x-article.ts | Long-form article publishing (Markdown) |
| scripts/md-to-html.ts | Markdown → HTML conversion |
| scripts/copy-to-clipboard.ts | Copy content to clipboard |
| scripts/paste-from-clipboard.ts | Send real paste keystroke |

## Prerequisites

- Google Chrome or Chromium installed
- bun installed (for running scripts)
- First run: log in to X in the opened browser window

## References

- **Regular Posts**: See references/regular-posts.md for manual workflow, troubleshooting, and technical details
- **X Articles**: See references/articles.md for long-form article publishing guide

---

## Regular Posts

Text + up to 4 images.

# Preview mode (doesn't post)
npx -y bun ${SKILL_DIR}/scripts/x-browser.ts "Hello from Claude!" --image ./screenshot.png

# Actually post
npx -y bun ${SKILL_DIR}/scripts/x-browser.ts "Hello!" --image ./photo.png --submit


> **Note**: ${SKILL_DIR} represents this skill's installation directory. Agent replaces with actual path at runtime.

**Parameters**:
| Parameter | Description |
|-----------|-------------|
| <text> | Post content (positional argument) |
| --image <path> | Image file path (can be repeated, max 4) |
| --submit | Actually post (default: preview only) |
| --profile <dir> | Custom Chrome profile directory |

---

## Video Posts

Text + video file (MP4, MOV, WebM).

# Preview mode (doesn't post)
npx -y bun ${SKILL_DIR}/scripts/x-video.ts "Check out this video!" --video ./clip.mp4

# Actually post
npx -y bun ${SKILL_DIR}/scripts/x-video.ts "Amazing content" --video ./demo.mp4 --submit


**Parameters**:
| Parameter | Description |
|-----------|-------------|
| <text> | Post content (positional argument) |
| --video <path> | Video file path (required) |
| --submit | Actually post (default: preview only) |
| --profile <dir> | Custom Chrome profile directory |

**Video Limits**:
- Regular accounts: 140 seconds max
- X Premium: up to 60 minutes
- Supported formats: MP4, MOV, WebM
- Processing time: 30-60 seconds depending on file size

---

## Quote Tweets

Quote an existing tweet with your comment - a way to share content while giving credit to the original creator.

# Preview mode (doesn't post)
npx -y bun ${SKILL_DIR}/scripts/x-quote.ts https://x.com/user/status/123456789 "Great insight!"

# Actually post
npx -y bun ${SKILL_DIR}/scripts/x-quote.ts https://x.com/user/status/123456789 "I agree!" --submit


**Parameters**:
| Parameter | Description |
|-----------|-------------|
| <tweet-url> | URL of the tweet to quote (positional argument) |
| <comment> | Your comment text (positional argument, optional) |
| --submit | Actually post (default: preview only) |
| --profile <dir> | Custom Chrome profile directory |

---

## X Articles

Long-form Markdown articles (requires X Premium).

# Preview mode
npx -y bun ${SKILL_DIR}/scripts/x-article.ts article.md

# With cover image
npx -y bun ${SKILL_DIR}/scripts/x-article.ts article.md --cover ./cover.jpg

# Publish
npx -y bun ${SKILL_DIR}/scripts/x-article.ts article.md --submit


**Parameters**:
| Parameter | Description |
|-----------|-------------|
| <markdown> | Markdown file path (positional argument) |
| --cover <path> | Cover image path |
| --title <text> | Override article title |
| --submit | Actually publish (default: preview only) |

**Frontmatter** (optional):
---
title: My Article Title
cover_image: /path/to/cover.jpg
---


---

## Notes

- First run requires manual login (session is saved)
- Always preview before using --submit
- Browser closes automatically after operation
- Supports macOS, Linux, and Windows

## Extension Support

Custom configurations via EXTEND.md.

**Check paths** (priority order):
1. .baoyu-skills/baoyu-post-to-x/EXTEND.md (project)
2. ~/.baoyu-skills/baoyu-post-to-x/EXTEND.md (user)

If found, load before workflow. Extension content overrides defaults.

How to Use This Skill Unit

Option A: Project-Specific (Recommended)

  1. Click "Download" above
  2. In your project, create the directory: .agent/skills/baoyu-post-to-x/
  3. Save the file as SKILL.md
  4. The agent will automatically discover the skill based on its description.

Option B: Global Installation (All Agents)

Save the file to these locations to make it available across all projects:

  • Claude Code: ~/.claude/skills/jimliu/baoyu-skills/baoyu-post-to-x/SKILL.md
  • Cursor: ~/.cursor/skills/jimliu/baoyu-skills/baoyu-post-to-x/SKILL.md
  • Antigravity: ~/.gemini/antigravity/skills/jimliu/baoyu-skills/baoyu-post-to-x/SKILL.md

🚀 Install with CLI:
npx skills add jimliu/baoyu-skills

Read the Master Guide: Mastering Agent Skills

Recommended Rules

View more rules

Recommended Workflows

View more workflows

Recommended MCP Servers

View more MCP servers

Take It Further

Maximize your productivity with these powerful resources

📋

Define Your Standards

Set up coding standards to ensure this workflow produces consistent, high-quality results.

Browse Rules Library
📖

Master Workflows

Learn how to create custom workflows, use Turbo Mode, and build your automation library.

Complete Guide

How to use this Skill in Claude Code & Cursor

For Claude Code (CLI)

To use this skill in Claude Code, copy the rule content into your project's custom instructions or follow our Add-Skill CLI guide. This ensures Claude follows your standards during every code generation.

For Cursor & Windsurf

For Cursor or Windsurf, individual skills are best used in the "Rules for AI" section. This specific unit helps the agent avoid marketing & growth issues, leading to cleaner, more efficient code.

Why the skill format matters: the standardized Agent Skills format lets your AI agent load detailed instructions only when they are relevant, keeping your prompt clean while improving results.

Source & attribution

This skill is categorized under Marketing & Growth and is published by Jim Liu, maintained in jimliu/baoyu-skills.

← Browse All Agent Skills
Sponsored AI assistant. Recommendations may be paid.