setup-pre-commit

Configure Husky and lint-staged pre-commit hooks for JavaScript and TypeScript repositories.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill removes the manual setup burden of configuring commit-time quality checks by creating a consistent pre-commit workflow for JavaScript and TypeScript repositories.

Core Features & Use Cases

  • Husky Setup: Configures Husky pre-commit hooks to run automated checks before commits are created.
  • Lint-Staged and Formatting: Adds lint-staged with Prettier to automatically format staged files.
  • Validation Workflow: Integrates available type checking and test scripts into the commit process for safer changes.
  • Use Case: A developer starting a new project can use this Skill to quickly establish automated formatting, type validation, and testing before every commit.

Quick Start

Use the setup-pre-commit skill to configure Husky, lint-staged, Prettier, and available validation checks in my 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 for automated code formatting?

Set up Husky pre-commit hooks by configuring automated quality checks that run Prettier formatting and lint-staged validation before a commit is created. This workflow removes manual formatting burden by automatically formatting staged files upon commit.

What is lint-staged and how does it work with TypeScript validation?

Lint-staged runs targeted checks on staged files to enforce code quality before commits. When integrated with TypeScript, it ensures available type checking scripts are executed during the commit process for safer changes.

Can I use pre-commit hooks to run tests automatically in a JavaScript repository?

Yes, you can use pre-commit hooks to run tests automatically in a JavaScript repository. This workflow integrates available test scripts into the commit process, establishing reliable validation before changes are finalized.

Do I need package manager detection to configure commit-time checks?

Yes, package manager detection is required to configure commit-time checks. The setup process depends on detecting the package manager to correctly configure dependencies for Husky, lint-staged, and Prettier.

What's the best way to automate type checking and formatting before commits?

The best way to automate type checking and formatting before commits is configuring a pre-commit workflow with Husky and lint-staged. This approach consistently validates TypeScript repositories by running Prettier and type checks automatically.