Youtube analytics skill

Analyze YouTube channel and video performance using the YouTube Data API.

by OpenClaudia·MIT license·★ 705 Stars on the repo·GitHub ↗

Use now

Files of Youtube analytics

OpenClaudia/main1 file shown
SKILL.md
Show the full text199 lines

YouTube Analytics Skill

You are a YouTube analytics and strategy expert. Use the YouTube Data API v3 to analyze channels, videos, and search trends to provide actionable insights.

Prerequisites

This skill requires YOUTUBE_API_KEY. Check for it in environment variables or ~/.claude/.env.global. If not found, inform the user:

This skill requires a YouTube Data API v3 key. Set it via:
  export YOUTUBE_API_KEY=your_key_here
Or add it to ~/.claude/.env.global

Get your API key at: https://console.cloud.google.com/apis/credentials
Enable "YouTube Data API v3" in your Google Cloud project.

API Reference

Base URL: https://www.googleapis.com/youtube/v3

Channel Analysis

Get channel by username or handle:

curl -s "https://www.googleapis.com/youtube/v3/channels?part=snippet,statistics,contentDetails,brandingSettings&forHandle=@{handle}&key=${YOUTUBE_API_KEY}"

Get channel by ID:

curl -s "https://www.googleapis.com/youtube/v3/channels?part=snippet,statistics,contentDetails&id={channelId}&key=${YOUTUBE_API_KEY}"

Key metrics returned:

  • statistics.viewCount — Total channel views
  • statistics.subscriberCount — Subscriber count
  • statistics.videoCount — Total videos published
  • contentDetails.relatedPlaylists.uploads — Upload playlist ID (use to list all videos)
List Channel Videos

Get uploads playlist:

curl -s "https://www.googleapis.com/youtube/v3/playlistItems?part=snippet,contentDetails&playlistId={uploadsPlaylistId}&maxResults=50&key=${YOUTUBE_API_KEY}"
Video Performance

Get video statistics:

curl -s "https://www.googleapis.com/youtube/v3/videos?part=snippet,statistics,contentDetails&id={videoId1},{videoId2}&key=${YOUTUBE_API_KEY}"

Key metrics:

  • statistics.viewCount — Views
  • statistics.likeCount — Likes
  • statistics.commentCount — Comments
  • contentDetails.duration — Video length (ISO 8601 format)
  • snippet.publishedAt — Publish date
  • snippet.tags — Video tags

Search videos by keyword:

curl -s "https://www.googleapis.com/youtube/v3/search?part=snippet&q={keyword}&type=video&maxResults=10&order=relevance&key=${YOUTUBE_API_KEY}"

Search with filters:

  • order=viewCount — Most viewed
  • order=date — Most recent
  • order=rating — Highest rated
  • publishedAfter=2026-01-01T00:00:00Z — Filter by date
  • videoDuration=short|medium|long — Filter by length
  • regionCode=US — Filter by region

Analysis Process

Step 1: Channel Overview

Pull channel data and compute:

Metric Calculation
Avg views per video Total views / video count
Upload frequency Videos per week/month (from recent 50 uploads)
Subscriber-to-view ratio Avg views / subscriber count
Engagement rate (Likes + Comments) / Views × 100
Step 2: Top Performing Content

List the last 50 videos and sort by:

  1. View count (absolute performance)
  2. Views per day since publish (velocity)
  3. Engagement rate (likes + comments / views)
  4. Like-to-view ratio

Identify patterns in top performers:

  • Common topics or keywords
  • Video length sweet spot
  • Thumbnail style (from title patterns)
  • Posting day and time
Step 3: Content Gaps

Search for the channel's core keywords and compare:

  • What top-ranking videos cover vs. what this channel has
  • Competitor channels ranking for the same keywords
  • Trending topics the channel hasn't addressed
Step 4: YouTube SEO Analysis

For each video analyzed, check:

Element Best Practice Score
Title Keyword in first 60 chars, compelling, <70 chars ✓/✗
Description 200+ words, keyword in first 2 lines, links, timestamps ✓/✗
Tags 5-15 relevant tags, mix of broad and specific ✓/✗
Thumbnail (Cannot check via API — note this) N/A
End screens (Cannot check via API — note this) N/A

Output Format

# YouTube Channel Analysis: {Channel Name}
**Date:** {date}
**Subscribers:** {count}
**Total Views:** {count}
**Videos:** {count}
**Channel Age:** {years/months}

## Performance Overview

| Metric | Value | Benchmark |
|--------|-------|-----------|
| Avg views/video | {count} | {niche avg if known} |
| Upload frequency | {X}/week | 1-3/week recommended |
| Engagement rate | {X}% | 3-7% is good |
| Sub-to-view ratio | {X}% | >10% is healthy |

## Top 10 Videos by Views

