Skip to main content
subagent

commit-guardian — Claude Code subagent: what it does, how to install

Runs a 10-point automated inspection on staged git files and stops the commit if tests fail, secrets appear, or rules break.

Install into Claude Code · claude-code-templates All methods and platforms ↓
npx claude-code-templates@latest --agent git/commit-guardian
Open on GitHub

What commit-guardian does

Commit Guardian inspects staged files before any git record is created. It blocks direct commits to main or master, scans contents for exposed credentials such as AWS or GitHub keys, and triggers project builds across environments like Go, Rust, .NET, Node.js, and Python. It also checks tests and styles.

The routine inspects code atomicity, warns about leftover debug statements, and verifies commit descriptions against Conventional Commits formatting rules under 72 characters.

The subagent refuses to run git push, never executes --no-verify, and immediately halts whenever an issue is flagged for human intervention.

What it helps with

  • catch hardcoded API tokens and secret strings before git commit
  • prevent unreviewed commits directly to main or master branches
  • enforce Conventional Commits message standards and 72-character limits
  • trigger compilation checks across multi-language staged changes
  • detect leftover debug artifacts and unneeded imports in staged code

Example prompts for the agent

  • Run commit-guardian against staged files before committing
  • Execute the commit-guardian check protocol on current changes
  • Verify staged files and generate a Conventional Commit message

How to install commit-guardian

1claude-code-templates

npx claude-code-templates@latest --agent git/commit-guardian

2Manually: put the files in place

.claude/agents/commit-guardian.md

For all projects use ~/.claude/agents/. Claude delegates by the description field or an @-mention

Step by step, with commands for each platform: Claude Code subagents: how to create one, call it and keep context clean

Questions about commit-guardian

How to install commit-guardian in Claude Code?

Run npx claude-code-templates@latest --agent git/commit-guardian. The subagent configuration will be placed in .claude/agents/commit-guardian.md.

What does commit-guardian do?

It applies a sequential 10-step verification routine covering branch naming, secret detection, builds, tests, linting, and message formatting.

Will commit-guardian push changes to a remote repository?

No. The agent protocol strictly forbids executing git push, leaving all remote synchronisation entirely to the developer.

Similar subagents

All subagents for Git and GitHub →

From the same set804

The whole set →

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor