setup-pre-commit

Configure Husky pre-commit hooks with lint-staged and Prettier for JavaScript/TypeScript projects.

12|1|Updated Feb 13, 2026
One-click install
npx skills add https://github.com/helderberto/skills --skill setup-pre-commit-helderberto
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: setup-pre-commit
Source: https://github.com/helderberto/skills/tree/main/setup-pre-commit
Command: npx skills add https://github.com/helderberto/skills --skill setup-pre-commit-helderberto

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill sets up Husky pre-commit hooks with lint-staged to apply Prettier formatting automatically, and wires in optional type-checking and tests for a safer commit process.

Core Features & Use Cases

  • Husky integration to run checks before commits.
  • lint-staged to format staged files with Prettier.
  • Optional checks like type-checking and running tests during commit.

Quick Start

Install and configure pre-commit hooks for your project in one step.

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 Prettier formatting with Husky pre-commit hooks?

Automate Prettier formatting by setting up Husky pre-commit hooks integrated with lint-staged, which automatically formats staged JavaScript and TypeScript files before they are committed. This ensures clean, consistent code enters your repository.

Can I run type-checking and tests in pre-commit hooks for JavaScript projects?

Yes, you can wire optional type-checking and tests into your pre-commit workflow. If your project has existing typecheck and test scripts, the setup integrates them into the Husky hooks to run during the commit process for safer commits.

Does the pre-commit setup work with yarn, pnpm, and bun package managers?

Yes, the pre-commit setup supports npm, yarn, pnpm, and bun. It automatically detects the package manager used in your JavaScript or TypeScript project to correctly install and configure the necessary Husky hooks and scripts.

What do I need to set up lint-staged and Husky in my repository?

You need a package.json file in the root of your JavaScript or TypeScript project. Optionally, having existing typecheck and test scripts allows the setup to include those checks in the pre-commit workflow alongside Prettier formatting.

Why use lint-staged with Husky for pre-commit formatting?

Using lint-staged with Husky runs Prettier formatting only on staged files rather than the entire project. This targeted approach keeps your pre-commit hooks fast while guaranteeing that every committed file meets your formatting standards.