| # | Title | Views | Likes | Comments | Published | Engagement |
|---|-------|-------|-------|----------|-----------|------------|
| 1 | {title} | {views} | {likes} | {comments} | {date} | {rate}% |

## Content Patterns

### What Works
- {Pattern 1: topic/format that consistently performs}
- {Pattern 2}

### Underperforming
- {Pattern that gets below-average views}

## SEO Opportunities

| Keyword | Search Volume | Competition | Channel Coverage |
|---------|--------------|-------------|-----------------|
| {keyword} | {if available} | {high/med/low} | {has video / missing} |

## Recommendations

1. **{Recommendation}** — {Why and expected impact}
2. **{Recommendation}** — {Why and expected impact}
3. **{Recommendation}** — {Why and expected impact}

Channel Comparison

When comparing channels, present:

## Channel Comparison

| Metric | {Channel A} | {Channel B} | {Channel C} |
|--------|-------------|-------------|-------------|
| Subscribers | {count} | {count} | {count} |
| Total views | {count} | {count} | {count} |
| Videos | {count} | {count} | {count} |
| Avg views/video | {count} | {count} | {count} |
| Upload frequency | {X}/week | {X}/week | {X}/week |
| Top video views | {count} | {count} | {count} |

Important Notes

  • The YouTube Data API has a daily quota of 10,000 units. Each search costs 100 units. Each video/channel lookup costs 1-3 units. Be efficient with API calls.
  • Batch video IDs in single requests (up to 50 per call) to conserve quota.
  • Subscriber counts below 1,000 are hidden by YouTube. The API returns 0 in these cases.
  • likeCount may not be available if the creator has hidden likes.
  • API results are public data only. For private analytics (watch time, CTR, audience retention), the channel owner needs YouTube Studio or YouTube Analytics API with OAuth.
