javascript-refactoring

Installation
SKILL.md

JavaScript Code Refactoring Guide

This guide explains how to refactor JavaScript code into a separate .cjs file in the gh-aw repository. Follow these steps when extracting shared functionality or creating new JavaScript modules.

Overview

The gh-aw project uses CommonJS modules (.cjs files) for JavaScript code that runs in GitHub Actions workflows. These files are:

  • Embedded in the Go binary using //go:embed directives
  • Bundled using a custom JavaScript bundler that inlines local require() calls
  • Executed in GitHub Actions using actions/github-script@v8

Top-Level Script Pattern

Top-level .cjs scripts (those that are executed directly in workflows) follow a specific pattern:

✅ Correct Pattern - Export main, but don't call it:

async function main() {
Related skills
Installs
32
Repository
github/gh-aw
GitHub Stars
4.4K
First Seen
Mar 18, 2026