setup-pre-commit

Automate pre-commit hook and lint tooling setup for Git repositories.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Prevents commit-time issues by automating pre-commit checks (linting, formatting, and basic tests) before code enters CI, reducing broken builds and manual debugging.

Core Features & Use Cases

  • Set up Husky-based pre-commit hooks to run lint-staged, Prettier, type checks, and tests on staged changes
  • Auto-detect the project’s package manager and apply the correct commands
  • Provide a minimal, repeatable baseline for enforcing code quality across JavaScript/TypeScript repos

Quick Start

Run the setup-pre-commit skill to add Husky, lint-staged, and sensible pre-commit checks to this 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 to run Prettier and lint-staged?

To set up Husky pre-commit hooks with Prettier and lint-staged, you can use an automated setup tool that configures Git hooks, detects your package manager, and validates the pre-commit workflow to enforce formatting and type checks on staged changes.

How do pre-commit hooks prevent broken builds in JavaScript and TypeScript repositories?

Pre-commit hooks prevent broken builds by running lint-staged, Prettier, type checks, and tests on staged changes before code enters CI, catching formatting errors and basic issues early to reduce manual debugging.

Can I configure Husky and lint-staged for an existing JavaScript codebase?

Yes, you can configure Husky and lint-staged for an existing JavaScript codebase. The setup process applies to both new projects and established codebases seeking to enforce code quality at commit time.

What's the best way to automate pre-commit checks for multiple package managers?

The best way to automate pre-commit checks across multiple package managers is to use a setup process that auto-detects the project's package manager and applies the correct Husky and lint-staged commands automatically.

Do I need typecheck and test scripts to run pre-commit hooks with Husky?

Typecheck and test scripts are not strictly required to run pre-commit hooks with Husky, but configuring them as optional pre-commit checks provides a minimal, repeatable baseline for enforcing code quality alongside Prettier and lint-staged.