setup-pre-commit

Set up Husky pre-commit hooks with lint-staged for JavaScript projects.

1|Updated Jun 22, 2026
One-click install
npx skills add https://github.com/jchildree/The-QUESTION --skill setup-pre-commit-jchildree
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: setup-pre-commit
Source: https://github.com/jchildree/The-QUESTION/tree/main/.agents/skills/setup-pre-commit
Command: npx skills add https://github.com/jchildree/The-QUESTION --skill setup-pre-commit-jchildree

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

Manages the setup of Husky pre-commit hooks for code formatting, linting, and testing, ensuring consistent code quality before commits.

Core Features & Use Cases

  • Husky Hook Setup: Configures Husky hooks to enforce code quality standards.
  • Linting & Formatting: Integrates with lint-staged to format code with Prettier and check it with lint-staged.
  • Type Checking & Testing: Sets up type checking and testing scripts in the pre-commit hook.
  • Use Case: Before pushing code, automatically runs formatting, linting, type checking, and tests to catch potential issues early.

Quick Start

Install the skill and follow the steps to set up Husky hooks with lint-staged, type checking, and tests in your repository.

Frequently Asked Questions about setup-pre-commit

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

FAQPage Schema
How do I set up Husky pre-commit hooks with lint-staged?

Configuring Husky pre-commit hooks with lint-staged involves setting up hook scripts that automatically run Prettier formatting, linting, type checking, and tests before changes are committed. This ensures consistent code quality across your JavaScript project.

Does the Husky and lint-staged setup work with pnpm and yarn?

Yes, the Husky and lint-staged pre-commit hook setup works with JavaScript projects using npm, yarn, or pnpm package managers. You can configure the hooks and scripts regardless of which of these package managers your project utilizes.

What is the best way to automate code formatting and testing before a git commit?

The best way to automate code formatting and testing before a commit is using Husky pre-commit hooks integrated with lint-staged. This mechanism runs Prettier formatting, linting, type checking, and tests to catch potential issues early before code is pushed.

Can I run type checking and tests in a pre-commit hook?

Yes, you can run type checking and tests in a pre-commit hook by configuring the hook with Husky. This setup executes your type checking and testing scripts automatically before the commit is finalized to prevent broken code from entering the repository.

Why should I use pre-commit hooks for code quality in a JavaScript project?

You should use pre-commit hooks for code quality to catch potential issues early before pushing code. By running formatting, linting, type checking, and tests automatically before commits, you enforce consistent code standards and prevent errors in your JavaScript project.