javascript-refactoring

Refactor JavaScript into modular CommonJS (.cjs) files for GitHub Actions workflows.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/maxfraieho/garden-seedling --skill javascript-refactoring-maxfraieho
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: javascript-refactoring
Source: https://github.com/maxfraieho/garden-seedling/tree/main/gh-aw/skills/javascript-refactoring
Command: npx skills add https://github.com/maxfraieho/garden-seedling --skill javascript-refactoring-maxfraieho

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Refactors JavaScript code into modular CommonJS (.cjs) files for GitHub Actions workflows, enabling reuse, testability, and easier maintenance across multiple pipelines.

Core Features & Use Cases

  • Clear guidance for extracting shared functionality into reusable .cjs utilities.
  • Distinct patterns for utilities and top-level scripts, including embedding with Go, bundling, and testing workflows.
  • Use cases include organizing workflow code, improving test coverage, and simplifying updates across workflows.

Quick Start

Create a new .cjs module under pkg/workflow/js, export a main function and let the bundler inline dependencies and inject await main() during workflow execution.

Frequently Asked Questions about javascript-refactoring

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

FAQPage Schema
How do I refactor JavaScript into modular files for GitHub Actions workflows?

To refactor JavaScript into modular files, create a new .cjs module under your workflow directory, export a main function, and let the bundler inline dependencies and inject await main() during execution.

When should I split GitHub Actions workflow scripts into CommonJS modules?

You should split workflow scripts into CommonJS modules when organizing shared functionality, improving test coverage, or simplifying updates across multiple pipelines to enhance maintainability.

Does the JavaScript bundling workflow support embedding with Go?

Yes, the JavaScript bundling workflow supports embedding with Go via the //go:embed directive, a GetJavaScriptSources registry for utilities, and a sync.Once-based bundling workflow for main scripts.

What is the best way to test modularized JavaScript utilities in GitHub Actions?

The best way to test modularized JavaScript utilities is using vitest-based tests, which validate the extracted .cjs modules to ensure functionality works correctly before bundling into workflow scripts.

Can I use this refactoring approach for top-level workflow scripts and shared utilities?

Yes, this refactoring approach applies to both top-level workflow scripts and shared utilities, providing distinct patterns for creation, embedding, bundling, and testing within GitHub Actions projects.