Skip to content
cccskills
FreePublished on GitHub

code-style

Write or review Kotlin and Java code in line with IntelliJ project conventions. The guidance covers language choice, formatting, sealed types, threading annotations, and safe handling of control flow exceptions so changes fit the surrounding codebase.

OriginalShow the original description

Apply IntelliJ Kotlin and Java code style when writing or reviewing.

JetBrains/intellij-community20,664 stars(GitHub 20,664 + cccskills 0)

Run score Not tested

See how to install

Good for

  • Writing a new Kotlin file that follows IntelliJ conventions
  • Reviewing Java code and checking its style guidance
  • Checking formatting, sealed-type handling, or exception handling

Files included (3)

  • SKILL.md3.2 KB
  • references/modern-java.LICENSE.txt1.0 KB
  • references/modern-java.md8.2 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

<!-- Generated by community/.ai/render-guides.mjs; edit community/.agents/skills/code-style/SKILL.md -->

Code Style

Follow the IntelliJ Coding Guidelines with these IntelliJ-specific rules.

Language

  • Use Kotlin for new files unless the user explicitly requests Java.
  • Keep existing Java files in Java unless the task requires a language conversion.
  • Before writing or reviewing Java, read Modern Java.
  • Use idiomatic Kotlin: extension functions, data classes, null safety
  • Mark experimental APIs with @ApiStatus.Experimental
  • Build scripts Kotlin style: Follow community/platform/build-scripts/kotlin-style-recommendations.md for build-scripts code:
    • Use @JvmField for internal data class fields
    • Use .put()/.get() instead of [] operator
    • Use explicit HashMap/HashSet/LinkedHashMap instead of mutableMapOf()/mutableSetOf()

Sealed hierarchies

  • Before you list several subtypes in a when branch, an is check, or a catch, open the declaration of the type.
  • If a common supertype covers exactly those subtypes, use the supertype. It stays correct when someone adds a new subtype.
  • Check the value of a sealed type or an enum with an exhaustive when. Do not use an is check, an as? cast, an == comparison, or else. In Eel and IJent code, this is a rule, also for a private type. See community/platform/eel/docs/api/exhaustive-when.md.

Formatting

  • Read every applicable .editorconfig before you review or change formatting.
  • Use the effective .editorconfig value for each setting. If no file defines a setting, use these defaults:
    • Indentation: 2 spaces (4 for Go files)
    • Line length: 140 characters max
    • Braces: else, catch, and finally on new lines
  • Only in /rustrover directory you must always use standard Kotlin formatting rules with 4 spaces indentation.

Threading annotations

  • When you add @RequiresEdt, @RequiresBackgroundThread, @RequiresReadLock, @RequiresWriteLock, or @RequiresReadLockAbsence, do not pass generateAssertion. Keep the default value unless the user explicitly requests a different one.
  • Never write generateAssertion = false /* IJPL-115548 */. It is a legacy mass-migration marker. Do not copy it from existing code.
  • Set generateAssertion = false only when the user explicitly requests it, or when the runtime assertion is known to fail. State the reason in a comment.
@RequiresEdt
fun updateUi() { ... }

Error handling

  • In a catch block for Throwable or Exception, call com.intellij.diagnostic.rethrowControlFlowException(e) first. It rethrows a control flow exception, such as CancellationException. A control flow exception must never reach the log.
  • Do not catch or rethrow CancellationException explicitly, and do not test the exception type by hand.
  • In Java, static-import com.intellij.diagnostic.ControlFlowExceptionsKt.rethrowControlFlowException.
  • Do not use the deprecated com.intellij.openapi.diagnostic.rethrowControlFlowException.
try {
  doWork()
}
catch (e: Throwable) {
  rethrowControlFlowException(e)
  LOG.error(e)
}

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

actions

FreeSummary

Implement or update IntelliJ `AnAction` classes and their `plugin.xml` registrations. Keep labels and descriptions in message bundles, configure optional icons, and launch suspending work through the event coroutine scope so synchronous action handling does not freeze the IDE.

  • Adding a new IntelliJ action
  • Updating an action's registration or icon
  • Moving action labels into a message bundle
JetBrains/intellij-community20.7KUpdated Oct 26, 2026

Move IntelliJ JPS test modules to Bazel and diagnose failures that occur only under Bazel. The guide helps trace missing dependencies, plugins, test data, and runfiles, then verify the generated target and migrated tests.

  • Migrating a JPS test module to Bazel
  • Diagnosing a test failure that occurs only in Bazel
  • Checking Bazel dependencies and test data wiring
JetBrains/intellij-community20.7KUpdated Oct 26, 2026

commits

FreeSummary

Create, amend, or rename IntelliJ commits with messages that follow the project’s ticket and label formats. Keep each commit focused, explain the reason and decision in the body when needed, and pass the message safely through the shell or PowerShell.

  • Writing a message for a change linked to a YouTrack ticket
  • Preparing a commit message for tests, cleanup, or documentation
  • Amending or renaming an existing IntelliJ commit
JetBrains/intellij-community20.7KUpdated Oct 26, 2026

Compare how Python type checkers interpret a code snippet or file. The script runs selected tools, including ty, pyrefly, basedpyright, mypy, and zuban, then produces a Markdown report with verdicts, timings, and each checker's diagnostic output.

  • Comparing type inference for a Python snippet
  • Checking whether a Python expression should be a type error
  • Reviewing differences among Python type checkers
JetBrains/intellij-community20.7KUpdated Oct 26, 2026

Shape Compose Desktop UI code by keeping composables focused on rendering and placing application decisions in presenters or coordinators. Get guidance on state ownership, effects, reusable component APIs, lazy-list keys, animation, and performance for individual UI changes.

  • Separating screen rendering from application decisions
  • Choosing which UI state belongs in composition
  • Structuring effects and coroutine work
JetBrains/intellij-community20.7KUpdated Oct 26, 2026

compose-ui-audit

FreeSummary

Audit Compose Desktop code for architecture and runtime issues, including state ownership, effects, coroutine use, lazy lists, animation, and recomposition. It produces prioritized findings with file and line references, while keeping visual design outside the audit scope.

  • Auditing state ownership and presenter boundaries in a Compose screen
  • Investigating effects, coroutines, or flow collection in desktop UI
  • Reviewing recomposition, lazy-list, or animation performance concerns
JetBrains/intellij-community20.7KUpdated Oct 26, 2026

See all skills by JetBrains

Report a problem with this skill