Skip to content
SkillModel-led588 tokens in use

Setup Pre-Commit

Set up Husky pre-commit hooks that run lint-staged with Prettier, then your typecheck and test scripts, with the package manager detected.

328,791 stars on the repository MIT Licensemattpocock/skills · skills/misc/setup-pre-commit
claude plugin install mattpocock-skills@claude-plugins-official
View source

Install command as written in the repository's README

Skill label

measured from its files

What installing Setup Pre-Commit costs

59tokens idle
588tokens in use

Idle is what sits in context while the skill is installed. In use is its instructions, loaded when it runs. Counts are approximate, made offline with cl100k_base.

Model dependence Model-led

Script-ledMixedModel-led

Mostly instructions, so how well it works depends on the model that follows them.

This describes the skill's structure, how much of it is scripts. It does not say how well it works.

Touches

shelldetected

Declared tags come from the skill's frontmatter; detected ones from its scripts, its code blocks and the commands it names in inline code. This is detected, not audited.

How it scores

Quality

How well the skill is written, counted from its own files: its frontmatter, its steps, examples, stated output and constraints, its size and whether every file it ships is one it names.How we score it →
Good
  • Frontmatter12/15
  • Structure15/25
  • Examples9/15
  • Output10/15
  • Size15/15
  • Resources0/15

Security

Starts at 100 and loses points for each thing in the skill's files that a reader should look at first.How we score it →
Excellent
  • Runs shell commands−5

    does this on the machine, and the frontmatter does not say so

    SKILL.md, line 32

Repository health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
Excellent
  • Development activity96
  • Maintenance100
  • Community56
  • Maturity32
  • Momentum40

Setup Pre-Commit configures a JavaScript or TypeScript repo so every commit formats staged files and runs a type check and the tests. It installs Husky, lint-staged and Prettier, writes the hook and config files, and commits the result.

It detects npm, pnpm, yarn or bun from the lockfile and adapts the hook commands.

What You Get

  • A Husky pre-commit hook that runs lint-staged, typecheck and tests
  • A lint-staged config that runs Prettier on staged files
  • A Prettier config with sensible defaults when none exists
  • A commit that doubles as a smoke test

Common Use Cases

  • Adding commit-time checks to a new repo
  • Standardising formatting across a team
  • Catching type errors and failing tests before they reach a pull request
  • Moving a repo from manual formatting to automatic Prettier runs

What Makes It Unique

It makes concrete choices: lint-staged first for speed, then the full typecheck and tests, and Husky v9 style hooks without a shebang. The final commit runs through the new hook, so the setup tests itself.

Under The Hood

The skill is Markdown with an agent metadata file for Codex. The agent reads lockfiles, installs husky, lint-staged and prettier from the npm registry with your package manager, runs npx husky init, writes three small files, runs npx lint-staged and makes a git commit.

Join founders building with open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on SubstackJoin 750+ subscribers