authoring-global-scripts

Authors and manages global package scripts using the _: prefix convention. Scripts defined in root package.json are propagated to all packages with the prefix stripped.

⭐5stars🔀0forks📁View on GitHub🕐Updated Dec 30, 2025⬇️1downloads

When & Why to Use This Skill

This Claude skill streamlines monorepo management by centralizing package scripts through a standardized convention. By using a specific `_:` prefix in the root configuration, it automates the propagation and synchronization of scripts across all sub-packages, ensuring architectural consistency and reducing manual maintenance overhead in complex JavaScript/TypeScript projects.

Use Cases

  • Standardizing build, test, and linting commands across dozens of sub-packages in a monorepo to ensure a uniform development experience.
  • Automating the update of shared scripts (like type-checking or security audits) from a single source of truth in the root package.json.
  • Auditing large repositories for script inconsistencies or unauthorized manual edits that deviate from the global project standards using the built-in check flag.
nameauthoring-global-scripts
descriptionAuthors and manages global package scripts using the _: prefix convention. Scripts defined in root package.json are propagated to all packages with the prefix stripped.

Authoring Global Scripts

Manage package scripts that apply to all packages in the monorepo.

Steps

Adding a Global Script

  1. Add script to root package.json with _: prefix:

    {
      "scripts": {
        "_:build": "tsgo -p tsconfig.build.json",
        "_:check:types": "tsgo --noEmit"
      }
    }
    
  2. Run the sync script at .claude/skills/authoring-global-scripts/scripts/sync-package-scripts.ts

Auditing for Inconsistencies

Run with --check flag to verify all packages are in sync without modifying:

tsx .claude/skills/authoring-global-scripts/scripts/sync-package-scripts.ts --check

Reference

Convention

Location Format Example
Root package.json _:script-name "_:build": "tsgo -p tsconfig.build.json"
Package package.json script-name "build": "tsgo -p tsconfig.build.json"

The _: prefix marks scripts as "global templates". The sync script:

  • Strips the prefix when copying to packages
  • Replaces all package scripts (packages should not have custom scripts)
  • Warns about extra scripts in packages that aren't in the template

Relative Paths

Relative paths like ../../oxlint.json are preserved as-is. They're relative from each package directory, so ../../ correctly points to the monorepo root from packages/*/.

Notes

  • Packages should NOT have custom scripts - all scripts come from the global template
  • If a package needs a unique script, reconsider whether it belongs as a global script
  • Run audit (--check) to catch manual edits that broke the pattern