Agent Skill
2/7/2026

quality-check

Runs ./gradlew check to identify code quality issues (ktlint, detekt, Spotless, tests) and automatically fixes all problems found.

D
danhdue
0GitHub Stars
1Views
npx skills add DanhDue/android_digital_wallet

SKILL.md

Namequality-check
DescriptionRuns ./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 for pkill -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

ToolPurpose
ktlintKotlin code style enforcement
detektStatic code analysis
SpotlessCode formatting
Unit TestsJUnit 4, MockK, Robolectric

Workflow

[!TIP] The ./gradlew check task is configured in quality.gradle.kts to automatically run:

  1. spotlessApply - Auto-fixes formatting issues
  2. spotlessCheck - Verifies formatting
  3. detekt - 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 TypeToolAction Required
FormattingSpotless✅ Auto-fixed by ./gradlew check
Code SmellsdetektManual fix based on rule violations
Test FailuresJUnitDebug and fix failing tests
CompilationKotlinFix syntax/type errors

Step 3: Manual Fixes

For issues that cannot be auto-fixed:

  1. Detekt Violations: Follow the rule description to refactor code
  2. Compilation Errors: Fix type mismatches, missing imports, etc.
  3. 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

RuleDescriptionFix Strategy
LongMethodMethod exceeds line limitExtract to smaller functions
ComplexConditionComplex boolean expressionsExtract to named variables
MagicNumberHardcoded numbersExtract to named constants
TooManyFunctionsClass has too many functionsSplit into multiple classes
UnusedPrivateMemberUnused private field/functionRemove or use
MaxLineLengthLine exceeds character limitBreak line or refactor
FunctionNamingComposable naming violationUse 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-java after extended development sessions or before major check runs.

[!TIP] Quick Format: Use ./gradlew spotlessApply for fast formatting fixes before running full check.

[!NOTE] CI Alignment: This skill mirrors CI pipeline checks. Passing locally ensures PR checks will pass.

Skills Info
Original Name:quality-checkAuthor:danhdue