GitHub Copilot Instructions for Node Module Template
March 10, 2026 · View on GitHub
Related Templates (Choose the Right Template First)
This repository is a GitHub Template Repo for reusable Node.js modules.
| If you are building… | Pick this template |
|---|---|
| Reusable libraries published for import | node-module-template |
| Command-line tools and terminal workflows | node-cli-template |
| Web APIs, workers, long-running services | node-app-template |
Default behavior in this repo: proceed in library mode.
Fast Path
- Use ESM only (
import/export) - Keep public API small and explicit through
index.js - Keep implementation in
lib/ - Write runtime tests in
test/*.spec.jswithnode:test+node:assert/strict - Write type tests in
typetests/*.tst.tswithtstyche - Validate with
npm testbefore finalizing
Commands
npm run build- clean and generate declaration outputnpm run husky-enable- enable git hooks (opt-in)npm run husky-disable- disable git hooksnpm run test:node- runtime tests with coveragenpm run check-type-tests- type-level testsnpm test- full checks + tests
Lockfile policy: this module template does not commit a lockfile by default (package-lock=false in .npmrc).
Guardrails
MUST
- Preserve public import surface and types unless intentionally changed
- Keep changes minimal and template-focused
- Keep docs aligned with actual scripts
ASK FIRST
- Runtime dependency changes
- Public API shape changes
- Large file moves or broad refactors
NEVER
- Introduce CommonJS runtime code
- Claim validation without running it
- Leave template docs with stale commands