setup-pre-commit

Configure Husky, lint-staged, and Prettier pre-commit hooks across package managers.

Updated Apr 4, 2026
One-click install
npx skills add https://github.com/ClyptAI/Clypt-Frontend --skill setup-pre-commit-clyptai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: setup-pre-commit
Source: https://github.com/ClyptAI/Clypt-Frontend/tree/main/.agents/skills/mattpocock-skills/setup-pre-commit
Command: npx skills add https://github.com/ClyptAI/Clypt-Frontend --skill setup-pre-commit-clyptai

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps teams enforce code quality by automatically running formatting, linting, type checks, and tests before commits, preventing bad changes from entering history.

Core Features & Use Cases

  • Automated pre-commit checks: Husky + lint-staged + Prettier to format and lint staged files.
  • Initialize Husky across package managers (npm, yarn, pnpm, bun) and wire up the pre-commit workflow.
  • Guidance for repos with or without existing typecheck or test scripts.

Quick Start

Install and configure pre-commit hooks in your repository with a single command sequence to detect your package manager, install dependencies, initialize Husky, and set up lint-staged and Prettier.

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, this Skill automatically detects your package manager, installs dependencies, initializes Husky, and configures lint-staged with Prettier to format and lint staged files before commits.

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

Yes, pre-commit hook configuration works across npm, yarn, pnpm, and bun projects, detecting the package manager automatically and adapting the installation and Husky initialization steps accordingly.

What happens if my repo doesn't have existing typecheck or test scripts?

If typecheck or test scripts are missing, the pre-commit setup provides adaptable steps and fallback behavior, ensuring Husky and lint-staged are still wired up without breaking the commit workflow.

Why use lint-staged and Husky for automated formatting before commits?

Using Husky with lint-staged automates formatting and linting on staged files, preventing bad changes from entering git history and enforcing code quality across the team without manual checks.

What's the best way to run type checking and tests before a git commit?

The best way to run type checking and tests before a commit is integrating them into a Husky pre-commit hook via lint-staged, which this Skill configures alongside Prettier in your package.json scripts.

Does this pre-commit setup work if I already have an existing Prettier config?

Yes, the pre-commit setup integrates with existing Prettier configurations and package.json scripts, applying lint-staged to staged files while respecting your current formatting rules.