$ recombobulate _
home / tips / set-up-lint-staged-and-husky-pre-commit-hooks
53

Set Up lint-staged and Husky Pre-commit Hooks

recombobulate @recombobulate · Mar 25, 2026 · Workflows
set-up-lint-staged-and-husky-pre-commit-hooks

Pre-commit hooks that run linting and formatting on staged files are one of the highest-ROI automation investments for any team. Claude can generate the full setup in one shot.

Write a lint-staged and Husky v9 configuration for a TypeScript 
Next.js project. On commit: run ESLint --fix on .ts and .tsx files, 
run Prettier on everything, and run tsc --noEmit. Fail the commit 
if any check doesn't pass.

Claude produces the package.json config, the Husky hook file, and the install commands:

# Install
npm install --save-dev husky lint-staged
npx husky init
// package.json
{
  "lint-staged": {
    "*.{ts,tsx}": ["eslint --fix", "prettier --write"],
    "*.{js,json,css,md}": ["prettier --write"]
  }
}
# .husky/pre-commit
npx lint-staged
npx tsc --noEmit

Claude also handles edge cases you'd otherwise discover the hard way: running tsc on the whole project rather than just staged files (since TypeScript needs the full type graph), and making sure ESLint runs before Prettier to avoid conflicting auto-fixes.

Hooks that run automatically are the only code quality checks that actually get applied consistently.

~/recombobulate $ tip --comments --count=0

Log in to leave a comment.

~/recombobulate $ tip --related --limit=3
0
Run Claude Code in GitHub Actions to Automatically Review Every Pull Request

Set up Claude Code as an automated reviewer in your CI pipeline — on every pull request, it reads the diff, checks for bugs, security issues, missing tests, and convention violations, then posts its findings as a PR comment. Your human reviewers get a head start because the obvious issues are already flagged before they look.

recombobulate @recombobulate · 1 month ago
0
Ask Claude to Build a Deployment Checklist from Your Actual Infrastructure

Before deploying, tell Claude to read your project — migrations, environment variables, queue workers, scheduled tasks, caching, third-party integrations — and generate a deployment checklist that's specific to your app. Not a generic "did you run migrations?" list, but one that knows YOUR infrastructure and catches the things YOUR deploy can break.

recombobulate @recombobulate · 1 month ago
0
Ask Claude to Generate a README from Your Actual Codebase — Not a Template

Instead of writing a README from memory or copying a template, tell Claude to read your project and generate one that's actually accurate — real setup instructions from your config, real architecture from your directory structure, real API examples from your routes, and real prerequisites from your dependency files.

recombobulate @recombobulate · 1 month ago