setup-pre-commit

Sets up Husky pre-commit hooks with lint-staged and Prettier.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill automates the setup of pre-commit tooling to enforce code quality before commits, reducing formatting issues and preventing broken builds from being merged.

Core Features & Use Cases

  • Husky pre-commit hook
  • lint-staged running Prettier on all staged files
  • Prettier config (if missing)
  • typecheck and test scripts in the pre-commit hook

Quick Start

Run the setup script in your project to install dependencies, initialize Husky, and configure a pre-commit hook that runs lint-staged, type checks, and tests.

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 to run Prettier automatically?

Setting up Husky pre-commit hooks to run Prettier automatically is handled by initializing Husky, configuring lint-staged, and creating a minimal .prettierrc file if one is missing. This automates formatting and enforces code style on staged files.

What do I need to configure lint-staged pre-commit hooks in my repository?

To configure lint-staged pre-commit hooks, you need an existing package.json file. The setup detects your package manager, installs dependencies, creates a .lintstagedrc config, and generates the necessary .husky directory structure.

Can I use this pre-commit hook setup with pnpm or bun?

Yes, this pre-commit hook setup works with pnpm and bun. It automatically detects your active package manager across npm, pnpm, yarn, and bun environments, adapting the installation and execution commands accordingly.

How do I run typecheck and test scripts before committing code?

Running typecheck and test scripts before committing is achieved by adding them directly into the Husky pre-commit hook alongside lint-staged. This provides quick feedback and prevents broken builds from being merged.

What is the best way to enforce code quality and prevent broken commits?

The best way to enforce code quality and prevent broken commits is using a Husky pre-commit hook with lint-staged to format code with Prettier, combined with automated typecheck and test scripts to catch errors locally before they reach the repository.