Skill Issue
← Browse

setup-pre-commit

Add formatting and lint checks before each commit

  • For people who code
  • Nothing to set up
by mattpocock
Add to your AI

What it does

Set up Husky pre-commit hooks with lint-staged (Prettier), type checking, and tests in the current repo.
mattpocock, in the skill's own instructions
Instructions the AI follows

This is the skill's own instruction file. It's written for the AI, so it can read like a list of orders. You don't need to read it to use the skill.

Instruction file1 min read

  • Husky pre-commit hook
  • lint-staged running Prettier on all staged files
  • Prettier config (if missing)
  • typecheck and test scripts in the pre-commit hook

Check for package-lock.json (npm), pnpm-lock.yaml (pnpm), yarn.lock (yarn), bun.lockb (bun). Use whichever is present. Default to npm if unclear.

Install as devDependencies:

Code
husky lint-staged prettier

bash
npx husky init

This creates .husky/ dir and adds prepare: "husky" to package.json.

Write this file (no shebang needed for Husky v9+):

Code
npx lint-staged
npm run typecheck
npm run test

Adapt: Replace npm with detected package manager. If repo has no typecheck or test script in package.json, omit those lines and tell the user.

json
{
  "*": "prettier --ignore-unknown --write"
}

Only create if no Prettier config exists. Use these defaults:

json
{
  "useTabs": false,
  "tabWidth": 2,
  "printWidth": 80,
  "singleQuote": false,
  "trailingComma": "es5",
  "semi": true,
  "arrowParens": "always"
}

From skills/misc/setup-pre-commit/SKILL.md in mattpocock/skills · read from GitHub at commit 5beb35b

Try it

  1. 1Add setup-pre-commit to your AI
  2. 2Ask for something like this
Your AI
  • Set up Husky pre-commit hooks with Prettier, type checking and tests in this project.

  • Add lint-staged so only changed files get formatted on commit.

  • Make commits fail if the types don't check.

Example prompts written from the skill's instructions.

Safety

SafeDetails

All three scanners ran and found nothing that could steal your data or hijack your AI.

What it can do
  • Runs commands on your computer
Scanners
SkillSpector 2.12.0 · HoneyBadger 0.8.1 · agentscan 1.2.2
Scanned on
Nov 10, 2026
  • Secret scanPassed
  • Dangerous commandsNoticedSkillSpector: RP1 MEDIUM SKILL.md:32 MCP server referenced without pinned version: 'npx husky'.SkillSpector: RP1 MEDIUM SKILL.md:42 MCP server referenced without pinned version: 'npx lint-staged'.SkillSpector: RP1 MEDIUM SKILL.md:79 MCP server referenced without pinned version: 'npx lint-staged'.
  • Network callsPassed
  • PermissionsPassed
  • Prompt injectionPassed
  • LicensePassed
  • MaintenancePassed
Human review

No person has signed this one off yet.

Reviewer notes (AI, proposed)

Gives explicit npx husky init and lint-staged install steps in your repo, as described.

An AI reviewer read the files and wrote this. It is not a scan, nobody approved it yet, and it never sets the label above.

Three open-source scanners (SkillSpector, HoneyBadger, agentscan) check this exact version. Heads up means it could steal your data or hijack your AI. What it can do is listed, not warned about. Scanners miss things.

How we check: only harm earns a Heads up, meaning prompt injection (OWASP LLM01) or data leaks (LLM02), in files the skill ships. Abilities like running commands (LLM06) are listed, not warned about. No AI is used for this step. OWASP

Details

Stars
332kwhole repo
Installs
571kon skills.sh
Last updated
Nov 24, 2026on GitHub

GitHub and skills.sh numbers are a snapshot from Nov 24, 2026, not live.

Community

Comments

See all Build skills

How to add setup-pre-commit to Claude

Press Add to your AI at the top of this page and pick Claude, or do it yourself:

  1. Download the skill. Keep the .zip as it is.
  2. On Claude's skills page, click +, then Create skill, then Upload a skill.
  3. Pick the file you downloaded and switch the skill on.

Works on every Claude plan, Free included. Code execution and file creation need to be on in Claude's settings. How to add a skill to Claude, step by step.

In ChatGPT

Skills are on ChatGPT Business, Enterprise, Healthcare and Edu plans. Download the skill. Keep the .zip as it is. In ChatGPT, open Plugins in the sidebar, then the Skills tab, then Create, then Upload from your computer. Pick the file you downloaded. ChatGPT checks it, then it's ready. More on ChatGPT.

For AI apps and agents: the skill's instructions as plain text, at the version we scanned.