create-spf-behavior

Scaffold a new SPF playback-engine behavior with signals, lifecycle, cleanup, composition, and tests.

931|91|Updated Aug 13, 2025
One-click install
npx skills add https://github.com/videojs/v10 --skill create-spf-behavior
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: create-spf-behavior
Source: https://github.com/videojs/v10/tree/main/.agents/skills/create-spf-behavior
Command: npx skills add https://github.com/videojs/v10 --skill create-spf-behavior

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Creating a new SPF playback-engine behavior without a disciplined workflow leads to behaviors with unclear purpose, oversized slot maps, mismatched cleanup patterns, and tests written after the fact. This Skill enforces a purpose-first, conventions-aligned creation workflow so each behavior is atomic, independently testable, and correctly wired into the engine composition.

Core Features & Use Cases

  • Purpose-first articulation: Define the behavior's business rule, signal inputs/outputs, lifecycle, and source-reset rules before writing any code.
  • Conventions-aligned scaffolding: Apply the project's signal, actor, reactor, config, and cleanup conventions (named-cleanup-collection, not AbortController) when designing the slot map and composition placement.
  • TDD workflow: Write a failing test in the behaviors test directory first, implement the smallest behavior, then wire it at the owning composition layer and run the affected SPF tests.
  • Use Case: When asked to extract manifest refresh scheduling into its own behavior, use this Skill to produce one independently testable responsibility with explicit inputs, writes, lifecycle, cleanup, composition, and proportional verification.

Quick Start

Ask the AI to create a new SPF behavior for a specific atomic responsibility, such as extracting manifest refresh scheduling into its own behavior.

Frequently Asked Questions about create-spf-behavior

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a new SPF behavior in Video.js v10?

Start by articulating the behavior's purpose in one sentence: its business rule, signal inputs and writes, lifecycle, and cleanup. Then write a failing test in the behaviors test directory, implement the smallest behavior, and wire it into the engine composition at the correct position.

What cleanup pattern do SPF behaviors use?

SPF behaviors use the named-cleanup-collection plus wrapper pattern for multi-cleanup, not AbortController. AbortController is recommended only for non-SPF code in the broader project guidelines, so new behaviors must match the SPF-specific convention.

When should I use Signal versus ReadonlySignal in a behavior?

Use Signal<T> when the behavior writes to a slot and ReadonlySignal<T> when it only reads. Keep stateKeys and contextKeys narrow, including only slots the behavior actually reads or writes, so variants can compose it without no-op wiring.

When is creating a new behavior the wrong approach?

If you are refactoring an existing behavior while preserving its purpose, or updating one whose purpose is changing, use the change-spf-behavior workflow instead. Splitting or merging existing behaviors also routes through the change workflow rather than creation.

Where should a variant-specific behavior live in the composition?

Variant-specific logic must be a separate behavior composed into the variant factory, such as an audio-only or live variant, not a runtime conditional inside an always-on behavior. Always-on behaviors belong in the main engine composition.