setup-pre-commit

Sets up Husky and lint-staged pre-commit hooks for formatting, type checking, and tests in JavaScript/TypeScript repositories.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill removes the manual work of remembering format, typecheck, and test checks before every commit, helping teams catch issues earlier and keep the repository consistent.

Core Features & Use Cases

  • Husky pre-commit setup: Creates a Git hook that runs automatically before commits.
  • lint-staged formatting: Runs Prettier on staged files so only changed files are formatted.
  • Quality gates: Adds type checking and tests to the commit workflow when those scripts exist.
  • Use case: A developer wants every commit to be validated the same way across the team without relying on memory or manual steps.

Quick Start

Ask the assistant to set up Husky pre-commit hooks with lint-staged, Prettier, type checking, and tests 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 set up Husky pre-commit hooks with lint-staged in a JavaScript repository?

To set up Husky pre-commit hooks with lint-staged, you need to install the hook dependencies, configure the hook files, and define Prettier defaults to format staged files automatically. This ensures consistent commit-time quality checks across your team.

What is the best way to automate Prettier formatting and type checking before every git commit?

The best way to automate Prettier formatting and type checking before a git commit is using Husky and lint-staged. This creates a Git hook that runs quality checks on staged files, catching issues early without relying on manual steps.

Does pre-commit automation with lint-staged work if my project is missing Prettier defaults?

Yes, lint-staged pre-commit automation works even if your project is missing Prettier defaults. The setup process detects your package manager, installs hook dependencies, and configures Prettier defaults automatically when they are absent.

Can I add type checking and tests to a Husky pre-commit workflow?

Yes, you can add type checking and tests to a Husky pre-commit workflow. The setup integrates these quality gates into the commit process automatically when the corresponding scripts already exist in your JavaScript or TypeScript repository.

Why should I use lint-staged for commit-time formatting instead of running Prettier on the whole project?

You should use lint-staged for commit-time formatting because it runs Prettier only on staged files. This targeted approach formats only changed files, keeping commits fast and preventing unrelated formatting changes from cluttering your repository history.

Do I need a specific package manager to configure Git hooks with Husky?

No specific package manager is strictly required to configure Git hooks with Husky. The setup process automatically detects your project's package manager to install dependencies and configure the pre-commit hook files correctly.