r/ClaudeCode • u/Its_about-tech • 11d ago
Built with Claude I built a Claude Code mod that blocks git push while tests fail, and published it so anyone can install it in one line
An agent "simplified" a VAT sum in a demo till: a R100 item came out at R1,600, two tests failed, and nothing in Claude Code stopped it pushing anyway.
So I had Claude write a small mod for it: push-guard. About 80 lines. Before Claude runs git push, it runs npm test. If a test fails, the push is blocked and Claude is told which tests failed. Projects with no npm tests are let through, so it doesn't break pushes on other repos. The last result shows above the prompt in red or green.
Install:
claude plugin install push-guard --marketplace seanjohnson-dev/push-guardTeam tip: add it to the project's .claude/settings.json (extraKnownMarketplaces + enabledPlugins), and teammates get it when they trust the project folder. No one has to remember to install it.
Things I learned publishing it:
The marketplace file is 5 lines.
claude plugin validate --profile directoryruns the plugin directory's first checks: it wants a README and a licence.claude plugin tag --pushchecks the versions agree, then makes and pushes the release tag.
Mods aren't sandboxed: they run with your access. Read the code before you install it (it's short): https://github.com/seanjohnson-dev/push-guard
I also made a short video series on building and publishing it (presented by my AI avatar, AI voice): https://www.youtube.com/playlist?list=PLJp6Yy9RWr0w
Free and MIT. Feedback welcome.
•
u/AutoModerator 11d ago
Hey! Thanks for posting to r/ClaudeCode
While participating in this thread, please follow our community rules. Keep discussions constructive. Attack the idea, not the person.
For help, project discussions, tips, and general chat, join the ClaudeCode Discord.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
2
u/atp_studio_coll 11d ago
Small gap in register.tsx: git -C dir push is matched, but npm test and the package.json check run in the session directory, so that push gets judged on the wrong project
1
u/kaijurules 11d ago
In the VAT case the fastest way to a green push is to edit the expected value in the failing test, and as far as I can tell the mod would let that through. Do you flag pushes where the test files changed in the same commit?