Skip to content

Commit 5c53a01

Browse files
nbradburyclaude
andauthored
Add project-wide codecheck Claude Code skill (#22667)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent fe4dc02 commit 5c53a01

1 file changed

Lines changed: 90 additions & 0 deletions

File tree

.claude/skills/codecheck/SKILL.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
---
2+
name: codecheck
3+
description: >
4+
Run all three code quality checks (detekt, checkstyle, lint),
5+
read the reports, and propose fixes for any issues found.
6+
---
7+
8+
# Code Check
9+
10+
Run all three code quality checks, read the reports, and propose
11+
fixes for any issues found.
12+
13+
## Steps
14+
15+
### 1. Detect the main branch
16+
17+
Detect the main/default branch (typically `trunk` or `main`):
18+
19+
```bash
20+
git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null \
21+
| sed 's@^refs/remotes/origin/@@'
22+
```
23+
24+
If that fails, check if `trunk` or `main` exists and use whichever
25+
is found. Store this as `<main-branch>` for later steps.
26+
27+
### 2. Run all three checks in parallel
28+
29+
Run these Gradle tasks:
30+
31+
```bash
32+
./gradlew detekt
33+
./gradlew checkstyle
34+
./gradlew lintWordPressRelease
35+
```
36+
37+
Run all three in parallel to save time. Allow each to complete even
38+
if others fail.
39+
40+
### 3. Read the reports
41+
42+
After the checks complete, read the generated report files:
43+
44+
- **Detekt**: `WordPress/build/reports/detekt/detekt.html`
45+
- **Checkstyle**: `WordPress/build/reports/checkstyle/checkstyle.html`
46+
- **Lint**: `WordPress/build/reports/lint-results-wordpressRelease.html`
47+
48+
Parse each report to extract the list of issues (file, line, rule,
49+
message).
50+
51+
### 4. Filter to relevant issues
52+
53+
Focus on issues in files that were changed on the current branch.
54+
To determine changed files:
55+
56+
```bash
57+
git diff --name-only $(git merge-base <main-branch> HEAD)..HEAD
58+
```
59+
60+
If no branch changes are detected (e.g., on trunk), report all
61+
issues found.
62+
63+
### 5. Present a summary
64+
65+
Output a summary table or grouped list of issues organized by tool:
66+
67+
- **Detekt issues** (count and details)
68+
- **Checkstyle issues** (count and details)
69+
- **Lint issues** (count and details)
70+
71+
For each issue include the file path, line number, rule name, and
72+
the message.
73+
74+
### 6. Propose fixes
75+
76+
For each issue, propose a specific fix. Group fixes by file. Show
77+
the current code and what it should be changed to.
78+
79+
### 7. Ask for approval
80+
81+
Present the proposed fixes and ask the user which ones to apply
82+
before making any changes.
83+
84+
## Important Rules
85+
86+
- Do NOT make any code changes until the user approves.
87+
- Respect the project's code style (120-char line limit, Kotlin
88+
conventions, no empty lines after opening braces).
89+
- Use TODO instead of FIXME in any comments.
90+
- Do not suppress warnings unless the user explicitly approves.

0 commit comments

Comments
 (0)