Markdown to X Article agent skill

If you already draft technical posts in Markdown or Obsidian and work inside Claude Code, Codex, or another coding agent that reads SKILL.md, you do not have to copy and upload assets by hand. The open-source md2xarticle agent skill checks your Markdown locally, resolves local images and covers, drives md2xarticle.com in your Chrome session, and returns an unpublished X Article draft URL.

The skill never publishes automatically and never modifies your original Markdown file. Lossless rewrites such as flattening simple nested lists or turning footnotes into endnotes run on a temporary copy, and publishing stays a manual step in X.

What the skill handles

Requirements

Install the skill

Clone the repository and copy or symlink skills/md2xarticle into your agent's skills folder (for example ~/.claude/skills/md2xarticle or ~/.agents/skills/md2xarticle):

git clone https://github.com/geoqiao/x-article-studio.git
ln -s "$PWD/x-article-studio/skills/md2xarticle" ~/.agents/skills/md2xarticle

No extra npm install is required to run the skill: scripts/studio-core.mjs is pre-bundled from the website's own Markdown checker and runs directly with Node 20+.

How the workflow runs

  1. Preflight and prepare: run prepare.mjs against your Markdown file. It validates the article without opening a browser, resolves images and cover candidates, and outputs JSON containing paths to generated create and wait browser scripts.
node skills/md2xarticle/scripts/prepare.mjs /path/to/article.md \
  --images /path/to/attachments \
  --cover /path/to/cover.png \
  --endnotes --flatten-lists
  1. Stage and create the draft in your Chrome: attach to your signed-in Chrome profile and run the generated script.
playwright-cli attach --extension=chrome --session=md2x-run
playwright-cli -s=md2x-run run-code --filename=<create-script-path>
playwright-cli -s=md2x-run tab-close
  1. First-run confirmation: on the first run, the companion opens its review page and stops at awaiting-confirmation. Click Create X draft there—and optionally tick Create drafts without this review once—so later agent runs complete without an extra click.

Returned stages

Draft creation outcomes reported by the skill
ResultMeaning and next step
ok: trueDraft created in X. Open the returned draftUrl to review and publish.
awaiting-confirmationCompanion review tab is open. Confirm Create X draft (and optionally enable skip-review), then run the generated wait script.
issuesThe website detected content that would lose data (such as an image that failed to load). Fix the listed line numbers and rerun step 1.
failedNo draft was created. For X_FIREWALL_BLOCKED, reword shell-pipe text such as curl … | sh; for sign-in errors, sign in to X and retry.
uncertainX returned no clear confirmation. Do not blindly retry—check x.com/compose/articles first to avoid duplicate drafts.
companion-missingInstall or enable the Chrome companion in that profile and reload md2xarticle.com.

Boundaries and safety

Related guides

md2xarticle is an independent tool and is not affiliated with or endorsed by X Corp. X controls Articles access and final rendering; check each draft in X before publishing.