kotlin-quality
БесплатноБез исполняемых скриптовНе проверенKotlin code quality toolchain — detekt (static analysis with rule sets, baseline, custom rules), ktlint (formatter + linter for the Kotlin style guide), and…
от claude-dev-suite★ 51 звезда на GitHubОб этом скилле
Kotlin Quality — detekt + ktlint
Deep Knowledge: Use
mcp__documentation__fetch_docswith technology:detektorktlint.
Tool Comparison
| Tool | Purpose |
|---|---|
| ktlint | Formatter + minimal linter — enforces Kotlin official style. Auto-fixes most issues. |
| detekt | Comprehensive static analyzer — code smells, complexity, security, naming, magic numbers, performance, style. Highly configurable. |
| Compose Rules (Twitter/Slack/Mrtn) | Compose-specific lint rules — composable naming, side-effects, parameter ordering. Plugs into both detekt and ktlint. |
| Android Lint | Android-specific (resources, manifest, lifecycle). Run alongside, not replaced. |
Use both ktlint and detekt — complementary. ktlint for formatting, detekt for everything else.
Setup — ktlint (Gradle Plugin)
// build.gradle.kts (root)
plugins {
id("org.jlleitschuh.gradle.ktlint") version "12.1.1" apply false
}
subprojects {
apply(plugin = "org.jlleitschuh.gradle.ktlint")
configure<org.jlleitschuh.gradle.ktlint.KtlintExtension> {
version.set("1.4.1")
verbose.set(true)
outputToConsole.set(true)
coloredOutput.set(true)
ignoreFailures.set(false)
enableExperimentalRules.set(false)
filter {
exclude("**/generated/**")
exclude("**/build/**")
include("**/kotlin/**")
}
}
}
./gradlew ktlintCheck # check all modules
./gradlew ktlintFormat # auto-fix
./gradlew :shared:ktlintCheck # one module
ktlint Configuration via .editorconfig
# .editorconfig
root = true
[*.{kt,kts}]
indent_size = 4
max_line_length = 120
ij_kotlin_imports_layout = *,java.**,javax.**,kotlin.**,^
# ktlint-specific
ktlint_standard = enabled
ktlint_experimental = disabled
ktlint_function_naming_ignore_when_annotated_with = Composable,Test
ktlint_compose = enabled
Setup — detekt
// build.gradle.kts (root)
plugins {
id("io.gitlab.arturbosch.detekt") version "1.23.7" apply false
}
subprojects {
apply(plugin = "io.gitlab.arturbosch.detekt")
configure<io.gitlab.arturbosch.detekt.extensions.DetektExtension> {
config.setFrom(files("$rootDir/config/detekt/detekt.yml"))
baseline = file("$projectDir/detekt-baseline.xml")
buildUponDefaultConfig = true
autoCorrect = false // CI-safe
parallel = true
}
dependencies {
"detektPlugins"("io.gitlab.arturbosch.detekt:detekt-formatting:1.23.7")
"detektPlugins"("io.nlopez.compose.rules:detekt:0.4.16") // Compose rules
}
}
tasks.withType<io.gitlab.arturbosch.detekt.Detekt>().configureEach {
reports {
html.required.set(true)
xml.required.set(true)
sarif.required.set(true)
}
}
./gradlew detekt
./gradlew detektBaseline # generate baseline
./gradlew :shared:detekt
detekt.yml — Production Config
# config/detekt/detekt.yml
build:
maxIssues: 0
weights:
complexity:
CyclomaticComplexMethod:
threshold: 15
LongMethod:
threshold: 60
LongParameterList:
functionThreshold: 8
TooManyFunctions:
thresholdInClasses: 30
ignoreAnnotatedFunctions:
- 'Composable'
empty-blocks:
active: true
exceptions:
TooGenericExceptionCaught:
exceptionNames:
- 'Exception'
- 'RuntimeException'
- 'Throwable'
allowedExceptionNameRegex: '_|(ignore|expected).*'
naming:
FunctionNaming:
functionPattern: '[a-z][a-zA-Z0-9]*'
excludes: ['**/test/**', '**/androidTest/**']
ignoreAnnotated:
- 'Composable' # PascalCase composables OK
performance:
active: true
potential-bugs:
HasPlatformType:
active: true # KMP-friendly: catch missing nullability
style:
MagicNumber:
ignoreNumbers: ['-1', '0', '1', '2', '100', '1000']
ignoreEnums: true
MaxLineLength:
maxLineLength: 120
ReturnCount:
max: 4
WildcardImport:
active: true
formatting: # ktlint-formatting plugin
active: true
android: false
autoCorrect: false
Baseline (For Legacy Code)
./gradlew detektBaseline # generates detekt-baseline.xml — commit it
New issues fail CI; existing ones silently allowed. Reduce baseline over time.
Compose Rules
Twitter/Slack/Mrtn maintain Compose-specific lint rules:
dependencies {
"detektPlugins"("io.nlopez.compose.rules:detekt:0.4.16")
// OR for ktlint
"ktlintRuleset"("io.nlopez.compose.rules:ktlint:0.4.16")
}
Catches:
@Composablenot in PascalCase- Modifier parameter not first
remember { mutableStateOf() }instead ofby remember- Side effects outside
LaunchedEffect - Missing
keyinLazyColumn.items
Установить kotlin-quality в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadGrepGlobWriteEditFAQ
Что делает скилл kotlin-quality?
Kotlin code quality toolchain — detekt (static analysis with rule sets, baseline, custom rules), ktlint (formatter + linter for the Kotlin style guide), and Compose-specific lint rules. Covers Gradle integration (KMP-aware), pre-commit hooks, CI integration, baseline files for legacy code, and config patterns for production apps including Jetpack Compose specifics (detekt-compose-rules). USE WHEN: user mentions "detekt", "ktlint", "ktlint-gradle", "detekt-gradle", "kotlin static analysis", "kotlin formatter", "kotlin lint", "compose-rules detekt", "kotlin code style", "detekt baseline" DO NOT USE FOR: Java-only static analysis - use SpotBugs/Checkstyle skill DO NOT USE FOR: Rust code quality - use `quality/rust-supply-chain` DO NOT USE FOR: Security-specific Kotlin issues - use `security/kotlin-security` DO NOT USE FOR: TypeScript linting - use eslint-specific skill
Как установить скилл kotlin-quality?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл kotlin-quality запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic