Utility scripts directory configuration (/scripts) for MetaSaver monorepos including setup automation, environment management, and cross-platform support. Includes 4 critical standards (setup scripts, cross-platform support, error handling, documentation). Use when creating or auditing /scripts directory with Node.js and shell utility scripts.
Inherits all available tools
Additional assets for this skill
This skill inherits all available tools. When active, it can use any tool Claude has access to.
templates/setup.sh.templateThis skill provides templates and validation logic for /scripts directory configuration in MetaSaver monorepos.
Manage /scripts directory to:
This skill is invoked by the scripts-agent when:
Standard script templates are located at:
templates/setup.sh.template
Required scripts for all repositories:
| Script | Purpose | Repository Type |
|---|---|---|
| setup-env.js | Generate .env from .env.example files | All repos |
| setup-npmrc.js | Generate .npmrc from .npmrc.template with token replacement | All repos |
| clean-and-build.sh | Clean and rebuild monorepo | All repos |
Additional scripts for consumer repositories:
| Script | Purpose |
|---|---|
| back-to-prod.sh | Switch to GitHub Packages registry |
| use-local-packages.sh | Switch to local Verdaccio registry |
| killport.sh | Cross-platform port management |
Validation:
# Check required scripts exist
[ -f "scripts/setup-env.js" ] || echo "VIOLATION: Missing setup-env.js"
[ -f "scripts/setup-npmrc.js" ] || echo "VIOLATION: Missing setup-npmrc.js"
[ -f "scripts/clean-and-build.sh" ] || echo "VIOLATION: Missing clean-and-build.sh"
# Consumer repos only
if [ "$REPO_TYPE" = "consumer" ]; then
[ -f "scripts/back-to-prod.sh" ] || echo "VIOLATION: Missing back-to-prod.sh"
[ -f "scripts/use-local-packages.sh" ] || echo "VIOLATION: Missing use-local-packages.sh"
[ -f "scripts/killport.sh" ] || echo "VIOLATION: Missing killport.sh"
fi
Requirements for Node.js scripts:
path module for all file paths (never hardcoded slashes)process.platform for OS-specific logic#!/usr/bin/env nodeExample:
const path = require("path");
const envPath = path.join(__dirname, "..", ".env"); // CORRECT
// const envPath = '../.env'; // WRONG - hardcoded path
Validation:
# Check for hardcoded paths in Node.js scripts
grep -E "\.\.\/|\.\.\\\\|\.\/" scripts/*.js && echo "WARNING: Possible hardcoded paths detected"
# Check for path module usage
grep -q "require.*path" scripts/*.js || echo "VIOLATION: path module not used"
Required error handling patterns:
try-catch blocks for async operationsconsole.log feedback for success/failureprocess.exit(1) on errorsExample:
try {
// Operation
console.log("Success: Operation completed");
} catch (error) {
console.error("Error: Operation failed -", error.message);
process.exit(1);
}
Validation:
# Check for error handling
grep -q "try.*catch" scripts/*.js || echo "WARNING: No try-catch blocks found"
grep -q "process.exit" scripts/*.js || echo "WARNING: No process.exit calls found"
Required documentation elements:
#!/usr/bin/env node or #!/usr/bin/env bash)README.md structure:
# Scripts Directory
Utility scripts for [repository name].
## Available Scripts
### setup-env.js
Description of what it does and when to use it.
### setup-npmrc.js
Description of what it does and when to use it.
...
Validation:
# Check for shebang
head -n1 scripts/*.js | grep -q "#!/usr/bin/env node" || echo "VIOLATION: Missing shebang"
# Check for README
[ -f "scripts/README.md" ] || echo "VIOLATION: Missing scripts/README.md"
To validate /scripts directory:
# Check directory exists at root
[ -d "scripts" ] || echo "VIOLATION: /scripts directory not found at root"
# Validate against 4 standards (see rules above)
# Report only violations
@metasaver/multi-mono): Core setup scripts only/scripts directory only/scripts (never in subdirectories)chmod +x instructions for shell scriptspath module consistently (never hardcoded paths)This skill integrates with:
scope parameter. If not provided, use /skill scope-check/skill audit-workflow - Bi-directional comparison workflow/skill remediation-options - Conform/Update/Ignore choicespackage-scripts-agent - For npm scripts that invoke /scripts utilities