Skip to content
fix-detekt-issues logo

Fix Detekt Issues

fix-detekt-issues

Automatically fixes detekt code quality issues by running detekt --auto-correct iteratively until all auto-correctable findings are resolved

SKILL.md

Full skill instructions

Fix Detekt Issues

Automatically resolves detekt code quality findings using detekt's auto-correct feature. Runs iteratively until all findings are fixed or no further progress can be made.

Usage

./​.claude/​skills/​fix-detekt-issues/​auto-fix.main.kts

The script will:

  1. Run ./​gradlew detekt --auto-correct
  2. Parse the number of findings from the output
  3. Repeat until findings reach 0 or stop decreasing
  4. Report success or indicate manual fixes are needed

Output Behavior

Success (exit 0):

Starting detekt auto-fix iterations...

=== Iteration 1 ===
Running: ./​gradlew detekt --auto-correct
Progress: 42 findings remaining

=== Iteration 2 ===
Running: ./​gradlew detekt --auto-correct
Progress: 15 findings remaining (reduced from 42)

=== Iteration 3 ===
Running: ./​gradlew detekt --auto-correct
Progress: 0 findings remaining (reduced from 15)

✓ Success! All detekt findings have been resolved.

No Progress (exit 1):

Starting detekt auto-fix iterations...

=== Iteration 1 ===
Running: ./​gradlew detekt --auto-correct
Progress: 23 findings remaining

=== Iteration 2 ===
Running: ./​gradlew detekt --auto-correct

⚠ No progress: Findings count unchanged at 23.
Some findings cannot be auto-corrected and require manual fixes.

How It Works

Detekt's --auto-correct flag automatically fixes many common code style and quality issues, but:

  • A single run may not fix all issues (some fixes reveal new issues)
  • Some findings cannot be auto-corrected and require manual intervention

This script handles both scenarios by:

  • Running multiple iterations to handle cascading fixes
  • Detecting when no progress is made (manual fixes needed)
  • Providing clear feedback on progress and final state

Safety Features

  • Maximum iterations: Stops after 10 iterations to prevent infinite loops
  • Progress detection: Exits if findings don't decrease
  • Anomaly detection: Warns if findings unexpectedly increase

When to Use

  • Before committing code to ensure code quality standards
  • After bulk code changes or refactoring
  • When preparing code for review
  • As part of CI/​CD pre-commit checks

Manual Fixes

If the script exits with remaining findings that cannot be auto-corrected:

  1. Run ./​gradlew detekt to see detailed findings
  2. Review the HTML report at build/​reports/​detekt/​detekt.html
  3. Fix issues manually or suppress with @Suppress("RuleName") if justified
  4. Rerun the script to verify all issues are resolved

Integration with Claude Code

This skill is automatically available to Claude Code. When Claude detects code quality issues or after making significant changes to Kotlin code, it can proactively use this skill to ensure code quality standards are met.

More skills from majiayu000

xiaohongshu logo
majiayu000/claude-arsenal

xiaohongshu

xiaohongshu

286 148
View
agent-task-conductor logo
majiayu000/claude-skill-registry

agent-task-conductor

Conduct multi-agent task orchestration and workflow coordination.

663 1
View
conductor-setup logo
majiayu000/claude-skill-registry

conductor-setup

Initialize project with Conductor artifacts (product definition,

663 1
View
animation-designer logo
majiayu000/claude-skill-registry

animation-designer

Expert in web animations, transitions, and motion design using Framer Motion and CSS

663 1
View
diagramming logo
majiayu000/claude-skill-registry

diagramming

Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...

663 1
View
h3-pg logo
majiayu000/claude-skill-registry-data

h3-pg

PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.

23 1
View
conductor-development logo
majiayu000/claude-skill-registry

conductor-development

Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...

663 1
View
conductor-status logo
majiayu000/claude-skill-registry

conductor-status

Display project status, active tracks, and next actions

663 1
View
dockerization logo
majiayu000/claude-skill-registry

dockerization

Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.

663 1
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View