setup-pre-commit

Automate Husky pre-commit hook setup with lint-staged for formatting and linting.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires husky, lint-staged, prettier, and includes scripts (resource) components.

What problem does it solve?

This Skill automates the setup of Husky pre-commit hooks for linting, formatting, and testing in Git repositories, reducing manual steps and ensuring code quality.

Core Features & Use Cases

  • Automated Setup: Simplifies the installation and configuration of Husky and lint-staged.
  • Code Quality: Integrates Prettier for code formatting and linting, and optionally type checking and testing.
  • Use Case: Ideal for developers who want to add pre-commit hooks for their team to ensure consistent code style and reduce merge conflicts.

Quick Start

Run the 'setup-pre-commit' skill to automatically configure Husky pre-commit hooks in your current Git 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 for code formatting?

To set up Husky pre-commit hooks with lint-staged, you can automate the installation and configuration process. This automatically integrates Prettier for code formatting and linting to enforce code quality before commits are finalized.

What is the best way to automate Git pre-commit hook configuration for my team?

Automating Git pre-commit hook configuration is best handled by using Husky with lint-staged. This combination enforces consistent code style across your team and reduces merge conflicts by running formatting checks automatically before commits.

Do I need Prettier installed to use Husky and lint-staged for pre-commit hooks?

Yes, Prettier is a required dependency to use this pre-commit hook setup. The automated configuration relies on Prettier to handle code formatting and linting tasks alongside Husky and lint-staged in your Git repository.

Can I include type checking and testing in my Husky pre-commit hooks?

Yes, you can include optional type checking and testing in your Husky pre-commit hooks. The configuration supports integrating these additional code quality checks alongside mandatory Prettier formatting and linting.

Why use Husky and lint-staged instead of manual Git hooks for code quality?

Using Husky and lint-staged automates setup and runs checks only on staged files, unlike manual Git hooks. This streamlines commit processes by enforcing code formatting and linting automatically, reducing manual steps and preventing inconsistent code styles.