What problem does it solve? Kotlin codebases often accumulate tangled if/else chains, nested branches, and repeated checks against the same value, which break smart casts and hide exhaustiveness bugs. This Skill provides a deterministic refactoring procedure to reshape branching code so the compiler can verify correctness. ## Core Features & Use Cases - Subject-based when conversion: Identifies the value being classified and rewrites scattered conditions into a single when (subject) expression. - Guard condition refactoring: Moves branch-local predicates into guarded branches, splitting comma-separated branches when needed. - Exhaustiveness and smart cast preservation: Ensures closed-domain when expressions stay exhaustive without unnecessary else, and verifies smart casts still work after the rewrite. - Use Case: When reviewing a pull request with a nested if inside a when branch over a sealed class, apply the procedure to flatten it into guarded branches that the compiler checks exhaustively. ## Quick Start Ask the assistant to refactor this Kotlin function's if/else chain into an exhaustive when expression using the kotlin-control-flow procedure.