$npx -y skills add JimLiu/baoyu-skills --skill baoyu-post-to-xPosts 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
| 1 | # Post to X (Twitter) |
| 2 | |
| 3 | Posts text, images, videos, and long-form articles to X via a real Chrome browser. |
| 4 | |
| 5 | In Codex, do not conflate these browser paths: |
| 6 | - **Codex Chrome plugin / `@chrome` / Chrome Extension**: use the bundled `chrome:Chrome` skill and its Node REPL browser client. This is required whenever the user says "Codex Chrome plugin", "Codex 自带的 Chrome 插件", `@chrome`, or similar. |
| 7 | - **Chrome Computer Use**: use `mcp__computer_use__.*` against the visible Google Chrome UI only when the user asks for Computer Use or no Chrome-plugin preference is stated and Computer Use is available. |
| 8 | - **CDP script mode**: use only as a fallback when the selected mode is unavailable or the user explicitly asks for CDP/script mode. |
| 9 | |
| 10 | ## Script Directory |
| 11 | |
| 12 | **Important**: All scripts are located in the `scripts/` subdirectory of this skill. |
| 13 | |
| 14 | **Agent Execution Instructions**: |
| 15 | 1. Determine this SKILL.md file's directory path as `{baseDir}` |
| 16 | 2. Script path = `{baseDir}/scripts/<script-name>.ts` |
| 17 | 3. Replace all `{baseDir}` in this document with the actual path |
| 18 | 4. Resolve `${BUN_X}` runtime: if `bun` installed → `bun`; if `npx` available → `npx -y bun`; else suggest installing bun |
| 19 | |
| 20 | **Script Reference**: |
| 21 | | Script | Purpose | |
| 22 | |--------|---------| |
| 23 | | `scripts/x-browser.ts` | Regular posts (text + images), CDP fallback | |
| 24 | | `scripts/x-video.ts` | Video posts (text + video), CDP fallback | |
| 25 | | `scripts/x-quote.ts` | Quote tweet with comment, CDP fallback | |
| 26 | | `scripts/x-article.ts` | Long-form article publishing (Markdown), CDP fallback | |
| 27 | | `scripts/md-to-html.ts` | Markdown → HTML conversion | |
| 28 | | `scripts/copy-to-clipboard.ts` | Copy content to clipboard | |
| 29 | | `scripts/paste-from-clipboard.ts` | Send real paste keystroke | |
| 30 | | `scripts/check-paste-permissions.ts` | Verify environment & permissions | |
| 31 | |
| 32 | ## Execution Mode Selection (Required) |
| 33 | |
| 34 | Choose exactly one mode before interacting with X: |
| 35 | |
| 36 | 1. If the user explicitly asks for the Codex Chrome plugin, `@chrome`, the Chrome extension, or "Codex 自带的 Chrome 插件", use **Codex Chrome Plugin Mode**. Do not call Computer Use first. |
| 37 | 2. If the user explicitly asks for Chrome Computer Use, use **Chrome Computer Use Mode**. Do not fall back to CDP, Playwright, the in-app Browser, or the Chrome plugin without telling the user and getting approval. |
| 38 | 3. If the user explicitly asks for CDP/script mode, use **CDP Script Mode**. |
| 39 | 4. Otherwise, prefer **Chrome Computer Use Mode**. For Markdown **X Articles with local content images**, use the tested X editor flow: insert each body image from the toolbar (`Insert` -> `Media` -> dialog icon button `Add photos or video`) at its placeholder, then delete the placeholder text. Use CDP Script Mode only when the selected browser-control mode is unavailable or the UI upload/selection flow is unreliable. |
| 40 | |
| 41 | Never use the in-app Browser for X publishing workflows. |
| 42 | |
| 43 | ## Codex Chrome Plugin Mode |
| 44 | |
| 45 | Use this mode whenever the user requests the Codex Chrome plugin, `@chrome`, or the Chrome Extension path. This uses the user's real Chrome profile and X login through the bundled Chrome plugin, not Computer Use and not CDP. |
| 46 | |
| 47 | **Setup** |
| 48 | 1. Load the `chrome:Chrome` skill before browser work. |
| 49 | 2. Use `tool_search` for `node_repl js` if the Node REPL `js` tool is not already visible. |
| 50 | 3. Initialize the Chrome browser client exactly as the Chrome skill specifies, then run a lightweight call such as `browser.user.openTabs()` to verify the extension connection. |
| 51 | 4. If the first lightweight call fails, wait 2 seconds and retry once. If it still fails, follow the Chrome skill's extension checks and recovery steps. If checks pass but communication still fails, ask the user before opening a new Chrome window. Do not switch to Computer Use or CDP silently. |
| 52 | |
| 53 | **General rules** |
| 54 | - Use the Chrome plugin's `browser.tabs.*`, `tab.playwright.*`, `tab.cua.*`, and file chooser APIs for X UI actions. |
| 55 | - Shell commands are allowed for Markdown preprocessing and rich-HTML clipboard preparation. For X Article body images, do not rely on image clipboard paste; use the editor's `Insert` -> `Media` upload flow. |
| 56 | - If a file upload fails with `Not allowed`, tell the user: `To enable file upload, go to chrome://extensions in Chrome, click Details under the Codex extension, and enable "Allow access to file URLs." See https://developers.openai.com/codex/app/chrome-extension#upload-files for details.` |
| 57 | - If |