spark-component-token
Create or update a token file in the Token folder in Sources of a spark-ios-component-XXX and add or update unit tests.
от leboncoin★ 22 звезды на GitHub
Установить spark-component-token в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Add Repository Skill
Overview & Prerequisites
This skill guides you to implement/update a token in spark component.
Component Selection
Parameter Handling:
If the skill is invoked with a parameter (e.g.,
/spark-component-token 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 token and the unit tests. See Modules/Components/InputOTP/Sources/Core/Token for a full real-world example.
The template uses
Border,Size,TypographyandAnimationpurely as illustrations of recurring patterns (see Rules below). A real component's token categories are whatever it actually needs — e.g.Colors,Opacity,Layout,Spacing,Icon,Animation, ... Determine the category names and count from the component's design/usage, not from the template names.
The token is exposed publicly through
theme.component.xxx(ComponentToken+XXX.swift) and consumed by the SwiftUI views throughEnvironmentTheme+XXXToken.swift. Theses two files are managed by the skill spark-component-migrate-token.
Rules
The Token file must respect theses rules :
- must be located in Sources/Core/Token and in Tests/UnitTests/Token.
- the root file is named XXXToken.swift and contains a
public struct XXXToken: Equatablewith one property per token category the component actually needs (there is no fixed list or fixed count — could be one category or a dozen), plus apublic init(theme: any Theme)that forwards the theme to every category that needs it. - each token category lives in its own file named XXXToken+CategoryName.swift (e.g.
XXXToken+Opacity.swift), containing apublic extension XXXTokenwith a nestedstruct CategoryName: Equatable. - a category that depends on the theme (illustrated by
BorderandTypographyin the template):- stores the theme in an internal
let theme: any Theme(no explicit init, the internal memberwiseinit(theme:)is used by the root struct). - exposes its values as public computed properties (
public var radius: CGFloat { ... }) readingself.theme. - exposes the values depending on a state/configuration (intent, isEnabled, isSelected, onError, ...) as public methods (
public func width(isSelected: Bool) -> CGFloat). Theses methods replace the old styling use cases. - implements a manual
static func ==comparing the themes:lhs.theme.equals(rhs.theme). - is assigned in the root
init(theme:).
- stores the theme in an internal
- a category that only exposes fixed constants (no theme-dependent values, illustrated by
Sizein the template) contains onlypublic letconstants. On the root struct, its property is a stored default value (public let size = Size()), not assigned in the rootinit(theme:)body. - the animation values (durations, curves) are tokens, not constants: they replace the
XXXConstants.Animationenum /XXXConstants.animationDuration. They live in anAnimationcategory (illustrated byAnimationin the template):- it is a constant category (
public let animation = Animation()on the root struct, no theme). - the file imports
SwiftUIand, since the nested struct shadows the SwiftUI type, refers to it asSwiftUI.Animation. - exposes each duration as a
public let xxxDuration: TimeInterval(used by the UIKit views and by delays such asDispatchQueue.main.asyncAfter). - exposes the matching SwiftUI animation as a public computed property built from the duration (
public var fast: SwiftUI.Animation { .easeInOut(duration: self.fastDuration) }), used by the views (.animation(token.animation.fast, value:),withAnimation(token.animation.fast)). - when migrating, move the animation values from XXXConstants.swift to the token, update every usage (
XXXConstants.animationDuration->self.theme.component.xxx.animation...in the ViewModifiers / views), remove them from the constants (and delete the constants file and its tests if it becomes empty).
- it is a constant category (
- every public struct, property and method must be documented with a doc comment (
///). - use
// MARK: - Properties,// MARK: - Methodsand// MARK: - Equatablein the categories. - the root XXXToken.swift file must have a top-level doc comment that:
- starts with "Contains all token values for the XXX component, grouped like the
Theme." - lists every category actually present, each with a doc link (e.g.
XXXToken/Categ
- starts with "Contains all token values for the XXX component, grouped like the
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- template/XXXToken+Animation.swift
- template/XXXToken+AnimationTests.swift
- template/XXXToken+Border.swift
- template/XXXToken+BorderTests.swift
- template/XXXToken+Size.swift
- template/XXXToken+SizeTests.swift
- template/XXXToken+Typography.swift
- template/XXXToken+TypographyTests.swift
- template/XXXToken.swift
- template/XXXTokenTests.swift
FAQ
Что делает скилл spark-component-token?
Create or update a token file in the Token folder in Sources of a spark-ios-component-XXX and add or update unit tests.
Как установить скилл spark-component-token?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл spark-component-token запускает скрипты?
Нет, скилл состоит только из инструкций (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…