How to Build a 5-Skill Agent Workflow for Content Marketing with Claude Code
Chain trending research, copywriting, repurposing, UGC scripts, and scheduling into one connected Claude Code workflow that runs your content pipeline.
Why Content Teams Are Moving to Agent Workflows
Content marketing at scale has an execution problem. Most teams aren’t stuck on ideas — they’re stuck on the pipeline: researching what’s trending, writing the copy, reformatting it for different channels, producing short-form video scripts, and getting everything scheduled before momentum dies.
The typical fix is a stack of disconnected tools with manual handoffs between them. Someone pulls a trend report, pastes it into a doc, hands it to a writer, the writer produces a draft, someone reformats it for LinkedIn, someone else writes the email version, and eventually it lands in a scheduling tool. Every handoff is a potential delay.
A Claude Code workflow built around five skills collapses that chain. Each skill is a callable capability — research, write, repurpose, script, schedule — and the agent connects them in sequence. You configure once and review the output at the end.
This guide walks through building that workflow step by step. You’ll set up your environment, wire up each of the five skills, and end with an agent that runs your content pipeline from trend discovery to publish queue.
What You’ll Need Before You Start
A few prerequisites need to be in place before building.
Claude Code is Anthropic’s agentic coding environment. It runs in your terminal, has access to your file system, and can execute code, call APIs, and manage files autonomously. If you haven’t installed it yet, the Anthropic Claude Code setup documentation covers the installation process.
Node.js 18+ is required for the MindStudio Agent Skills Plugin, which handles several capabilities in this workflow.
You’ll also need:
- A MindStudio account (free to start at mindstudio.ai)
- API access for a scheduling platform (Buffer, Hootsuite, Later, or similar)
- A working directory for your workflow project
Once those are in place, you’re ready to build.
An Overview of the Five-Skill Structure
Before getting into each skill, it helps to understand how they connect.
The workflow runs linearly, with each skill consuming the previous step’s output:
- Trending Research — The agent searches for high-signal topics in your niche and returns a ranked list of trending subjects with context.
- Copywriting — Using the research output, the agent generates a full draft in whatever format you specify.
- Content Repurposing — The draft gets reformatted into multiple short-form assets for different channels.
- UGC Script Generation — The agent writes short video scripts in a conversational, user-generated content style optimized for TikTok, Reels, or Shorts.
- Scheduling — All assets get queued to your publishing platform with timing and metadata.
Each step is a function Claude Code can call. The agent works through them in sequence, carrying output from one step into the next.
Setting Up Your Project
Start by creating a project directory and installing dependencies.
mkdir content-workflow
cd content-workflow
npm init -y
npm install @mindstudio-ai/agent
The @mindstudio-ai/agent SDK gives Claude Code access to MindStudio’s typed capabilities — web search, workflow execution, email sending, and more — as simple method calls. It handles rate limiting, retries, and authentication behind the scenes.
Create a .env file with your credentials:
MINDSTUDIO_API_KEY=your_api_key_here
SCHEDULER_API_KEY=your_scheduler_key_here
Then create your main workflow file:
touch workflow.js
At the top of workflow.js, initialize the agent:
const { MindStudioAgent } = require('@mindstudio-ai/agent');
const agent = new MindStudioAgent({
apiKey: process.env.MINDSTUDIO_API_KEY
});
With setup done, you’re ready to build each skill.
Skill 1: Trending Research
The first skill finds what people are actually searching for and discussing in your content niche. Good research grounds everything downstream — the copy, the scripts, the social posts — in real demand rather than guesswork.
How It Works
The agent calls agent.searchGoogle() with queries tailored to your niche. Running several searches in parallel covers different angles: trending topics, common questions, and recent high-performing content. The results then get synthesized into a structured brief.
async function trendingResearch(niche, timeframe = '7d') {
const searches = await Promise.all([
agent.searchGoogle({ query: `trending ${niche} topics ${timeframe}` }),
agent.searchGoogle({ query: `${niche} questions people are asking 2024` }),
agent.searchGoogle({ query: `${niche} most shared content this week` })
]);
const researchBrief = await agent.runWorkflow({
workflowId: 'research-synthesizer',
inputs: {
searchResults: searches,
niche,
outputFormat: 'ranked_topic_list'
}
});
return researchBrief;
}
The runWorkflow call points to a MindStudio workflow that handles synthesis — ranking topics by relevance, filtering duplicates, and returning a clean list. You build this once in MindStudio’s visual editor and reference it by ID from Claude Code.
What It Returns
A structured object with 5–10 ranked topic suggestions, each with:
- A suggested headline
- Why it’s trending (search volume signals, social engagement)
- Recommended angle or hook
- Estimated audience interest level
This brief feeds directly into Skill 2.
Skill 2: Copywriting
With a research brief available, the agent writes the actual content. This is where Claude’s language capabilities do most of the work.
Configuring the Prompt
The prompt needs to be explicit about tone, target audience, and format. Vague prompts return flat output. Specific prompts return something usable.
async function generateCopy(researchBrief, config) {
const { topic, format, tone, wordCount, audience } = config;
const prompt = `
You are a content writer for ${audience}.
Research brief: ${JSON.stringify(researchBrief)}
Write a ${format} about: ${topic}
Requirements:
- Tone: ${tone}
- Length: approximately ${wordCount} words
- Include a clear hook in the first paragraph
- Use headers to break up sections
- End with a concrete takeaway or call to action
Output the content in Markdown format.
`;
// Claude Code handles this as a native reasoning step — no separate API call required
const copy = await runCompletion(prompt);
return copy;
}
Because you’re already operating inside Claude Code, content generation happens natively. The agent reasons through the prompt directly — no external API call to a separate model needed.
Format Options
Pass the format parameter to control what gets written:
blog_post— Long-form article, 800–1,500 wordslinkedin_article— Professional tone, 600–1,000 wordsnewsletter— Conversational, 400–700 wordslanding_page— Conversion-focused copy with headers and CTAs
You can run this step multiple times with different format configs to produce several assets from one research brief.
Skill 3: Content Repurposing
One long-form piece isn’t enough. Most content strategies require the same core idea expressed across multiple channels: LinkedIn, X, Instagram, email, and sometimes YouTube. Manual repurposing is tedious and inconsistent — this is exactly the kind of task agents handle well.
Breaking the Draft into Formats
The repurposing skill takes the full draft and generates channel-specific versions:
async function repurposeContent(originalDraft, channels) {
const repurposed = {};
for (const channel of channels) {
const prompt = buildRepurposePrompt(originalDraft, channel);
repurposed[channel] = await runCompletion(prompt);
}
return repurposed;
}
function buildRepurposePrompt(draft, channel) {
const channelSpecs = {
twitter_thread: 'Write a 7-tweet thread. Each tweet max 280 chars. First tweet is the hook.',
linkedin_post: 'Write a LinkedIn post, 150-300 words. Start with a bold statement. Use line breaks for readability.',
instagram_caption: 'Write an Instagram caption, 100-150 words. Conversational tone. Include 5 relevant hashtags.',
email_snippet: 'Write an email newsletter intro, 80-120 words. Friendly tone. End with a clear link CTA.',
};
return `
Original content: ${draft}
Task: ${channelSpecs[channel]}
Keep the core message intact but adapt the style and length for this channel.
`;
}
What to Watch For
Repurposing works well for the factual core of a piece but can flatten voice. After this skill runs, a quick scan of each output checks whether:
- Channel-specific conventions are respected (hashtags, line breaks, thread numbering)
- The tone matches what actually performs on that platform
- The core message survived the format shift intact
These checks typically take 30 seconds per format and make a real difference in output quality.
Skill 4: UGC Script Generation
Short-form video is one of the highest-reach formats most content teams work with. But scripts that feel authentic — not like branded announcements — require a specific style that’s distinct from regular copywriting.
UGC-style scripts mimic how people actually talk on camera: direct, casual, with a strong hook in the first three seconds and a clear call to action at the end.
The Script Formula
UGC scripts that consistently perform well follow a simple four-part structure:
- Hook (0–3 seconds) — A provocative statement, surprising fact, or direct question
- Setup (4–15 seconds) — The context or problem
- Payoff (16–45 seconds) — The actual insight, tip, or story
- CTA (final 5 seconds) — A specific, low-friction next action
async function generateUGCScript(repurposedContent, platform) {
const platformSpecs = {
tiktok: { maxDuration: 60, style: 'casual and direct, conversational pacing' },
reels: { maxDuration: 90, style: 'energetic, visual cues included' },
shorts: { maxDuration: 60, style: 'fast-paced, information-dense' }
};
const spec = platformSpecs[platform];
const prompt = `
You're writing a UGC-style video script for ${platform}.
Source content: ${repurposedContent.linkedin_post}
Requirements:
- Max duration: ${spec.maxDuration} seconds when read aloud at natural pace
- Style: ${spec.style}
- Structure: Hook / Setup / Payoff / CTA
- Write as spoken word, not prose
- Include [PAUSE], [POINT TO SCREEN], and [CUT] stage directions where natural
Output the script only.
`;
return await runCompletion(prompt);
}
A Note on Hook Quality
The hook determines whether someone keeps watching. Weak hooks: “Today I’m going to talk about…” Strong hooks: “Nobody tells you this about [topic], but…” or “I tested this for 30 days. Here’s what actually happened.”
If you want more control over this, prompt the agent to generate three hook variations and pick the strongest one before the full script runs.
Skill 5: Scheduling
With content created and repurposed, the final skill queues everything for publishing. This step connects to your scheduling platform and handles the timing logic so posts go out consistently.
Connecting to a Scheduler
Most scheduling platforms (Buffer, Hootsuite, Later, Publer) expose REST APIs. The wrapper follows the same pattern regardless of which one you use:
async function scheduleContent(contentBundle, schedulingConfig) {
const { timezone, postingCalendar, platforms } = schedulingConfig;
const scheduledPosts = [];
for (const platform of platforms) {
const content = contentBundle[platform];
const optimalTime = getOptimalTime(platform, postingCalendar, timezone);
const response = await fetch(SCHEDULER_API_ENDPOINT, {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.SCHEDULER_API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
platform,
content: content.body,
scheduledTime: optimalTime,
mediaUrls: content.media || []
})
});
scheduledPosts.push(await response.json());
}
return scheduledPosts;
}
Posting Time Starting Points
General patterns hold across most audiences, though your actual engagement data will tell a more precise story:
- LinkedIn: Tuesday–Thursday, 8–10 AM or 12–1 PM in your primary audience’s timezone
- X/Twitter: Monday–Friday, 9 AM or 4–5 PM
- Instagram/Reels: Tuesday–Friday, 10 AM–12 PM
- TikTok: Tuesday, Thursday, Friday, 6–9 PM
After a few weeks, pull your own analytics and adjust the getOptimalTime lookup table accordingly.
Wiring the Five Skills into One Workflow
With each skill built, the final step connects them into a single orchestrated run:
async function runContentWorkflow(config) {
const {
niche,
topic,
audience,
tone,
platforms,
schedulingConfig
} = config;
console.log('Step 1: Running trending research...');
const researchBrief = await trendingResearch(niche);
console.log('Step 2: Generating copy...');
const draft = await generateCopy(researchBrief, {
topic: topic || researchBrief.topTopic,
format: 'blog_post',
tone,
wordCount: 1000,
audience
});
console.log('Step 3: Repurposing content...');
const repurposed = await repurposeContent(draft, platforms);
console.log('Step 4: Generating UGC scripts...');
const scripts = {};
for (const platform of ['tiktok', 'reels']) {
scripts[platform] = await generateUGCScript(repurposed, platform);
}
console.log('Step 5: Scheduling all content...');
const contentBundle = { ...repurposed, scripts };
const scheduled = await scheduleContent(contentBundle, schedulingConfig);
return { researchBrief, draft, repurposed, scripts, scheduled };
}
To run the full pipeline:
runContentWorkflow({
niche: 'B2B SaaS marketing',
audience: 'marketing managers at tech companies',
tone: 'direct and practical',
platforms: ['twitter_thread', 'linkedin_post', 'instagram_caption', 'email_snippet'],
schedulingConfig: {
timezone: 'America/New_York',
postingCalendar: 'weekdays_only'
}
}).then(result => {
console.log('Workflow complete:', result.scheduled);
});
The entire pipeline — research through scheduled posts — runs in a few minutes and produces a week’s worth of content from a single config object.
How MindStudio’s Agent Skills Plugin Fits In
The workflow above uses Claude Code as the reasoning layer, but several skills depend on external capabilities: web search, workflow orchestration for synthesis logic, and tool integrations for scheduling. Managing each of those integrations from scratch — handling auth, rate limits, retries, error states — adds friction fast.
That’s the specific problem the MindStudio Agent Skills Plugin addresses. The @mindstudio-ai/agent npm SDK gives Claude Code (and any other agent runtime) access to 120+ typed capabilities as clean method calls. No separate API accounts to manage. No infrastructure wiring.
In this workflow, the most direct applications are:
agent.searchGoogle()in the trending research skill — structured search results come back immediately, with no raw parsing requiredagent.runWorkflow()for synthesis and complex logic — you build the reasoning logic once in MindStudio’s visual editor and call it by ID from Claude Codeagent.sendEmail()if you want to route a content brief to a human reviewer before the scheduling step fires
Because MindStudio connects to 1,000+ tools — including HubSpot, Notion, Airtable, Slack, and Google Workspace — extending this workflow into your existing stack doesn’t require writing additional integration code. You just add the method call.
The synthesis workflow referenced in Skill 1 takes about 15–20 minutes to build in MindStudio’s visual editor. You can try it free at mindstudio.ai.
Common Issues and Fixes
Even well-structured workflows hit problems. Here are the ones that come up most:
The research step returns irrelevant results. The search query is probably too broad. Add specificity — include the target audience, content format, and a time constraint. “B2B SaaS email marketing trends for 2024” will return far more useful results than “marketing trends.”
The copy sounds generic. Check the prompt structure. Is the tone explicitly defined? Is the audience specific? Are there format constraints? Adding two or three examples of copy you like as few-shot examples inside the prompt tends to lift output quality significantly.
Repurposed content feels like a truncated version of the original.
Channel-specific instructions in buildRepurposePrompt need more constraints. Add requirements like “Start with a bold claim,” “Use a line break after every sentence,” or “No paragraph longer than two lines.” Specificity forces channel-appropriate writing.
UGC scripts read like prose.
Add performance cues to the prompt. Stage directions like [PAUSE], [LOOK AWAY], and [NATURAL LAUGH] signal to Claude that this is spoken content. Also add: “Write exactly as someone would say this out loud. Avoid complete formal sentences.”
Scheduling fails without clear error messages. Add full response logging around the fetch calls. Most scheduling APIs return detailed error bodies when a post fails — character limits exceeded, unsupported media types, missing fields. Log the complete response object, not just the status code.
FAQ
What is Claude Code and how does it differ from the standard Claude interface?
Claude Code is Anthropic’s agentic tool designed to run inside your development environment. Unlike the browser-based Claude interface, Claude Code can execute terminal commands, read and write files, call external APIs, and manage code across a project autonomously — without you copying outputs between tools. It’s designed for multi-step tasks where the AI takes action, not just responds.
Can this workflow run automatically without manual input each time?
Yes, once built. The workflow function accepts a config object, so you can trigger it on a schedule using a cron job or a CI/CD pipeline. You can also set it up as a background agent in MindStudio’s workflow builder that runs daily and routes finished content to a Slack channel or Notion database for review before scheduling fires.
How much does it cost to run a workflow like this?
The main cost is Claude API usage, which scales with token volume. A complete run — research, a 1,000-word draft, repurposing for four channels, three UGC scripts, and scheduling — typically consumes 15,000–25,000 tokens. At current Claude pricing, that’s roughly $0.15–$0.50 per full content batch. MindStudio’s free tier covers basic usage; paid plans start at $20/month.
Which scheduling platforms does this work with?
Any platform with a REST API. Buffer, Hootsuite, Later, Publer, and Sprout Social all work. Swap out SCHEDULER_API_ENDPOINT and adjust the request body format for whichever API you’re targeting. Most scheduling APIs follow similar patterns, so the wrapper function needs minimal changes between platforms.
Do I need coding experience to build this?
You need basic JavaScript familiarity to follow this guide as written. If you’re not comfortable writing code, MindStudio’s no-code workflow builder lets you build equivalent agent workflows visually — no terminal required. The same five-skill logic applies; you’re just wiring nodes in a visual editor rather than writing functions.
Can I extend this beyond five skills?
The workflow is modular by design, so yes. Common extensions include an image generation skill that produces thumbnail images and social cards using FLUX or DALL·E, and a performance review skill that pulls analytics from previous posts to inform the next research brief. Both can be added as additional steps in the runContentWorkflow function.
Key Takeaways
Building a five-skill agent workflow for content marketing with Claude Code is a practical way to remove the most time-consuming manual steps from a content pipeline.
- The five skills — trending research, copywriting, repurposing, UGC scripts, and scheduling — each handle a discrete step, with each output feeding the next
- Claude Code serves as the reasoning layer, calling each skill in sequence and making logic decisions along the way
- The MindStudio Agent Skills Plugin (
@mindstudio-ai/agent) handles the integration layer — search, workflow orchestration, and tool calls become simple method calls with no infrastructure management - The full pipeline runs in minutes and produces a week’s worth of multi-channel content from a single config
- Start small — build two or three skills first, validate the output quality, then add the remaining steps once you’re confident in each piece
If you’d rather build this without writing code, MindStudio’s visual workflow builder supports the same structure — research, generation, repurposing, and scheduling as connected visual nodes, with a working agent running in under an hour.