setup-pre-commit
Installation
SKILL.md
Setup Pre-Commit Hooks
Wire up a Husky pre-commit hook that runs lint-staged (Prettier on staged files), then a typecheck and test pass. Detects the package manager, installs the tooling as devDependencies, writes the hook + config files, verifies, and commits.
Ported from
mattpocock/skills→misc/setup-pre-commit. Adapted to this catalog's conventions.
What this sets up
- Husky — git pre-commit hook manager
- lint-staged — runs Prettier on staged files only (fast)
- Prettier — formatter + config (only written if no config exists)
- typecheck + test — full passes run from the hook, when those scripts exist
This is a JS/npm-based toolchain. The hook tooling is npx-driven — keep it JS, not shell. (Any operator helper commands below use zsh per repo preference, but the hook itself stays npm-based.)