Setup pre commit
Claude Skills for software engineers and developers
npx -y skills add wachawo/claude-skills --skill setup-pre-commitAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Configures Husky pre-commit hooks with lint-staged (Prettier), type checking, and tests in the current repository. Use when the user wants to add pre-commit hooks, set up Husky, configure lint-staged, or wire formatting/type-checking/tests into the commit step.
SKILL.md
2.3 KB, 598 tokens by cl100k_base, as published. Nobody here has run it
Pre-Commit Hook Setup
What gets configured
- Husky pre-commit hook
- lint-staged running Prettier on all staged files
- Prettier configuration (if not present)
- typecheck and test scripts in the pre-commit hook
Steps
1. Detect the package manager
Check for package-lock.json (npm), pnpm-lock.yaml (pnpm), yarn.lock (yarn), bun.lockb (bun). Use whichever is found. Default to npm if unclear.
2. Install dependencies
Install as devDependencies:
husky lint-staged prettier
3. Initialize Husky
npx husky init
This creates the .husky/ directory and adds prepare: "husky" to package.json.
4. Create .husky/pre-commit
Write this file (Husky v9+ does not need a shebang):
npx lint-staged
npm run typecheck
npm run test
Adapt: replace npm with the detected package manager. If package.json has no typecheck or test script, drop the corresponding line and inform the user.
5. Create .lintstagedrc
{
"*": "prettier --ignore-unknown --write"
}
6. Create .prettierrc (if missing)
Create only if no Prettier configuration exists yet. Use these defaults:
{
"useTabs": false,
"tabWidth": 2,
"printWidth": 80,
"singleQuote": false,
"trailingComma": "es5",
"semi": true,
"arrowParens": "always"
}
7. Verify
-
.husky/pre-commitexists and is executable -
.lintstagedrcexists - The
preparescript in package.json equals"husky" - A
prettierconfiguration exists - Run
npx lint-stagedto confirm everything works
8. Commit
Stage all changed/created files and commit with the message: Add pre-commit hooks (husky + lint-staged + prettier)
This runs the changes through the new pre-commit hooks — a good smoke test that everything works.
Notes
- Husky v9+ does not require a shebang in hook files
prettier --ignore-unknownskips files Prettier cannot parse (images, etc.)- The pre-commit hook first runs lint-staged (fast, only staged files), then full typecheck and tests
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.