How to Repurpose YouTube Videos Into Multi-Platform Social Posts with Claude Code
Use Claude Code and a social media API to turn one YouTube video into LinkedIn, Instagram, and X posts with platform-optimized visuals in a single prompt.
Why Content Repurposing Breaks Down at Scale
You publish a YouTube video and walk away with 20 minutes of recorded content. Claude Code — Anthropic’s agentic coding tool — can turn that into a full week of social posts across LinkedIn, Instagram, and X before your next meeting.
Most teams don’t do this. Either they ignore the opportunity entirely, or they spend two hours manually adapting the video into three slightly different posts that still feel copy-pasted. Both approaches waste time and leave real content value on the table.
The core problem isn’t effort — it’s that each platform has distinct formatting rules, audience expectations, and engagement patterns. A LinkedIn post that performs well reads completely differently from an Instagram caption or an X thread. Doing that translation three times, for every video, by hand is unsustainable.
This guide shows you exactly how to use Claude Code to automate the entire pipeline: extract the transcript, generate platform-specific posts, produce image prompts and visuals, and save everything to clean output files — all from one prompt.
What You Need Before Starting
The prerequisites list here is short.
Required:
- Claude Code access — Available via Anthropic’s CLI (installable through npm as
npm install -g @anthropic-ai/claude-code) or the Claude.ai Pro and Max subscription tiers, which include Claude Code in the browser. - A public YouTube video URL — The video needs captions enabled. Most videos have auto-generated captions by default.
- Python 3.8 or higher — Claude Code writes and executes Python scripts. Most machines have this already; if not, it’ll tell you.
Optional but useful:
- YouTube Data API key — For pulling structured metadata (title, description, tags) via the YouTube Data API v3. The free tier is generous for most use cases.
- An image generation API key — Replicate, OpenAI DALL-E 3, or Stability AI for generating platform-specific visuals. Without this, Claude Code outputs detailed image prompts you can run separately.
You don’t write any code yourself. Claude Code handles that.
How Claude Code Runs This Pipeline
Claude Code is not a standard AI chat interface. When you give it a task, it writes code, executes it in your environment, reviews the output, corrects errors, and iterates until the job is done. It has access to your file system, can install Python packages, and can chain operations across multiple steps without you managing any of it.
For content repurposing, you give it one detailed prompt and it handles:
- Installing required libraries like
youtube-transcript-api - Fetching the transcript from the YouTube URL
- Pulling video metadata via the YouTube API if you provide a key
- Generating posts for each platform using the Claude API
- Formatting and saving everything to structured output files
- Running image generation calls if you provide an API key
The agentic aspect matters here. If the transcript API fails for a video with disabled captions, Claude Code tries an alternative approach. If the output JSON is malformed, it self-corrects and reruns. You review the output, not the execution.
Build the YouTube-to-Social Pipeline
Step 1: Write the Master Prompt
The quality of your output depends on how clearly you describe the task. Here’s a prompt structure that works well:
I want to repurpose this YouTube video into social media posts.
Video URL: https://www.youtube.com/watch?v=YOUR_VIDEO_ID
Please:
1. Extract the full transcript using the youtube-transcript-api Python library.
Clean it first: remove filler words, fix obvious transcription errors,
and correct any misspelled technical terms.
2. If I provide a YouTube Data API key, pull the video title, description,
and tags as additional context.
3. Generate the following from the transcript:
- One LinkedIn post (800–1,200 words, professional tone, thought leadership
framing, 3–5 hashtags at the end, hook in the first line under 10 words)
- One Instagram caption (150–300 words, conversational, strong hook opener,
12–15 relevant hashtags separated by a line break at the end)
- One X thread (6–8 tweets, each under 280 characters, starts with a bold
claim, 1–2 hashtags per tweet max)
4. For each post, write a detailed image generation prompt that describes
a visual suited to the platform's format and aesthetic.
5. Save everything to a file called repurposed_content.json.
YouTube Data API key: [YOUR KEY or "not available"]
Being specific about word counts, tone, and structure makes a significant difference. Claude Code follows your specs closely.
Step 2: Extract the Transcript
When Claude Code runs, it first handles the transcript extraction. The code it generates looks roughly like this:
from youtube_transcript_api import YouTubeTranscriptApi
import re
def extract_video_id(url):
patterns = [
r'(?:v=|\/)([0-9A-Za-z_-]{11})',
r'youtu\.be\/([0-9A-Za-z_-]{11})'
]
for pattern in patterns:
match = re.search(pattern, url)
if match:
return match.group(1)
raise ValueError("Could not extract video ID from URL")
video_id = extract_video_id("https://www.youtube.com/watch?v=YOUR_VIDEO_ID")
transcript_data = YouTubeTranscriptApi.get_transcript(video_id)
raw_transcript = " ".join([entry['text'] for entry in transcript_data])
A typical 20-minute video produces 3,000–5,000 words of transcript. If the video is longer and the transcript exceeds the model’s context window, Claude Code will chunk or summarize it automatically before generating posts.
Step 3: Generate the Platform Posts
With the transcript ready, Claude Code calls the Claude API to generate all three posts at once. It instructs the model to return structured JSON so the output is immediately usable:
import anthropic
import json
client = anthropic.Anthropic(api_key=os.getenv("ANTHROPIC_API_KEY"))
system_prompt = """You are a social media content strategist. Given a YouTube
transcript, create platform-optimized posts that capture the most valuable
insights. Return your response as valid JSON only, with no extra commentary."""
user_prompt = f"""
Video Title: {video_title}
Transcript: {cleaned_transcript}
Generate posts with these exact JSON keys:
- linkedin_post: object with "copy", "hashtags" (array), "image_prompt"
- instagram_caption: object with "copy", "hashtags" (array), "image_prompt"
- x_thread: array of objects, each with "tweet" (string) and "hashtags" (array)
- x_image_prompt: string describing the header visual for the thread
"""
response = client.messages.create(
model="claude-opus-4-5",
max_tokens=4096,
system=system_prompt,
messages=[{"role": "user", "content": user_prompt}]
)
The model reads the full cleaned transcript and identifies which ideas translate best to each platform’s format — not just summarizing, but reframing the content for different audiences.
Step 4: Save and Review Your Output
Claude Code saves everything to a structured JSON file:
{
"video_url": "https://www.youtube.com/watch?v=YOUR_VIDEO_ID",
"video_title": "Your Video Title Here",
"generated_at": "2025-06-01T14:30:00Z",
"linkedin_post": {
"copy": "Most teams get this wrong about product launches...",
"hashtags": ["#ProductStrategy", "#Leadership", "#SaaS"],
"image_prompt": "Clean flat-lay of notebook and laptop on white desk..."
},
"instagram_caption": {
"copy": "Nobody tells you this about building in public.\n\n...",
"hashtags": ["#buildingInPublic", "#startuplife", "..."],
"image_prompt": "High-contrast square image, bold typography overlay..."
},
"x_thread": [
{"tweet": "Most founders waste their first 6 months. Here's the pattern:", "hashtags": ["#startups"]},
{"tweet": "They optimize for the wrong thing...", "hashtags": []}
]
}
From this file, you can copy content directly into a scheduling tool or pass it to a publishing API. The review step — 10 minutes of light editing — significantly improves quality and keeps your voice consistent.
Platform Formatting Rules That Actually Matter
Claude Code will follow your specs, but understanding the reasoning helps you write better prompts and refine output faster.
LinkedIn rewards depth. Posts between 800 and 1,500 words consistently outperform shorter ones in organic reach. The algorithm favors content that keeps users on the platform, so long-form posts with a clear structure — problem, insight, implication — tend to get amplified more than link posts or short updates.
Key parameters for your prompt:
- Hook in the first line, under 10 words, without a period (the period creates a visual stop before the “see more” cutoff)
- Short paragraphs and occasional single-line breaks — walls of text kill engagement
- End with a direct question to drive comments
- 3–5 hashtags at the very end, not scattered through the text
Instagram is visual-first. The caption supports the image rather than standing alone. Only the first 125 characters show before the “more” tap, so the opening line carries disproportionate weight.
Key parameters:
- Open with a bold statement or question — not a greeting or “I want to share”
- Keep the body under 300 words; Instagram is not a reading platform
- Separate hashtags from copy with a line break
- 10–15 hashtags is the practical sweet spot; more hashtags don’t always help if they’re off-topic
X (Twitter)
X threads perform well for taking one strong argument from the video and developing it tweet by tweet. The first tweet determines whether people read the rest.
Key parameters:
- First tweet: a claim that creates tension, curiosity, or contradicts conventional wisdom
- Each tweet adds exactly one new idea — no padding
- 6–8 tweets is the optimal length; engagement drops sharply after tweet 5 in most threads
- 1–2 hashtags per tweet maximum; hashtag-heavy threads look spammy
Generate Visuals for Each Platform
Posts with platform-optimized images consistently outperform text-only posts. Aspect ratios affect performance more than most people realize — an image cropped incorrectly looks amateurish in the feed.
Standard Dimensions to Specify
| Platform | Recommended Size | Aspect Ratio |
|---|---|---|
| 1200 × 627 px | 1.91:1 | |
| Instagram (square) | 1080 × 1080 px | 1:1 |
| Instagram (portrait) | 1080 × 1350 px | 4:5 |
| X | 1200 × 675 px | 16:9 |
Add Image Generation to Your Claude Code Prompt
If you have a DALL-E 3 or Replicate API key, extend your original prompt with:
5. For each platform, generate an image using the DALL-E 3 API.
Use the image_prompt generated in step 3 for each platform.
Save images as linkedin_visual.png, instagram_visual.png, x_visual.png.
Size parameters (use the closest available ratio):
- LinkedIn: 1792×1024
- Instagram: 1024×1024
- X: 1792×1024
Claude Code handles the API calls, error handling if generation fails, and file saving.
Visual Direction by Platform
When Claude Code writes image prompts — or when you write your own — the aesthetic should match platform expectations:
- LinkedIn: Professional and clean — data visualizations, bold typography overlays on neutral backgrounds, or workspace imagery without looking like a stock photo
- Instagram: High contrast and scroll-stopping — bright colors, human faces, or visually bold compositions that read well at thumbnail size
- X: Simple and readable at small sizes — text-heavy images often underperform; lean toward minimal visuals with one focal point
If you want brand consistency, add a brief brand description to your master prompt: color palette, typography preferences, and any imagery to avoid.
Extend This Workflow With MindStudio
Running this pipeline manually with Claude Code works well for occasional use. But if you want it to trigger automatically whenever a new video is published — or if non-technical teammates need to run it without a CLI — the MindStudio Agent Skills Plugin is worth adding to the stack.
The plugin is an npm SDK (@mindstudio-ai/agent) that gives Claude Code — or any AI agent — direct access to 120+ pre-built capabilities as simple method calls. Instead of writing custom integration code for image generation, Slack notifications, or social scheduling, the agent calls:
const { MindStudio } = require('@mindstudio-ai/agent');
const agent = new MindStudio();
// Generate the LinkedIn visual
const image = await agent.generateImage({
prompt: "Professional LinkedIn visual, clean desk, laptop...",
size: "1792x1024"
});
// Notify the content team when posts are ready
await agent.sendSlackMessage({
channel: "#content-team",
message: "New social posts from last night's video are ready for review."
});
The plugin handles rate limiting, retries, and authentication in the background — the agent handles the reasoning, not the infrastructure plumbing.
For teams that want a fully no-code version of this workflow — with visual triggers, human approval steps, and direct publishing to Buffer or Hootsuite — you can build the equivalent pipeline in MindStudio’s visual workflow builder without writing code. The same logic applies: YouTube URL in, platform-ready posts out, with scheduling and notifications built in.
You can start building free at mindstudio.ai.
Common Mistakes to Avoid
Skipping transcript cleaning. Auto-generated YouTube captions contain filler words, repeated phrases, and transcription errors for technical terms. Always include a cleaning step in your prompt before generating posts. The quality difference in output is significant.
Using identical tone instructions for all platforms. If you only say “generate three posts,” Claude Code defaults to a similar voice across all three. Be explicit: professional and authoritative for LinkedIn, conversational and direct for Instagram, punchy and counterintuitive for X.
Ignoring context limitations for long videos. Videos over 60 minutes produce transcripts that can exceed the model’s context window. Add a fallback instruction: “If the transcript is over 6,000 words, identify and extract the 5 most substantive sections before generating posts.”
Generating visuals without brand direction. The images will be generic without explicit guidance. Add a two-sentence brand description to your prompt covering your color palette, visual style, and any imagery to avoid.
Not saving your working prompt as a template. Once you find a prompt that consistently produces good output for your style, save it. Future runs only need the video URL swapped in. This is where the time savings compound — first run takes 15 minutes to set up, every subsequent run takes 30 seconds to trigger.
Treating the output as final copy. Claude Code is fast but not infallible. Budget 10 minutes for a review pass on each batch. The goal is to eliminate 90% of the manual work, not to remove human judgment from the process entirely.
Frequently Asked Questions
Does this workflow work for private or unlisted YouTube videos?
The youtube-transcript-api library only works with public videos. For private or unlisted videos, export the captions manually from YouTube Studio (under the video’s subtitle settings) and paste the text into your Claude Code prompt as raw transcript content instead of providing a URL. The rest of the pipeline — post generation, image creation, output formatting — works identically.
What if the video has no captions at all?
You have two options. First, enable auto-captions in YouTube Studio and wait up to 24 hours for them to generate. Second, use a transcription service to generate a transcript from the audio. Claude Code can handle this directly — ask it to download the audio using yt-dlp and run OpenAI Whisper locally to transcribe it. This approach requires more compute time but works for any video with audible speech.
Can Claude Code post directly to social platforms?
Yes, if you provide the right API credentials. LinkedIn, Instagram (via Meta’s Graph API), and X all have publishing APIs. Claude Code can write the posting code, but Meta’s Graph API for Instagram requires a business account connected to a Facebook Page — it doesn’t work with personal accounts. For teams managing multiple accounts or platforms, a social scheduling tool with an API like Buffer, Hootsuite, or Ayrshare is generally easier to integrate than platform APIs directly.
How long does the full pipeline take to run?
For a typical 15–20 minute video: transcript extraction under 30 seconds, Claude API calls for post generation 20–60 seconds depending on output length, image generation via DALL-E 3 another 30–90 seconds per image. End to end, the complete pipeline runs in 3–5 minutes for all three platforms plus visuals — compared to 2–3 hours of manual work.
What if the generated posts don’t sound like our brand?
Add example posts to your prompt as style references. Include 3–5 posts you’ve already published that represent your voice, and tell Claude Code: “Use these as a style guide for tone, sentence structure, and level of formality. Do not reuse content from them.” Claude will match your voice more accurately from concrete examples than from abstract descriptions like “professional but approachable.”
Can this workflow handle other video platforms besides YouTube?
The transcript extraction step is YouTube-specific, but everything else works with any text input. For Vimeo, export a manual transcript from the video settings. For TikTok or Instagram Reels, use yt-dlp to download the audio and transcribe it with Whisper. Once you have the transcript text, the Claude Code prompt for generating posts is identical regardless of the original platform.
Key Takeaways
- Claude Code runs the complete repurposing pipeline — transcript extraction, post generation, image creation, and file output — from a single natural language prompt, with no code writing required from you.
- Platform-specific instructions are essential: LinkedIn needs depth and a cliffhanger hook, Instagram needs a visual-first opening line, and X needs a bold claim that creates tension in the first tweet.
- Standard aspect ratios (1.91:1 for LinkedIn, 1:1 or 4:5 for Instagram, 16:9 for X) affect how professional posts look in the feed and should be specified in your image generation instructions.
- The full pipeline runs in 3–5 minutes end to end. Save your working prompt as a reusable template — future runs take 30 seconds to trigger.
- For scheduled automation, team-friendly workflows, or no-code deployment of this same pipeline, MindStudio’s Agent Skills Plugin and visual workflow builder extend what Claude Code starts.
Teams that want to go further — multi-video campaigns, email newsletters from YouTube content, or SEO articles derived from transcripts — can wire up the full content automation pipeline in MindStudio without writing any code. Start free at mindstudio.ai.