init-prettier-git-hooks

Automate Prettier, lint-staged, and simple-git-hooks setup for Node.js projects.

4|1|Updated Mar 24, 2024
One-click install
npx skills add https://github.com/ruan-cat/monorepo --skill init-prettier-git-hooks
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: init-prettier-git-hooks
Source: https://github.com/ruan-cat/monorepo/tree/main/claude-code-marketplace/common-tools/skills/init-prettier-git-hooks
Command: npx skills add https://github.com/ruan-cat/monorepo --skill init-prettier-git-hooks

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

In Node.js projects, inconsistent code formatting and manual setup of git hooks waste time and introduce drift. This Skill provides a repeatable, automated way to initialize Prettier + lint-staged + simple-git-hooks for pre-commit formatting and lint checks.

Core Features & Use Cases

  • Automates the installation of formatting and linting tooling (Prettier, lint-staged, simple-git-hooks, and commitlint) as development dependencies.
  • Configures Prettier with a sensible workflow and integrates with lint-staged and git hooks to enforce standards automatically.
  • Updates package.json with scripts for formatting and hook preparation, and initializes the git hooks to run pre-commit and commit-msg checks.

Quick Start

Run the initialization to set up git hooks using lint-staged and simple-git-hooks in your Node.js project.

Frequently Asked Questions about init-prettier-git-hooks

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up Prettier with git hooks in a Node.js project?

To set up Prettier with git hooks in a Node.js project, you can automate the installation of lint-staged and simple-git-hooks to enforce pre-commit formatting. This workflow updates package.json with necessary scripts and initializes the git hooks automatically.

What is the benefit of using lint-staged with simple-git-hooks?

Using lint-staged with simple-git-hooks ensures consistent code formatting by running Prettier only on staged files before commits. This combination prevents unformatted code from entering the repository and standardizes commit messaging through commitlint checks.

Can I use this git hooks setup to enforce commit message formatting?

Yes, this git hooks setup enforces commit message formatting by initializing a commit-msg hook. It integrates commitlint to check commit messages against standardized conventions during your Node.js project's git workflow.

Does this pre-commit formatting workflow require any external dependencies?

This pre-commit formatting workflow requires no external dependencies beyond the Node.js environment itself. It automatically installs Prettier, lint-staged, simple-git-hooks, and commitlint as development dependencies within your existing project.

Why should I automate code formatting with pre-commit hooks instead of manual formatting?

Automating code formatting with pre-commit hooks eliminates manual setup drift and wasted time. It guarantees that Prettier enforces consistent formatting standards on staged files before they are committed, preventing style inconsistencies across your team.