cm — Claude Code command: what it does, how to install
cm inspects diffs for secrets, stages files individually, and formats a Conventional Commit without pushing to remotes.
MIT ★ 907 updated 2025-11-12
.claude/commands/cm.mdWhat cm does
The command begins by running git status --short and examining individual diffs to stop credentials or secrets from slipping into history. Instead of blindly running git add ., it stages files path by path.
Next, it drafts a Conventional Commit subject limited to 72 characters with a kebab-case scope. For detailed sections covering Context, Testing, and Reviewers, it references .github/commit-template.txt, then applies the commit and displays git log -1 --stat.
This workflow intentionally halts before any push happens. Publishing changes to a remote repository requires a separate prompt such as git/cp.md.
What it helps with
- inspect file diffs for credentials before staging
- stage modified files individually instead of blanket staging
- construct Conventional Commit subjects within 72 characters
- append review and testing notes using a repository template
Example prompts for the agent
- /cm
- Review pending changes and commit with /cm
- Create a Conventional Commit for staged files using /cm
How to install cm
Manually: put the files in place
.claude/commands/cm.mdCall it with /cm. For all projects use ~/.claude/commands/
Manually: put the files in place
~/.codex/prompts/cm.mdCall it with /prompts:cm. Codex marks this format deprecated in favour of skills
Manually: put the files in place
.github/prompts/cm.prompt.mdManually: put the files in place
.gemini/commands/cm.tomlGemini stores commands as TOML: the prompt text goes into the prompt field
Questions about cm
How to install cm in Claude Code?
Save the command markdown file to .claude/commands/cm.md inside your repository.
Does the cm command push commits to the remote?
No, it stops right after the local commit. You must publish changes separately with git/cp.md.
What commit types does cm support?
It formats messages with types like feat, fix, docs, style, refactor, perf, test, build, ci, chore, and revert.
Source text
cm.md · MIT
--- description: Stage working tree changes and create a Conventional Commit (no push). --- 1. Run `git status --short` to review pending changes. 2. For each file, open a diff (`git diff -- path/to/file`) and ensure no secrets or credentials are present. 3. Stage the files intentionally (`git add path/to/file`). Avoid `git add .` unless every change was reviewed. 4. Generate a Conventional Commit message (types: feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert). - Commit subject ≤ 72 chars. - Scope uses kebab-case (e.g., `feat(workflows): ...`). - Use `.github/commit-template.txt` for Context / Testing / Reviewers sections. 5. Run `git commit` and paste the generated message + context from the template. 6. Show the resulting commit (`git log -1 --stat`) and keep the commit hash handy. 7. **Do not push** in this command. Use `git/cp.md` when you're ready to publish.
© alirezarezvani · MIT · alirezarezvani/claude-code-skill-factory