X Article Publisher
A Claude Code skill that moves a Markdown article into the X Articles editor with formatting and images
Install
git clone https://github.com/wshuyi/x-article-publisher-skill.git
cp -r x-article-publisher-skill/skills/x-article-publisher ~/.claude/skills/Dependencies: on macOS pip install Pillow pyobjc-framework-Cocoa, on Windows pip install Pillow pywin32 clip-util.
This is third-party code. Review the repository files before installing.
What it does
The skill parses a Markdown file: the H1 becomes the article title, the first image becomes the cover, and other images get the index of the block they follow. Text is converted to HTML and pasted into the X editor via the clipboard, so headings, lists, quotes and links survive. Playwright MCP drives the browser and images are inserted from last to first so positions do not shift. Tables and Mermaid diagrams can be converted to PNG beforehand. The article is only saved as a draft; a human publishes it.
Who it is for. For writers who draft in Markdown and publish long articles on X with a Premium Plus subscription.
Good fit when
- You need to move a finished article into X Articles without manual formatting
- The article has many images and their positions matter
Not a fit when
- You do not have X Premium Plus
- You work on Linux
- You need to publish to other social networks
Example request
Publish ~/Documents/post.md to X Articles as a draftLimitations
Requires Claude Code, Playwright MCP, an X login with Premium Plus and Python 3.9+ with Pillow and clipboard libraries. macOS and Windows are supported; Linux is not yet. One run works with one account; switch accounts manually.
How to disable. Delete ~/.claude/skills/x-article-publisher or uninstall the plugin via /plugin uninstall.
Security check
- Drives a browser in a logged-in X account
- Uses the system clipboard
README in short
The README describes formatting loss when moving Markdown into X and the fix via file parsing, the clipboard and browser automation. It lists requirements, two install methods, the skill's steps and a table of supported markup. An example input file and parsed output are included. MIT licensed.
SKILL.md
--- name: x-article-publisher description: | Publish Markdown articles to X (Twitter) Articles editor with proper formatting. Use when user wants to publish a Markdown file/URL to X Articles, or mentions "publish to X", "post article to Twitter", "X article", or wants help with X Premium article publishing. Handles cover image upload and converts Markdown to rich text automatically. --- # X Article Publisher Publish Markdown content to X (Twitter) Articles editor, preserving formatting with rich text conversion. ## Prerequisites - Playwright MCP for browser automation - User logged into X with Premium Plus subscription - Python 3.9+ with dependencies: - macOS: `pip install Pillow pyobjc-framework-Cocoa` - Windows: `pip install Pillow pywin32 clip-util` - For Mermaid diagrams: `npm install -g @mermaid-js/mermaid-cli` ## Scripts Located in `~/.claude/skills/x-article-publisher/scripts/`: ### parse_markdown.py Parse Markdown and extract structured data: ```bash python parse_markdown.py <markdown_file> [--output json|html] [--html-only] ``` Returns JSON with: title, cover_image, content_images, **dividers** (with block_index for positioning), html, total_blocks ### copy_to_clipboard.py Copy image or HTML to system clipboard (cross-platform): ```bash # Copy image (with optional compression) python copy_to_clipboard.py image /path/to/image.jpg [--quality 80] # Copy HTML for rich text paste python copy_to_clipboard.py html --file /path/to/content.html ```
FAQ
Does the skill publish the article?
No, it only saves a draft; publishing is up to you.
What about tables?
X Articles does not render them, so table_to_image.py turns a table into a PNG.
Related
Marketing Skills for AI agents
Marketing Skills for AI Agents
About fifty skills for CRO, copywriting, SEO, analytics, ads and launches, built for coding agents
A skill that strips AI writing tells from text using Wikipedia's list, without adding invented facts
Content skills: article illustrations, covers, infographics, comics, translation, URL to Markdown and social posting
The Chinese version of Humanizer: finds and removes signs of AI writing in Chinese text