Matt Pocock's skill for replacing `as` type assertions in TypeScript tests with @total-typescript/shoehorn's fromPartial, fromAny and fromExact helpers.
Setup Pre-Commit (Matt Pocock) Skill
Matt Pocock's skill that wires Husky, lint-staged and Prettier into a JavaScript or TypeScript repo, so every commit is formatted, type-checked and tested before it lands.
Install
Other ways to install
About
- Detects npm, pnpm, Yarn or Bun from the lockfile
- Installs Husky, lint-staged and Prettier as dev dependencies
- Pre-commit hook runs lint-staged, then typecheck and test scripts when they exist
- Formats only staged files with prettier --ignore-unknown
- Writes a default .prettierrc only when none exists
- Verification checklist and a smoke-test commit
Setup Pre-Commit is a short, procedural skill from Matt Pocock's public mattpocock/skills collection. Ask an agent to "add pre-commit hooks" or "set up Husky" and it carries out the whole chore in one pass instead of improvising a configuration.
The skill first detects the package manager from the lockfile (npm, pnpm, Yarn or Bun) and uses it throughout. It installs husky, lint-staged and prettier as dev dependencies, runs npx husky init, and writes a .husky/pre-commit hook that runs lint-staged and then the repository's own typecheck and test scripts, leaving out any script the project does not have and telling you so. lint-staged is configured to run prettier --ignore-unknown --write on staged files only, and a default .prettierrc is written only when the project has no Prettier config yet.
It ends with a checklist (hook file present and executable, prepare script set to husky, Prettier config present) and commits the result, so the new hook runs on its own commit as a smoke test. It targets Husky v9 and later, where hook files need no shebang.
Useful for anyone starting a Node.js or TypeScript project with Claude Code, Codex or Cursor who wants commit-time formatting and checks without looking up the current Husky setup. MIT licensed.
SKILL.md
The instructions your agent loads, as published by Matt Pocock.
Related Skills
See all Setup Pre-Commit (Matt Pocock) alternativesMatt Pocock's skill that gives coding agents a shared vocabulary for designing deep modules: interfaces, seams, adapters, depth, leverage and locality, plus rules for testable design.
Skill: TDD
by Matt Pocock
Matt Pocock's test-driven development skill: one red-to-green slice at a time, tests only at seams agreed with you first, and a named list of test anti-patterns to avoid.
Skill: Diagnosing Bugs
by Matt Pocock
Matt Pocock's discipline for hard bugs and performance regressions: build a tight, red-capable feedback loop first, then reproduce, minimise, hypothesise, instrument, fix with a regression test and clean up.