kevinbadi/ai-os-skills · Archived

klap-generate-shorts

Generates short-form video clips from YouTube videos using Klap API.

First seen Apr 8, 2026

Installation

$ npx skills add kevinbadi/ai-os-skills --skill klap-generate-shorts

Summary

  • Generates short-form video clips from YouTube videos using Klap API.
  • Submits video, polls for processing, exports all shorts with virality scores, downloads locally, and stores in database.
  • Trigger when asked to create shorts from YouTube, generate clips from long videos, or use Klap for video editing.

Stronger alternatives

This repository is archived — consider an actively maintained alternative.

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from kevinbadi/ai-os-skills · top by installs.

npx skills add kevinbadi/ai-os-skills

Browse all from kevinbadi/ai-os-skills

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Repository health

Stars 55
License MIT
Default branch main
Open issues 0
Status Archived

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 3,480 B
  • docs SUMMARY.md 331 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 4 installs

SKILL.md

Klap Generate Shorts

End-to-end workflow for generating short-form video clips from YouTube videos using the Klap API. Handles the complete pipeline: submit → process → export → download → store.

What It Does

  1. Submits a YouTube URL to Klap for AI-powered editing
  2. Polls for processing completion (~5-30 minutes)
  3. Lists all generated shorts with virality scores
  4. Exports each short (creates download URLs)
  5. Downloads videos locally
  6. Stores everything in videotoshorts_agent database table
  7. Sends desktop/webhook notifications when complete

How to Run

# Generate shorts from YouTube video
python3 skills/klap-generate-shorts/scripts/klap_generate_shorts.py "https://youtube.com/watch?v=VIDEO_ID"

# With custom user ID
python3 skills/klap-generate-shorts/scripts/klap_generate_shorts.py "https://youtube.com/watch?v=VIDEO_ID" --user-id 2

Configuration

Environment Variables

KLAP_API_KEY=xxx
DATABASE_URL=postgresql://...

# Optional
NOTIFICATION_WEBHOOK_URL=https://hooks.slack.com/services/...

Dependencies

pip install requests psycopg2-binary python-dotenv

Workflow Steps

  1. SubmitPOST /tasks/video-to-shorts with source URL, language, max duration, clip count
  2. Poll TaskGET /tasks/{task_id} every 30 seconds until status = success
  3. List ShortsGET /projects/{folder_id} to get all generated clips
  4. ExportPOST /projects/{folderid}/{shortid}/exports for each short
  5. Poll ExportGET .../exports/{export_id} every 5 seconds until download URL ready
  6. Download — Save MP4 files locally
  7. Store — Update database with video URLs and metadata

Klap API Settings

max_duration = 30          # Max seconds per clip
max_clip_count = 5         # Max clips to generate
language = "en"
intro_title = False        # No intro title overlay

Polling Configuration

TASK_POLL_INTERVAL = 30    # Seconds between task checks
EXPORT_POLL_INTERVAL = 5   # Seconds between export checks
MAX_TASK_POLLS = 60        # ~30 min max wait for processing
MAX_EXPORT_POLLS = 40      # ~3 min max wait for export

Database Table: videotoshorts_agent

Column Description
id Klap clip ID
name Generated clip title
status pending → processing → complete → exported → downloaded
src_url Original YouTube URL
outputvideourl Final exported video URL (Google Storage)
virality_score AI-predicted virality (0-100)
publication_captions Ready-to-use captions (JSONB)

Important Notes

  • Processing takes 5-30 minutes depending on video length
  • Each short must be exported individually before downloading
  • Downloads go to shorts/klap{folderid}_{date}/ directory
  • macOS desktop notification sent when complete
  • Klap dashboard: https://klap.app/spaces/{folder_id}
  • Handles API rate limits, timeouts, and export failures gracefully

Scripts

File Purpose
klapgenerateshorts.py Full end-to-end shorts workflow