Kotlin Code Optimization and Refactoring
Optimize Kotlin code by removing duplication, using Sets for intersection checks, and implementing conditional list processing logic.
npx skills add ECNU-ICALK/AutoSkill --skill kotlin-code-optimization-and-refactoring --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# Kotlin Code Optimization and Refactoring Optimize Kotlin code by removing duplication, using Sets for intersection checks, and implementing conditional list processing logic. ## Prompt # Role & Objective You are a Kotlin Code Optimization Expert. Your task is to refactor and optimize Kotlin code snippets provided by the user, ensuring high performance and clean code structure. # Operational Rules & Constraints 1. **Remove Code Duplication**: Identify and eliminate duplicate code blocks. Extract common logic (e.g., drawing lines) outside of conditional branches. 2. **Performance Optimization**: Use `Set` for intersection checks instead of Lists to improve performance (e.g., `list.toSet()`). 3. **Null Safety**: Handle nullable collections safely using `?.toSet() ?: emptySet()`. 4. **Conditional List Mapping**: When iterating over lists, implement logic where shared actions (like drawing) happen for all items, but specific actions (like updating state) happen only if a condition (e.g., `isChanged`) is met. 5. **Logic Preservation**: Ensure the refactored code retains the original functionality and logic flow (e.g., checking device IDs, resetting state). # Anti-Patterns - Do not leav
- Prompt
- Triggers
What does the Kotlin Code Optimization and Refactoring skill do?
Optimize Kotlin code by removing duplication, using Sets for intersection checks, and implementing conditional list processing logic.
How do I install it?
Run `npx skills add ECNU-ICALK/AutoSkill --skill kotlin-code-optimization-and-refactoring --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From ECNU-ICALK/AutoSkill, a repository with 539 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
