ci-guard — Claude Code command: check branch names and commits
ci-guard runs the ci-commit-branch-guard.yml workflow on demand to check branch naming and Conventional Commit syntax.
MIT ★ 907 updated 2025-11-12
.claude/commands/ci-guard.mdWhat ci-guard does
A thin wrapper around GitHub CLI. It fires the ci-commit-branch-guard.yml workflow and reports whether your branch name and commit message pass the guard.
Pass a branch or a SHA as [ref] when you want to check something other than what is checked out. Leave it out and the current branch from git branch --show-current is used. gh run watch --workflow "Commit & Branch Guard" follows the run; a failure means renaming the branch or amending the commit before you carry on.
GitHub CLI has to be signed in first. Step one is gh auth status, and an unauthenticated gh stops everything before a workflow is dispatched.
What it helps with
- re-run the branch and commit guard without pushing
- validate naming rules on a branch you have not checked out
- catch a badly formatted Conventional Commit on the spot
- find out why the Commit & Branch Guard run failed
- recheck after renaming a branch or amending a commit
Example prompts for the agent
- Run
/ci-guardand tell me if the current branch name or commit message breaks the guard. - Validate
/ci-guard <ref>for that branch and follow the run until it finishes. - The guard failed on my branch rename — rerun
/ci-guardand show me the log.
How to install ci-guard
Manually: put the files in place
.claude/commands/ci-guard.mdCall it with /ci-guard. For all projects use ~/.claude/commands/
Manually: put the files in place
~/.codex/prompts/ci-guard.mdCall it with /prompts:ci-guard. Codex marks this format deprecated in favour of skills
Manually: put the files in place
.github/prompts/ci-guard.prompt.mdManually: put the files in place
.gemini/commands/ci-guard.tomlGemini stores commands as TOML: the prompt text goes into the prompt field
Questions about ci-guard
How do I install ci-guard in Claude Code?
Copy the command file to .claude/commands/ci-guard.md inside your project, then call /ci-guard.
What does ci-guard do?
It starts the ci-commit-branch-guard.yml GitHub Actions workflow by hand to check branch naming and Conventional Commit syntax.
What do I need before running it?
A signed-in GitHub CLI, since the first step checks gh auth status. The [ref] argument is optional and falls back to the current branch.
Source text
ci-guard.md · MIT
---
description: Trigger the Commit & Branch Guard workflow on demand.
argument-hint: [ref]
---
## Purpose
Run `ci-commit-branch-guard.yml` manually to validate branch naming and Conventional Commit syntax.
## Usage
```
/ci-guard [ref]
```
- `ref` (optional): Branch or SHA to validate. Defaults to current branch.
## Steps
1. Ensure you are authenticated with GitHub CLI (`gh auth status`).
2. Determine the branch to validate (defaults to `git branch --show-current`).
3. Trigger the workflow:
```bash
gh workflow run ci-commit-branch-guard.yml --ref ${ref:-$(git branch --show-current)}
```
4. Watch progress:
```bash
gh run watch --workflow "Commit & Branch Guard"
```
5. Resolve any failures (branch rename or commit amend) before continuing.
© alirezarezvani · MIT · alirezarezvani/claude-code-skill-factory