Bundle scripts, references, and assets
Write a safe, self-contained script
Give bundled code clear inputs, useful errors, stable output, documented dependencies, and no surprising side effects.
10 minute lesson
A skill script may run in a repository you have never seen. Make its boundary boring.
validate-report.mjs accepts one explicit file path. It reads that file, checks the required headings and decision, prints useful errors, and exits non-zero on failure. It has no surprising side effects: it does not scan the working directory, install packages, rewrite the report, use the network, or read environment variables.
The smallest useful interface looks like this:
node scripts/validate-report.mjs path/to/release-report.md
Document the required runtime beside the command. Use standard-library features when they are enough. If a dependency is necessary, explain how the host should detect it and what to do when it is missing. Do not let a helper quietly install its own dependencies.
Errors should help the agent recover. “Missing section: ## Blockers” is useful. “Invalid input” is not. Send normal results to standard output and errors to standard error. Return distinct success and failure exit codes.
Test the script with a valid report, a missing file, a missing heading, an invalid decision, and a filename containing spaces. Then read it as an attacker. Could a report path execute shell syntax? Could a huge file exhaust memory? Could the script overwrite user data?
The script is part of the skill’s authority. Keep it narrower than the prose, not broader.
Lesson completed