This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Template notice: This file describes the template repository itself. If working in a project derived from this template, inform the user that this CLAUDE.md still contains template guidance and should be updated with project-specific content.
This is a minimal Node.js library and CLI starter template written in TypeScript targeting Node 24 (ESM). The Fibonacci sequence code in src/ is a placeholder — replace it with your actual library and CLI logic when starting a new project.
src/cli/commands/— Individual yargs command modules; each exports acreateXxxCommand()factory that accepts injected streams/deps for testability.src/cli/index.ts— CLI entry point built with yargs that wires commands and parsesprocess.argv.src/fibonacci.ts— The library implementation (currently a Fibonacci sequence generator as a placeholder example).src/index.ts— The library's public API (re-exports from implementation modules).src/*.test.ts— Vitest test files co-located with source.
dist/cli/index.js— CLI binary.dist/index.js+dist/index.d.ts— Library entry (exported as".").
Keeps GitHub Actions and npm dependencies up to date automatically via .github/dependabot.yaml.
Linter configured in eslint.config.ts.
Automates CI. Workflow files:
.github/workflows/ci.yaml— Triggers on push tomain, pull requests, and manual dispatch.
Git hook manager configured in lefthook.yaml.
Package manager. Also manages the Node.js runtime — versions for Node.js and pnpm are pinned in package.json.
Formatter configured in .prettierrc.json using prettier-plugin-organize-imports — import order is auto-managed.
Type checker and compiler. tsconfig.json is used for type checking via pnpm tsc; tsconfig.build.json is used for compilation via pnpm pack.
Both configs set moduleResolution: node16, which requires all import paths to use .js extensions — even when importing .ts source files.
Test runner configured in vitest.config.ts with 100% coverage threshold required on every test run.
Run the pre-commit hook:
lefthook run pre-commit # staged files only (default)
lefthook run pre-commit --all-files # all files — matches what CI runsIf any file changes during the run, re-stage the changed files and retry.
pnpm vitest run # Run all tests
pnpm vitest run <file> # Run a single test fileCoverage is always enabled and computed for all files imported during the test run. Running a single test file may fail the 100% threshold if it imports a source file that another test is responsible for fully covering — use the full suite for accurate results.
Use pnpm pack to build and package the library into a tarball (e.g. for publishing to npm). The prepack script runs tsc -p tsconfig.build.json automatically before packing.