CtrlK
BlogDocsLog inGet started
Tessl Logo
PluginPublic

gamussa/reels-producer-skill

Write talking-head scripts and produce Instagram reels and YouTube shorts

1.07x
Quality

96%

Does it follow best practices?

Impact

98%

1.07x

Average score across 8 eval scenarios

SecuritybySnyk

Low

Low-risk findings worth noting

Overview
Quality
Evals
Security
Files

story_plan.pyskills/reel-builder/scripts/

#!/usr/bin/env python3
"""Story-planning mode for a longer video: check the plan's shape, find claims
that are told but never shown, and write the pickup-shot list before editing.

plan/story.json (schema_version 1):
  {"schema_version": 1,
   "promise": "what the video delivers, stated in the first 15 s",
   "chapters": [
     {"title": "The test", "claim": "talking pace is easy pace",
      "pace": "explain" | "demo" | "breather",
      "evidence": [{"kind": "shown", "ref": "select 4 / 12:30-13:05"},
                   {"kind": "told", "ref": "coach explains"}],
      "pickups": [{"shot": "watch face at 6:20/km, HR on screen", "proves": "the pace drop"}]}
   ],
   "conclusion": "returns to the promise: ..."}

check flags, per references/long-form.md:
  missing proof   a chapter whose claim has no "shown" evidence and no planned
                  pickup — a behaviour explained but never seen
  flat pace       three or more consecutive chapters at the same pace
  no promise / no conclusion, chapters without a claim

pickups writes plan/pickups.md: every planned pickup shot, plus a TODO row for
each chapter still missing proof, so the shoot list exists before the edit.
What a pickup should show is the agent's call (written into "pickups"); the
script only finds where one is missing.

Exit codes: 0 valid (check may still report missing proof as warnings);
1 invalid shape. JSON on stdout.

Usage:
  story_plan.py check plan/story.json
  story_plan.py pickups plan/story.json --out plan/pickups.md
"""

import argparse
import json
import sys
from pathlib import Path

SCHEMA_VERSION = 1
PACES = ("explain", "demo", "breather")
FLAT_RUN = 3


def analyse(doc):
    """(errors, warnings, missing_proof[chapter index])."""
    errors, warnings, missing = [], [], []
    if doc.get("schema_version") != SCHEMA_VERSION:
        return [f"schema_version must be {SCHEMA_VERSION}"], [], []
    if not (doc.get("promise") or "").strip():
        errors.append("state the promise")
    chapters = doc.get("chapters") or []
    if len(chapters) < 2:
        errors.append("a longer video needs at least two chapters")
    for n, ch in enumerate(chapters, 1):
        tag = f"chapter {n} ({ch.get('title') or 'untitled'})"
        if not (ch.get("claim") or "").strip():
            errors.append(f"{tag}: what does it claim or show?")
        if ch.get("pace") not in PACES:
            errors.append(f"{tag}: pace must be one of {', '.join(PACES)}")
        ev = ch.get("evidence") or []
        if any(e.get("kind") not in ("shown", "told") for e in ev):
            errors.append(f"{tag}: evidence kind must be 'shown' or 'told'")
        shown = any(e.get("kind") == "shown" for e in ev)
        planned = any((p.get("shot") or "").strip() for p in ch.get("pickups") or [])
        if ch.get("pace") != "breather" and not shown and not planned:
            missing.append(n - 1)
            warnings.append(f"{tag}: claim is told, never shown — plan a pickup or cut the claim")
    paces = [c.get("pace") for c in chapters]
    run = 1
    for i in range(1, len(paces)):
        run = run + 1 if paces[i] == paces[i - 1] else 1
        if run == FLAT_RUN:
            warnings.append(
                f"chapters {i - FLAT_RUN + 2}-{i + 1} are all '{paces[i]}' — "
                "change pace (demonstration, breather) so it does not read as a lecture"
            )
    if not (doc.get("conclusion") or "").strip():
        errors.append("write the conclusion: return to the promise and show it kept")
    return errors, warnings, missing


def pickup_list(doc, missing):
    lines = [
        "# Pickup shots",
        "",
        f"Promise: {doc.get('promise', '').strip()}",
        "",
        "| # | chapter | shot | proves |",
        "|---|---|---|---|",
    ]
    n = 0
    for i, ch in enumerate(doc.get("chapters") or []):
        for p in ch.get("pickups") or []:
            if (p.get("shot") or "").strip():
                n += 1
                lines.append(
                    f"| {n} | {ch.get('title', '')} | {p['shot']} | {p.get('proves', '')} |"
                )
        if i in missing:
            n += 1
            lines.append(
                f"| {n} | {ch.get('title', '')} | TODO: decide what shows it | "
                f"{ch.get('claim', '')} |"
            )
    lines += [
        "",
        "Shoot these before editing; a claim nobody sees is a claim the viewer "
        "has to take on trust.",
        "",
    ]
    return "\n".join(lines), n


def main():
    ap = argparse.ArgumentParser(
        description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter
    )
    sub = ap.add_subparsers(dest="cmd", required=True)
    c = sub.add_parser("check")
    c.add_argument("story")
    p = sub.add_parser("pickups")
    p.add_argument("story")
    p.add_argument("--out", default="plan/pickups.md")
    a = ap.parse_args()
    try:
        doc = json.loads(Path(a.story).read_text())
    except (OSError, json.JSONDecodeError) as e:
        print(json.dumps({"ok": False, "errors": [f"cannot read {a.story}: {e}"]}))
        sys.exit(1)
    errors, warnings, missing = analyse(doc)
    if a.cmd == "check":
        print(
            json.dumps(
                {
                    "ok": not errors,
                    "errors": errors,
                    "warnings": warnings,
                    "missing_proof": [doc["chapters"][i].get("title") for i in missing],
                }
            )
        )
        sys.exit(1 if errors else 0)
    if errors:
        print(json.dumps({"ok": False, "errors": errors}))
        sys.exit(1)
    text, n = pickup_list(doc, missing)
    Path(a.out).parent.mkdir(parents=True, exist_ok=True)
    Path(a.out).write_text(text)
    print(json.dumps({"ok": True, "out": a.out, "shots": n, "todo": len(missing)}))


if __name__ == "__main__":
    main()

skills

tile.json