home / skills / questnova502 / claude-skills-sync / baoyu-post-to-x

baoyu-post-to-x skill

/skills/baoyu-post-to-x

This skill posts text, images, videos, and long-form articles to X using real Chrome, bypassing anti-automation for reliable publishing.

npx playbooks add skill questnova502/claude-skills-sync --skill baoyu-post-to-x

Review the files below or copy the command above to add this skill to your agents.

Files (9)
SKILL.md
4.0 KB
---
name: baoyu-post-to-x
description: Post content and articles to X (Twitter). Supports regular posts with images/videos and X Articles (long-form Markdown). Uses real Chrome with CDP to bypass anti-automation.
---

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

```bash
# 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).

```bash
# 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

---

## X Articles

Long-form Markdown articles (requires X Premium).

```bash
# 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):
```yaml
---
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.

Overview

This skill posts content to X (Twitter) using a real Chrome browser with CDP to bypass anti-automation checks. It supports regular posts with images, video posts, and long-form X Articles authored in Markdown. The tool runs scripts that offer a preview mode by default and an explicit --submit flag to publish.

How this skill works

Scripts launch a real Chrome/Chromium instance and automate posting flows through the Chrome DevTools Protocol, preserving a real browser session to avoid bot detection. There are separate scripts for text+images, video uploads, and converting/publishing Markdown articles; a preview-only run shows the full workflow until you pass --submit to finalize. You must log in once interactively; sessions are saved for subsequent runs.

When to use it

  • Publish a short text post with up to four images.
  • Share an MP4/MOV/WebM video with an accompanying caption.
  • Publish a long-form article drafted in Markdown to X Articles.
  • Automate repeated posting while keeping an interactive browser session.
  • Preview an automated post workflow before actually publishing.

Best practices

  • Always run in preview mode first and review what will be posted before using --submit.
  • Log into X in the opened browser on first run so the session can be stored for future automation.
  • Use a custom Chrome profile with --profile to isolate sessions and avoid cross-account issues.
  • Respect video format and duration limits: typical accounts ~140s, Premium accounts longer; allow 30–60s for processing.
  • Keep images under platform limits and limit to four images per regular post.

Example use cases

  • Post a promotional image carousel from a local folder using the image script in preview then publish.
  • Upload a product demo video with caption using the video script and --submit after validation.
  • Convert a Markdown article to HTML and publish it as an X Article with an optional cover image.
  • Automate scheduled content creation by invoking the scripts from a task runner, verifying with preview.
  • Use a dedicated Chrome profile directory to manage multiple X accounts safely.

FAQ

What do I need installed to run this?

Google Chrome or Chromium and bun are required. Run a script once to log in interactively.

How do I actually publish instead of preview?

Pass the --submit flag to the chosen script; without it the run is preview-only.

Can I post videos and what are the limits?

Yes. Supported formats: MP4, MOV, WebM. Regular accounts typically max 140 seconds; Premium accounts allow longer uploads.