Agent skill
lintstagedrc
Generates .lintstagedrc configuration to automatically fix and format staged files before commit. Runs ESLint, Stylelint, and Prettier on staged files.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/development/lintstagedrc
SKILL.md
Lint-Staged Configuration Skill
Purpose
Generate lint-staged configuration to automatically fix and format staged files before commit.
🚨 MANDATORY FILE COUNT
This skill MUST create exactly 1 file:
.lintstagedrc.json(preferred format)
🔍 BEFORE GENERATING - CRITICAL RESEARCH REQUIRED
⚠️ HIGH PRIORITY: Verify current tool CLI flags to prevent outdated commands
Required Research Steps:
- ESLint CLI Flags: Verify
eslint --fixis still the correct flag- Check if ESLint CLI has deprecated or changed flags
- Verify
--fixflag still works with current ESLint version
- Prettier CLI Flags: Verify
prettier --writeis still correct- Check if Prettier CLI has changed flags
- Verify
--writeflag syntax hasn't changed
- Stylelint CLI (if project uses Stylelint):
- Check
package.jsonforstylelintdependency - If found: Verify
stylelint --fixis correct flag - Include style file patterns in configuration
- Check
- File Patterns: Verify glob patterns work with lint-staged version
- Check if pattern syntax has changed
- Verify file extension support (jsx, tsx, css, scss)
- Command Chaining: Verify array of commands still executes sequentially
- Alternative Formats: Check if
.lintstagedrc.jsonis still recommended format- Verify not deprecated in favor of
.lintstagedrc.jsor package.json field
- Verify not deprecated in favor of
Output
Create the file: .lintstagedrc.json
Supported Format:
.lintstagedrc.json(strict preferred format - simple JSON configuration)
Alternative Formats (only if JSON deprecated):
.lintstagedrc.js(JavaScript with dynamic logic)lint-stagedfield inpackage.json.lintstagedrc.cjs(CommonJS format)
Example File
See: examples.md in this directory for complete examples and detailed explanations.
⚠️ IMPORTANT: The examples.md file contains December 2025 configurations. Always verify current CLI flags before using.
Execution Checklist
- Research current ESLint CLI flags (verify
--fix) - Research current Prettier CLI flags (verify
--write) - Check if project has Stylelint in package.json
- If Stylelint found, verify
stylelint --fixflag - Determine file patterns based on project needs (jsx/tsx/css/scss)
- Verify lint-staged glob pattern syntax hasn't changed
- Create
.lintstagedrc.jsonwith appropriate commands and patterns - Verify JSON format is still recommended (not deprecated)
🛑 BLOCKING VALIDATION CHECKPOINT
STOP! Before proceeding to the next skill, verify:
Automated Verification
Run this command to verify the file exists:
if [ -f ".lintstagedrc.json" ] || [ -f ".lintstagedrc.js" ] || [ -f ".lintstagedrc.cjs" ] || grep -q "lint-staged" package.json 2>/dev/null; then
echo "✓ Lint-staged configuration found"
if [ -f ".lintstagedrc.json" ]; then
echo "✓ Using .lintstagedrc.json (preferred format)"
# Validate JSON syntax
if command -v jq >/dev/null 2>&1; then
jq empty .lintstagedrc.json && echo "✓ Valid JSON syntax" || echo "✗ Invalid JSON syntax"
fi
fi
else
echo "✗ Lint-staged configuration missing"
exit 1
fi
Manual Verification
- ✓
.lintstagedrc.jsonexists at project root - ✓ File contains valid JSON syntax
- ✓ File includes ESLint command with current flags
- ✓ File includes Prettier command with current flags
- ✓ File patterns match project file types (js/ts/vue, optionally jsx/tsx/css/scss)
- ✓ Commands use current CLI flags (not deprecated)
- ✓ If Stylelint in project, style files have stylelint command
If Validation Fails
DO NOT PROCEED to the next skill. Create or fix the missing/incorrect file immediately.
Notes
- ESLint Auto-Fix: Runs
eslint --fixon JS/TS/Vue files (verify flag current) - Prettier Formatting: Runs
prettier --writeon code and config files (verify flag current) - Fast and Efficient: Only processes staged files, not entire codebase
- Husky Integration: Works with pre-commit hook for automated quality checks
- Prevents Bad Commits: Blocks commits that don't meet linting standards
- Sequential Execution: Commands in array run sequentially for each file
- File Patterns: Supports glob patterns (
*.{js,ts,vue},*.{css,scss}) - Extended Patterns: Include jsx/tsx if React, css/scss if using style files
- Stylelint Optional: Only include if project has
stylelintin package.json - Always verify current CLI flags - Tools may change flag syntax
- JSON Format Preferred: Simple, declarative, works without build step
- Command Arrays: Multiple commands per pattern run sequentially on same files
Didn't find tool you were looking for?