Post-Edit Test Runner
Post-Edit Test Runner triggers after every file write or edit operation. It detects which test files correspond to the modified source file using common naming conventions (*.test.ts, *.spec.ts, __tests__/*) and runs only those tests. If no matching test file exists, it skips silently. This gives you instant feedback on whether an edit broke existing functionality, catching regressions before they compound.
Hook Code
Add this hook to your Claude Code settings or .claude/settings.json to activate.
Terminal Preview
About Post-Edit Test Runner
Claude Code hooks let you run custom shell commands automatically in response to specific events during Claude's operation. Post-Edit Test Runner is a Post-Tool hook at the Beginner level that automates tasks at key moments in your development workflow, reducing manual steps and enforcing consistency across your team.
Related Hooks
Auto-Format on Save
Automatically run Prettier on files after Claude writes or edits them to maintain consistent formatting.
TypeScript Type Checker
Run TypeScript type checking after file edits to catch type errors before they accumulate.
Auto Changelog Appender
Automatically extract commit messages and append structured entries to CHANGELOG.md after each commit.