ktlint

Enforce Kotlin code style and formatting using ktlint presets and editorconfig.

Updated Apr 8, 2026
One-click install
npx skills add https://github.com/ClankerGuru/opsx --skill ktlint
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ktlint
Source: https://github.com/ClankerGuru/opsx/tree/main/cli/src/main/resources/content/skills/ktlint
Command: npx skills add https://github.com/ClankerGuru/opsx --skill ktlint

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

ktlint enforces Kotlin code style and formatting according to a set of presets (ktlint_official, intellij_idea, android_studio) and adheres to a project’s .editorconfig.

Core Features & Use Cases

  • Enforces Kotlin style and formatting across Kotlin codebases.
  • Supports multiple style presets (ktlint_official, intellij_idea, android_studio) and editorconfig-driven rules.
  • Integrates with Gradle via the ktlint plugin and can generate a formatting baseline for CI.
  • Provides suppression via @Suppress for allowed exceptions in code.

Quick Start

Run ktlintCheck to lint Kotlin sources and ktlintFormat to apply fixes.

Frequently Asked Questions about ktlint

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I enforce Kotlin code style and formatting consistently across a multi-module Gradle project?

To enforce Kotlin code style across a multi-module Gradle project, use ktlint with the jlleitschuh Gradle plugin. Running ktlintCheck detects style violations, while ktlintFormat automatically applies fixes, ensuring consistent formatting throughout your repository.

Does ktlint work with .editorconfig and Android Studio code style presets?

Yes, ktlint works with .editorconfig files for rule configuration and supports multiple style presets including ktlint_official, intellij_idea, and android_studio. This allows you to match your existing IDE formatting rules and maintain consistent Kotlin code style.

How can I suppress specific Kotlin linting rules for a line of code?

You can suppress specific Kotlin linting rules by using the @Suppress annotation in your code. This allows you to bypass ktlint style checks for allowed exceptions without disabling the rule globally across your codebase.

What is the best way to introduce Kotlin formatting in CI without breaking existing builds?

The best way to introduce Kotlin formatting in CI without breaking builds is generating a ktlint baseline. The jlleitschuh Gradle plugin supports baseline files, allowing existing style violations to be ignored while enforcing rules strictly on new code.