What problem does it solve? Repository automation scripts that must run before dependencies are installed often break in subtle ways: they import packages that do not exist yet, inherit GIT_DIR from a git hook and write to the wrong repository, or emit errors an automated agent cannot act on. This Skill defines the authoring contract that prevents those failures. ## Core Features & Use Cases - Dependency-free .mjs authoring: Restricts scripts to node:* builtins and shared helpers under scripts/lib/, with explicit imports of Node globals and no compile step. - Git hook safety: Explains how an inherited GIT_DIR or GIT_INDEX_FILE outranks cwd and -C, and requires isolatedGitEnv from scripts/lib/git-env.mjs for any spawned git call. - Typing and JSON narrowing: Requires JSDoc boundary types under allowJs/checkJs and narrowing JSON.parse output through readKey/readString in scripts/lib/json.mjs instead of casts. - CLI guard and stderr contract: Mandates the import.meta.main guard for dual importable/runnable files and an ERR_<STAGE>_* error format stating what failed, expected versus actual, and the next safe command. - Use Case: A lefthook pre-commit run fails because a spawned git command wrote to the outer repository's index; this Skill diagnoses the inherited GIT_DIR cause and prescribes the isolatedGitEnv fix. ## Quick Start Ask the AI to write a new repository automation script under scripts/ that follows this Skill's rules for imports, git isolation, typing, and error reporting.