ktlint-kmp-code-style

Enforces Ktlint formatting rules for Kotlin Multiplatform code to pass ktlintCheck.

Updated Sep 12, 2026
One-click install
npx skills add https://github.com/Vierco/citoVisionApp --skill ktlint-kmp-code-style-vierco
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: ktlint-kmp-code-style
Source: https://github.com/Vierco/citoVisionApp/tree/main/.claude/skills/ktlint-kmp-code-style
Command: npx skills add https://github.com/Vierco/citoVisionApp --skill ktlint-kmp-code-style-vierco

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Kotlin/KMP code that fails ktlintCheck generates hundreds of formatting errors in every Pull Request, blocking commits and creating noisy diffs. This Skill ensures generated or modified Kotlin code follows Ktlint rules from the first attempt. ## Core Features & Use Cases - Import Management: Removes unused imports, replaces wildcard imports with explicit ones, and orders imports lexicographically. - Formatting Rules: Applies trailing commas, multiline expression placement, parameter-per-line layout, blank line rules, and class body spacing. - Compose Naming Exception: Preserves PascalCase for @Composable UI functions and guides .editorconfig configuration instead of incorrectly renaming them. - Use Case: After generating a new LoginScreen composable and its ViewModel, run this Skill to fix all Ktlint violations before opening the Pull Request so ktlintCheck passes cleanly. ## Quick Start Review my Kotlin files and fix all Ktlint errors so that ./gradlew ktlintCheck passes without changing any functional behavior.

Frequently Asked Questions about ktlint-kmp-code-style

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

FAQPage Schema
How do I fix Ktlint errors in Kotlin Multiplatform projects?▼

Run ./gradlew ktlintCheck to list violations, then fix autocorrectable issues first: unused imports, wildcard imports, trailing commas, and blank lines. Use ./gradlew ktlintFormat if autocorrection is enabled, then handle non-autocorrectable errors like function naming manually.

How to replace wildcard imports with explicit imports in Kotlin?▼

Replace each wildcard import with the specific classes actually used, then order all imports lexicographically. Verify Compose APIs like MutableStateFlow, remember, and Composable are correctly imported after removing wildcards.

Why does Ktlint complain about Composable function names in uppercase?▼

Ktlint's default function naming rule expects lowercase camelCase, but Compose convention uses PascalCase for UI functions. Do not rename the Composable; instead configure .editorconfig with ktlint_function_naming_ignore_when_annotated_with = Composable.

Does Ktlint require trailing commas in Kotlin code?▼

Yes, when configured, Ktlint requires trailing commas in multiline calls, constructors, and parameter lists. Add a comma after the last argument in any multiline structure to satisfy the rule.

When should I not change code just to satisfy Ktlint?▼

Do not change functional behavior, architecture, or Compose naming conventions just to silence Ktlint. For legitimate exceptions like @Composable PascalCase names, adjust .editorconfig rather than modifying correct code.