SkillsReviewed · mattpocock

Setup Pre-Commit

Setup Pre-Commit is an AI assistant skill for developers adding Git commit checks, but it relies on existing project scripts for type checking and tests. It configures Husky, lint-staged and Prettier to format staged files and run the available checks before committing.

Researched 14 Nov 2026

In short.

Setup Pre-Commit is an AI assistant skill for developers adding Git commit checks, but its type checking and testing depend on scripts the repository already provides. It describes package-manager detection, dependency installation, staged-file formatting and a Husky hook that invokes existing checks. Missing scripts are omitted, and running full checks may increase commit time. Dependency versions and compatibility are unspecified. Nothing was executed, so installation, hook behavior and performance remain unverified.

Researched and written by an AI model and checked by a second AI model. How it works

Covers the complete selected folder through skills/misc/setup-pre-commit/SKILL.md and skills/misc/setup-pre-commit/agents/openai.yaml at revision 5863806dd4e15c63174bee4e7515a4256792ecfa, together with the repository-level LICENSE as an associated notice outside that folder. Other folders and linked pages are excluded. No installation, command execution, hook run, test run, performance measurement or runtime compatibility check was performed.

The overview

identity

Setup Pre-Commit is an instruction skill in the mattpocock/skills repository at [https://github.com/mattpocock/skills/tree/main/skills/misc/setup-pre-commit]. Its stated purpose is to add Husky pre-commit hooks with lint-staged, Prettier, type checking and tests.

The accompanying agents/openai.yaml supplies the display name Setup Pre-Commit and the short description Add pre-commit quality checks. It contains interface labels rather than additional setup logic.

assessment

The skill provides concrete configuration templates for a common repository task. Its useful distinction is between formatting staged files and invoking the project's existing typecheck and test scripts afterward.

It is most suitable when those scripts already express the checks the team wants. It does not create missing test or type-checking infrastructure, and the supplied evidence does not demonstrate a successful installation or commit.

users

The intended users are developers asking an assistant to add commit-time formatting and checks. Its package-manager and package.json assumptions make JavaScript or TypeScript package repositories the apparent target. Beginners receive explicit file templates; experienced developers still need to reconcile them with existing repository conventions.

capabilities

The instructions detect npm, pnpm, Yarn or Bun from named lockfiles, install husky, lint-staged and prettier as development dependencies, initialize Husky, and create a pre-commit hook and lint-staged configuration.

They also supply a default Prettier configuration when none exists. The hook invokes existing typecheck and test scripts when present. Despite the lint-staged name, the supplied configuration runs a formatter; it does not configure a separate code linter.

Using it

requirements

The instructions imply a Git repository with package.json, suitable JavaScript tooling, and the ability to install development dependencies and edit project files. Typecheck and test scripts are optional for installation but necessary for their respective checks to appear in the hook.

Minimum runtime versions and supported assistant versions are unspecified. The hook template explicitly assumes Husky v9 or later when omitting a shebang. Although package-manager adaptation is requested, the initialization and lint-staged examples use npx; compatibility across the named package managers was not assessed.

mechanism

Husky connects the pre-commit hook to Git's commit process. The hook first invokes lint-staged, whose configuration applies prettier --ignore-unknown --write to staged files. This writes formatting changes and skips unsupported file types. The hook then invokes the existing typecheck and test scripts, without adding a staged-file restriction to those commands. Their actual coverage depends on their definitions.

setup

The documented sequence detects the package manager, installs the three development dependencies and runs npx husky init. It then writes .husky/pre-commit and .lintstagedrc, adapting the npm script commands to the detected package manager and omitting missing scripts.

If no Prettier configuration exists, the defaults use spaces, a two-space tab width, an 80-character print width, double quotes, ES5 trailing commas, semicolons and parentheses around arrow-function parameters. The final steps check the files and prepare script, run lint-staged, and create a commit. These are source instructions, not completed actions.

example

In an npm repository that already defines both scripts, the proposed hook runs npx lint-staged, then npm run typecheck, then npm run test. A staged file supported by Prettier would receive formatting before the other commands run. If the repository lacks a test script, the instructions omit npm run test and tell the user. This is an illustration of the template, not an observed execution.

Assessment & evidence

limitations

Package-manager detection lists package-lock.json, pnpm-lock.yaml, yarn.lock and bun.lockb, with npm as the fallback. It does not explain how to resolve conflicting lockfiles or handle other filenames. Dependency versions are not pinned.

The instructions preserve an existing Prettier configuration but do not explain how to merge existing Husky hooks, lint-staged rules or a prepare script. They configure a local commit hook without providing a CI setup. Successful installation, formatting behavior, check failures and commit behavior remain unverified.

reasoning

The configuration suggests a practical tradeoff: staged-file formatting limits the formatting task, while reusing project scripts avoids defining a second set of type-checking and test commands. Those broader commands can still dominate commit time. Omitting absent scripts makes the setup adaptable, but it also means two repositories using this skill may receive substantially different checks. These are implications of the instructions, not measured outcomes.

alternatives

A developer could create the same Husky, lint-staged and Prettier configuration manually using the supplied templates. A repository with established hooks could instead extend its current configuration. These are practical alternatives inferred from the files involved; the source provides no comparison with other hook managers or evidence that this arrangement is superior.

evidence

The substantive source is the complete SKILL.md at [https://raw.githubusercontent.com/mattpocock/skills/5863806dd4e15c63174bee4e7515a4256792ecfa/skills/misc/setup-pre-commit/SKILL.md]. The accompanying agents/openai.yaml establishes its interface labels, and the repository LICENSE establishes the supplied reuse terms.

These files document intended configuration and verification steps. They contain no execution receipts, compatibility results, benchmarks or demonstrated repository outcomes. Nothing was executed for this report.

Access & freshness

costs

The supplied files state no purchase price, subscription fee or usage charge. Assistant costs and any other operational costs are unknown. Running type checking and tests on each commit adds work, but the evidence contains no timings or measurements from which to estimate that overhead.

rights

The accompanying repository license is MIT, with copyright attributed to Matt Pocock in 2026. It permits use, modification, copying, distribution, sublicensing and sale, provided the copyright and permission notices remain in copies or substantial portions. It disclaims warranties and liability. Separate license terms for installed dependencies are not established by these files.

freshness

The supplied snapshot is pinned to repository revision 5863806dd4e15c63174bee4e7515a4256792ecfa and was captured on 2026-11-14 at 00:29:38.005 UTC. That capture time is not a release or last-maintained date. The files do not establish the skill's update history or current dependency releases. Compatibility with dependency versions resolved during a future installation is unknown.

actions

Before applying the templates, identify the intended package manager and inspect existing hooks, formatting settings, the prepare script, and the typecheck and test scripts. Decide whether their scope and duration suit running on every commit.

After setup, follow the documented checks for an executable .husky/pre-commit, .lintstagedrc, the Husky prepare script and a Prettier configuration. Run the documented lint-staged check and inspect staged changes before the prescribed commit. A successful lint-staged invocation alone would not demonstrate that type checking, tests and the full commit hook work.

Evidence for this report

LICENSEnotice · checked 2026-11-14
skills/misc/setup-pre-commit/SKILL.mdselected · checked 2026-11-14