5 Claude Code hooks that auto-fix my code
Автор: TubeForge
Загружено: 2026-04-30
Просмотров: 33
Описание:
Skills cut my tokens. MCP cut my context. Subagents cut my time. Hooks cut something else: rework. Five things Claude keeps getting wrong on every save — and five tiny entries in your .claude/settings.json that fix them before you even see the diff.
Fourth in the series. All five hook configs are free on GitHub (link below). One settings.json snippet per hook — copy, paste, restart Claude Code.
⏱ Chapters
00:00 The rework problem
00:24 What you'll learn
00:34 Hook 1 — auto-formatter (PostToolUse + prettier)
01:12 Hook 2 — lint --fix (PostToolUse + ESLint)
01:48 Hook 3 — type-check (PostToolUse + tsc --noEmit)
02:26 Hook 4 — auto-test (PostToolUse + vitest related)
03:02 Hook 5 — safety guard (PreToolUse path block)
03:46 Ranked by rework killed
04:06 What's next
🔧 All 5 hooks as a copy-paste settings.json:
https://github.com/UrNas/devtips/tree...
✅ What each hook does
• auto-formatter — PostToolUse on Edit/Write/MultiEdit. Runs prettier --write on the file Claude just touched. 80ms per save. Style drift dies where it's born.
• lint --fix — Same trigger. Runs ESLint with --fix. About 80% of warnings auto-resolve (unused vars, missing const, no-explicit-any). Friday cleanup: gone.
• type-check — Runs tsc --noEmit after every edit. Type errors surface in 3 seconds instead of 30 minutes (in CI). Claude reads its own failure on the next turn and fixes it.
• auto-test — Runs vitest related on the file Claude touched. Regressions caught at edit-time, not PR-review-time. Long-form companion to the 45s PostToolUse Short.
• safety guard — PreToolUse hook on Edit/Write/MultiEdit. A 4-line script: if the path is outside $CLAUDE_PROJECT_DIR, exit 2. The tool call is denied. Your dotfiles, /etc, and ~/.ssh stay untouched even when Claude wanders.
🧵 The full series
• Part 1 — 5 Claude Code Skills that cut my token bill in half
• Part 2 — The 5 MCP servers I use in every Claude Code session
• Part 3 — The 5 Claude Code subagents I run in parallel
• Part 4 — this video
👉 Subscribe for more Claude Code workflow tips:
/ @tubeforge
#claudecode #anthropic #aitools #developerproductivity #aicoding
Повторяем попытку...
Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: