setup-pre-commit

Configure Husky, lint-staged, and Prettier pre-commit hooks for npm, pnpm, or yarn.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps teams quickly add robust pre-commit hooks by configuring Husky, lint-staged, and Prettier, so code quality checks run automatically before commits.

Core Features & Use Cases

  • Automatic hook setup: Detects the project package manager, installs Husky, lint-staged, and Prettier as devDependencies, and initializes Husky.
  • Config generation: Creates .husky/pre-commit, .lintstagedrc, and .prettierrc (if missing) to enforce consistent formatting and quality checks.
  • Verification & guidance: Verifies the setup, provides a smoke test, and guides the user to commit changes safely.
  • Use Case: When onboarding a new repo, drop in this Skill to enable automated style and test checks on every commit.

Quick Start

Run the setup steps to enable Husky-based pre-commit checks in your 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 with lint-staged and Prettier?

To set up Husky pre-commit hooks, this Skill detects your package manager, installs Husky, lint-staged, and Prettier as devDependencies, and automatically generates the necessary configuration files to enforce code quality before commits.

Does this pre-commit automation work with pnpm and yarn repositories?

Yes, this pre-commit automation supports pnpm and yarn repositories. The tool detects your current package manager and initializes the appropriate Husky and lint-staged setup for your specific environment.

What configuration files are needed to automate code quality checks before commits?

To automate code quality checks before commits, you need the .husky/pre-commit, .lintstagedrc, and .prettierrc files. This Skill automatically creates these missing configurations to enforce consistent formatting.

What is the best way to enforce Prettier formatting on git commits?

The best way to enforce Prettier formatting on git commits is using Husky pre-commit hooks integrated with lint-staged. This combination automatically runs formatting checks on staged files before commits are finalized.

Can I integrate pre-commit hook scripts into my CI workflows and package.json?

Yes, you can integrate pre-commit hook scripts into your CI workflows and package.json. This setup provides optional script integration alongside the generated Husky and lint-staged configurations for comprehensive code quality automation.