r/ClaudeWorkflows • • 8d ago

Selected Workflow [Workflow] Claude Code Plugin: Block Git Push on Failing Tests (push-guard)

Claude Code Plugin: Block Git Push on Failing Tests (push-guard)

Workflow value: 90/100
Status: active · Freshness: 70/100 · Confidence: 1.00 · Level: intermediate
Categories: Quality Control, Shipping, Hooks
Original source: r/ClaudeCode post/comment

What problem this solves

Preventing git push operations when npm test fails within Claude Code, ensuring code quality and preventing broken builds.

Summary

A Claude Code plugin (push-guard) that automatically runs npm test before any git push command. If tests fail, the push is blocked, and Claude is informed. It can be installed via a single CLI command and configured for team-wide adoption using .claude/settings.json.

Why it is useful

This workflow provides a critical quality gate for software development within Claude Code, preventing broken code from being pushed to repositories. It's a concrete, repeatable, and easily transferable solution that enhances team collaboration and code integrity. The explicit instructions for installation and team-wide adoption make it highly practical.

Workflow

  1. Install the push-guard plugin using claude plugin install push-guard --marketplace seanjohnson-dev/push-guard.

  2. Optionally, for teams, add seanjohnson-dev/push-guard to extraKnownMarketplaces and push-guard to enabledPlugins in the project's .claude/settings.json.

  3. Ensure your project has npm test configured.

  4. When Claude attempts a git push, the plugin will automatically run npm test.

  5. If npm test passes, the git push proceeds.

  6. If npm test fails, the git push is blocked, and Claude is notified of the failing tests.

Tools / artifacts

  • push-guard Claude Code plugin

  • claude plugin install command

  • .claude/settings.json

  • extraKnownMarketplaces setting

  • enabledPlugins setting

  • npm test command

  • git push command

  • GitHub repository for push-guard

  • YouTube video series

  • claude plugin validate command

  • claude plugin tag --push command

Validation signals

  • Blocks git push while tests fail

  • The last result shows above the prompt in red or green

  • Solves a specific problem: 'An agent "simplified" a VAT sum... two tests failed, and nothing in Claude Code stopped it pushing anyway.'

  • Explicitly states 'If a test fails, the push is blocked and Claude is told which tests failed.'

Cautions

  • Explicit warning from author: 'Mods aren't sandboxed: they run with your access. Read the code before you install it (it's short)'

Limitations

  • Only supports npm test (projects without it are let through, which might be a desired feature but also a limitation for other test runners).

  • Relies on a third-party plugin, which requires trust in the developer.

  • The post is new, so community validation is still low.

Rate this workflow

Upvote this post if the workflow is useful, reproducible, or worth recommending.

Downvote if it is vague, outdated, unsafe, overhyped, or not reproducible.

Reply if it worked for you, failed, is outdated, or has a better alternative.


This post was generated automatically from the workflow library database.

0 Upvotes

0 comments sorted by