Skip to content

Commit 34b6fcf

Browse files
Johan Brobergclaude
andcommitted
Update commit skill to match CI check order
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>
1 parent a0d8f11 commit 34b6fcf

1 file changed

Lines changed: 36 additions & 23 deletions

File tree

.claude/skills/commit/SKILL.md

Lines changed: 36 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
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".
44
allowed-tools: Bash, Read, Grep, Glob, Edit
55
---
66

@@ -18,9 +18,33 @@ git diff --cached --stat
1818

1919
If there are no staged changes, inform the user and stop. Suggest they stage changes with `git add`.
2020

21-
## Step 2: Check Code Formatting
21+
## Step 2: Check Linting
2222

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):
2448

2549
```bash
2650
uv run --frozen ruff format --check .
@@ -32,37 +56,26 @@ uv run --frozen ruff format --check .
3256
2. Ask if they want you to auto-fix the formatting issues
3357
3. If yes, run: `uv run --frozen ruff format .`
3458
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
3660
6. Continue to the next step
3761

3862
### If formatting check passes:
3963
Continue to the next step.
4064

41-
## Step 3: Check Linting
65+
## Step 4: Re-verify After Auto-fixes
4266

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:
4468

4569
```bash
4670
uv run --frozen ruff check .
71+
uv run --frozen ruff format --check .
4772
```
4873

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

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:
55-
- Show the errors clearly to the user
56-
- STOP the commit process
57-
- Explain what needs to be manually fixed
58-
5. If all errors were auto-fixed:
59-
- Stage the fixes: `git add -u`
60-
- Continue to the next step
61-
62-
### If linting check passes:
63-
Continue to the next step.
76+
If no auto-fixes were applied, skip this step.
6477

65-
## Step 4: Run Tests
78+
## Step 5: Run Tests
6679

6780
Run the unit tests (excluding integration tests):
6881

@@ -84,7 +97,7 @@ uv run --frozen pytest tests/ -v --tb=short -m "not integration" 2>&1
8497
### If tests pass:
8598
Continue to the next step.
8699

87-
## Step 5: Generate Commit Message
100+
## Step 6: Generate Commit Message
88101

89102
Analyze the staged changes to generate an appropriate commit message:
90103

@@ -113,7 +126,7 @@ Types of changes to identify:
113126
- `Test` - Adding or updating tests
114127
- `Chore` - Maintenance tasks
115128

116-
## Step 6: Confirm and Commit
129+
## Step 7: Confirm and Commit
117130

118131
1. Show the user the proposed commit message
119132
2. Ask if they want to proceed with this message or modify it

0 commit comments

Comments
 (0)