Conversation
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>
There was a problem hiding this comment.
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
commitskill 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>
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>
| 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 |
There was a problem hiding this comment.
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.
| 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 . --fixAfter 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- 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
- If all errors were auto-fixed:
-
Stage only the files modified by Ruff:
git add $(cat /tmp/ruff_fixed.txt)
-
| Run the linting check first (matches CI order in .github/workflows/ci.yml): | ||
|
|
||
| ```bash | ||
| uv run --frozen ruff check . | ||
| ``` |
There was a problem hiding this comment.
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).
| ```bash | ||
| uv run --frozen ruff check . | ||
| uv run --frozen ruff format --check . | ||
| ``` |
There was a problem hiding this comment.
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.
Adds a Claude Code skill that enforces code quality before committing: