Claude Code Tutorial: Build a YouTube Research Agent using Slash Commands
Learn how to use slash commands to turn Claude Code into a powerful AI research agent
Dear subscribers,
Today, I want to show you how to build an AI research agent with Claude Code.
Most people use Claude Code for coding, but it's really an everything agent that can automate any task for you.
In the tutorial below, I walk through how to build a YouTube research agent that finds the best videos from your favorite channels and highlights each creator’s winning formula. You’ll learn about slash commands, permissions, and more.
This agent has already changed the YouTube strategy for me and many of my creator friends. Some quotes from them:
"Damn it's true what it says."
"Call this the harsh truth agent."
Timestamps:
(00:00) Why Claude Code is an everything agent
(01:10) Step 1: Explore solutions with Claude in plan mode
(03:08) Step 2: Set permissions to auto-approve changes
(04:49) Step 3: Write a spec for the slash command
(07:56) Step 4: Convert the spec into a detailed to-do list
(08:42) Step 5: Create the slash command and test with real channel
(11:01) Step 6: Add batch processing to analyze 5 channels at once
Watch now on YouTube or read the written guide below.
Thanks to Linear for sponsoring this newsletter
I love working with Linear because they share my obsession for product craft and quality. Now they’re bringing the same attention to detail to build an operating system for teams to collaborate with AI agents that can:
Analyze customer feedback from multiple sources
Auto-triage tickets and assign owners
Build complete features from scratch
See for yourself what the difference is by trying Linear Business for 6 months free exclusively for readers of this newsletter.
What we'll build: A YouTube research agent
Let’s create a /youtube
slash command that analyzes any channel to get the 10 best recent videos and insights on what’s working. Here's the analysis for my channel:
Here’s the same analysis for Lenny’s channel:
I’ll assume that you already have Claude Code installed. If you don’t, follow the instructions from last week’s beginner’s tutorial.
1. Explore solutions with Claude
Tip: Always start by exploring solutions with Claude in plan mode (shift-tab). It can save you hours of going down the wrong path.
It's funny that Claude Code and other CLI tools all have a "plan mode" because the models are just way too eager to start coding. Type this prompt into Claude:
"I want to build a tool where if I type '/youtube @channelname', it outputs a youtube-research.md file with that channel's top recent videos (title, views, YouTube link) plus a key insight about what content works. Can you suggest 3 ways to get YouTube data with pros/cons?
Claude will suggest several approaches including a free tool called yt-dlp that can fetch YouTube data without any API keys. I would’ve never found this tool if I didn’t ask Claude to explore solutions first.
2. Set permissions to auto-approve changes
Before we go further, let's configure permissions so Claude can work without interrupting us every 30 seconds. Type:
/permissions
Claude will create a .claude/settings.local.json file. Add these specific permissions:
{
"allowedTools": [
"Read",
"Write",
"Bash(npm:*)",
"Bash(yt-dlp:*)"
]
}
This lets Claude read, write, and run specific commands (e.g., npm and yt-dlp) without asking you for permission all the time. This way, we can actually get coffee and browse YouTube while Claude works. ☺️
3. Write a spec for the slash command
Tip: Use slash commands to re-use your favorite AI prompts and workflows.
Now let’s ask Claude to write a spec for our /youtube
slash command: