kotlin-style

Enforces official Kotlin coding conventions for class layout, naming, imports, and formatting.

Updated May 21, 2025
One-click install
npx skills add https://github.com/albertmartorell1975/MeteoMartoCompose --skill kotlin-style-albertmartorell1975
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: kotlin-style
Source: https://github.com/albertmartorell1975/MeteoMartoCompose/tree/main/.agents/skills/kotlin-style
Command: npx skills add https://github.com/albertmartorell1975/MeteoMartoCompose --skill kotlin-style-albertmartorell1975

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Inconsistent Kotlin code style across a project creates technical debt, noisy diffs, and lint warnings. This Skill gives AI agents and developers a strict, enforceable checklist based on the Official Kotlin Coding Conventions so every code change in the MeteoMartoCompose project follows the same layout, naming, and formatting rules. ## Core Features & Use Cases - Class Layout Enforcement: Mandates declaration order (properties, constructors, functions, companion object last) for readable, predictable classes. - Naming & Modifier Rules: Defines PascalCase, camelCase, UPPER_SNAKE_CASE conventions and the canonical modifier order (e.g., suspend operator fun). - Import & Formatting Hygiene: Bans wildcard imports, requires removal of unused imports, enforces 4-space indentation, trailing commas, and extraction of magic literals into centralized constants. - Use Case: When an AI agent implements a new feature like a high-temperature notification service, it verifies the generated Kotlin code against this checklist as part of the Definition of Done before submitting the change. ## Quick Start Review my new Kotlin class and fix any violations of the project's coding conventions, including companion object placement, modifier order, and wildcard imports.

Frequently Asked Questions about kotlin-style

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

FAQPage Schema
How do I enforce Kotlin coding conventions in an Android project?▼

Define a written style checklist covering class layout, naming, imports, and formatting, then verify every code change against it as part of the Definition of Done. This Skill provides that checklist based on the Official Kotlin Coding Conventions.

Where should the companion object go in a Kotlin class?▼

The companion object must be placed at the very end of the class, just before the closing brace. It comes after properties, initializer blocks, secondary constructors, and function declarations.

What is the correct order of Kotlin modifiers?▼

Follow the canonical order: visibility modifier first, then override, suspend, inline/infix/operator, and data. For example, write `suspend operator fun invoke(...)` rather than `operator suspend fun invoke(...)`.

Are wildcard imports allowed in Kotlin style guides?▼

No, wildcard imports are prohibited under these conventions. Always use explicit imports and remove any unused imports as part of the Definition of Done to keep the codebase clean.

How should magic numbers and string literals be handled in Kotlin?▼

All literal values used as thresholds, defaults, or keys must be extracted into centralized constants such as an AppConstants file. This avoids scattered magic literals and makes values easier to maintain.