pre-commit-hooks

Configure Husky and lint-staged pre-commit hooks for automated code quality checks.

2|1|Updated Nov 13, 2025
One-click install
npx skills add https://github.com/MolcajeteAI/plugin --skill pre-commit-hooks-molcajeteai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pre-commit-hooks
Source: https://github.com/MolcajeteAI/plugin/tree/main/deprecated/tech-stacks/js/common/skills/pre-commit-hooks
Command: npx skills add https://github.com/MolcajeteAI/plugin --skill pre-commit-hooks-molcajeteai

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill automates the setup and configuration of pre-commit hooks using Husky and lint-staged, ensuring code quality and consistency are enforced before code is committed to the repository.

Core Features & Use Cases

  • Automated Linting & Formatting: Automatically formats code and checks for linting errors on staged files.
  • Pre-commit Quality Gates: Prevents low-quality code from entering the version control system.
  • Use Case: When developing a new feature, this skill ensures that all staged TypeScript files are formatted by Biome and pass linting checks before you can commit them, maintaining a clean and consistent codebase.

Quick Start

Configure pre-commit hooks by installing husky and lint-staged and updating your package.json scripts.

Frequently Asked Questions about pre-commit-hooks

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up pre-commit hooks with Husky and lint-staged for automated code quality checks?

To set up pre-commit hooks, you install husky and lint-staged and update your package.json scripts. This configuration ensures staged files automatically undergo code formatting and linting checks before each commit is finalized.

What does lint-staged do when running pre-commit hooks on JavaScript and TypeScript files?

Lint-staged runs automated linters and formatters exclusively on staged files. When applied to JavaScript and TypeScript files, it integrates with tools like Biome, ESLint, or Prettier to enforce project standards before code enters version control.

Can I use Biome and Prettier together for pre-commit formatting on JSON and Markdown files?

Yes, pre-commit hooks can integrate with both Biome and Prettier to format staged files. This setup applies automated quality checks across JavaScript, TypeScript, JSON, and Markdown files to ensure formatting consistency before committing.

What is the best way to prevent low-quality code from entering my git repository?

The best way to prevent low-quality code from entering git is by enforcing pre-commit quality gates using husky and lint-staged. These hooks automatically block commits if staged files fail specified linting or formatting checks.

Does this pre-commit configuration work with both ESLint and Biome for linting?

Yes, the pre-commit configuration supports integration with both ESLint and Biome. It applies these linters to staged JavaScript and TypeScript files, ensuring code adheres to project standards before each commit is allowed to proceed.

Why should I use pre-commit hooks instead of running linters manually before committing?

Pre-commit hooks automate quality checks so you never forget to run linters. By using husky and lint-staged, the system automatically validates staged files against your configured formatters and linters, maintaining consistency without manual intervention.