Generate short video scripts for oral broadcast from article content. Automatically analyzes content and outputs scripts in one of three template types...
This skill converts written articles into engaging short video scripts following specific templates and style guidelines.
This skill can receive content from:
When called from rss-article-retriever:
result.article.content.plain_text from the RSS article outputExample chain:
User: "请用最新一篇关于'民间借贷'的文章来制作视频脚本"
Step 1: rss-article-retriever skill
→ Outputs: <skill-output type="rss-article">...result.article.content.plain_text...</skill-output>
Step 2: video-script-generator skill (AUTOMATIC)
→ Extracts plain_text from step 1
→ Generates video script
→ Outputs: <skill-output type="video-script">...</skill-output>
Analyze the input content and classify it into one of these three types:
When to use: Content involves real stories/cases about business transactions, payment disputes, or recovery failures.
Structure:
Closing tone: 用"故事"证明:别白忙,先用尺子看门槛。
When to use: Content addresses common questions, misconceptions, or "how to" queries in the domain.
Structure:
Closing tone: 用"问答"让用户对号入座:你先自查,再决定要不要投入。
When to use: Content highlights a critical gap, requirement, or deal-breaker that must be addressed.
Structure:
Closing tone: 用"模板"给用户一把尺子:先对照门槛,看你缺不缺这一条。
When generating scripts, analyze the source content's style across these 7 dimensions (see STYLE_GUIDE.md for detailed framework):
重要:此协议定义了 Skill 输出的边界标记,确保主 Agent 和应用程序能可靠地解析输出。
所有结构化输出必须包裹在以下标记中:
<skill-output type="video-script" schema-version="1.0.0">
{完整的 JSON,遵循 schema/output-schema-v1.json}
</skill-output>
标记属性说明:
| 属性 | 值 | 说明 |
|---|---|---|
type |
video-script |
固定值,标识 Skill 类型 |
schema-version |
1.0.0 |
对应 schema 版本,用于兼容性检查 |
┌─────────────────────────────────────────────────────┐
│ Skill 完整输出 │
├─────────────────────────────────────────────────────┤
│ [可选] 解释性文字(应被忽略) │
│ │
│ <skill-output type="video-script" schema-version="1.0.0">
│ { │
│ "version": "1.0.0", │
│ "script_type": "A", │
│ "final_script": { ... }, ← 干净脚本 │
│ "metadata": { ... }, ← 推理过程/元数据 │
│ "templates": { ... } │
│ } │
│ </skill-output> │
│ │
│ [可选] 补充说明(应被忽略) │
└─────────────────────────────────────────────────────┘
主 Agent 解析逻辑:
<skill-output ...> 和 </skill-output> 之间的内容| 模式 | 触发方式 | 输出内容 | 使用场景 |
|---|---|---|---|
| 默认模式 | 无参数 | 边界标记 + JSON + 可选说明 | SaaS 集成、主 Agent 调用 |
| 原始模式 | --raw |
纯 JSON(无标记、无说明) | API 直接调用、测试 |
| 人类模式 | --format markdown |
Markdown 格式(无 JSON) | CLI 交互、人类阅读 |
┌─────────────────────────────────────────────────────┐
│ 前端主展示区 │
│ └─ final_script.full_text(干净脚本) │
│ └─ final_script.word_count / estimated_duration │
├─────────────────────────────────────────────────────┤
│ [折叠] 制作过程 │
│ └─ metadata.style_analysis(7维分析) │
│ └─ metadata.generation_info(生成信息) │
│ └─ metadata.system_instruction(系统指令) │
├─────────────────────────────────────────────────────┤
│ [折叠] 模板库 │
│ └─ templates.hooks / transitions / ctas │
└─────────────────────────────────────────────────────┘
This skill outputs structured JSON by default for system integration.
The JSON output contains three main sections:
final_script - The complete, ready-to-use script
metadata - Style analysis and generation logs
templates - Reusable template library
To request human-readable Markdown format (3-part output), add --format markdown to your request:
Example: "把这篇文章做成视频脚本 --format markdown"
The Markdown format includes:
在生成输出之前,必须完成以下检查:
读取 Schema 文件
schema/output-schema-v1.json参考示例输出
references/EXAMPLES.md格式要求确认
version 必须使用语义化版本格式 "1.0.0"system_instruction 必须控制在 200-500 字符rules 数量为 2-5 条templates 中 hooks/transitions/ctas 各必须恰好 3 条Generate structured JSON output according to the schema defined in schema/output-schema-v1.json:
Extract the complete script with the following fields:
title: Script title or hook linesegments: Array of script sections, each with:section: Section type ("hook", "slot_1"-"slot_5", "closing")text: Text content of the segmentnotes (optional): Notes for this segmentfull_text: Complete script as plain text (ready for direct use)word_count: Estimated word countestimated_duration: Duration in seconds (word_count ÷ 2.5 for typical speech rate)Place ALL production logs and analysis in metadata:
style_analysis: 7-dimension analysis (persona_and_audience, tone_and_emotion, rhythm_and_syntax, vocabulary, structure, reasoning, cta_and_guidance)system_instruction: ~300-word AI instruction for generating scripts in the same stylegeneration_info: script_type, generated_at, input_summary, model_versionProvide exactly 3 templates for each:
hooks: Opening hook templatestransitions: Transition phrase templatesctas: Call-to-action templatesOutput three parts in order:
Analyze the source content's style across the 7 dimensions listed above. Use clear lists and bullet points. For each dimension, provide:
Generate a ~300-word system instruction for AI to generate scripts in the same style. Requirements:
Provide 3 templates for each:
All templates must match the analyzed style.
When generating JSON output, follow these guidelines:
Extract final script into final_script.full_text
Segment the script by sections in final_script.segments
Place ALL style analysis in metadata.style_analysis
Include system instruction in metadata.system_instruction
Add templates to templates.hooks/transitions/ctas
Ensure all required fields are present
Calculate metadata accurately
word_count: Count actual words in the scriptestimated_duration: Divide word_count by 2.5 (typical speech rate)generated_at: Use current timestamp in ISO 8601 formatUser input: "把这篇文章做成视频脚本"
Output:
<skill-output type="video-script" schema-version="1.0.0">
{
"version": "1.0.0",
"script_type": "A",
"final_script": {
"title": "...",
"full_text": "完整脚本内容...",
"segments": [...],
"word_count": 248,
"estimated_duration": 99
},
"metadata": {
"style_analysis": {...},
"system_instruction": "...",
"generation_info": {...}
},
"templates": {
"hooks": [...],
"transitions": [...],
"ctas": [...]
}
}
</skill-output>
User input: "把这篇文章做成视频脚本 --raw"
Output: 纯 JSON,无边界标记,无解释性文字
{
"version": "1.0.0",
"script_type": "A",
...
}
User input: "把这篇文章做成视频脚本 --format markdown"
Output: Markdown 格式的三部分报告(无 JSON)
必须严格遵守的格式要求:
| 字段 | 格式要求 | 示例 |
|---|---|---|
version |
语义化版本 (semver) | "1.0.0" |
system_instruction |
200-500 字符 | 约 150-250 字 |
rules 数组 |
2-5 条 | 不多不少 |
hooks/transitions/ctas |
各 3 条 | 不能多也不能少 |
generated_at |
ISO 8601 格式 | "2026-01-22T14:30:00Z" |
常见错误:
"version": "1.0" → ✅ "version": "1.0.0"当你的 SaaS 主 Agent 调用此 Skill 时,应按以下方式处理输出:
import re
import json
from typing import TypedDict, Optional
class VideoScript(TypedDict):
title: str
full_text: str
segments: list
word_count: int
estimated_duration: float
class SkillOutput(TypedDict):
version: str
script_type: str
final_script: VideoScript
metadata: dict
templates: dict
def parse_skill_output(raw_output: str) -> SkillOutput:
"""
从 Skill 输出中提取结构化数据。
Args:
raw_output: Skill 的完整输出(包含边界标记)
Returns:
解析后的结构化数据
Raises:
ValueError: 如果找不到边界标记或 JSON 解析失败
"""
# 1. 提取边界标记内的内容
pattern = r'<skill-output[^>]*>([\s\S]*?)</skill-output>'
match = re.search(pattern, raw_output)
if not match:
raise ValueError("No <skill-output> marker found in output")
json_content = match.group(1).strip()
# 2. 解析 JSON
try:
data = json.loads(json_content)
except json.JSONDecodeError as e:
raise ValueError(f"Failed to parse JSON: {e}")
# 3. 验证必要字段(可选,推荐使用 jsonschema 库)
required_fields = ["version", "script_type", "final_script", "metadata", "templates"]
for field in required_fields:
if field not in data:
raise ValueError(f"Missing required field: {field}")
return data
def extract_for_frontend(skill_output: SkillOutput) -> dict:
"""
提取前端渲染所需的数据结构。
Returns:
{
"script": { ... }, # 主展示区
"process": { ... }, # 折叠区:制作过程
"templates": { ... } # 折叠区:模板库
}
"""
return {
# 主展示区:干净脚本
"script": {
"title": skill_output["final_script"]["title"],
"content": skill_output["final_script"]["full_text"],
"wordCount": skill_output["final_script"]["word_count"],
"duration": skill_output["final_script"]["estimated_duration"],
"segments": skill_output["final_script"]["segments"],
},
# 折叠区:制作过程元数据
"process": {
"scriptType": skill_output["script_type"],
"styleAnalysis": skill_output["metadata"]["style_analysis"],
"generationInfo": skill_output["metadata"]["generation_info"],
"systemInstruction": skill_output["metadata"]["system_instruction"],
},
# 折叠区:模板库
"templates": skill_output["templates"],
}
interface VideoScriptResult {
// 主展示区
script: {
title: string;
content: string; // full_text,可直接渲染
wordCount: number;
duration: number; // 秒
segments: Array<{
section: string;
text: string;
notes?: string;
}>;
};
// 折叠区:制作过程
process: {
scriptType: 'A' | 'B' | 'C';
styleAnalysis: Record<string, {
summary: string;
rules: string[];
sentence_patterns: string[];
}>;
generationInfo: {
script_type: string;
generated_at: string;
input_summary: string;
model_version: string;
};
systemInstruction: string;
};
// 折叠区:模板库
templates: {
hooks: string[];
transitions: string[];
ctas: string[];
};
}
def safe_call_skill(article_content: str) -> Optional[SkillOutput]:
"""带错误处理的 Skill 调用。"""
try:
# 1. 调用 Skill(通过你的主 Agent)
raw_output = call_main_agent(f"把这篇文章做成视频脚本:\n{article_content}")
# 2. 解析输出
result = parse_skill_output(raw_output)
# 3. 返回结构化数据
return result
except ValueError as e:
# 解析失败,记录日志
logger.error(f"Failed to parse skill output: {e}")
return None
except Exception as e:
# 其他错误
logger.error(f"Skill call failed: {e}")
return None
import jsonschema
def validate_output(data: dict) -> bool:
"""使用 JSON Schema 验证输出。"""
with open("schema/output-schema-v1.json") as f:
schema = json.load(f)
try:
jsonschema.validate(data, schema)
return True
except jsonschema.ValidationError as e:
logger.warning(f"Schema validation failed: {e.message}")
return False