| name | video-transcript |
| description | Use this skill whenever the user provides a YouTube URL and wants the spoken content as a transcript or Word document. Triggers include: any YouTube link combined with words like '講稿', '字幕', '逐字稿', '整理', 'transcript', 'script', 'transcribe', '幫我整理', '轉成文字', or '翻譯'. Also trigger when the user pastes a youtu.be / youtube.com URL alongside any request to read, summarize, or document the content — even if they don't use exact keywords. Additionally trigger when the user pastes a block of subtitle/caption text (with or without timestamps) and asks to turn it into a clean document or translate it. Always use this skill for any YouTube-to-document workflow — do NOT handle it ad hoc.
|
Video Transcript Skill
Extracts spoken content from YouTube videos and delivers polished Word (.docx) documents:
- 逐字稿 — verbatim, timestamped
- 整理版 — cleaned up, sectioned, with headings
- For non-Chinese videos: both an 原文版 and a 正體中文版 (two separate .docx files)
Step 1 — 取得字幕文字
Claude.ai 環境說明
Claude.ai 網頁版無法直接抓取 YouTube 字幕 API(fetch 受環境限制)。正確流程是由使用者複製字幕文字後貼入對話。
判斷使用者是否已貼上文字
情況 A:使用者只貼了 YouTube URL,沒有附上文字
立即回覆以下引導說明(語氣親切、步驟清楚):
收到影片連結!要製作講稿,需要先把字幕文字複製給我。以下是最快的方式:
方法一:YouTube 內建字幕複製(最簡單,30 秒完成)
- 在電腦瀏覽器開啟影片
- 點影片下方「⋯」(更多)→「開啟逐字稿」
- 右上角點「⋮」→「切換時間戳記」(可關閉時間戳,讓文字更乾淨)
- 全選文字(Ctrl+A)→ 複製(Ctrl+C)→ 貼到這裡
方法二:沒有「開啟逐字稿」選項?
表示影片沒有字幕。可改用:
把複製好的文字貼回來,我馬上幫你製作 Word 講稿 ✦
Stop here and wait. Do not proceed without actual transcript text.
情況 B:使用者同時提供了 URL 和文字內容
直接進入 Step 2,不需要再詢問。
情況 C:使用者貼了字幕文字但沒有 URL
也直接進入 Step 2。記錄影片標題為「未知」,在文件 header 說明來源不明。
Step 2 — Detect Language & Plan Output
Once you have the raw transcript text:
- Detect the primary language of the content (not the metadata/title — the spoken content).
- Decide output plan:
| 語言 | 輸出文件 |
|---|
| 繁體/簡體中文 | 2 個 .docx:逐字稿、整理版(均為中文) |
| 英文 / 日文 / 其他 | 4 個 .docx:原文逐字稿、原文整理版、正體中文逐字稿、正體中文整理版 |
Tell the user the plan before proceeding:
偵測到影片語言為【English】,將產出 4 份文件:原文逐字稿、原文整理版、正體中文逐字稿、正體中文整理版。
Step 3 — Prepare Both Text Versions
逐字稿版 (Verbatim)
- Keep all words, including filler words (um, uh, 那個, 就是) — but remove repeated stutters like "I I I"
- Add timestamps every ~2 minutes:
[00:02:15]
- Do NOT add headings or restructure
- Minimal cleanup only: fix obvious ASR errors where context is unambiguous
整理版 (Edited)
- Remove filler words, false starts, repetitions
- Break into logical sections with Heading 2 titles (infer from content)
- Write a brief 摘要 (Summary) at the top (3–5 sentences)
- Fix punctuation and sentence breaks
- Preserve the speaker's meaning and terminology faithfully — do not paraphrase aggressively
正體中文版 (if needed)
- Translate the above two versions into 正體中文 (Traditional Chinese)
- Use natural, fluent 繁體中文 — not word-for-word translation
- Preserve technical terms; add original term in parentheses on first use:
機器學習 (machine learning)
- Timestamps in 逐字稿 should be preserved
Step 4 — Create .docx Files
Use the docx npm package. For each document, follow the docx skill conventions.
Document Structure
Header (all documents):
影片來源:[YouTube URL]
影片標題:[title from page metadata if available]
產出日期:[today's date]
文件類型:逐字稿 / 整理版
語言:原文 (English) / 正體中文版
Page setup: A4, margins 2cm all sides (2835 DXA), font: "Microsoft JhengHei" for Chinese content, "Arial" for English content.
Styles:
- Title: 18pt bold
- Heading 1: 14pt bold (document sections like 摘要, 逐字稿內容)
- Heading 2: 12pt bold (content sections in 整理版)
- Body: 11pt, line spacing 1.5
- Timestamps: 9pt, grey color
999999, inline with text
File naming:
[VideoTitle]_逐字稿.docx
[VideoTitle]_整理版.docx
[VideoTitle]_EN_逐字稿.docx ← only for non-Chinese videos
[VideoTitle]_EN_整理版.docx ← only for non-Chinese videos
Use the video title (up to 30 chars, sanitized — no /\:*?"<>|).
docx-js scaffold (A4, Traditional Chinese)
const { Document, Packer, Paragraph, TextRun, HeadingLevel, AlignmentType } = require('docx');
const fs = require('fs');
const doc = new Document({
styles: {
default: { document: { run: { font: "Microsoft JhengHei", size: 22 } } },
paragraphStyles: [
{ id: "Heading1", name: "Heading 1", basedOn: "Normal", next: "Normal",
run: { size: 28, bold: true, font: "Microsoft JhengHei" },
paragraph: { spacing: { before: 240, after: 120 }, outlineLevel: 0 } },
{ id: "Heading2", name: "Heading 2", basedOn: "Normal", next: "Normal",
run: { size: 24, bold: true, font: "Microsoft JhengHei" },
paragraph: { spacing: { before: 180, after: 90 }, outlineLevel: 1 } },
]
},
sections: [{
properties: {
page: {
size: { width: 11906, height: 16838 },
margin: { top: 1134, right: 1134, bottom: 1134, left: 1134 }
}
},
children: [ ]
}]
});
Packer.toBuffer(doc).then(buf => fs.writeFileSync("output.docx", buf));
Timestamp rendering (逐字稿)
new Paragraph({
children: [
new TextRun({ text: "[00:02:15] ", color: "999999", size: 18 }),
new TextRun({ text: "實際講稿內容從這裡開始...", size: 22 }),
],
spacing: { line: 360 }
})
Validate each file
python /mnt/skills/public/docx/scripts/office/validate.py output.docx
Step 5 — Deliver to User
- Copy all output files to
/mnt/user-data/outputs/
- Call
present_files with all files
- Give the user a brief summary:
- Video title and detected language
- Number of files produced
- Approximate word count of the transcript
- Any caveats (e.g., "部分時間戳可能有誤差,建議對照原影片確認")
Edge Cases
| 情況 | 處理方式 |
|---|
| 字幕為自動產生(ASR) | 在文件 header 標註「字幕來源:YouTube 自動產生,可能含辨識錯誤」 |
| 影片超過 60 分鐘 | 整理版每 15 分鐘為一個 Heading 1 大節 |
| 多語言混合(如台灣中英夾雜) | 以主要語言判斷;在正體中文版保留英文專有名詞 |
| 字幕有廣告/贊助段落 | 在逐字稿保留,整理版可標註「[贊助段落]」並縮排 |
| 影片為 Shorts(< 3 分鐘) | 只產出整理版一份,不做逐字稿(告知用戶) |