What problem does it solve? Kotlin codebases often accumulate tangled if/else chains, nested branches, and repeated condition checks that hide the classified value, break smart casts, and miss compiler-verified exhaustiveness. This Skill provides a structured refactoring procedure to reshape branching logic into clear, compiler-checked control flow. ## Core Features & Use Cases - Subject identification and branch primitive selection: Decide between subject when, subjectless when, guard conditions, early returns, or explicit else using a decision table. - Guard condition refactoring: Move branch-local predicates into guarded branches, split comma-separated branches, and order guarded branches before unguarded fallbacks. - Exhaustiveness and smart cast verification: Keep closed-domain when expressions exhaustive without unnecessary else and confirm smart casts still work without as or !!. - Use Case: When reviewing a pull request containing a nested if inside a when branch over a sealed class, apply the rewrite recipes to convert it into guarded branches with compiler-proven exhaustiveness. ## Quick Start Ask the AI to review and refactor the branching logic in your Kotlin file using the kotlin-control-flow procedure, converting nested if/else chains into exhaustive when expressions with guard conditions.