Skill
/setup-pre-commit
Set up Husky pre-commit hooks with lint-staged (Prettier), type checking, and tests in the current repo. Use when user wants to add pre-commit hooks, set up Husky, configure lint-staged, or add commit-time formatting/typechecking/testing.
One skill from mattpocock-skills. Installed with the plugin, it fires itself as you prompt.
shell
$ npx -y skills add mattpocock/skills --skill setup-pre-commit --agent claude-codeInstalls just this skill. Get the whole plugin for auto-invocation.
SKILL.md
setup-pre-commit.SKILL.md
--- name: setup-pre-commit description: Set up Husky pre-commit hooks with lint-staged (Prettier), type checking, and tests in the current repo. Use when user wants to add pre-commit hooks, set up Husky, configure lint-staged, or add commit-time formatting/typechecking/testing. --- # Setup Pre-Commit Hooks ## What This Sets Up - **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 ## Steps ### 1. Detect package manager 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. ### 2. Install dependencies Install as devDependencies: ``` husky lint-staged prettier ``` ### 3. Initialize Husky ```bash npx husky init ``` This creates `.husky/` dir and adds `prepare: "husky"` to package.json. ### 4. Create `.husky/pre-commit` Write this file (no shebang needed for Husky v9+): ``` npx lint-staged
Ships with mattpocock-skills
Stars169,411Forks14,585LanguageShellLicenseMIT
Get the whole plugin, auto-invoked