michaelst/spendable / .claude/skills/record-demo-video
record-demo-video
VerifiedRecord a narrated video of a feature running in the local dev app, for a PR or a stakeholder. Drives a headless Chrome over the DevTools Protocol so clicks and keystrokes are real, captures frames, and encodes an mp4 with no extra tooling installed. Use when the user asks to "record a video", "make a demo", "show this working", or wants a screen recording of a change.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 8.5 KB |
| scripts/driver.mjs | script | 9.8 KB |
| scripts/encode.swift | script | 3.2 KB |
| scripts/example-scenario.mjs | script | 2.5 KB |
| scripts/record.shexecutable | script | 3.1 KB |
| scripts/session_cookie.exs | other | 1.9 KB |
| scripts/worktree_env.shexecutable | script | 1.0 KB |
scripts/encode.swift
View on GitHub// Encodes a directory of PNG frames into an H.264 mp4 with AVFoundation, so no ffmpeg is needed.
// Usage: swift encode.swift <frame-dir> <out.mp4> <fps>
import AVFoundation
import AppKit
import Foundation
let arguments = CommandLine.arguments
guard arguments.count >= 4 else {
print("usage: encode.swift <frame-dir> <out.mp4> <fps>")
exit(1)
}
let frameDirectory = arguments[1]
let outputURL = URL(fileURLWithPath: arguments[2])
let framesPerSecond = Int32(arguments[3]) ?? 8
let frameNames = try FileManager.default
.contentsOfDirectory(atPath: frameDirectory)
.filter { $0.hasSuffix(".png") }
.sorted()
guard let firstName = frameNames.first,
let firstImage = NSImage(contentsOfFile: "\(frameDirectory)/\(firstName)"),
let firstBitmap = firstImage.representations.first
else {
print("no readable PNG frames in \(frameDirectory)")
exit(1)
}
let width = firstBitmap.pixelsWide
let height = firstBitmap.pixelsHigh
try? FileManager.default.removeItem(at: outputURL)
let writer = try AVAssetWriter(outputURL: outputURL, fileType: .mp4)
let input = AVAssetWriterInput(
mediaType: .video,
outputSettings: [
AVVideoCodecKey: AVVideoCodecType.h264,
AVVideoWidthKey: width,
AVVideoHeightKey: height
]
)
input.expectsMediaDataInRealTime = false
let adaptor = AVAssetWriterInputPixelBufferAdaptor(
assetWriterInput: input,
sourcePixelBufferAttributes: [
kCVPixelBufferPixelFormatTypeKey as String: Int(kCVPixelFormatType_32ARGB),
kCVPixelBufferWidthKey as String: width,
kCVPixelBufferHeightKey as String: height
]
)
writer.add(input)
writer.startWriting()
writer.startSession(atSourceTime: .zero)
func pixelBuffer(for path: String) -> CVPixelBuffer? {
guard let image = NSImage(contentsOfFile: path),
let cgImage = image.cgImage(forProposedRect: nil, context: nil, hints: nil)
else { return nil }
var buffer: CVPixelBuffer?
CVPixelBufferCreate(
kCFAllocatorDefault, width, height, kCVPixelFormatType_32ARGB,
[kCVPixelBufferCGImageCompatibilityKey: true, kCVPixelBufferCGBitmapContextCompatibilityKey: true] as CFDictionary,
&buffer
)
guard let buffer else { return nil }
CVPixelBufferLockBaseAddress(buffer, [])
let context = CGContext(
data: CVPixelBufferGetBaseAddress(buffer),
width: width,
height: height,
bitsPerComponent: 8,
bytesPerRow: CVPixelBufferGetBytesPerRow(buffer),
space: CGColorSpaceCreateDeviceRGB(),
bitmapInfo: CGImageAlphaInfo.noneSkipFirst.rawValue
)
context?.draw(cgImage, in: CGRect(x: 0, y: 0, width: width, height: height))
CVPixelBufferUnlockBaseAddress(buffer, [])
return buffer
}
var index: Int32 = 0
for name in frameNames {
while !input.isReadyForMoreMediaData { usleep(5000) }
guard let buffer = pixelBuffer(for: "\(frameDirectory)/\(name)") else { continue }
adaptor.append(buffer, withPresentationTime: CMTime(value: CMTimeValue(index), timescale: framesPerSecond))
index += 1
}
input.markAsFinished()
let done = DispatchSemaphore(value: 0)
writer.finishWriting { done.signal() }
done.wait()
if writer.status == .completed {
print("WROTE \(outputURL.path) frames=\(index) fps=\(framesPerSecond)")
} else {
print("FAILED \(writer.error?.localizedDescription ?? "unknown")")
exit(1)
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |