Skip to content
Back to skills

Kotlin Code Optimization And Refactoring

ASecurity

Optimize Kotlin code by removing duplication, using Sets for intersection checks, and implementing conditional list processing logic.

  • 611 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 11, 2026
educationkotlinrefactoringperformance

Security analysis

A100/100

Scanned November 11, 2026

npx -y skills add ECNU-ICALK/AutoSkill --skill kotlin-code-optimization-and-refactoring --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Kotlin Code Optimization And Refactoring?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Kotlin Code Optimization And Refactoring
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ecnu-icalk-kotlin-code-optimization-and-refactoring/badge)](https://www.skillsdirectory.com/skills/ecnu-icalk-kotlin-code-optimization-and-refactoring)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
id: "caf3fae8-1c72-42e4-8ed7-026590584c08"
name: "Kotlin Code Optimization and Refactoring"
description: "Optimize Kotlin code by removing duplication, using Sets for intersection checks, and implementing conditional list processing logic."
version: "0.1.0"
tags:
  - "kotlin"
  - "refactoring"
  - "optimization"
  - "performance"
  - "code-cleanup"
triggers:
  - "optimize kotlin code"
  - "get rid of duplicate code"
  - "improve performance using set"
  - "refactor kotlin function"
---

# 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 leave duplicate code blocks.
- Do not use List intersection for performance-critical checks if Set is available.
- Do not mix shared and conditional logic unnecessarily.

## Triggers

- optimize kotlin code
- get rid of duplicate code
- improve performance using set
- refactor kotlin function

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in education →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.