posthog/x-article
Convert a posthog.com blog or newsletter post into a markdown file formatted for posting as an X (Twitter) Article. Strips frontmatter, promotes the title to an H1, remaps headings to X's two heading levels (subheadings + bold), downloads all post images into a numbered folder, and appends a subscribe CTA for newsletters. Use when the user wants to copy a post from contents/blog/ or contents/newsletter/ into X Article format.
npx skills add https://github.com/PostHog/posthog.com --skill x-article
X Articles only support two heading levels ("heading" and "subheading") plus bold text, and images must be uploaded one at a time. This skill produces a clean markdown file and a folder of ordered images so the user can copy/paste text and drag images in order.
The user will provide a post — a slug, a filename, or a path under contents/blog/ or contents/newsletter/: $ARGUMENTS
Find the source file under contents/blog/ or contents/newsletter/ (extension may be .md or .mdx). If the argument is ambiguous or matches multiple files, ask which one. Note whether it came from blog or newsletter — the CTA in Step 4 only applies to newsletters.
Read the full file.
Derive {slug} from the source filename (without extension). Create the output folder x-articles/{slug}/ (relative to repo root) and an images/ subfolder inside it.
x-articles/{slug}/article.mdTransform the source body into the article file:
---).import lines and any other JSX/component noise that won't render as plain text (e.g. <NewsletterForm />, <ProductComparisonTable .../>, wrapping <div>s). If a component can't be represented as text, drop it. Images inside components are still handled in Step 4.title from the frontmatter and put it as a single # Title at the very top of the file.## → #### → ###### Heading → Heading (bold paragraph, heading text only)#####+ as bold too./blog/..., /feature-flags) with https://posthog.com. [IMAGE 1: alt text]
Numbered in document order starting at 1. This tells the user which downloaded image goes where.
Collect every image URL in document order. Images appear as:
!altimageLight="https://res.cloudinary.com/..." (and imageDark= — prefer imageLight; skip the dark duplicate)<img src="...">Cloudinary URLs may contain transformation segments between /upload/ and the filename (e.g. /upload/q_auto,f_auto/file.jpg or /upload/w_1600,c_limit,q_auto,f_auto/file.jpg). Download the URL as-is — the transformations are harmless.
Do not download the featuredImage from frontmatter unless it also appears in the body.
For each image in order, save it to x-articles/{slug}/images/{n}.{ext} where {n} matches the [IMAGE n: ...] marker and {ext} is the original extension from the URL (jpg, png, gif, webp). Download with:
curl -sSL -o "x-articles/{slug}/images/{n}.{ext}" "{url}"
Run the downloads and verify each file is non-empty (a failed Cloudinary fetch returns a tiny error body). Report any that failed.
If — and only if — the source was a newsletter, append this to the very bottom of article.md:
> Subscribe to [build mode](https://newsletter.posthog.com/subscribe), our newsletter, to get more writing like this.
Tell the user:
x-articles/{slug}/article.md[IMAGE n: ...] markers in the text show where each numbered image goesTake posthog/x-article from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.