--- name: youtube description: Summarize YouTube videos from links using the local chrome-youtube-skill project. Use when a user shares a YouTube URL (youtube.com, youtu.be, shorts) and asks for a transcript, summary, key points, or breakdown. Extract transcript with this project's Python tool, then return a concise actionable summary personalized to the user's projects, goals, and work style. --- # YouTube Summary (project-backed) Use this workflow every time this skill is invoked. ## 1) Extract transcript with the project tool (required) Run: ```bash TMP_JSON="$(mktemp -t yt_transcript_XXXXXX.json)" # Read output directory from config or use default OUTPUT_DIR="$(grep '^OUTPUT_DIR=' skill.config 2>/dev/null | head -1 | cut -d= -f2-)" OUTPUT_DIR="${OUTPUT_DIR:-$HOME/youtube_transcripts}" if [ -x ./scripts/run_transcript.py ]; then ./scripts/run_transcript.py "" --json --json-out "$TMP_JSON" --output-dir "$OUTPUT_DIR" >/dev/null elif [ -x ./extract ]; then ./extract "" --json --json-out "$TMP_JSON" --output-dir "$OUTPUT_DIR" >/dev/null else echo "Runner not found. Run from the youtube skill root." exit 1 fi cat "$TMP_JSON" ``` Rules: - Always use this project tool for extraction. - Do not switch to other transcript tools. - The extractor launches a visible Chrome session; extract **once** per URL and reuse `TMP_JSON` for downstream steps. - Parse JSON output and check `success`. ## 2) Handle extraction failure If `success` is false: - Reply with a short failure note. - Include the tool's error text. - Ask for another link or a retry. ## 3) Build summary in the exact target markdown shape When extraction succeeds, build output with this exact structure: ```markdown ## (<channel>) **URL:** <video_url> **Published:** <publish_date> | **Duration:** <duration> | **Views:** <view_count> ### Key points - ... ### Relevant to you - ... ### Actionable items - ... ``` Content rules: - Key points: 5-8 bullets - Relevant to you: 3-5 bullets personalized - Actionable items: 3-5 concrete next steps - Format `duration_seconds` as human-readable (e.g. "12:34" or "1:02:15") - Format `view_count` with thousands separators (e.g. "1,234,567") - Use `publish_date` as-is (ISO date, e.g. "2025-03-15") Personalization targets for the user: - OpenClaw monetization and skill/product opportunities - Shipping habits, distribution consistency, and creator workflow - Builder-first decisions for indie products (pricing, positioning, MVP scope) - Practical next actions he can do today ## 4) Response style - Keep it concise, useful, and concrete. - Avoid fluff and generic motivation. - Prefer explicit next steps over abstract advice. ## 5) Required save On every successful run, two files are saved to the output directory: 1. **Transcript** (`.txt`) — saved automatically by the extractor via `--output-dir` in Step 1. 2. **Summary** (`.md`) — written by this skill after building the summary in Step 3. **Output directory resolution:** 1. Read from `skill.config` in the project root (format: `OUTPUT_DIR=/path/to/directory`) 2. If config doesn't exist or `OUTPUT_DIR` is not set, fall back to `~/youtube_transcripts` **Summary file path:** `<output_directory>/<channel> - <title>.md` Rules: - Create output directory if it does not exist. - Sanitize filename characters (`/ \\ : * ? " < > |`) to `_`. - Summary file contents must exactly match the markdown structure in Step 3. - Save via shell `exec` (not `write`) because file tools are workspace-root sandboxed and will reject paths outside workspace with `Path escapes workspace root`. - Use a safe heredoc pattern for writes (example): ```bash # Read output directory from config or use default OUTPUT_DIR="$(grep '^OUTPUT_DIR=' skill.config 2>/dev/null | head -1 | cut -d= -f2-)" OUTPUT_DIR="${OUTPUT_DIR:-$HOME/youtube_transcripts}" mkdir -p "$OUTPUT_DIR" cat > "$OUTPUT_DIR/<channel> - <title>.md" <<'MD' <full markdown summary> MD ``` - After saving, output the exact absolute paths of both saved files (transcript `.txt` and summary `.md`). ## Expected JSON fields Typical output includes: - `success` - `video_id` - `title` - `channel` - `url` - `transcript` - `language` - `method` - `error` - `view_count` - `publish_date` - `duration_seconds`