All skills
jimliu avatar

/baoyu-post-to-x

@0114060 official
by Jim Liu 宝玉jimliu/baoyu-skills26k stars
2,896

Posts content and articles to X (Twitter). Supports regular posts with images/videos and X Articles (long-form Markdown). In Codex, honor explicit requests for the Codex Chrome plugin/@chrome by using the Chrome Extension workflow; otherwise use Chrome Computer Use when available and fall back to real Chrome CDP scripts only when allowed. Use when user asks to "post to X", "tweet", "publish to Twitter", or "share on X".

Use this Skill: https://skilld.dev/gh/jimliu/baoyu-skills/baoyu-post-to-x

This session only. Nothing lands on disk.

referencesregular-posts.md

≈1k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Regular Posts - Detailed Guide

Detailed documentation for posting text and images to X.

Manual Workflow

If you prefer step-by-step control:

Step 0: Prefer Chrome Computer Use in Codex

When running inside Codex, first detect whether Chrome Computer Use is enabled:

  1. If Computer Use tools are already visible, call get_app_state for Google Chrome.
  2. If not, use tool_search for computer-use get_app_state click press_key drag scroll Google Chrome, then call get_app_state.
  3. If get_app_state succeeds, use the user's real Chrome with Computer Use for all X UI actions.
  4. Use CDP scripts only when Computer Use is unavailable or explicitly requested.

If the user explicitly asks for Chrome Computer Use, do not use Playwright, the in-app Browser, or CDP without approval.

Step 1: Copy Image to Clipboard

${BUN_X} {baseDir}/scripts/copy-to-clipboard.ts image /path/to/image.png

Step 2: Paste from Clipboard

# Simple paste to frontmost app
${BUN_X} {baseDir}/scripts/paste-from-clipboard.ts

# Paste to Chrome with retries
${BUN_X} {baseDir}/scripts/paste-from-clipboard.ts --app "Google Chrome" --retries 5

# Quick paste with shorter delay
${BUN_X} {baseDir}/scripts/paste-from-clipboard.ts --delay 200

Step 3: Use Chrome Computer Use (Preferred)

  1. Use get_app_state for Google Chrome.
  2. Navigate Chrome to https://x.com/compose/post if needed.
  3. Click the composer and type the post text.
  4. Copy each image to the clipboard with copy-to-clipboard.ts image <path>.
  5. Press super+v on macOS or control+v on Windows/Linux with Computer Use.
  6. Wait until X finishes media upload.
  7. Ask for explicit confirmation before clicking Post.

Image Support

  • Formats: PNG, JPEG, GIF, WebP
  • Max 4 images per post
  • Images copied to system clipboard, then pasted via keyboard shortcut

Example Session

User: /post-to-x "Hello from Claude!" --image ./screenshot.png

Claude:
1. Detects Chrome Computer Use
2. Opens X compose in the user's real Chrome
3. Types text into editor
4. Copies image to clipboard and pastes with Computer Use
5. Waits for upload and verifies the preview
6. Asks before clicking Post

Troubleshooting

  • Chrome not found: Set X_BROWSER_CHROME_PATH environment variable
  • Not logged in: First run opens Chrome - log in manually, cookies are saved
  • Image paste fails:
    • Verify clipboard script: ${BUN_X} {baseDir}/scripts/copy-to-clipboard.ts image <path>
    • On macOS, grant "Accessibility" permission to Terminal/iTerm in System Settings > Privacy & Security > Accessibility
    • Keep Chrome window visible and in front during paste operations
  • osascript permission denied: Grant Terminal accessibility permissions in System Preferences
  • Rate limited: Wait a few minutes before retrying

How It Works

In Chrome Computer Use mode:

  1. Codex controls the user's visible Google Chrome window
  2. Text is typed through the real UI
  3. Images are copied to the system clipboard and pasted with real keystrokes
  4. The user confirms before the final public post

The x-browser.ts script is the CDP fallback. It uses Chrome DevTools Protocol (CDP) to:

  1. Launch real Chrome (not Playwright) with --disable-blink-features=AutomationControlled
  2. Use persistent profile directory for saved login sessions
  3. Interact with X via CDP commands (Runtime.evaluate, Input.dispatchKeyEvent)
  4. Paste images using osascript (macOS): Sends real Cmd+V keystroke to Chrome, bypassing CDP's synthetic events that X can detect

This approach bypasses X's anti-automation detection that blocks Playwright/Puppeteer.

Image Paste Mechanism (macOS)

CDP's Input.dispatchKeyEvent sends "synthetic" keyboard events that websites can detect. X ignores synthetic paste events for security. The solution:

  1. Copy image to system clipboard via Swift/AppKit (copy-to-clipboard.ts)
  2. Bring Chrome to front via osascript
  3. Send real Cmd+V keystroke via osascript and System Events
  4. Wait for upload to complete

This requires Terminal to have "Accessibility" permission in System Settings.

Source: SKILL.md on GitHub

2 warnings16d5 checks · Risk SAFE
  • Gen Agent Trust Hub16d

    The skill automates posting content to X (Twitter) using a real Chrome browser instance. It performs Markdown-to-HTML conversion, handles media uploads, and simulates user keystrokes for pasting. To function correctly, it requires access to the system clipboard and may need 'Accessibility' permissions on macOS. The skill also processes external Markdown files and remote images.

  • Socket16d

    1 alert: gptSecurity

  • Snyk16d

    Risk: MEDIUM · 1 issue

  • Runlayer6mo

    4/16 files flagged

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at 0114060. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 days ago.

Activeupdated 4 months ago
version
1.58.1
Other metadata
metadata
{
  "openclaw": {
    "homepage": "https://github.com/JimLiu/baoyu-skills#baoyu-post-to-x",
    "requires": {
      "anyBins": [
        "bun",
        "npx"
      ]
    }
  }
}
  • x
  • twitter
  • posting
  • articles
  • markdown
  • chrome
  • automation
  • social-media
  • codex

README badge

README badge for jimliu/baoyu-skills/baoyu-post-to-x

Posts text, images, videos, and long-form Markdown articles to X via Chrome browser control. Supports three execution modes: Codex Chrome plugin, Chrome Computer Use, or CDP script fallback, with explicit workflow instructions for X Articles including cover upload, body paste, and inline image insertion.

Generated from the current SKILL.md.

Does this skill work with the Codex Chrome plugin?
Yes. When you request the Codex Chrome plugin, `@chrome`, or the Chrome Extension, the skill uses the bundled `chrome:Chrome` skill and Node REPL browser client. Otherwise it defaults to Chrome Computer Use when available, or falls back to CDP scripts.
What types of posts can this skill publish?
Regular posts with text, images, and videos; quote tweets with comments; and X Articles in long-form Markdown with cover images and inline content images.
Does this skill require Chrome to be already logged in to X?
Yes. The skill uses your existing Chrome profile and X session. On first run, you must log in to X manually in Chrome; the session is then saved for future use.
What runtimes does this skill require?
Either `bun` or `npx` (to run Bun). Chrome or Chromium must also be installed, or the `X_BROWSER_CHROME_PATH` environment variable must be set.
Will this skill click Post or Publish without asking me first?
No. The skill always asks for explicit final confirmation from you in the conversation before clicking any submit action.

Generated from the current SKILL.md. These answers refresh after source changes.