pre-commit-hooks

Automate pre-commit checks for linting, formatting, tests, and secrets.

Updated Jan 7, 2026
One-click install
npx skills add https://github.com/Smooth-Operation/household-expense-tracker --skill pre-commit-hooks-smooth-operation
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pre-commit-hooks
Source: https://github.com/Smooth-Operation/household-expense-tracker/tree/main/.claude/skills/safety/pre-commit-hooks
Command: npx skills add https://github.com/Smooth-Operation/household-expense-tracker --skill pre-commit-hooks-smooth-operation

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill ensures code quality by automatically enforcing pre-commit checks so bad commits never enter the repository.

Core Features & Use Cases

  • Automated Quality Gates: Runs linting (eslint/tsc), formatting (prettier), and tests before each commit.
  • Security & Consistency: Checks for secrets and enforces consistent coding standards across team members.
  • Use Case: Onboarding, teams set up pre-commit hooks to prevent unformatted code or failing tests from being committed.

Quick Start

Install dependencies and enable hooks:

  • npm install --save-dev husky lint-staged
  • npx husky install
  • npm set-script prepare "husky install" Then configure package.json with a pre-commit script or by creating a .husky/pre-commit file to run lint-staged.

Frequently Asked Questions about pre-commit-hooks

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

FAQPage Schema
How do I automate code quality checks with pre-commit hooks?

Automate code quality checks by installing and configuring husky and lint-staged via npm scripts to run deterministic checks like eslint and prettier before each git commit.

What problems do pre-commit hooks solve for a development team?

Pre-commit hooks solve code inconsistency and security issues by catching linting errors, formatting deviations, failing tests, and secret leaks before bad commits enter the repository.

Can I run eslint and prettier automatically before every git commit?

Yes, you can run eslint and prettier automatically before each commit by creating a .husky/pre-commit file that executes lint-staged to enforce consistent coding standards.

How do I set up husky and lint-staged for a new repository?

Set up husky and lint-staged by running npm install --save-dev husky lint-staged, executing npx husky install, and adding a prepare script to package.json to automate hook installation.

Do pre-commit hooks prevent secrets from being committed to git?

Yes, pre-commit hooks prevent secret leaks by running automated security checks during regular development, ensuring that sensitive data is caught before a commit is finalized.

What's the best way to enforce coding standards across team members?

The best way to enforce coding standards is applying automated pre-commit quality gates that run formatting, linting, and tests during repository setup and regular development.