x-article-publisher
Skill77 starsChanged 10 months agoMITView on GitHub
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.
- Installs packages
5 other projects use a version of this, 3 of them edited.
Adopted by
Most recently taken up by
- ZeroTokenClaw/agents-skillsedited, first seen Sep 21, 2026
- anbeime/skilledited, first seen Jun 17, 2026
- cellinlab/cell-skillstheir own version, first seen Apr 10, 2026
- wshuyi/x-article-publisher-skilltheir own version, first seen Jan 25, 2026
- ttmouse/skillsedited, first seen Nov 18, 2025
Other versions5 projects use a version of this.
Word for word · 0
None found.
Edited · 3
- anbeime/skill★ 7.5k97% same
- ttmouse/skills★ 3416% same
- ZeroTokenClaw/agents-skills★ 197% same
Wrote their own version · 2
- wshuyi/x-article-publisher-skill★ 868same name
- cellinlab/cell-skills★ 29same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repositoryOne other file it gives its agents.
- x-article-publisherSkill
The file
We split this skill into the rules it gives an agent
2 rules. 0 are common, 1 is distinctive, and 1 is very specific to this project.
0
Common
Most of the 4 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 221
NEVER auto-publish: - Only save as draft
- Very specific: line 223
Clean placeholders: - Remove all remaining @@@IMG_X@@@ markers after image insertion
“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
X Article Publisher
Publish Markdown content to X (Twitter) Articles editor, preserving formatting with rich text conversion.
Prerequisites
- X Premium Plus subscription
- Python 3.9+ with dependencies:
pip install Pillow pyobjc-framework-Cocoa patchright
🎉 首次使用:一次认证,告别重复登录
X Article Publisher 现在支持持久化认证,无需每次手动登录!
🔧 初始化认证(仅需一次)
首次使用前,运行认证设置:
cd ~/.claude/skills/x-article-publisher/scripts
python auth_manager.py setup流程:
- ✅ 浏览器窗口自动打开 X 登录页面
- 🔐 手动登录你的 X 账号(需 Premium+ 订阅)
- ✅ 完成 2FA 验证(如已启用)
- 🏠 登录成功后自动跳转到 Home 时间线
- 💾 认证状态自动保存(有效期 7 天)
📋 认证管理命令
# 检查认证状态
python auth_manager.py status
# 验证认证是否有效
python auth_manager.py validate
# 清除认证数据(需重新登录)
python auth_manager.py clear
# 重新认证(清除 + 设置)
python auth_manager.py reauth🚀 自动化工作流
认证设置完成后,skill 执行时会自动:
- ✅ 检查认证状态
- 🔓 如已认证,直接使用保存的浏览器状态(无需登录)
- ⚠️ 如未认证,提示运行
auth_manager.py setup
注意:认证数据存储在 ~/.claude/skills/x-article-publisher/data/browser_state/,已通过 .gitignore 排除,不会提交到 Git。
Scripts
Located in ~/.claude/skills/x-article-publisher/scripts/:
publish_article.py (主脚本 - 一键发布)
推荐使用 - 自动完成所有发布步骤:
# 基本用法
python publish_article.py --file article.md
# 显示浏览器(调试用)
python publish_article.py --file article.md --show-browser
# 自定义标题
python publish_article.py --file article.md --title "自定义标题"parse_markdown.py
Parse Markdown and extract structured data:
python parse_markdown.py <markdown_file> [--output json|html] [--html-only]Returns JSON with: title, cover_image, content_images (with block_index for positioning), html, total_blocks
copy_to_clipboard.py
Copy image or HTML to system clipboard:
# 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.htmlWorkflow (简化版)
前提:已完成认证设置(python auth_manager.py setup)
🚀 一键发布(推荐)
直接运行 publish_article.py,自动完成所有步骤:
cd ~/.claude/skills/x-article-publisher/scripts
python publish_article.py --file /path/to/article.md脚本会自动:
- ✅ 检查认证状态
- 📄 解析 Markdown 文件
- 🌐 启动已认证的浏览器
- 📍 导航到 X Articles 编辑器
- 🔘 点击 create 按钮
- 🖼️ 上传封面图(如有)
- 📝 填写标题
- 📋 粘贴 HTML 内容
- ✅ 保存草稿(不会自动发布)
手动工作流(高级用户)
如需更精细控制,可分步执行:
- Parse Markdown:
python parse_markdown.py article.md - 手动操作浏览器发布
🧠 智能增强功能
智能标题生成
当文章没有 H1 标题时,parse_markdown.py 会返回 needs_title_generation: true。
Claude 应该自动:
- 阅读文章内容,理解核心观点
- 生成一个吸引人点击的标题(15-25字为佳)
- 使用
--title "生成的标题"参数发布
好标题的特点:
- 包含数字或具体细节("3个方法"、"90%的人不知道")
- 激发好奇心("为什么..."、"如何..."、"...的真相")
- 与读者切身相关
- 避免标题党,但要有吸引力
示例:
# 解析文章
python parse_markdown.py article.md
# 如果 needs_title_generation: true,Claude 生成标题后:
python publish_article.py --file article.md --title "AI时代,普通人的3个生存法则"智能封面图生成
当文章没有封面图时,parse_markdown.py 会返回 needs_cover_generation: true。
Claude 应该自动:
- 阅读文章,提炼核心概念(1-3个关键词)
- 调用
gemini-image-generator或jimeng-image-generatorskill 生成封面图 - 封面图风格建议:
- 简洁大气,避免复杂细节
- 可以是抽象概念的可视化
- 或是带有核心关键词的文字海报
- 将生成的图片路径插入到文章开头作为封面
封面图生成提示词模板:
为一篇关于「{文章主题}」的文章生成封面图。
风格:简洁、现代、科技感
元素:{1-3个核心视觉元素}
文字:可选,如果加文字只放{1-3个关键词}
尺寸:16:9 横版工作流示例:
# 1. 解析文章
python parse_markdown.py article.md
# 输出: needs_cover_generation: true
# 2. Claude 调用生图 skill 生成封面(假设保存到 /tmp/cover.png)
# 3. 将封面图插入文章开头,或手动上传注意:封面图上传目前需要在浏览器中手动操作,脚本会打开编辑器后等待用户操作。
技术细节
parse_markdown.py 输出格式
{
"title": "Article Title",
"title_source": "h1", // "h1", "h2", "first_line", or "none"
"needs_title_generation": false, // true if no H1 title
"cover_image": "/path/to/first-image.jpg",
"needs_cover_generation": false, // true if no cover image
"content_images": [
{"path": "/path/to/img2.jpg", "block_index": 5}
],
"html": "<p>Content...</p><h2>Section</h2>...",
"total_blocks": 45
}字段说明:
title_source: 标题来源h1: 来自 H1 标题(最理想)h2: 来自第一个 H2 标题first_line: 来自第一行文本none: 无法提取标题
needs_title_generation: 是否需要 Claude 生成更好的标题needs_cover_generation: 是否需要 Claude 生成封面图
Critical Rules
- NEVER auto-publish - Only save as draft
- NO automatic cover images - User adds cover manually, never insert first image as cover
- Clean placeholders - Remove all remaining
@@@IMG_X@@@markers after image insertion - H1 title handling - H1 is used as title only, not included in body
Supported Formatting
- H2 headers (## )
- Blockquotes (> )
- Code blocks (converted to blockquotes)
- Bold text (**)
- Hyperlinks (text)
- Ordered/Unordered lists
- Paragraphs
Example
User: "Publish /path/to/article.md to X"
cd ~/.claude/skills/x-article-publisher/scripts
python publish_article.py --file /path/to/article.mdOutput:
📄 解析文件:/path/to/article.md
📝 标题:文章标题
🖼️ 封面图:/path/to/cover.jpg
📷 内容图:2 张
🌐 启动浏览器...
📍 导航到 X Articles...
🔘 点击 create 按钮...
📝 填写标题...
📋 粘贴内容...
✅ 草稿已创建!
💡 请在浏览器中检查并手动发布
🖥️ 浏览器保持打开,请检查草稿并手动发布
⏎ 完成后按回车键关闭浏览器...技术经验参考: 浏览器自动化调试技巧详见 skill-development-guide
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

