setup-pre-commit

Install Husky pre-commit hooks for lint-staged, Prettier, typecheck, and tests in JavaScript/TypeScript repos.

3|Updated Mar 1, 2026
One-click install
npx skills add https://github.com/onblueroses/strata --skill setup-pre-commit-onblueroses
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: setup-pre-commit
Source: https://github.com/onblueroses/strata/tree/main/skills/setup-pre-commit
Command: npx skills add https://github.com/onblueroses/strata --skill setup-pre-commit-onblueroses

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires husky, lint-staged, prettier, and includes scripts (resource) components.

What problem does it solve?

This Skill automates the setup of a comprehensive commit-time gate that includes lint-staged + Prettier for staged files and a full-project typecheck and test run for JavaScript/TypeScript repositories.

Core Features & Use Cases

  • Commit-Time Typecheck/Tests: Ensures full-project typechecking and testing on every commit, beyond edit-time linting.
  • Husky Pre-commit Integration: Installs Husky as a pre-commit gate for lint-staged + Prettier on staged files.
  • Scoped to JS/TS: Only applicable for JavaScript/TypeScript repositories with a package.json.
  • Guardrails and Validation: Verifies existence of package.json and checks for incompatible projects.

Quick Start

Run /setup-pre-commit inside your JS/TS repo with package.json.

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 a pre-commit hook to run Prettier and tests in a JavaScript repo?▼

To set up a pre-commit hook for Prettier and tests, this Skill installs Husky and lint-staged to enforce commit-time formatting on staged files and execute full-project typechecking and testing in JavaScript/TypeScript repositories.

Does this pre-commit hook setup work with projects that do not have a package.json?▼

No, this pre-commit hook setup does not work without a package.json. The Skill includes guardrails to verify the existence of a package.json file and is strictly scoped to JavaScript and TypeScript repositories.

What is the difference between edit-time linting and a commit-time typecheck gate?▼

A commit-time typecheck gate ensures full-project typechecking and testing on every commit, whereas edit-time linting only checks files as you write them. This gate uses Husky to intercept commits and run validation.

How do I configure lint-staged and Husky to format staged files before committing?▼

You can configure lint-staged and Husky by running the setup command inside your repository. This automates the installation of Husky as a pre-commit gate to run Prettier on staged files before a commit is finalized.

Can I use this commit hook automation for non-JavaScript projects like Python or Go?▼

No, you cannot use this commit hook automation for Python or Go. The Skill explicitly checks for incompatible projects and only supports JavaScript and TypeScript repositories containing a package.json.