/linkedin-article-publisher:linkedin-article-publisherfrom linkedin-article-publisher
Publishes Markdown articles to LinkedIn Articles editor with rich text conversion and cover image upload. Useful for automating LinkedIn article publishing from Markdown files.
Ships in linkedin-article-publisher. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Publish Markdown content to LinkedIn Articles editor, preserving formatting with rich text conversion.
pip install Pillow pyobjc-framework-CocoaLocated in ~/.claude/skills/linkedin-article-publisher/scripts/:
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 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.html
Strategy: "Text First, Images Later"
For articles with multiple images, paste ALL text content first, then insert images at correct positions using block index.
Goal: Minimize wait time between operations for smooth automation.
Most browser operations (click, type, press_key, etc.) return page state in response. Don't call browser_snapshot after every operation - use the returned state directly.
Bad:
browser_click -> browser_snapshot -> analyze -> browser_click -> browser_snapshot -> ...
Good:
browser_click -> use returned state -> browser_click -> ...
Only use browser_wait_for when:
Don't use browser_wait_for for buttons or inputs - they're available immediately after page load.
When two operations have no dependencies, call multiple tools in the same message:
Can parallel:
- Fill title (browser_type) + Copy HTML to clipboard (Bash)
- Parse Markdown JSON + Generate HTML file
Cannot parallel (has dependencies):
- Must navigate to editor before uploading cover image
- Must paste content before inserting images
Each browser operation returns page state with element references. Use these references directly for the next operation:
# Ideal flow (execute directly, no extra waits):
browser_navigate -> find cover button in returned state -> browser_click(cover)
-> find title field in returned state -> browser_type(title)
-> click editor -> browser_press_key(Meta+v)
-> ...
Before starting browser operations, complete all preparation:
This allows browser operations to execute continuously without stopping for data processing.
Use parse_markdown.py to extract all structured data:
python ~/.claude/skills/linkedin-article-publisher/scripts/parse_markdown.py /path/to/article.md
Output JSON:
{
"title": "Article Title",
"cover_image": "/path/to/first-image.jpg",
"content_images": [
{"path": "/path/to/img2.jpg", "block_index": 5, "after_text": "context for debugging..."},
{"path": "/path/to/img3.jpg", "block_index": 12, "after_text": "another context..."}
],
"html": "<p>Content...</p><h2>Section</h2>...",
"total_blocks": 45
}
Key fields:
block_index: The image should be inserted AFTER block element at this index (0-indexed)total_blocks: Total number of block elements in the HTMLafter_text: Kept for reference/debugging only, NOT for positioningSave HTML to temp file for clipboard:
python parse_markdown.py article.md --html-only > /tmp/article_html.html
browser_navigate: https://www.linkedin.com/article/new/
Important: The page loads directly into the article editor. Wait for the editor to fully load:
browser_snapshot to check page state# 1. Navigate to editor
browser_navigate: https://www.linkedin.com/article/new/
# 2. Get page snapshot to find elements
browser_snapshot
# 3. Proceed with cover image upload, title, content
Note: If user is not logged in, prompt them to log in manually and retry.
LinkedIn's cover image upload:
Look for elements like:
Copy HTML to system clipboard using Python, then paste:
# Copy HTML to clipboard
python ~/.claude/skills/linkedin-article-publisher/scripts/copy_to_clipboard.py html --file /tmp/article_html.html
Then in browser:
browser_click on editor content area
browser_press_key: Meta+v
This preserves all rich text formatting (H2, bold, links, lists).
Key improvement: Use block_index for precise positioning instead of text matching.
After pasting HTML, editor content consists of block elements (paragraphs, headers, quotes, etc.). Each image's block_index indicates it should be inserted after the Nth block element.
block_index positionFor each content image (from content_images array):
# 1. Copy image to clipboard (with compression)
python ~/.claude/skills/linkedin-article-publisher/scripts/copy_to_clipboard.py image /path/to/img.jpg --quality 85
# 2. Click the block element at block_index
# Example: if block_index=5, click the 6th block element (0-indexed)
browser_click on the element at position block_index in the editor
# 3. Paste image
browser_press_key: Meta+v
# 4. Wait for upload to complete (short timeout, returns immediately when done)
browser_wait_for time=3
In browser_snapshot, editor content typically appears as:
textbox [ref=xxx]:
generic [ref=block0]: # block_index 0
- paragraph content
heading [ref=block1]: # block_index 1
- h2 content
generic [ref=block2]: # block_index 2
- paragraph content
...
To insert image after block_index=5:
Note: Each inserted image shifts subsequent indices. Insert images in reverse order by block_index (highest to lowest) so earlier indices remain valid.
If 3 images have block_index 5, 12, 27:
This way each insertion doesn't affect previously positioned locations.
...) - converted to blockquotes for compatibilityUser: "Publish /path/to/article.md to LinkedIn"
# Step 1: Parse Markdown
python ~/.claude/skills/linkedin-article-publisher/scripts/parse_markdown.py /path/to/article.md > /tmp/article.json
python ~/.claude/skills/linkedin-article-publisher/scripts/parse_markdown.py /path/to/article.md --html-only > /tmp/article_html.html
title)python ~/.claude/skills/linkedin-article-publisher/scripts/copy_to_clipboard.py html --file /tmp/article_html.html
Then: browser_press_key Meta+vpython copy_to_clipboard.py image /path/to/img.jpg --quality 85
block_index positionafter_text kept for human verificationKey understanding: browser_wait_for's time parameter is maximum wait time, not fixed delay. Operations return immediately when conditions are met.
time=10 - if upload takes 2 seconds, remaining 8 seconds wastedtime=3 - returns immediately when done, max wait 3 seconds# Correct: Short time value, returns immediately when condition met
browser_wait_for time=3
# Wrong: Fixed long wait, wastes time
browser_wait_for time=10 # Unconditional 10-second wait
Principle: Don't assume "how long it takes" - set reasonable maximum, let condition checking return quickly.
Each image's browser operations reduced from 5 steps to 2:
https://www.linkedin.com/article/new/https://www.linkedin.com/pulse/ (may redirect here)LinkedIn's editor supports:
触发:/linkedin 新手、「这个怎么用」「第一次用」「能干嘛」「带我走一遍」,
以及用户输入了技能名却没有给任何任务的时候。
这个模式的铁律:不假设、不索取。用户可能什么都没准备, 不要一上来就问他要文件、要 API key、要具体需求。按下面四步走:
一、先说清楚这是什么(三句话以内)
一句话:把一篇 Markdown 直接发成 LinkedIn 长文,格式不丢。 标题、小标题、列表、粗体、链接、封面图都会保留, 不用再手动往 LinkedIn 编辑器里一段段粘。
二、给编号选项,让他按回车就能继续
不要问开放式问题(「你想做什么?」对新手是负担)。给 3 个选项加一个默认:
想先看哪个?(直接回车 = 1)
1. 看看一篇文章发出去长什么样(示例)
2. 把我的 Markdown 文件发成草稿
3. 先讲讲要准备什么
三、直接演示一遍,边做边解释
选完立刻做给他看,用示例数据,不需要他提供任何东西。 每做完一步,加一行「💡 刚才发生了什么」,一句话说明这步的意义。
四、毕业
演示完只问一个是非题:「要不要用你自己的文章真跑一遍?」
答是就进正常流程;答否就告诉他随时回来输 /linkedin 新手。
关于前置条件:这个技能需要 Playwright MCP,以及浏览器里已经登录 LinkedIn。 新手模式下不要提前索取——先用示例数据演示完,到第四步真跑的时候再引导他配置, 并说清楚在哪配、怎么拿。新手最容易在这一步流失。
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Claude Code refuses to install this plugin
.claude-plugin/plugin.json: dependencies: Invalid input: expected array, received object
Checked against Claude Code 2.1.332's install rules. The listing below is what the repository ships; Claude Code cannot install it as published.
Other plugins' skills for the same job