Gitprompt onlyintermediate

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.

← all loops
gitcommitsconventional-commitscommitlint

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.

  1. 01

    Start the Loop

    Begin by running the agent in prompt mode with the kickoff prompt.

  2. 02

    Automatic Validation

    The agent will automatically run commitlint to check the latest commit message.

  3. 03

    Fix Issues

    If commitlint fails, the agent will suggest corrections and help rewrite the commit message.

  4. 04

    Repeat Until Success

    The process repeats up to 10 times or stops when all commits pass validation.

Workflow Steps

  1. 01

    Check Commit

    Use commitlint to validate the most recent commit message.

  2. 02

    Evaluate Result

    If the commit passes, proceed to exit. If it fails, generate a corrected message.

  3. 03

    Suggest Fix

    The agent provides a conventional commit-compliant version of the message.

  4. 04

    Rewrite Commit

    Amend the commit with the corrected message using git commit --amend.

  5. 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

rendering…

Related loops — Git