setup-linter-hooks

Configure file-change hooks for linting and formatting in code repositories.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/swat9013/dotfiles --skill setup-linter-hooks
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: setup-linter-hooks
Source: https://github.com/swat9013/dotfiles/tree/main/.claude-global/skills/setup-linter-hooks
Command: npx skills add https://github.com/swat9013/dotfiles --skill setup-linter-hooks

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Projects often lack consistent, automated formatting and linting on file save, causing style drift, avoidable CI failures, and developer inefficiency; this Skill detects tools and config files and generates hooks to enforce formatting and linting automatically.

Core Features & Use Cases

  • Automatic detection: Scans project root for package.json, pyproject.toml, Cargo.toml, go.mod, Gemfile, and composer.json to determine language and tooling.
  • Smart hook generation: Chooses formatter-first then linter, prefers tools with automatic fix/write flags, and generates either inline commands or an external script based on complexity.
  • Safe application: Merges or updates .claude/settings.json without overwriting unrelated settings, creates .claude/hooks scripts when needed, and sets executable permissions.
  • Use case: For a Node.js repo with Prettier and ESLint, generate a format-and-lint hook that runs Prettier --write then ESLint --fix on edited files.

Quick Start

Run the setup-linter-hooks skill to detect project linters and generate or merge .claude hook configurations and an executable formatter-and-linter script that runs on file edits.

Frequently Asked Questions about setup-linter-hooks

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

FAQPage Schema
How do I automatically configure pre-commit hooks for linting and formatting?

Automatically configuring pre-commit hooks for linting and formatting requires scanning project configuration files like package.json or Cargo.toml to detect languages, then generating executable scripts that run your linter and formatter on file edits.

What is the best way to set up format-on-save hooks for multiple programming languages?

The best way to set up format-on-save hooks for multiple programming languages is to detect the specific linter and formatter tools from your project files, then generate hook commands that prefer tools supporting automatic fixing like --write or --fix flags.

Does hook generation work with Node.js, Python, Rust, Go, and Ruby projects?

Yes, hook generation works with Node.js, Python, Rust, Go, and Ruby projects by scanning configuration files such as package.json, pyproject.toml, Cargo.toml, go.mod, and Gemfile to identify the correct language tooling and select appropriate formatting commands.

How do I merge new linting hooks into existing settings without overwriting configurations?

To merge new linting hooks into existing settings without overwriting configurations, the hook generation process safely updates the settings.json file by preserving unrelated entries and only injecting the necessary formatting and linting command entries.

Can I generate a shell script for complex linter and formatter commands?

Yes, you can generate a shell script for complex linter and formatter commands; when hook logic is too complicated for inline commands, the tool creates an executable format-and-lint.sh script within the hooks directory to handle the execution.

Why should I use automated formatting hooks instead of running linters manually?

You should use automated formatting hooks instead of running linters manually to prevent style drift, avoid CI pipeline failures caused by unformatted code, and eliminate the developer inefficiency of remembering to execute formatting commands before commits.