setup-pre-commit

Automate Husky, lint-staged, and Prettier pre-commit setup in JavaScript/TypeScript repositories.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Set up Husky pre-commit hook, lint-staged, Prettier config, and integrate typecheck and test scripts into the pre-commit flow to ensure code quality before commits.

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-pre-commit workflow in your repository to wire Husky, lint-staged, and Prettier into your pre-commit process.

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 and Prettier?

To set up Husky pre-commit hooks with lint-staged and Prettier, you can automate the process by detecting your package manager, installing the necessary devDependencies, initializing Husky, and configuring lint-staged to run Prettier on staged files.

Can I configure pre-commit hooks for a pnpm or bun JavaScript repository?

Yes, you can configure pre-commit hooks for a pnpm or bun JavaScript repository. The setup process detects your package manager from lockfiles and applies the Husky, lint-staged, and Prettier configuration across npm, pnpm, yarn, or bun environments.

What is the best way to run typecheck and test scripts before a Git commit?

The best way to run typecheck and test scripts before a Git commit is by integrating them directly into your Husky pre-commit hook, which ensures these checks automatically execute to enforce code quality before any changes are committed.

How do I automatically format staged files with Prettier in a pre-commit hook?

You can automatically format staged files with Prettier in a pre-commit hook by configuring lint-staged to run Prettier on them. This setup creates the necessary hook file and configures Prettier if a configuration is missing.

Does setting up Husky and lint-staged require an existing Prettier config?

No, setting up Husky and lint-staged does not require an existing Prettier config. The setup process will automatically generate a Prettier configuration for your repository if one is missing during the initialization phase.