setup-pre-commit

Automates Husky pre-commit hooks with lint-staged, Prettier, type checks, and tests for JavaScript/TypeScript.

Updated Apr 14, 2026
One-click install
npx skills add https://github.com/kvithayathil/agent-resources --skill setup-pre-commit-kvithayathil
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: setup-pre-commit
Source: https://github.com/kvithayathil/agent-resources/tree/main/skills/setup-pre-commit
Command: npx skills add https://github.com/kvithayathil/agent-resources --skill setup-pre-commit-kvithayathil

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Manually enforcing code formatting, type safety, and test passing before commits leads to inconsistent code quality, broken builds, and wasted time during code reviews.

Core Features & Use Cases

  • Zero-Effort Hook Setup: Automatically configures Husky pre-commit hooks, lint-staged, and Prettier with sensible defaults.
  • Commit-Time Quality Gates: Runs Prettier on staged files, plus full type checks and tests, before code is committed.
  • Use Case: For a JavaScript/TypeScript development team, use this skill to eliminate formatting debates and catch errors early by enforcing consistent code standards on every commit.

Quick Start

Use the setup-pre-commit skill to add pre-commit hooks that run Prettier, type checks, and tests to your current 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 pre-commit hooks for Prettier and tests in a JavaScript repository?

This skill automates pre-commit hook setup by configuring Husky and lint-staged with sensible defaults to run Prettier, type checks, and tests on staged JavaScript files before committing.

What is the best way to automate code formatting and linting before a git commit?

Automating code formatting before a git commit is best handled by Husky pre-commit hooks combined with lint-staged, which runs Prettier only on staged files to ensure consistent code quality without slowing down development.

Can I use lint-staged and Husky to run type checking on staged TypeScript files?

Yes, you can use this skill to configure Husky and lint-staged to execute full type checking and test suites alongside Prettier, ensuring type safety is enforced before code reaches version control.

Do I need to manually configure Husky to enforce code quality in my JavaScript project?

No manual configuration is needed for Husky, as this skill provides a zero-configuration setup that automatically establishes commit-time quality gates with sensible defaults for formatting and testing.

Why does my pre-commit hook run slow when checking code formatting on all files?

Pre-commit hooks run slow when checking all files, but using lint-staged configures the quality gate to run Prettier and checks only on staged files, significantly improving commit speed.