INTERMEDIATEπŸ“… Updated 2026-01-20

X Article Publisher

Claude Code skill for publishing Markdown articles to X (Twitter) Articles with one command. Automates the entire publishing workflow including format conversion, image uploads, and precise image positioning using block-index.

social-media-publishingcontent-managementmarkdown-conversionbrowser-automationimage-upload
430
Stars
wshuyi
Author
βœ“ Verified Safe

A Claude Code skill that automates publishing Markdown articles to X (Twitter) Articles, eliminating the tedious manual formatting and image upload process. With one command, it converts Markdown to rich HTML, uploads images with precise positioning, and saves a draft ready for review.

The Problem

Publishing to X Articles from Markdown is traditionally painful:

  • Format Loss: Copy-paste destroys all Markdown formatting
  • Manual Formatting: 15-20 minutes to set H2, bold, links manually
  • Tedious Image Upload: 5+ clicks per image
  • Position Errors: Difficult to remember where each image should go

The Solution

This skill automates the entire workflow:

Markdown File β†’ Python Parsing β†’ Structured Data β†’ Playwright MCP β†’ X Articles Editor β†’ Draft Saved

Key Features

Rich Text Paste

Convert Markdown to HTML and paste via clipboard - all formatting preserved automatically

Block-Index Positioning (v1.1.0)

  • Precise image placement using element indices, not fragile text matching
  • Each image has a block_index indicating exactly which block element it follows
  • Deterministic and reliable positioning

Reverse Insertion

Insert images from highest to lowest index to avoid position shifts during insertion

Smart Wait Strategy

Conditions return immediately when met, eliminating wasted wait time

Safe by Design

Only saves as draft, never publishes automatically - maintain full editorial control

Requirements

RequirementDetails
Claude Codeclaude.ai/code
Playwright MCPBrowser automation via MCP
X Premium PlusRequired for Articles feature
Python 3.9+With Pillow and pyobjc-framework-Cocoa
macOSCurrently macOS only (PRs welcome for Windows/Linux)

Installation

git clone https://github.com/wshuyi/x-article-publisher-skill.git
cp -r x-article-publisher-skill/skills/x-article-publisher ~/.claude/skills/

Method 2: Plugin Marketplace

/plugin marketplace add wshuyi/x-article-publisher-skill
/plugin install x-article-publisher@wshuyi/x-article-publisher-skill

Usage

Natural Language

Publish /path/to/article.md to X
Help me post this article to X Articles: ~/Documents/my-post.md

Skill Command

/x-article-publisher /path/to/article.md

Workflow

The skill executes 7 automated steps:

  1. Parse Markdown

    • Extract title, cover image, content images with block_index
    • Convert to HTML, count total blocks
  2. Open X Articles editor

    • Navigate to x.com/compose/articles
  3. Upload cover image

    • First image automatically becomes article cover
  4. Fill title

    • H1 used as title (not included in body)
  5. Paste article content

    • Rich text via clipboard
    • All formatting preserved
  6. Insert content images (reverse order)

    • Sort by block_index descending
    • Click block element at index β†’ Paste image
    • Wait for upload (returns immediately when done)
  7. Save draft

    • βœ… Review and publish manually

Supported Markdown

SyntaxResult
# H1Article title (extracted, not in body)
## H2Section headers
**bold**Bold text
*italic*Italic text
[text](url)Hyperlinks
> quoteBlockquotes
- itemUnordered lists
1. itemOrdered lists
![](img.jpg)Images (first = cover)

Performance

TaskManualWith This SkillImprovement
Format conversion15-20 min0 (automatic)100% saved
Cover image1-2 min10 sec10x faster
5 content images5-10 min1 min5-10x faster
Total20-30 min2-3 min10x faster

Example

Input: article.md

# 5 AI Tools Worth Watching in 2024

![cover](./images/cover.jpg)

AI tools exploded in 2024. Here are 5 worth your attention.

## 1. Claude: Best Conversational AI
*Claude* by Anthropic excels at long-context understanding.

> Claude's context window reaches 200K tokens.
> ![claude-demo](./images/claude-demo.png)

## 2. Midjourney: AI Art Leader
[Midjourney](https://midjourney.com) is most popular AI art tool.
![midjourney](./images/midjourney.jpg)

Parsed Output

{
  "title": "5 AI Tools Worth Watching in 2024",
  "cover_image": "./images/cover.jpg",
  "content_images": [
    {"path": "./images/claude-demo.png", "block_index": 4},
    {"path": "./images/midjourney.jpg", "block_index": 6}
  ],
  "total_blocks": 7
}

Insertion Order

Images inserted in reverse: block_index=6 first, then block_index=4.

Result

  • Cover: cover.jpg uploaded
  • Title: "5 AI Tools Worth Watching in 2024"
  • Content: Rich text with H2, bold, quotes, links
  • Images: Inserted at precise positions via block index
  • Status: Draft saved (ready for manual review)

FAQ

Q: Why Premium Plus? A: X Articles is exclusive to Premium Plus subscribers.

Q: Windows/Linux support? A: Currently macOS only. PRs welcome for cross-platform clipboard support.

Q: Image upload failed? A: Check: valid path, supported format (jpg/png/gif/webp), stable network.

Q: Can I publish to multiple accounts? A: Not automatically. Switch accounts in browser manually before running.

Q: Why insert images in reverse order? A: Each inserted image shifts subsequent block indices. Inserting from highest to lowest ensures earlier indices remain valid.

Q: What if text matching was used before? A: v1.1 replaces text matching with block_index. The after_text field is kept for debugging but not used for positioning.

Q: Why does wait return immediately sometimes? A: browser_wait_for textGone="..." returns as soon as the text disappears. The time parameter is just a maximum, not a fixed delay.

Recent Updates

v1.1.0 (December 2025)

  • Block-index positioning: Replace text matching with precise element indices
  • Reverse insertion order: Prevent index shifts when inserting multiple images
  • Optimized wait strategy: Return immediately when upload completes
  • H1 title handling: H1 extracted as title, not included in body HTML

Documentation

Technical Details

The skill uses:

  • Python: Markdown parsing and HTML conversion
  • Playwright MCP: Browser automation for X Articles editor
  • Clipboard API: Rich text transfer
  • Block-index system: Deterministic image positioning

Contributing

  • Issues: Report bugs or request features
  • PRs: Welcome! Especially for Windows/Linux support

License

MIT License β€” see LICENSE