A small, reusable starter repo for building TypeScript npm packages with ESM, CJS output, declaration files, Biome, and release-it.
This repository is meant to be copied and customized for each new package you publish. It now contains only generic starter code and setup.
- TypeScript source in
src/ - Bundling with
tsup - ESM + CommonJS output in
dist/ - Generated
.d.tstypes - Linting and formatting with Biome
- Release workflow via
release-it
- Create a new repository from this one, or clone/copy it into a new folder.
- Update
package.json:- change
name - change
description - set the initial
version - update
license,repository,homepage, andbugsfields if you want them - remove
"private": truebefore publishing
- change
- Replace the starter implementation in
src/index.tswith your package code. - Add any runtime dependencies your package needs.
- Install dependencies and start developing.
bun installThe current starter export is intentionally minimal:
import { hello } from 'your-package-name'
console.log(hello())
console.log(hello('team', { punctuation: '!!' }))Replace this with your actual public API once you start the new package.
# Build ESM, CJS, and type declarations
bun run build
# Rebuild on file changes
bun run dev
# Check & fix formatting + linting
bun run check.
├── src/
│ └── index.ts
├── dist/
├── biome.json
├── package.json
└── tsconfig.json
Before publishing a package created from this template:
- Replace the starter code in
src/index.ts. - Update
package.jsonmetadata. - Run
npm run build. - Run
npm run check. - Publish with your preferred workflow, for example
npm publishornpm run release.
This repo includes an agent skill (SKILL.md) that teaches AI coding agents how to scaffold new npm packages using this template's conventions. Install it with npx skills:
# Interactive — choose your agent(s) and scope
npx skills add mrmartineau/npm-package
# Install globally for a specific agent
npx skills add mrmartineau/npm-package -g -a amp
# Install globally for Claude Code
npx skills add mrmartineau/npm-package -g -a claude-codeOnce installed, your agent will automatically use this skill when asked to create or scaffold a new npm package.
Supports Amp, Claude Code, Cursor, Codex, and many more.
- The template targets Node.js 20+.
- Package entrypoints are exposed through the
exportsfield. - Build output is written to
dist/, which is the only published directory.
Made by Zander • zander.wtf • GitHub