setup-pre-commit

Configure Husky and lint-staged pre-commit hooks for JavaScript and TypeScript repositories.

Updated May 5, 2026
One-click install
npx skills add https://github.com/wachawo/claude-skills --skill setup-pre-commit-wachawo
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: setup-pre-commit
Source: https://github.com/wachawo/claude-skills/tree/main/skills/setup-pre-commit
Command: npx skills add https://github.com/wachawo/claude-skills --skill setup-pre-commit-wachawo

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill eliminates manual code quality checks by automating the enforcement of linting, formatting, and testing before every commit.

Core Features & Use Cases

  • Husky Integration: Automatically initializes Husky to manage Git hooks.
  • Lint-Staged Workflow: Ensures only staged files are processed by Prettier, keeping commits clean and fast.
  • Verification: Automatically configures type-checking and test execution to prevent broken code from entering the repository.

Quick Start

Run the setup-pre-commit skill to initialize Husky, lint-staged, and Prettier in your current project directory.

Frequently Asked Questions about setup-pre-commit

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I automate code formatting with pre-commit hooks in a JavaScript project?

Automating pre-commit hooks uses Husky and lint-staged to run Prettier formatting on staged files. This ensures consistent code quality standards are enforced automatically before every Git commit in JavaScript and TypeScript repositories without manual checks.

What's the best way to run Prettier only on staged files before a commit?

Running Prettier on staged files is handled by integrating lint-staged with Husky pre-commit hooks. Lint-staged ensures only modified files are processed by Prettier, keeping the formatting validation clean and fast.

Can I use Husky pre-commit hooks with pnpm or bun package managers?

Husky pre-commit hooks are compatible with pnpm and bun, alongside npm and yarn. The setup requires a Node.js environment with access to any of these package managers to initialize the hook configuration.

How do I prevent broken code from entering a Git repository?

Preventing broken code from entering a Git repository is achieved by configuring pre-commit hooks to execute automated type-checking and tests. This validation blocks the commit if errors are detected before the code enters the repository.

Do I need Node.js to set up lint-staged and Husky?

Node.js is required to set up lint-staged and Husky. The automation configuration depends on a Node.js environment with access to npm, pnpm, yarn, or bun to install the necessary packages and initialize the hooks.

Why use lint-staged instead of running Prettier on the whole project?

Using lint-staged instead of running Prettier on the whole project ensures only staged files are processed. This targeted approach keeps pre-commit validation fast and prevents unrelated formatting changes from cluttering your commit history.