You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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>
Copy file name to clipboardExpand all lines: .claude/skills/commit/SKILL.md
+36-23Lines changed: 36 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
2
name: commit
3
-
description: Use this skill when the user wants to commit staged changes. This skill checks formatting, runs linting, executes tests, generates a commit message, and commits the changes. Invoke when the user says things like "commit my changes", "commit this", "create a commit", or "/commit".
3
+
description: Use this skill when the user wants to commit staged changes. This skill checks linting, then formatting (matching CI order), runs tests, generates a commit message, and commits the changes. Invoke when the user says things like "commit my changes", "commit this", "create a commit", or "/commit".
4
4
allowed-tools: Bash, Read, Grep, Glob, Edit
5
5
---
6
6
@@ -18,9 +18,33 @@ git diff --cached --stat
18
18
19
19
If there are no staged changes, inform the user and stop. Suggest they stage changes with `git add`.
20
20
21
-
## Step 2: Check Code Formatting
21
+
## Step 2: Check Linting
22
22
23
-
Run the formatting check on the repository:
23
+
Run the linting check first (matches CI order in .github/workflows/ci.yml):
24
+
25
+
```bash
26
+
uv run --frozen ruff check .
27
+
```
28
+
29
+
### If linting check fails:
30
+
31
+
1. Inform the user about the linting errors
32
+
2. Ask if they want you to auto-fix what can be auto-fixed
33
+
3. If yes, run: `uv run --frozen ruff check . --fix`
34
+
4. If there are remaining errors that cannot be auto-fixed:
35
+
- Show the errors clearly to the user
36
+
- STOP the commit process
37
+
- Explain what needs to be manually fixed
38
+
5. If all errors were auto-fixed:
39
+
- Stage the fixes by running `git add` only on the files that were fixed
40
+
- Continue to the next step
41
+
42
+
### If linting check passes:
43
+
Continue to the next step.
44
+
45
+
## Step 3: Check Code Formatting
46
+
47
+
Run the formatting check (after linting, matches CI order):
24
48
25
49
```bash
26
50
uv run --frozen ruff format --check .
@@ -32,37 +56,26 @@ uv run --frozen ruff format --check .
32
56
2. Ask if they want you to auto-fix the formatting issues
33
57
3. If yes, run: `uv run --frozen ruff format .`
34
58
4. Show the user what files were reformatted
35
-
5. Stage the formatting fixes by running `git add` only on the files that were reformatted (do not use `git add -u`)
59
+
5. Stage the formatting fixes by running `git add` only on the files that were reformatted
36
60
6. Continue to the next step
37
61
38
62
### If formatting check passes:
39
63
Continue to the next step.
40
64
41
-
## Step 3: Check Linting
65
+
## Step 4: Re-verify After Auto-fixes
42
66
43
-
Run the linting check:
67
+
**IMPORTANT**: If any auto-fixes were applied in Steps 2 or 3, re-run both checks to ensure consistency:
44
68
45
69
```bash
46
70
uv run --frozen ruff check .
71
+
uv run --frozen ruff format --check .
47
72
```
48
73
49
-
### If linting check fails:
74
+
This prevents commits that pass locally but fail CI (e.g., lint fixes that introduce formatting issues). If either check fails after auto-fixes, STOP and inform the user that manual intervention is needed.
50
75
51
-
1. Inform the user about the linting errors
52
-
2. Ask if they want you to auto-fix what can be auto-fixed
53
-
3. If yes, run: `uv run --frozen ruff check . --fix`
54
-
4. If there are remaining errors that cannot be auto-fixed:
0 commit comments