mk-youtube-transcript-summarize

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

YouTube Video Summary

YouTube视频摘要

Generate a structured, high-quality summary of a YouTube video from its transcript.
从YouTube视频的转录文件生成结构化、高质量的摘要。

Quick Start

快速开始

/mk-youtube-transcript-summarize <transcript_file_path> [--force]
/mk-youtube-transcript-summarize --check <URL_or_video_id>
/mk-youtube-transcript-summarize <transcript_file_path> [--force]
/mk-youtube-transcript-summarize --check <URL_or_video_id>

Parameters

参数

ParameterRequiredDefaultDescription
transcript_file_pathYes*-Path to transcript file (.txt). *Not needed with
--check
.
--forceNofalseForce re-generate summary even if cached file exists
--checkNofalseCheck if summary exists for a URL or video_id (no transcript file needed)
参数是否必填默认值说明
transcript_file_path是*-转录文件(.txt)的路径。*使用
--check
时无需提供。
--forcefalse即使缓存文件已存在,强制重新生成摘要
--checkfalse检查指定URL或video_id是否已有摘要(无需转录文件)

Examples

示例

  • /mk-youtube-transcript-summarize /path/to/captions/20091025__dQw4w9WgXcQ.en.txt
  • /mk-youtube-transcript-summarize /path/to/transcribe/20091025__dQw4w9WgXcQ.txt
Typical workflow:
/mk-youtube-get-caption https://youtube.com/watch?v=xxx
→ outputs transcript file path

/mk-youtube-transcript-summarize /path/to/captions/20091025__VIDEO_ID.en.txt
→ generates structured summary saved to {baseDir}/data/20091025__VIDEO_ID.en.md
  • /mk-youtube-transcript-summarize /path/to/captions/20091025__dQw4w9WgXcQ.en.txt
  • /mk-youtube-transcript-summarize /path/to/transcribe/20091025__dQw4w9WgXcQ.txt
典型工作流程:
/mk-youtube-get-caption https://youtube.com/watch?v=xxx
→ 输出转录文件路径

/mk-youtube-transcript-summarize /path/to/captions/20091025__VIDEO_ID.en.txt
→ 生成结构化摘要并保存到 {baseDir}/data/20091025__VIDEO_ID.en.md

Check Mode

检查模式

Check if a cached summary exists without requiring a transcript file:
/mk-youtube-transcript-summarize --check <URL_or_video_id>
无需转录文件,检查指定视频是否已有缓存的摘要:
/mk-youtube-transcript-summarize --check <URL_or_video_id>

Check Mode Examples

检查模式示例

  • /mk-youtube-transcript-summarize --check https://youtube.com/watch?v=dQw4w9WgXcQ
  • /mk-youtube-transcript-summarize --check dQw4w9WgXcQ
  • /mk-youtube-transcript-summarize --check https://youtube.com/watch?v=dQw4w9WgXcQ
  • /mk-youtube-transcript-summarize --check dQw4w9WgXcQ

Check Mode Output

检查模式输出

Summary exists:
json
{
  "status": "success",
  "exists": true,
  "output_summary": "{baseDir}/data/20091025__dQw4w9WgXcQ.en.md",
  "summary_char_count": 5000,
  "summary_line_count": 120,
  "video_id": "dQw4w9WgXcQ",
  "title": "Video Title",
  "channel": "Channel Name",
  "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
}
Summary does not exist:
json
{
  "status": "success",
  "exists": false,
  "video_id": "dQw4w9WgXcQ",
  "title": "",
  "channel": "",
  "url": ""
}
When
exists: true
, read the summary file at
output_summary
and display its COMPLETE content (Full Display Rule applies).
摘要已存在:
json
{
  "status": "success",
  "exists": true,
  "output_summary": "{baseDir}/data/20091025__dQw4w9WgXcQ.en.md",
  "summary_char_count": 5000,
  "summary_line_count": 120,
  "video_id": "dQw4w9WgXcQ",
  "title": "Video Title",
  "channel": "Channel Name",
  "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
}
摘要不存在:
json
{
  "status": "success",
  "exists": false,
  "video_id": "dQw4w9WgXcQ",
  "title": "",
  "channel": "",
  "url": ""
}
exists: true
时,读取
output_summary
路径下的摘要文件,并完整展示其全部内容(需遵循完整展示规则)。

How it Works

工作原理

  1. Execute:
    {baseDir}/scripts/summary.sh "<transcript_file_path>"
    (normal mode) OR:
    {baseDir}/scripts/summary.sh --check "<URL_or_video_id>"
    (check mode)
  2. Parse JSON output to get
    source_transcript
    ,
    output_summary
    ,
    char_count
    , and
    strategy
  3. Follow the Processing Strategy indicated by
    strategy
    field
  4. Generate a structured summary following the Summary Generation Rules
  5. Save to
    {baseDir}/data/<basename>.md
    using Write tool (use
    output_summary
    path from JSON)
  6. Display the FULL summary content to the user exactly as written to the file — do NOT abbreviate, condense, or re-summarize
  7. Include file path in response footer
  1. 执行:
    {baseDir}/scripts/summary.sh "<transcript_file_path>"
    (普通模式) 或:
    {baseDir}/scripts/summary.sh --check "<URL_or_video_id>"
    (检查模式)
  2. 解析JSON输出,获取
    source_transcript
    output_summary
    char_count
    strategy
  3. 按照
    strategy
    字段指定的处理策略执行
  4. 遵循摘要生成规则生成结构化摘要
  5. 使用Write工具将摘要保存到
    {baseDir}/data/<basename>.md
    (使用JSON输出中的
    output_summary
    路径)
  6. 向用户完整展示摘要内容,与文件中写入的内容完全一致——不得缩写、压缩或重新摘要
  7. 在响应末尾包含文件路径

Processing Strategy

处理策略

The
strategy
field from
summary.sh
determines how to handle the transcript:
summary.sh
返回的
strategy
字段决定了转录文件的处理方式:

Strategy:
standard
(< 80,000 chars, ~2 hr EN)

策略:
standard
(少于80,000字符,约2小时英文内容)

  • Read the entire file with the Read tool
  • Directly apply Summary Generation Rules
  • 使用Read工具读取整个文件
  • 直接应用摘要生成规则

Strategy:
sectioned
(80,000–200,000 chars, ~2 hr – 5 hr EN)

策略:
sectioned
(80,000–200,000字符,约2-5小时英文内容)

Use a structured multi-phase approach within the main conversation to counter lost-in-middle effects:
  1. Read the entire file with the Read tool
  2. Phase 1 — Segment identification: Identify 5-10 major section boundaries (topic shifts, speaker changes, chapter markers) and list them
  3. Phase 2 — Section-by-section extraction: For each identified section, extract key points, data, quotes, and arguments
  4. Phase 2.5 — Topic grouping (if > 6 sections identified):
    • Group related sections into 4-6 macro-topics (e.g., "Background & Context", "Core Argument", "Evidence & Examples", "Implications")
    • Under each macro-topic, aggregate the key points from its constituent sections
    • This reduces synthesis pressure in Phase 3 by providing pre-organized intermediate structure
  5. Phase 3 — Synthesis: Compose the final structured summary from the macro-topics (or directly from sections if ≤ 6), ensuring every identified section is represented
  6. Cross-check: Verify that mid-content sections are not underrepresented compared to the beginning and end
采用结构化的多阶段方法处理,避免内容过长导致的信息丢失:
  1. 读取:使用Read工具读取整个文件
  2. 阶段1——识别分段:识别5-10个主要分段边界(主题切换、发言者变更、章节标记)并列出
  3. 阶段2——逐段提取:针对每个识别出的分段,提取关键点、数据、引用和论点
  4. 阶段2.5——主题分组(如果识别出超过6个分段):
    • 将相关分段分组为4-6个宏观主题(例如“背景与上下文”、“核心论点”、“证据与示例”、“影响意义”)
    • 在每个宏观主题下,汇总其包含的分段的关键点
    • 通过提供预组织的中间结构,降低阶段3的合成压力
  5. 阶段3——合成:根据宏观主题(如果分段数≤6则直接基于分段)撰写最终的结构化摘要,确保每个识别出的分段都有体现
  6. 交叉检查:验证中间内容分段的代表性是否与开头和结尾一致,避免被忽略

Strategy:
chunked
(> 200,000 chars, > 5 hr EN)

策略:
chunked
(超过200,000字符,超过5小时英文内容)

Use parallel subagents to process chunks independently, keeping the main conversation context clean:
  1. Calculate chunk count:
    ceil(line_count / 1000)
    — each chunk is ~1000 lines
  2. Spawn parallel subagents using the Task tool (
    subagent_type: "general-purpose"
    ):
    • Each subagent receives: the file path, start line offset, end line limit, and summarization instructions
    • Chunk overlap: Each chunk includes a 50-line overlap with the previous chunk for context continuity (chunk 1: lines 1–1000, chunk 2: lines 951–2000, chunk 3: lines 1951–3000, etc.). The first chunk has no leading overlap.
    • Each subagent prompt:
      Read the file at {file_path} from line {start_offset} to line {end_limit} using the Read tool (with offset and limit parameters).
      Then produce a summary of this section with 5-10 bullet points covering:
      - Main topics and arguments discussed
      - Key data points (numbers, dates, names) in plain text
      - Use sub-bullets for supporting details under a main point (max 2 levels)
      - Notable quotes as blockquotes
      Write the summary in the same language as the transcript (this will be synthesized into the user's language in the final step).
      IMPORTANT — Boundary continuity: If the beginning of your chunk clearly continues a topic from a previous section, prefix your first bullet with [continues from previous]. If the end of your chunk is mid-topic and clearly continues into the next section, suffix your last bullet with [continues to next]. This helps the synthesis step merge cross-chunk topics.
    • Use
      model: "haiku"
      for cost efficiency
  3. Collect all subagent section summaries
  4. Synthesize a final structured summary in the main conversation following the Summary Generation Rules
    • During synthesis, check for
      [continues from previous]
      and
      [continues to next]
      markers across adjacent chunks — merge bullets that belong to the same topic into a single coherent section rather than repeating them
使用并行子代理独立处理分块内容,保持主对话上下文清晰:
  1. 计算分块数量:
    ceil(line_count / 1000)
    ——每个分块约1000行
  2. 生成并行子代理:使用Task工具(
    subagent_type: "general-purpose"
    • 每个子代理将收到:文件路径、起始行偏移、结束行限制和摘要说明
    • 分块重叠:每个分块与前一个分块重叠50行,保证上下文连续性(分块1:第1–1000行,分块2:第951–2000行,分块3:第1951–3000行等。第一个分块无前缀重叠)
    • 每个子代理的提示:
      使用Read工具(指定offset和limit参数)读取{file_path}文件中从第{start_offset}行到第{end_limit}行的内容。
      然后生成该分段的摘要,包含5-10个要点,涵盖:
      - 讨论的主要主题和论点
      - 关键数据点(数字、日期、名称),以纯文本呈现
      - 主点下的支持细节使用子项目符号(最多2级)
      - 重要引用使用块引用格式
      摘要使用与转录文件相同的语言撰写(最终步骤会将其合成为用户使用的语言)。
      重要——边界连续性:如果你的分块开头明显延续了前一个分段的主题,请在第一个项目符号前添加[continues from previous]。如果你的分块结尾处于主题中途,明显延续到下一个分段,请在最后一个项目符号后添加[continues to next]。这有助于合成步骤合并跨分块的主题。
    • 使用
      model: "haiku"
      以降低成本
  3. 收集所有子代理生成的分段摘要
  4. 合成:在主对话中遵循摘要生成规则,生成最终的结构化摘要
    • 合成过程中,检查相邻分块的
      [continues from previous]
      [continues to next]
      标记——将属于同一主题的项目符号合并为一个连贯的分段,避免重复

Fallback Rules

回退规则

  • Missing or unknown strategy: If the
    strategy
    field is missing, empty, or contains an unrecognized value, default to the
    standard
    strategy
  • Chunked subagent retry: If a subagent in
    chunked
    mode returns an empty result or clearly irrelevant content (e.g., error messages instead of summary bullets), retry that specific chunk once before proceeding with synthesis
  • 缺失或未知策略:如果
    strategy
    字段缺失、为空或包含未识别的值,默认使用
    standard
    策略
  • 分块子代理重试:如果
    chunked
    模式下的子代理返回空结果或明显无关的内容(例如错误信息而非摘要项目符号),在继续合成前重试该分块一次

Summary Generation Rules

摘要生成规则

After obtaining the transcript, generate the summary using EXACTLY this structure and rules:
获取转录文件后,必须严格按照以下结构和规则生成摘要:

Output Structure

输出结构

markdown
undefined
markdown
undefined

Video Info (optional)

视频信息(可选)

FieldValue
Title{title}
Channel{channel}
Duration{duration_string}
Views{view_count, formatted with commas}
Upload Date{upload_date, formatted as YYYY-MM-DD}
Subtitle{subtitle_type} ({transcript_language})
URL{url}
字段
标题{title}
频道{channel}
时长{duration_string}
播放量{view_count, 带逗号格式化}
上传日期{upload_date, 格式化为YYYY-MM-DD}
字幕{subtitle_type} ({transcript_language})
链接{url}

Content Summary

内容摘要

{Section Title 1}

{分段标题1}

  • Main point expressed concisely
    • Supporting detail or data point
  • Another independent point
  • ...
  • 简洁表达的主论点
    • 支持细节或数据点
  • 另一个独立论点
  • ...

{Section Title 2}

{分段标题2}

  • ...
(Continue for all logical sections)
  • ...
(按逻辑分段继续)

Key Takeaways

核心要点

  • 5-8 most important conclusions or insights from the video
undefined
  • 从视频中提取的5-8个最重要的结论或见解
undefined

Video Info Table

视频信息表格

  • Include the Video Info table if
    /mk-youtube-get-info
    results are available in the current conversation context
  • Omit the table if no metadata is available (proceed directly to Content Summary)
  • 如果当前对话上下文有
    /mk-youtube-get-info
    的结果,包含视频信息表格
  • 如果没有可用元数据,省略该表格(直接进入内容摘要)

Content Rules

内容规则

  1. Section structure: Divide the summary into logical sections using H4 (
    ####
    ) headings
    • If the video description contains chapter timestamps, use those as the section skeleton
    • Otherwise, identify 5-10 logical topic shifts in the transcript
    • Each section should have 3-7 bullet points
    • Prefer more sections with focused content over fewer sections with broad content
    Bullet formatting:
    • Each bullet should express one main point concisely (target: under 60 characters for CJK, under 120 characters for English)
    • When a bullet has 2+ supporting details (data, examples, sub-arguments), use second-level sub-bullets
    • NEVER nest beyond 2 levels (no sub-sub-bullets)
    • When details are independent facts without a shared parent topic, keep them as separate top-level bullets
    Ordering:
    • Arrange sections in the order topics appear in the video (chronological/narrative flow)
    • Within each section, list bullets in the order they were discussed in the transcript (source order)
    • Do NOT reorder bullets by perceived importance — preserve the speaker's narrative progression
  2. Data preservation: Always preserve specific data points in plain text
    • Percentages, dollar amounts, dates, statistics — include as-is, no formatting
    • Person names, company names, product names — include as-is, no formatting
    • Direct quotes that are impactful → use blockquote format
    • Do NOT use inline bold (
      **text**
      ) anywhere in the summary body (Content Summary and Key Takeaways sections)
  3. Language: Write the summary in the user's conversation language
    • Detect the language the user is using in the current conversation
    • Write the entire summary (section titles, bullet points, key takeaways) in that language
    • Example: If user speaks Traditional Chinese, summarize in 繁體中文 regardless of transcript language
  4. Length: Target compression ratio based on processing strategy:
    StrategyCompressionGuideline
    standard
    20-30%Short content, detailed coverage
    sectioned
    15-20%Medium-long content, balanced density
    chunked
    10-15%Very long content, high-level synthesis
  5. Tone: Maintain an informative, neutral tone
    • Present the speaker's arguments faithfully
    • Do not add opinions or editorial commentary
    • Use active voice
  6. Key Takeaways: End with 5-8 bullet points summarizing the most important insights
    • These should be standalone — understandable without reading the full summary
    • Prioritize actionable insights and surprising findings
    • Order by importance/impact (most significant insight first, descending)
  1. 分段结构:使用H4(
    ####
    )标题将摘要划分为逻辑分段
    • 如果视频描述包含章节时间戳,将其作为分段框架
    • 否则,识别转录文件中的5-10个逻辑主题切换点
    • 每个分段应有3-7个项目符号
    • 优先选择更多聚焦内容的分段,而非更少涵盖广泛内容的分段
    项目符号格式:
    • 每个项目符号应简洁表达一个主论点(目标:中文不超过60字符,英文不超过120字符)
    • 当一个主论点有2个以上支持细节(数据、示例、子论点)时,使用二级子项目符号
    • 绝不嵌套超过2级(无三级子项目符号)
    • 如果细节是独立事实,无共同父主题,则保留为顶级项目符号
    排序:
    • 按视频中主题出现的顺序排列分段(时间/叙事顺序)
    • 在每个分段内,按转录文件中讨论的顺序列出项目符号(原文顺序)
    • 不得按重要性重新排序项目符号——保留发言者的叙事流程
  2. 数据保留:始终以纯文本形式保留特定数据点
    • 百分比、金额、日期、统计数据——原样保留,不添加格式
    • 人名、公司名、产品名——原样保留,不添加格式
    • 有影响力的直接引用→使用块引用格式
    • 摘要主体(内容摘要和核心要点部分)不得使用内联加粗(
      **text**
  3. 语言:使用用户对话的语言撰写摘要
    • 检测用户在当前对话中使用的语言
    • 整个摘要(分段标题、项目符号、核心要点)都使用该语言撰写
    • 示例:如果用户使用繁体中文,无论转录文件语言如何,都用繁體中文撰写摘要
  4. 长度:根据处理策略确定目标压缩比:
    策略压缩比指南
    standard
    20-30%短内容,详细覆盖
    sectioned
    15-20%中长内容,平衡密度
    chunked
    10-15%超长内容,高层级合成
  5. 语气:保持信息性、中立的语气
    • 如实呈现发言者的论点
    • 不得添加个人观点或编辑评论
    • 使用主动语态
  6. 核心要点:结尾用5-8个项目符号总结最重要的见解
    • 这些要点应独立可懂,无需阅读完整摘要
    • 优先选择可操作的见解和意外发现
    • 按重要性/影响力排序(最重要的见解在前,依次递减)

Save Summary to File

将摘要保存到文件

After generating the summary, save it to the skill-local
data/
directory
using the Write tool:
  • Output path: Use
    output_summary
    from the script JSON output (points to
    {baseDir}/data/<basename>.md
    )
  • Filename:
    <transcript_basename>.md
    (preserves unified naming format)
Example:
  • Input:
    .../20091025__dQw4w9WgXcQ.en.txt
  • Output:
    {baseDir}/data/20091025__dQw4w9WgXcQ.en.md
CRITICAL — Full Display Rule: After saving the summary file, you MUST display the COMPLETE summary content to the user in your response. Output the full markdown content exactly as written to the file. Do NOT:
  • Re-summarize or condense the summary
  • Show only selected sections
  • Create an abbreviated version
  • Paraphrase or rewrite any part
The user expects to see the full summary directly in the conversation without needing to open the file.
End your response with the file path:
---
Summary saved to: `{output_summary path from JSON}`
生成摘要后,使用Write工具将其保存到技能本地的
data/
目录
  • 输出路径:使用脚本JSON输出中的
    output_summary
    (指向
    {baseDir}/data/<basename>.md
  • 文件名
    <transcript_basename>.md
    (保持统一命名格式)
示例:
  • 输入:
    .../20091025__dQw4w9WgXcQ.en.txt
  • 输出:
    {baseDir}/data/20091025__dQw4w9WgXcQ.en.md
关键规则——完整展示规则:保存摘要文件后,必须在响应中向用户完整展示摘要内容。完全按照文件中写入的Markdown内容输出,不得:
  • 重新摘要或压缩摘要
  • 仅展示选定分段
  • 创建缩写版本
  • 改写或重述任何部分
用户期望在对话中直接看到完整摘要,无需打开文件。
在响应末尾添加文件路径:
---
摘要已保存至:`{JSON中的output_summary路径}`

Output Format

输出格式

Normal Mode Output

普通模式输出

json
{
  "status": "success",
  "source_transcript": "/path/to/20091025__VIDEO_ID.en.txt",
  "output_summary": "{baseDir}/data/20091025__VIDEO_ID.en.md",
  "char_count": 30000,
  "line_count": 450,
  "strategy": "standard",
  "cached": false,
  "video_id": "dQw4w9WgXcQ",
  "title": "Video Title",
  "channel": "Channel Name",
  "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
}
Cache hit (returns existing summary):
json
{
  "status": "success",
  "source_transcript": "/path/to/20091025__VIDEO_ID.en.txt",
  "output_summary": "{baseDir}/data/20091025__VIDEO_ID.en.md",
  "cached": true,
  "summary_char_count": 5000,
  "summary_line_count": 120,
  "video_id": "dQw4w9WgXcQ",
  "title": "Video Title",
  "channel": "Channel Name",
  "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
}
When
cached: true
, the summary file already exists — read and display it directly without regenerating.
json
{
  "status": "success",
  "source_transcript": "/path/to/20091025__VIDEO_ID.en.txt",
  "output_summary": "{baseDir}/data/20091025__VIDEO_ID.en.md",
  "char_count": 30000,
  "line_count": 450,
  "strategy": "standard",
  "cached": false,
  "video_id": "dQw4w9WgXcQ",
  "title": "Video Title",
  "channel": "Channel Name",
  "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
}
缓存命中(返回已有摘要):
json
{
  "status": "success",
  "source_transcript": "/path/to/20091025__VIDEO_ID.en.txt",
  "output_summary": "{baseDir}/data/20091025__VIDEO_ID.en.md",
  "cached": true,
  "summary_char_count": 5000,
  "summary_line_count": 120,
  "video_id": "dQw4w9WgXcQ",
  "title": "Video Title",
  "channel": "Channel Name",
  "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
}
cached: true
时,摘要文件已存在——直接读取并展示,无需重新生成。

Check Mode Output

检查模式输出

See Check Mode section above.
The script automatically extracts video metadata from the centralized metadata store if available.
见上方检查模式部分。
如果可用,脚本会自动从集中元数据存储提取视频元数据。

Notes

注意事项

  • File caching: If summary already exists for this video, it will be reused (returns
    cached: true
    )
  • Check mode: Use
    --check
    to check if a cached summary exists without a transcript file
  • Force refresh: Use
    --force
    flag to re-generate summary even if cached file exists
  • This skill does NOT download videos or subtitles — use
    /mk-youtube-get-caption
    first to obtain a transcript file
  • Uses system jq if available, otherwise auto-downloads on first run
  • For best results, combine with
    /mk-youtube-get-info
    to include the Video Info table in the summary
  • Summary is saved to the skill-local
    data/
    directory
  • 文件缓存:如果该视频的摘要已存在,将直接复用(返回
    cached: true
  • 检查模式:使用
    --check
    参数可在无转录文件的情况下检查缓存摘要是否存在
  • 强制刷新:使用
    --force
    标志可强制重新生成摘要,即使缓存文件已存在
  • 本技能不下载视频或字幕——需先使用
    /mk-youtube-get-caption
    获取转录文件
  • 如果系统已安装jq则直接使用,否则首次运行时自动下载
  • 为获得最佳效果,建议结合
    /mk-youtube-get-info
    使用,以便在摘要中包含视频信息表格
  • 摘要将保存到技能本地的
    data/
    目录