home / skills / ehtbanton / claudeskillsrepo / lint-staged-config-generator

lint-staged-config-generator skill

/lint-staged-config-generator

This skill generates a complete lint-staged configuration for staged files, enabling automated linting with ESLint, Prettier, and other tools.

npx playbooks add skill ehtbanton/claudeskillsrepo --skill lint-staged-config-generator

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
811 B
---
name: lint-staged-config-generator
description: Generate lint-staged configuration for running linters on staged Git files. Triggers on "create lint-staged config", "generate lint staged", "lint-staged setup", "staged file linting".
---

# Lint-Staged Config Generator

Generate lint-staged configuration for running linters only on staged Git files.

## Output Requirements

**File Output:** `.lintstagedrc.js`, `lint-staged.config.js`, or in `package.json`
**Format:** Valid lint-staged configuration
**Standards:** lint-staged 15.x

## When Invoked

Immediately generate a complete lint-staged configuration for the project's file types.

## Example Invocations

**Prompt:** "Create lint-staged config for TypeScript and CSS"
**Output:** Complete `.lintstagedrc.js` with ESLint, Prettier, and Stylelint.

Overview

This skill generates a ready-to-use lint-staged configuration for running linters and formatters on staged Git files. It emits .lintstagedrc.js, lint-staged.config.js, or a package.json section formatted for lint-staged 15.x. The goal is to produce a complete, valid configuration tailored to the project's file types and tooling.

How this skill works

When invoked with a target set of file types or tools, the skill builds rules that map globs to commands (ESLint, Prettier, Stylelint, etc.) and formats them to the requested output file. It respects lint-staged 15.x syntax and includes common optimizations like using --cache, batching, and running fix flags where appropriate. The generated config is ready to paste into the repo or written to the selected output file.

When to use it

  • Setting up pre-commit staged linting for a new or existing repository
  • Adding lint-staged support for TypeScript, JavaScript, CSS, or other file types
  • Automatically generating rules that combine ESLint, Prettier, and Stylelint
  • Converting ad-hoc git hooks into a standardized lint-staged configuration
  • Quickly producing a config snippet to paste into package.json or a config file

Best practices

  • Specify the output target (.lintstagedrc.js, lint-staged.config.js, or package.json) when requesting the config
  • List the file types and tools you use (e.g., TypeScript, ESLint, Prettier, Stylelint) for tailored rules
  • Prefer fix flags and cache options (e.g., --fix --cache) for faster runs and automated fixes
  • Batch commands where possible to reduce overhead and keep tasks fast on large commits
  • Keep commands idempotent and avoid heavy operations that block commits

Example use cases

  • Create lint-staged config for TypeScript and CSS that runs ESLint --fix, Prettier --write, and Stylelint --fix
  • Generate a package.json lint-staged section for a JavaScript-only project using ESLint and Prettier
  • Produce a .lintstagedrc.js that only targets .ts, .tsx, .js, .jsx, .css, and .scss files with appropriate commands
  • Set up staged linting for a monorepo by producing per-package lint-staged.config.js stubs
  • Convert an existing husky pre-commit hook into a lint-staged configuration with batching and caching

FAQ

Which output formats are supported?

I can generate .lintstagedrc.js, lint-staged.config.js, or a package.json lint-staged section formatted for lint-staged 15.x.

What linters and formatters can I include?

Common choices are ESLint, Prettier, Stylelint, and TypeScript checks. Provide the tools you want and I will include appropriate commands and flags.

Will the config use best practices?

Yes. The generated config uses --fix where safe, enables caching for tools that support it, and uses batching to keep staged runs fast.