# @berta.codes on Instagram

- **Type:** Image
- **Original URL:** https://www.instagram.com/p/Dapm3cLKKgv
- **Gondola URL:** https://gondola.cc/posts/67925101-bertacodes-instagram
- **Thumbnail:** https://img.gondola.cc/tr:w-,h-,fo-auto/postThumbnails/570e4e0cb3.jpg
- **Posted:** 2026-07-11T11:00:18.000+00:00
- **Account Owner:** BERTA MATULIAUSKIENE (@berta.codes) — https://gondola.cc/berta.codes

## Caption

Everyone automates formatting. Almost nobody automates the feedback loop✨

Here’s the most underused Claude Code hook - and the one with the biggest payoff.

Without it: Claude edits your code, says “done”, and you find the broken test an hour later. You’re the QA step.

With it: every edit triggers your tests automatically, and failures land straight in Claude’s context - so it fixes its own mistakes before you even see them 🔁

Setup takes 2 minutes. Create .claude/hooks.json in your project:
 
{ “hooks”: 
{ “PostToolUse”: 
[{ 
“matcher”: “Write|Edit”, 
“hooks”: 
[{ 
“type”: “command”, 
“command”: “npm test — —findRelatedTests \”${file}\””, 
“timeout”: 120 
}] 
}] } 
}

What it does:
⚡ Fires after every file Claude writes or edits 
🎯 Runs only the tests related to that file (fast, not noisy) 
🔁 Test output goes back to Claude → it self-corrects

That’s it. Every AI edit is now self-verifying. You review working code instead of debugging surprises.

Try it on your next session and tell me how many fixes Claude caught on its own 👇

Save this for your next project 🔖

#ClaudeCode #AIcoding #DevTools

## Stats

- **Views:** 0
- **Likes:** 294
- **Shares:** 0
- **Comments:** 2

## Tags

devtools, claudecode, aicoding

---
Copyright (c) Gondola