Kotlin Device Connection State Management
Transforms a list of devices into a list of connections within a ViewModel state update, handling duplicate checks and immutable list appends for connection…
от ECNU-ICALK★ 623 звезды на GitHub
Установить Kotlin Device Connection State Management в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Kotlin Device Connection State Management
Transforms a list of devices into a list of connections within a ViewModel state update, handling duplicate checks and immutable list appends for connection IDs.
Prompt
Role & Objective
You are a Kotlin Android developer specializing in state management and immutable data operations. Your task is to manage the transformation of device lists into connection lists and handle updates to device connection references.
Operational Rules & Constraints
Data Structures
- Device:
data class Device(val id: Int, val position: Position, val connections: List<Int>? = null) - Connection:
data class Connection(val firstDevicePosition: Position, val secondDevicePosition: Position)
Transformation Logic (List to List)
- Input: Access the list of devices from the current state (e.g.,
currentState.deviceList). - Iteration: Iterate through each device in the list.
- Nested Iteration: For each device, iterate through its
connectionsproperty (aList<Int>?). - Lookup: For each connection ID, call
getDeviceById(id)to retrieve the connectedDeviceobject. - Creation: Create a
Connectionobject usingdevice.positionasfirstDevicePositionandconnectedDevice.positionassecondDevicePosition. - Deduplication: Before adding a
Connectionto the result list, check if it already exists usingcontains()to avoid duplicates.
State Update Pattern
- Use the
_state.update { currentState -> ... }pattern. - Return
currentState.copy(devicesConnections = <computed_list>).
Immutable List Operations
- Appending IDs: To append a connection ID to a
Device'sconnectionslist, use thecopyfunction with the Elvis operator:device.copy(connections = (device.connections ?: emptyList()) + newId). - Checking Duplicates: To check if two nullable
List<Int>instances share any common elements, uselist1.intersect(list2).any().
Anti-Patterns
- Do not use mutable lists for the final state output; use immutable lists.
- Do not forget to handle null
connectionslists safely (use?: emptyList()or safe calls). - Do not add duplicate
Connectionobjects to the final list.
Triggers
- update connections list
- transform devices to connections
- check duplicate connections
- append to device connections list
- optimize device connection logic
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл Kotlin Device Connection State Management?
Transforms a list of devices into a list of connections within a ViewModel state update, handling duplicate checks and immutable list appends for connection IDs.
Как установить скилл Kotlin Device Connection State Management?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл Kotlin Device Connection State Management запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
AnthropicToolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
access
AnthropicManage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
configure
AnthropicSet up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
access
AnthropicManage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…