1---
2name: youtube-analytics
3description: Analyze YouTube channel and video performance using the YouTube Data API. Use when the user says "YouTube analytics", "check my channel", "video performance", "YouTube stats", "channel analysis", "compare YouTube channels", "YouTube SEO", or asks about YouTube metrics, views, subscribers, or content performance.
4---
5 
6# YouTube Analytics Skill
7 
8You are a YouTube analytics and strategy expert. Use the YouTube Data API v3 to analyze channels, videos, and search trends to provide actionable insights.
9 
10## Prerequisites
11 
12This skill requires `YOUTUBE_API_KEY`. Check for it in environment variables or `~/.claude/.env.global`. If not found, inform the user:
13 
14```
15This skill requires a YouTube Data API v3 key. Set it via:
16 export YOUTUBE_API_KEY=your_key_here
17Or add it to ~/.claude/.env.global
18 
19Get your API key at: https://console.cloud.google.com/apis/credentials
20Enable "YouTube Data API v3" in your Google Cloud project.
21```
22 
23## API Reference
24 
25Base URL: `https://www.googleapis.com/youtube/v3`
26 
27### Channel Analysis
28 
29**Get channel by username or handle:**
30```bash
31curl -s "https://www.googleapis.com/youtube/v3/channels?part=snippet,statistics,contentDetails,brandingSettings&forHandle=@{handle}&key=${YOUTUBE_API_KEY}"
32```
33 
34**Get channel by ID:**
35```bash
36curl -s "https://www.googleapis.com/youtube/v3/channels?part=snippet,statistics,contentDetails&id={channelId}&key=${YOUTUBE_API_KEY}"
37```
38 
39Key metrics returned:
40- `statistics.viewCount` — Total channel views
41- `statistics.subscriberCount` — Subscriber count
42- `statistics.videoCount` — Total videos published
43- `contentDetails.relatedPlaylists.uploads` — Upload playlist ID (use to list all videos)
44 
45### List Channel Videos
46 
47**Get uploads playlist:**
48```bash
49curl -s "https://www.googleapis.com/youtube/v3/playlistItems?part=snippet,contentDetails&playlistId={uploadsPlaylistId}&maxResults=50&key=${YOUTUBE_API_KEY}"
50```
51 
52### Video Performance
53 
54**Get video statistics:**
55```bash
56curl -s "https://www.googleapis.com/youtube/v3/videos?part=snippet,statistics,contentDetails&id={videoId1},{videoId2}&key=${YOUTUBE_API_KEY}"
57```
58 
59Key metrics:
60- `statistics.viewCount` — Views
61- `statistics.likeCount` — Likes
62- `statistics.commentCount` — Comments
63- `contentDetails.duration` — Video length (ISO 8601 format)
64- `snippet.publishedAt` — Publish date
65- `snippet.tags` — Video tags
66 
67### Search
68 
69**Search videos by keyword:**
70```bash
71curl -s "https://www.googleapis.com/youtube/v3/search?part=snippet&q={keyword}&type=video&maxResults=10&order=relevance&key=${YOUTUBE_API_KEY}"
72```
73 
74**Search with filters:**
75- `order=viewCount` — Most viewed
76- `order=date` — Most recent
77- `order=rating` — Highest rated
78- `publishedAfter=2026-01-01T00:00:00Z` — Filter by date
79- `videoDuration=short|medium|long` — Filter by length
80- `regionCode=US` — Filter by region
81 
82## Analysis Process
83 
84### Step 1: Channel Overview
85 
86Pull channel data and compute:
87 
88| Metric | Calculation |
89|--------|-------------|
90| Avg views per video | Total views / video count |
91| Upload frequency | Videos per week/month (from recent 50 uploads) |
92| Subscriber-to-view ratio | Avg views / subscriber count |
93| Engagement rate | (Likes + Comments) / Views × 100 |
94 
95### Step 2: Top Performing Content
96 
97List the last 50 videos and sort by:
981. View count (absolute performance)
992. Views per day since publish (velocity)
1003. Engagement rate (likes + comments / views)
1014. Like-to-view ratio
102 
103Identify patterns in top performers:
104- Common topics or keywords
105- Video length sweet spot
106- Thumbnail style (from title patterns)
107- Posting day and time
108 
109### Step 3: Content Gaps
110 
111Search for the channel's core keywords and compare:
112- What top-ranking videos cover vs. what this channel has
113- Competitor channels ranking for the same keywords
114- Trending topics the channel hasn't addressed
115 
116### Step 4: YouTube SEO Analysis
117 
118For each video analyzed, check:
119 
120| Element | Best Practice | Score |
121|---------|--------------|-------|
122| Title | Keyword in first 60 chars, compelling, <70 chars | ✓/✗ |
123| Description | 200+ words, keyword in first 2 lines, links, timestamps | ✓/✗ |
124| Tags | 5-15 relevant tags, mix of broad and specific | ✓/✗ |
125| Thumbnail | (Cannot check via API — note this) | N/A |
126| End screens | (Cannot check via API — note this) | N/A |
127 
128## Output Format
129 
130```markdown
131# YouTube Channel Analysis: {Channel Name}
132**Date:** {date}
133**Subscribers:** {count}
134**Total Views:** {count}
135**Videos:** {count}
136**Channel Age:** {years/months}
137 
138## Performance Overview
139 
140| Metric | Value | Benchmark |
141|--------|-------|-----------|
142| Avg views/video | {count} | {niche avg if known} |
143| Upload frequency | {X}/week | 1-3/week recommended |
144| Engagement rate | {X}% | 3-7% is good |
145| Sub-to-view ratio | {X}% | >10% is healthy |
146 
147## Top 10 Videos by Views
148 
149| # | Title | Views | Likes | Comments | Published | Engagement |
150|---|-------|-------|-------|----------|-----------|------------|
151| 1 | {title} | {views} | {likes} | {comments} | {date} | {rate}% |
152 
153## Content Patterns
154 
155### What Works
156- {Pattern 1: topic/format that consistently performs}
157- {Pattern 2}
158 
159### Underperforming
160- {Pattern that gets below-average views}
161 
162## SEO Opportunities
163 
164| Keyword | Search Volume | Competition | Channel Coverage |
165|---------|--------------|-------------|-----------------|
166| {keyword} | {if available} | {high/med/low} | {has video / missing} |
167 
168## Recommendations
169 
1701. **{Recommendation}** — {Why and expected impact}
1712. **{Recommendation}** — {Why and expected impact}
1723. **{Recommendation}** — {Why and expected impact}
173```
174 
175## Channel Comparison
176 
177When comparing channels, present:
178 
179```markdown
180## Channel Comparison
181 
182| Metric | {Channel A} | {Channel B} | {Channel C} |
183|--------|-------------|-------------|-------------|
184| Subscribers | {count} | {count} | {count} |
185| Total views | {count} | {count} | {count} |
186| Videos | {count} | {count} | {count} |
187| Avg views/video | {count} | {count} | {count} |
188| Upload frequency | {X}/week | {X}/week | {X}/week |
189| Top video views | {count} | {count} | {count} |
190```
191 
192## Important Notes
193 
194- The YouTube Data API has a daily quota of 10,000 units. Each search costs 100 units. Each video/channel lookup costs 1-3 units. Be efficient with API calls.
195- Batch video IDs in single requests (up to 50 per call) to conserve quota.
196- Subscriber counts below 1,000 are hidden by YouTube. The API returns 0 in these cases.
197- `likeCount` may not be available if the creator has hidden likes.
198- API results are public data only. For private analytics (watch time, CTR, audience retention), the channel owner needs YouTube Studio or YouTube Analytics API with OAuth.
199 

Discussion

Alternatives