What it does
Set up Husky pre-commit hooks with lint-staged (Prettier), type checking, and tests in the current repo
Skills ZICQ category:Agent Workflows 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.
Official URL:skills.sh
Intro in this page language first. The official description stays in its original wording; we do not rewrite SKILL.md.
Set up Husky pre-commit hooks with lint-staged (Prettier), type checking, and tests in the current repo
user wants to add pre-commit hooks, set up Husky, configure lint-staged, or add commit-time formatting/typechecking/testing
Per Agent Skills progressive disclosure: name and description load at startup (~100 tokens); the full SKILL.md body loads when the skill activates; scripts/, references/, and assets/ load only as needed. This file's sections: Setup Pre-Commit Hooks; What This Sets Up; Steps; 1. Detect package manager; 2. Install dependencies; 3. Initialize Husky. It includes spec-recommended sections: step-by-step instructions.
File analysis: instruction-only skill (SKILL.md). The agent loads the full body when activated.
Setup Pre-Commit HooksWhat This Sets UpSteps1. Detect package manager2. Install dependencies3. Initialize Husky4. Create `.husky/pre-commit`5. Create `.lintstagedrc`6. Create `.prettierrc` (if missing)7. Verify8. CommitNotes
Source category:skills.sh agent-skill
namesetup-pre-commitdescriptionInvocation syntax and available tools depend on your Agent client. Client integration guide ↗
Choose the target agent and installation scope, keep referenced package files, then verify the skill appears in the client's catalog.
Copy these instructions to a compatible agent and confirm the target directory matches your client.
Install the agent skill "setup-pre-commit" into my project. The full SKILL.md and official description are at https://zicq.com/en/skills/skl-1fc012fd3368bcb0-Setup-Pre-Commit.html Save it as .cursor/skills/setup-pre-commit/SKILL.md or .claude/skills/setup-pre-commit/SKILL.md and keep the frontmatter name and description exactly as-is.
Requires Node.js and npx. First inspect the repository's skill list to confirm the name.
npx skills add 'https://github.com/mattpocock/skills' --list
npx skills add 'https://github.com/mattpocock/skills' --skill 'setup-pre-commit'
The CLI lets you choose the agent interactively. The default scope is the project; use -g for user scope. Confirm package availability with the discovery command, then use npx skills list to inspect installed skills.
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:
husky lint-staged prettier
npx husky init
This creates .husky/ dir and adds prepare: "husky" to package.json.
.husky/pre-commitWrite this file (no shebang needed for Husky v9+):
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.
.lintstagedrc{
"*": "prettier --ignore-unknown --write"
}
.prettierrc (if missing)Only create if no Prettier config exists. Use these defaults:
{
"useTabs": false,
"tabWidth": 2,
"printWidth": 80,
"singleQuote": false,
"trailingComma": "es5",
"semi": true,
"arrowParens": "always"
}
.husky/pre-commit exists and is executable.lintstagedrc existsprepare script in package.json is "husky"prettier config existsnpx lint-staged to verify it worksStage all changed/created files and commit with message: Add pre-commit hooks (husky + lint-staged + prettier)
This will run through the new pre-commit hooks: a good smoke test that everything works.
prettier --ignore-unknown skips files Prettier can't parse (images, etc.)Agent Workflows
Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that exte…
Agent Workflows
Use the ClawdHub CLI to search, install, update, and publish agent skills from clawdhub.com. Use when you need to fetch new skills on the fl…
Agent Workflows
Orchestrate multi-agent teams with defined roles, task lifecycles, handoff protocols, and review workflows. Use when: (1) Setting up a team …
Agent Workflows
Spec-first, TDD, subagent-driven software development workflow. Use when: (1) building any new feature or app — triggers brainstorm → plan →…