companion-action-file-pattern

Creates and wires a new split-file actions category into a Bitfocus Companion module aggregator.

Updated May 19, 2026
One-click install
npx skills add https://github.com/digitaldrummerj/bitfocus-companion-skills --skill companion-action-file-pattern-digitaldrummerj
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: companion-action-file-pattern
Source: https://github.com/digitaldrummerj/bitfocus-companion-skills/tree/main/plugins/companion-action-file-pattern
Command: npx skills add https://github.com/digitaldrummerj/bitfocus-companion-skills --skill companion-action-file-pattern-digitaldrummerj

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @companion-module/base.

What problem does it solve? Adding a brand-new action category to a Bitfocus Companion module requires creating a correctly typed file, exporting an enum and factory function, and wiring everything into the actions.ts aggregator — a process with several easy-to-miss steps that cause TypeScript build errors. ## Core Features & Use Cases - Split-File Action Pattern: Documents the exact structure for creating a new src/actions/action-{category}.ts file with typed enums, factory functions, options, and callbacks. - Aggregator Wiring: Explains how to import the new file, call its factory, extend the union type, and spread results inside actions.ts. - Mistake Prevention: Lists common build-time errors such as duplicate action IDs, missing .js import extensions, and uncast option values. - Use Case: When adding a new recording actions category to a Companion module, follow the step-by-step recipe to create the file, wire it into GetActions(), and verify with a clean TypeScript build. ## Quick Start Ask the agent to create a new action category for your Companion module using the split-file action pattern and wire it into actions.ts.

Frequently Asked Questions about companion-action-file-pattern

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

FAQPage Schema
How do I add a new action category to a Bitfocus Companion module?▼

Create a new src/actions/action-{category}.ts file exporting an action ID enum and a GetActions{Category} factory, then import it in actions.ts, call the factory, add the enum to the union type, and spread the result into the combined actions object.

How do I wire a new action file into the actions.ts aggregator?▼

Import the enum and factory with a .js extension, call the factory inside GetActions() storing the typed result, add the enum to the [id in ...] union type, and spread the local variable into the combined actions object returned to setActionDefinitions.

When should I create a new action file instead of editing an existing one?▼

Create a new file only when adding a logically distinct category with no existing action-{category}.ts file. If a file for your category already exists, add the enum member and action definition directly to that file without touching the aggregator.

Why does my Companion module build fail after adding a new action file?▼

Common causes are forgetting the .js extension on ESM imports, adding the spread but not the enum to the union type, duplicating an existing action ID, or using await in a callback not marked async. Run yarn build to surface the exact TypeScript error.

How do I access option values inside a Companion action callback?▼

Cast action.options values explicitly since TypeScript types them as any, for example action.options.level as number. For text options, use await instance.parseVariablesInString() to resolve Companion variables before use.