spark-component-view-model
Create or update an view model file in the ViewModel folder in Sources of a spark-ios-component-XXX and add or update unit tests.
от leboncoin★ 22 звезды на GitHub
Установить spark-component-view-model в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Add Repository Skill
Overview & Prerequisites
This skill guides you to implement/update an view model in spark component.
Component Selection
Parameter Handling:
If the skill is invoked with a parameter (e.g.,
/spark-component-view-model button):- Use the parameter as the component name
- Verify the folder exists in
Modules/Components/{component-name}/ - If found, use that component and skip the selection step
If no parameter is provided:
- List all folders in the
Modules/Components/directory - Use AskUserQuestion to let the user select ONE component from the list
- Format: Display folder names as options (e.g., "button", "card", "checkbox")
- List all folders in the
Once the component is selected, all operations must be performed in Modules/Components/{component-name}/ folder.
Use the files in the template folder as reference to manage the view model and the unit tests.
Rules
The ViewModel file must respect theses rules :
- must be located in Sources/Core/ViewModel and in Tests/UnitTests/ViewModel.
- should contains
final classimplementation. - should have this comment before the final class
// sourcery: AutoPublisherTest, AutoViewModelStub - if there is
@Published private(set)with anany XXX, add before the func// sourcery: nameOfProperty = "Identical". Replace nameOfProperty by the real name of the variable - must contains only :
- some @Published private(set) var that only set by use cases and consume by the views
- some var. Setted by the views and the setup function. Manage the didSet to call use case if it is needed
- A private var alreadyUpdateAll use to know if the viewModel is setup are not.
- A list of usecase used by the viewmodel to set the @Published properties.
- The init with all use cases (and with the default implementation)
- The setup func with all needed properties send by the init. Set the alreadyUpdateAll to true.
- The private setter func. Use to set @Published from use cases.
- unit testing : use the same logic/conception as the test file in template.
Workflow
- Add/Update the code.
- Run swiftlint
$ swiftlint. - Run sourcery
$ sourcery - Implement the unit tests. Read theses folders to get mocks :
- spark-ios-component-XXX/Sources/Testing
- spark-ios-common/Sources/Testing
- spark-ios-theming/Sources/Testing
Code Conventions
- File headers follow pattern:
Created by {firstname.lastname} on DD/MM/YYYY - Copyright line includes current year
- No empty lines contain whitespace or tabs
- All class members accessed with
self. - Protocol marked with
// sourcery: AutoMockable - Proper MARK comments in place
Test Implementation
- Tests must be written in Swift Testing framework
- Proper imports (SparkComponentXXX, SparkCommon, SparkTheming, @testable, @_spi(SI_SPI) @testable import SparkComponentXXXTesting, Testing, ...)
- Every
@Testmust have a description, written as the function name in a sentence (e.g.@Test("Radius should return radius full")forfunc radiusShouldReturnRadiusFull(),@Test("Value should return expected scale", arguments: [...])for a parameterized test). Never use a bare@Testor@Test(arguments:)
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- template/XXXViewModel.swift
- template/XXXViewModelTests.swift
FAQ
Что делает скилл spark-component-view-model?
Create or update an view model file in the ViewModel folder in Sources of a spark-ios-component-XXX and add or update unit tests.
Как установить скилл spark-component-view-model?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл spark-component-view-model запускает скрипты?
Нет, скилл состоит только из инструкций (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…