Skip to content

[Chore][CI] Claude does not auto-run pre-commit or validate commit message format on commit #226

@superAngGao

Description

@superAngGao

Problem

When Claude commits changes in this repository, it does not automatically:

  1. Run pre-commit run --all-files before recording the commit.
  2. Validate that the commit message follows the TileLang Commit Convention ([Type] Description or [Type][Scope] Description).

This means non-compliant commits (bad formatting, lint errors, wrong message format) can silently enter the branch history, causing CI failures and review friction downstream.

Root Cause

  • pre-commit install installs the pre-commit stage hook, but the commit-msg hook is not installed by default (pre-commit install --hook-type commit-msg is a separate step that is not documented in the setup instructions).
  • There is no Claude skill or workflow that explicitly enforces both checks before git commit runs.
  • The existing creating-pull-request skill mentions pre-commit run --all-files as a pre-check, but there is no equivalent guardrail at the individual commit level.

Impact

  • Commit messages like fix something or feat: add op (wrong format) are accepted silently.
  • Formatting/lint issues are only caught at PR time, not at commit time.
  • Inconsistent history makes git log and automated changelog generation harder.

Proposed Fix

  1. Add a commit-msg git hook (scripts/hooks/commit-msg) that validates the message format against the valid types defined in docs/CONTRIBUTING.md.
  2. Register the hook in .pre-commit-config.yaml as a local hook with stages: [commit-msg].
  3. Update Claude.md setup instructions to run both:
    pre-commit install
    pre-commit install --hook-type commit-msg
  4. Add a commit skill (.claude/commit/SKILL.md) so Claude follows a consistent commit workflow: validate staged changes → run pre-commit → validate message → commit.

Checklist

  • scripts/hooks/commit-msg added and executable
  • .pre-commit-config.yaml updated with local commit-msg-format hook
  • Claude.md setup step updated to install both hooks
  • .claude/commit/SKILL.md added to skill index

Metadata

Metadata

Assignees

No one assigned

    Labels

    choreAuto-created by issue labeler

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions