Conventional Commit Enforcer
This loop ensures all Git commits follow the Conventional Commits specification by using commitlint to validate commit messages. It automatically detects non-compliant commits, suggests fixes, and guides the user through correcting them until all commits pass validation.
Goal
Standardize commit messages
How to Run
Run this loop in Cursor, Claude Code, Codex, OpenCode, or Gemini CLI. It will validate your last commit message against conventional commit standards and iteratively guide you to fix any issues.
- 01
Start the Loop
Begin by running the agent in prompt mode with the kickoff prompt.
- 02
Automatic Validation
The agent will automatically run commitlint to check the latest commit message.
- 03
Fix Issues
If commitlint fails, the agent will suggest corrections and help rewrite the commit message.
- 04
Repeat Until Success
The process repeats up to 10 times or stops when all commits pass validation.
Workflow Steps
- 01
Check Commit
Use commitlint to validate the most recent commit message.
- 02
Evaluate Result
If the commit passes, proceed to exit. If it fails, generate a corrected message.
- 03
Suggest Fix
The agent provides a conventional commit-compliant version of the message.
- 04
Rewrite Commit
Amend the commit with the corrected message using git commit --amend.
- 05
Restart Loop
Return to step 1 to re-validate the amended commit.
Kickoff Prompt
Start the "Conventional Commit Enforcer" loop. Goal: Standardize commit messages Max iterations: 10 Between iterations run: commitlint Exit when: Commit lint passes Check the last commit message using commitlint. If it fails, suggest a fix and amend the commit. Repeat until it passes or max iterations are reached. Self-pace this loop. After each iteration, run `commitlint` and evaluate the output, and only continue if the exit condition is not met (Commit lint passes). Stop when the exit condition passes or 10 iterations are reached. Give a short status update each pass.
Guardrails
hardcoded- ·Ensure commitlint is installed and configured in the project before starting the loop.
- ·Do not modify files unrelated to the commit message during the loop.
- ·Stop the loop immediately if the maximum number of iterations is reached.
- ·Avoid overriding existing commitlint rules; work within the project's defined conventions.
- ·Check for unstaged changes before amending commits to prevent data loss.
Flow Diagram
Related loops — Git
Git
Large Commit Splitter
Automatically splits large, monolithic Git commits into smaller, more reviewable units while preserving logical code boundaries and maintaining clean history.
Git
Git Hygiene Loop
This loop helps maintain a clean Git repository by identifying and removing stale or outdated branches that are no longer needed. It ensures your branch list remains manageable and reduces clutter in collaborative environments.
Git
Merge Conflict Resolver
Automate the resolution of Git merge conflicts by iteratively detecting conflicts, resolving them, and retrying the merge until successful.