Skip to content
Python

Swap linkedin-to-reels for reels-scripting

Charlie Hills341ebe9ada6c
diff --git a/README.md b/README.md
index d44cdf0..6d49829 100644
--- a/README.md
+++ b/README.md
@@ -58,7 +58,7 @@ Run profile-optimizer first. Traffic from posts lands on your profile, so fix th
| Skill | What it does |
|---|---|
-| [linkedin-to-reels](./linkedin-to-reels) | Repurposes top LinkedIn posts into Instagram Reel scripts |
+| [reels-scripting](./reels-scripting) | Reverse-engineers an outlier Reel via Apify + Gemini 2.5 Flash, then writes a new script in your voice from your newsletter |
| [youtube-thumbnail](./youtube-thumbnail) | Builds a branded YouTube thumbnail before you write the script |
## Layer 4: Community
diff --git a/linkedin-to-reels/SKILL.md b/linkedin-to-reels/SKILL.md
deleted file mode 100644
index 17480ff..0000000
--- a/linkedin-to-reels/SKILL.md
+++ /dev/null
@@ -1,183 +0,0 @@
----
-name: linkedin-to-reels
-description: Repurpose top LinkedIn posts into Instagram Reel scripts. Scrapes LinkedIn posts via Apify, ranks by engagement, scrapes competitor Reels to find trending topics, reverse-engineers patterns, writes Reel scripts, and generates a tracker. Use when the user wants to turn LinkedIn content into Instagram Reels.
-disable-model-invocation: false
-user-invocable: true
-argument-hint: [linkedin-profile-url]
-allowed-tools: Read, Grep, Bash(node *), Bash(mkdir *), Bash(open *), Bash(npm *)
----
-
-# LinkedIn to Reels
-
-Repurpose top-performing LinkedIn posts into trend-aligned Instagram Reel scripts.
-
-## Prerequisites
-
-- **APIFY_TOKEN** must be set as an environment variable
-- **Node.js** installed (v18+)
-- The `apify-client` npm package (installed automatically if missing)
-
-If APIFY_TOKEN is not set, ask the user to run: `! export APIFY_TOKEN=their_token_here`
-
-## Arguments
-
-- `$0` — LinkedIn profile URL (required). Example: `https://www.linkedin.com/in/charlie-hills/`
-
-If no argument is provided, ask for the LinkedIn profile URL before proceeding.
-
-## Workflow
-
-Run these steps in order. Confirm the output of each step before moving to the next.
-
-### Step 1: Set up workspace
-
-Create the output directory and install dependencies:
-
-```
-mkdir -p ~/Desktop/Reels
-cd ~/Desktop/Reels
-npm init -y
-npm install apify-client
-```
-
-### Step 2: Scrape LinkedIn posts
-
-Write and run a Node.js script (`~/Desktop/Reels/scrape-posts.js`) that:
-
-1. Uses the `apify-client` package to call actor `harvestapi/linkedin-profile-posts`
-2. Input: `{ profileUrls: [$0], postsLimit: 20 }`
-3. Saves raw JSON to `~/Desktop/Reels/raw-posts.json`
-4. Field mapping for this actor:
- - Post text: `item.content`
- - Reactions: `item.engagement.likes`
- - Comments: `item.engagement.comments`
- - Shares: `item.engagement.shares`
- - Date: `item.postedAt.date`
- - URL: `item.linkedinUrl`
-5. Ranks posts by `reactions + comments` descending
-6. Picks the top 5
-7. Saves `~/Desktop/Reels/top-5-summary.md` with a table and full text of each
-8. Saves `~/Desktop/Reels/top-5.json`
-
-Present the top 5 to the user with rank, engagement, and first line of each post.
-
-### Step 3: Ask for Instagram details
-
-Ask the user:
-
-1. Their Instagram profile URL or handle
-2. A list of competitor Instagram handles in their niche (as many as they want)
-
-### Step 4: Scrape the user's own Reels
-
-Write and run a script (`~/Desktop/Reels/scrape-reels.js`) that:
-
-1. Calls actor `apify/instagram-reel-scraper`
-2. Input: `{ username: ['handle'], resultsLimit: 10 }`
-3. Field mapping:
- - Caption: `item.caption`
- - Views: `item.views` or `item.videoViewCount`
- - Likes: `item.likesCount`
- - Comments: `item.commentsCount`
- - Duration: `item.videoDuration`
- - Date: `item.timestamp`
- - URL: `item.url` or construct from `item.shortCode`
-4. Ranks by views descending
-5. Saves `~/Desktop/Reels/reels-analysis.md` with a table of all 10 and full breakdowns of the top 3
-6. Saves `~/Desktop/Reels/ranked-reels.json`
-
-### Step 5: Reverse-engineer Reel patterns
-
-Analyse the user's top 3 performing Reels. Write `~/Desktop/Reels/pattern-analysis.md` covering:
-
-- **Hook patterns**: How do the top Reels open? Brand names, numbers, provocative statements?
-- **Structure patterns**: Duration, pacing, number of points
-- **CTA patterns**: Comment triggers, follow CTAs, link-in-bio?
-- **Content type**: Tutorial, showcase, personal story, listicle?
-
-Distil into 3-5 concrete rules to apply to the new scripts.
-
-### Step 6: Scrape competitor Reels
-
-Write and run a script (`~/Desktop/Reels/scrape-competitors.js`) that:
-
-1. Calls `apify/instagram-reel-scraper` with all competitor usernames in one batch
-2. Input: `{ username: [array of handles], resultsLimit: 5 }` (5 per account)
-3. Filters results to the last 7 days only
-4. Ranks by views descending, picks top 20
-5. Saves `~/Desktop/Reels/competitor-trends.md` with a table and full captions
-6. Saves `~/Desktop/Reels/top-20-trending.json`
-
-### Step 7: Write Reel scripts
-
-For each of the top 5 LinkedIn posts, create a script file `~/Desktop/Reels/reel-N-[slug].md`:
-
-**Structure:**
-```
-# Reel: [Title]
-
-## Original LinkedIn post (X reactions, Y comments)
-"[first line]" — DD/MM/YYYY
-
-## Patterns applied
-[Which patterns from Step 5 were used]
-
----
-
-## Script (~30-40 seconds)
-
-### HOOK (0-3s)
-[Pattern interrupt. Under 5 seconds. Lead with a brand name + specific number where possible.]
-
-### KEY POINT 1 (3-15s)
-[Core insight from the original post]
-
-### KEY POINT 2 (15-25s)
-[Supporting point or actionable takeaway]
-
-### CTA (25-35s)
-[Comment-trigger keyword + promised deliverable, if that pattern applies]
-
----
-
-**Visual notes:** [Suggested visuals, cuts, text overlays]
-```
-
-**Writing rules:**
-- British English throughout
-- Short sentences. No em dashes. No semicolons.
-- Never use: "leverage", "deep dive", "unlock", "game-changer", "groundbreaking", "tapestry", "landscape", "notably", "furthermore"
-- Conversational tone. Natural sentences, not staccato fragments.
-- Target 30-40 seconds duration
-- 2 key points, not 3 (tighter pacing)
-- One core idea per script
-
-### Step 8: Cross-reference with trends
-
-Write `~/Desktop/Reels/trend-crossref.md` that:
-
-1. Compares each of the 5 scripts against the top 20 trending competitor Reels
-2. Flags topic overlaps (strong / moderate / low)
-3. Assigns a priority order (1-5) based on trend alignment
-4. Explains why each script ranks where it does
-5. Includes bonus observations from the competitor data
-
-### Step 9: Build the tracker
-
-Create `~/Desktop/Reels/tracker.html` — a single-file HTML tracker with:
-
-- Dark theme UI
-- One row per script, sorted by trend priority
-- Columns: Priority (#), Script title, Hook, Trend overlap badge, Status dropdown (To record / Recorded / Posted), Post date picker, Notes (editable textarea)
-- Pre-fill notes with trend overlap insights
-- Auto-save to localStorage on every change
-- Open the file in the browser when done
-
-### Step 10: Present results
-
-Summarise to the user:
-- Top 5 LinkedIn posts selected and why
-- Key patterns found in their existing Reels
-- Priority order based on competitor trends
-- Remind them the tracker is open in their browser
-- Ask what they want to adjust
diff --git a/reels-scripting/SKILL.md b/reels-scripting/SKILL.md
new file mode 100644
index 0000000..ddf87d9
--- /dev/null
+++ b/reels-scripting/SKILL.md
@@ -0,0 +1,201 @@
+---
+name: reels-scripting
+description: >
+ Turn a reference Instagram Reel into a script for your own Reel, tuned to your voice and repurposed from your newsletter content. Takes a Reel URL or Notion reference link, uses Apify to scrape the video, sends it to Gemini 2.5 Flash for full transcript + hook + structure analysis, then writes a new script applying the same patterns to your newsletter topic. Use this skill whenever the user says "script a reel", "reels scripting", "turn this into a reel", pastes an Instagram Reel URL, or references their Notion outlier reels database. Requires APIFY_API_TOKEN and GOOGLE_AI_API_KEY environment variables.
+---
+
+# Reels Scripting
+
+## CRITICAL: Auto-start on load
+
+When this skill triggers, go straight to Step 1. Do not summarise.
+
+## Prerequisites
+
+This skill needs:
+
+- `APIFY_API_TOKEN` environment variable (Instagram scraping)
+- `GOOGLE_AI_API_KEY` environment variable (Gemini 2.5 Flash video analysis)
+- Node.js 18+ and the `apify-client` and `@google/generative-ai` packages
+
+If either env var is missing, tell the user to run:
+
+```
+! export APIFY_API_TOKEN=your_token
+! export GOOGLE_AI_API_KEY=your_key
+```
+
+Then stop until both are set.
+
+## Step 1. Get the reference
+
+Ask:
+
+> Paste the reference Reel URL or Notion link. This is the outlier Reel you want to reverse-engineer the format from.
+
+Wait for the URL.
+
+If the user pastes a Notion link, follow it via WebFetch, locate the Instagram Reel URL on the page, and extract it. If no Reel URL is found on the Notion page, ask the user to paste the Reel URL directly.
+
+## Step 2. Get the newsletter topic
+
+Ask:
+
+> What's the topic from your newsletter you want to repurpose into this Reel? Paste the relevant newsletter section, or type the core idea in a sentence.
+
+Wait for the topic. Read newsletter-voice.md, voice.md, and about-me.md from the project if they exist, so the script matches the user's voice.
+
+## Step 3. Scrape and download the Reel
+
+Create `~/Desktop/Reels/` if it does not exist. Write a Node.js script at `~/Desktop/Reels/analyse-reel.js` that:
+
+1. Uses `apify-client` to call `apify/instagram-reel-scraper` with `{ directUrls: [reelUrl], resultsLimit: 1 }`. If that returns no items, fall back to `{ urls: [reelUrl], resultsLimit: 1 }`, then `apify/instagram-scraper` with `{ directUrls: [reelUrl], resultsType: 'posts', resultsLimit: 1 }`.
+2. Extracts `videoUrl` from the returned item.
+3. Downloads the video to `~/Desktop/Reels/downloads/{username}_{shortCode}.mp4`.
+4. Saves raw scrape data to `~/Desktop/Reels/reel_data_{shortCode}.json`.
+
+Run the script. Confirm file size and metadata (views, likes, comments, caption first 200 chars) before continuing.
+
+## Step 4. Analyse with Gemini 2.5 Flash
+
+Extend the Node script (or run a second pass) that:
+
+1. Reads the downloaded `.mp4` as base64.
+2. Calls `genAI.getGenerativeModel({ model: 'gemini-2.5-flash' })`.
+3. Sends the video with this exact prompt:
+
+```
+I'm studying this Reel to write my own script in a similar style for my audience of [AUDIENCE FROM about-me.md].
+
+## Full Transcript
+- Transcribe EVERY word with timestamps
+
+## Hook
+- Exact first words spoken
+- Word count of the hook
+- What makes it stop the scroll?
+
+## Language Patterns
+- Average sentence length
+- You/your vs I/me ratio
+- Transitions between points
+- Where are the 'just' minimisers?
+
+## Structure
+- Total duration
+- Section breakdown with timings
+- What's the before/after moment?
+- What's the CTA?
+
+## One key insight
+- The single most important technique to learn from this Reel
+```
+
+Save the analysis to `~/Desktop/Reels/analysis_reference_{shortCode}.md`.
+
+## Step 5. Write the new Reel script
+
+Using the analysis from Step 4, the newsletter topic from Step 2, and the user's voice files, write a new Reel script to `~/Desktop/Reels/reel-[slug].md`.
+
+Apply these rules (non-negotiable):
+
+### Hook
+- Never open with "I". Use "this", "you", a fact, or a name drop.
+- Proven formats: "This changed... forever" / negative flip ("X is useless unless...") / capability statement.
+- Hook creates curiosity or pattern interrupt within 3 seconds.
+- Mirror the hook's word count and structure from the reference analysis.
+
+### Body
+- British English. Short sentences. No em dashes, no semicolons.
+- Use "you" and "just" conversationally ("you just drop in...").
+- Never merge three or more staccato fragments. Combine into one flowing sentence.
+- Never state the conclusion. Let the facts do the work.
+- No "link in bio". Use comment automation.
+
+### Comment trigger
+- Single caps word only (SCRIPT, WIKI, PROMPTS, VIDEO).
+- Must directly relate to what is being promised.
+- No quotes, no "below", no trailing punctuation.
+
+### CTA
+- "Comment [WORD] and I'll send you [specific thing]"
+- Short. No "the link to my full" padding.
+
+### Duration and structure
+- Target 30 to 45 seconds total.
+- 2 key points maximum, not 3.
+- Caption mirrors the script. Update both together.
+
+### Script file structure
+
+```
+# Reel: [title]
+
+## Reference analysis
+- URL: [reel url]
+- Views: [number]
+- Key technique: [from Gemini analysis]
+
+## Duration target
+30-45 seconds
+
+## Hook (0-3s)
+[Exact words]
+
+## Point 1 ([start]-[end]s)
+[Exact words]
+
+## Point 2 ([start]-[end]s)
+[Exact words]
+
+## CTA ([start]-[end]s)
+[Exact words including "Comment [WORD]"]
+
+---
+
+## Caption
+[Mirror the script, formatted for Instagram]
+
+## Comment trigger
+[WORD]
+
+## Deliverable
+[What the comment trigger unlocks]
+
+---
+
+## Visual notes
+[Cuts, B-roll ideas, text overlays]
+```
+
+## Step 6. QA loop
+
+Score the script against the rules in Step 5. Every violation must be fixed. Re-score until the script hits 95/100. Never show the user anything below 95.
+
+Common violations to check:
+- Opens with "I"
+- Staccato fragments of three or more
+- States the conclusion
+- Multi-word or stylised comment trigger
+- Duration over 45 seconds when read aloud
+- 3 points instead of 2
+- Caption does not mirror script
+
+## Step 7. Offer the pipeline
+
+After the script is approved, offer:
+
+> Two paths from here:
+>
+> 1. Record it yourself.
+> 2. Auto-generate with ElevenLabs (voice) + HeyGen (avatar) + Remotion (motion graphics). If you have the my-video project configured, run `npm run pipeline:claude-routines` with this script config.
+
+## Rules
+
+- Never skip the 95/100 QA gate.
+- Always read voice.md and about-me.md before writing. Voice match is non-negotiable.
+- Never invent metrics from the reference Reel. Use only what Apify returns.
+- British English. No em dashes. No semicolons.
+- Every script deliverable includes the exact caption and comment trigger alongside the script. Never deliver just the script.
+- If the reference Reel scrape fails across all three actor variants, report the failure and stop. Do not fabricate analysis.
+- Gemini 2.5 Flash is the model. Do not substitute without the user's approval.