Skip to content

Add commit skill for quality-gated commits#128

Open
pontemonti wants to merge 4 commits intomainfrom
users/johanb/Skill
Open

Add commit skill for quality-gated commits#128
pontemonti wants to merge 4 commits intomainfrom
users/johanb/Skill

Conversation

@pontemonti
Copy link
Contributor

Adds a Claude Code skill that enforces code quality before committing:

  • Checks formatting with ruff format
  • Runs linting with ruff check
  • Executes unit tests
  • Auto-generates commit messages

Adds a Claude Code skill that enforces code quality before committing:
- Checks formatting with ruff format
- Runs linting with ruff check
- Executes unit tests
- Auto-generates commit messages

Co-Authored-By: Claude <noreply@anthropic.com>
@pontemonti pontemonti requested a review from a team as a code owner January 22, 2026 23:23
Copilot AI review requested due to automatic review settings January 22, 2026 23:23
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a Claude Code /commit skill that quality-gates commits by running formatting, linting, and unit tests before generating a commit message and committing staged changes.

Changes:

  • Add a new commit skill definition with step-by-step quality gates (ruff format, ruff lint, pytest).
  • Add commit-message generation guidelines and a standardized commit execution flow.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings January 22, 2026 23:28
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Reorders quality checks to run linting before formatting, matching
the CI pipeline order in .github/workflows/ci.yml. Adds a re-verify
step after auto-fixes to prevent commits that pass locally but fail
CI when lint fixes introduce formatting issues.

Co-Authored-By: Claude <noreply@anthropic.com>
@pontemonti pontemonti enabled auto-merge (squash) January 23, 2026 23:03
Copilot AI review requested due to automatic review settings February 6, 2026 17:23
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.

Comment on lines +33 to +39
3. If yes, run: `uv run --frozen ruff check . --fix`
4. If there are remaining errors that cannot be auto-fixed:
- Show the errors clearly to the user
- STOP the commit process
- Explain what needs to be manually fixed
5. If all errors were auto-fixed:
- Stage the fixes by running `git add` only on the files that were fixed
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This step says to “git add only on the files that were fixed” but doesn’t specify a deterministic way to identify those files. Without a concrete command sequence, the assistant may stage the wrong set of files (or have to guess). Consider adding explicit instructions to capture the changed file list after ruff check --fix (e.g., via git diff --name-only) and git add exactly those paths.

Suggested change
3. If yes, run: `uv run --frozen ruff check . --fix`
4. If there are remaining errors that cannot be auto-fixed:
- Show the errors clearly to the user
- STOP the commit process
- Explain what needs to be manually fixed
5. If all errors were auto-fixed:
- Stage the fixes by running `git add` only on the files that were fixed
3. If yes, and you may have other modified files in the working tree, first capture the current set of changed files:
```bash
git diff --name-only | sort > /tmp/before_ruff.txt

Then run the auto-fix:

uv run --frozen ruff check . --fix

After the fix, capture the new set of changed files and compute exactly which files were modified by Ruff:

git diff --name-only | sort > /tmp/after_ruff.txt
comm -13 /tmp/before_ruff.txt /tmp/after_ruff.txt > /tmp/ruff_fixed.txt
  1. If there are remaining errors that cannot be auto-fixed:
    • Show the errors clearly to the user
    • STOP the commit process
    • Explain what needs to be manually fixed
  2. If all errors were auto-fixed:
    • Stage only the files modified by Ruff:

      git add $(cat /tmp/ruff_fixed.txt)

Copilot uses AI. Check for mistakes.
Comment on lines +23 to +27
Run the linting check first (matches CI order in .github/workflows/ci.yml):

```bash
uv run --frozen ruff check .
```
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI runs uv run --frozen ruff check . --preview (see .github/workflows/ci.yml). This skill uses ruff check . without --preview, so it may report a clean lint locally but fail CI if preview-only rules are enabled/changed. Align the command here (and the --fix variant) with CI by including --preview (or explicitly justify why it’s omitted).

Copilot uses AI. Check for mistakes.
Comment on lines +69 to +72
```bash
uv run --frozen ruff check .
uv run --frozen ruff format --check .
```
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When re-running lint after auto-fixes, the skill again omits --preview even though CI includes it. To keep the “re-verify after auto-fixes” step faithful to CI (and avoid CI-only failures), update this re-run command to match the CI invocation as well.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant