setup-pre-commit

Configure Git pre-commit hooks with Husky and lint-staged.

Updated Apr 8, 2026
One-click install
npx skills add https://github.com/tonomb/personal-pnl --skill setup-pre-commit-tonomb
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: setup-pre-commit
Source: https://github.com/tonomb/personal-pnl/tree/main/.agents/skills/setup-pre-commit
Command: npx skills add https://github.com/tonomb/personal-pnl --skill setup-pre-commit-tonomb

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires husky, lint-staged, prettier.

What problem does it solve?

This Skill solves the inconsistency and manual overhead of maintaining code quality by automating the execution of linters, formatters, and tests before every commit.

Core Features & Use Cases

  • Husky Integration: Automatically initializes and configures Git hooks to prevent bad commits.
  • Lint-Staged Execution: Runs Prettier and other checks only on staged files to ensure high performance.
  • Use Case: Use this when starting a new project or onboarding a team to ensure that every commit is automatically formatted, type-checked, and tested without manual intervention.

Quick Start

Run the setup-pre-commit skill to configure Husky, lint-staged, and Prettier in the current 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 automate code formatting and linting with Git pre-commit hooks?

Automating code formatting with Git pre-commit hooks requires configuring Husky to manage hooks and lint-staged to run Prettier on staged files. This ensures consistent formatting and type checking before every commit.

What is the best way to run Prettier only on staged files before committing?

The best way to run Prettier on staged files is using lint-staged alongside Husky. Lint-staged targets only modified files in the Git staging area, ensuring high performance and consistent formatting without scanning the entire project.

Does Husky work with lint-staged to enforce code quality standards?

Yes, Husky works seamlessly with lint-staged to enforce code quality standards. Husky initializes and configures the Git hooks, while lint-staged executes Prettier and other checks specifically on staged files to prevent bad commits.

Can I use pre-commit hooks to run tests automatically before code submission?

Yes, you can use pre-commit hooks to run tests automatically before code submission. By configuring Husky and lint-staged, you can execute automated type checking and test suites on staged files prior to every Git commit.

Why should I use lint-staged instead of running linters across the whole project?

You should use lint-staged instead of running linters across the whole project to ensure high performance. Lint-staged executes checks only on staged files, significantly reducing execution time and preventing inconsistent formatting in the codebase.

What do I need to set up automated dependency installation and hook initialization for Git?

To set up automated dependency installation and hook initialization for Git, you need to configure Husky, lint-staged, and Prettier in your current repository. This combination initializes Git hooks and enforces formatting rules automatically.