refresh-content
Guide content sync operations for X posts and YouTube videos. Use when user mentions "refresh feed", "sync posts", "update videos", "fetch latest", or asks about content pipeline.
When & Why to Use This Skill
This Claude skill streamlines the synchronization of social media content, enabling automated updates for X (Twitter) posts and YouTube videos. It provides a robust framework for managing content pipelines, triggering API-driven refreshes, and ensuring data consistency between external social platforms and your internal database.
Use Cases
- Real-time Feed Synchronization: Automatically update your application's social feeds by fetching the latest posts and videos from X and YouTube via secure admin API endpoints.
- AI-Powered Content Summarization: Enhance your video library by triggering automated summaries for newly synced YouTube content using integrated OpenAI workflows.
- Content Pipeline Management: Monitor and maintain data freshness by checking last-fetch timestamps and executing manual refreshes to resolve synchronization gaps.
- Social Media Engagement Tracking: Sync X mentions and interactions to maintain an up-to-date record of brand engagement and community activity within your local environment.
| name | refresh-content |
|---|---|
| description | Guide content sync operations for X posts and YouTube videos. Use when user mentions "refresh feed", "sync posts", "update videos", "fetch latest", or asks about content pipeline. |
| allowed-tools | Read, Glob, Grep, Bash |
Refresh Content
Guide for refreshing X (Twitter) and YouTube content via admin endpoints.
Instructions
Check current cache status:
- Read
src/lib/db.tsforgetLastFetchedAt*functions - Query database for last fetch timestamps
- Read
Available refresh endpoints (POST requests):
X Posts:
curl -X POST http://localhost:3000/api/admin/refresh/x-postsX Mentions:
curl -X POST http://localhost:3000/api/admin/refresh/x-mentionsYouTube Videos:
curl -X POST http://localhost:3000/api/admin/refresh/youtube-videosVideo Summaries (requires OpenAI):
curl -X POST http://localhost:3000/api/admin/refresh/video-summariesFor production, use the deployed URL instead of localhost
Check responses for success/count:
{ "success": true, "message": "Refreshed 15 posts", "count": 15 }
Data Flow
- Admin triggers POST to refresh endpoint
- API calls external source (XAI for X, YouTube API)
- Data parsed and validated
- Upserted to database with
fetched_attimestamp - Frontend fetches from
/api/x/postsor/api/youtube/videos
Troubleshooting
No data returned:
- Check API keys in
.env.local:XAI_API_KEY,YOUTUBE_API_KEY - Verify rate limits not exceeded
JSON parse errors (X posts):
- XAI sometimes returns malformed JSON
- Check
src/lib/xai.tsfor sanitization logic
YouTube filtering:
- Shorts (<=180s) and livestreams are automatically excluded
- See
src/lib/youtube.tsfor filter logic
Examples
- "Refresh the X posts feed"
- "Sync latest YouTube videos"
- "Check when content was last updated"
Guardrails
- Do NOT purge data without explicit confirmation
- Run one refresh at a time to avoid rate limits
- Check environment variables are set before calling endpoints
- Never expose API keys in logs or responses