quality-check
Runs ./gradlew check to identify code quality issues (ktlint, detekt, Spotless, tests) and automatically fixes all problems found.
SKILL.md
| Name | quality-check |
| Description | Runs ./gradlew check to identify code quality issues (ktlint, detekt, Spotless, tests) and automatically fixes all problems found. |
name: Quality Check description: Runs ./gradlew check to identify code quality issues (ktlint, detekt, Spotless, tests) and automatically fixes all problems found.
Quality Check Skill
[!IMPORTANT] Resource Cleanup: After completing quality checks, ALWAYS run
cleanup-java(alias forpkill -9 java) as the FINAL STEP to stop all background Java/Gradle daemon threads and release system resources.
[!IMPORTANT] Role: You are a Senior Android Developer responsible for maintaining code quality standards. Your task is to run quality checks and fix all identified issues.
Technology Stack
| Tool | Purpose |
|---|---|
| ktlint | Kotlin code style enforcement |
| detekt | Static code analysis |
| Spotless | Code formatting |
| Unit Tests | JUnit 4, MockK, Robolectric |
Workflow
[!TIP] The
./gradlew checktask is configured inquality.gradle.ktsto automatically run:
spotlessApply- Auto-fixes formatting issuesspotlessCheck- Verifies formattingdetekt- Static code analysis
Step 1: Run Gradle Check
./gradlew check
This single command will:
- ✅ Auto-fix Spotless formatting issues (no manual step needed)
- ✅ Run detekt for code smells
- ✅ Run unit tests
Step 2: Analyze Output
If the check fails, parse the output and categorize issues by type:
| Issue Type | Tool | Action Required |
|---|---|---|
| Formatting | Spotless | ✅ Auto-fixed by ./gradlew check |
| Code Smells | detekt | Manual fix based on rule violations |
| Test Failures | JUnit | Debug and fix failing tests |
| Compilation | Kotlin | Fix syntax/type errors |
Step 3: Manual Fixes
For issues that cannot be auto-fixed:
- Detekt Violations: Follow the rule description to refactor code
- Compilation Errors: Fix type mismatches, missing imports, etc.
- Test Failures: Debug tests, mock missing dependencies
After fixing, re-run:
./gradlew check
Step 4: Build Verification
[!IMPORTANT] Build the project to ensure all changes compile and work correctly.
./gradlew assembleDebug
This verifies:
- ✅ All code compiles successfully
- ✅ Resources are processed correctly
- ✅ Hilt/KSP code generation works
- ✅ No runtime configuration issues
Step 5: Resource Cleanup (MANDATORY - FINAL STEP)
[!CAUTION] ALWAYS run this as the FINAL STEP to stop all background Java/Gradle daemon threads and release system resources for your PC.
# Stop all Java/Gradle daemon processes
cleanup-java
# Or directly: pkill -9 java
Common Detekt Rules & Fixes
| Rule | Description | Fix Strategy |
|---|---|---|
LongMethod | Method exceeds line limit | Extract to smaller functions |
ComplexCondition | Complex boolean expressions | Extract to named variables |
MagicNumber | Hardcoded numbers | Extract to named constants |
TooManyFunctions | Class has too many functions | Split into multiple classes |
UnusedPrivateMember | Unused private field/function | Remove or use |
MaxLineLength | Line exceeds character limit | Break line or refactor |
FunctionNaming | Composable naming violation | Use PascalCase for Composables |
Input
No explicit input required. The skill operates on the current project state.
Output Format
Your response MUST be structured as follows:
### 🔧 Gradle Check Results
**Status**: ✅ PASSED / ❌ FAILED
### 📊 Issues Found
| Type | Count | Module | Status |
|------|-------|--------|--------|
| ktlint | X | :module | Fixed/Pending |
| detekt | X | :module | Fixed/Pending |
| Spotless | X | :module | Fixed/Pending |
| Tests | X | :module | Fixed/Pending |
### 🛠️ Fixes Applied
1. **[File:Line]**: [Description of fix]
### ⚠️ Manual Intervention Required
- **[File:Line]**: [Issue description] → [Suggested fix]
### ✅ Final Status
(Choose one: 🟢 All Checks Passing / 🟡 Partial Fix / 🔴 Needs Manual Fix)
Example Usage
Use the @quality_check skill to fix all code quality issues.
Or step-by-step:
1. Run @quality_check
2. Fix all detekt violations in :features:home module
Important Notes
[!WARNING] Memory Management: Gradle daemons can consume significant memory. Always run
cleanup-javaafter extended development sessions or before major check runs.
[!TIP] Quick Format: Use
./gradlew spotlessApplyfor fast formatting fixes before running full check.
[!NOTE] CI Alignment: This skill mirrors CI pipeline checks. Passing locally ensures PR checks will pass.