Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

swiftui-atomic-design

БесплатноБез исполняемых скриптовНе проверен

Guide for building SwiftUI components using Brad Frost's Atomic Design methodology — organizing views into Atoms, Molecules, Organisms, Templates, and Pages…

tddworksот tddworks★ 40 звёзд на GitHub

Об этом скилле

SwiftUI Atomic Design System

Atomic Design is Brad Frost's methodology for building UI systems from small, composable pieces. In SwiftUI, this maps naturally to the framework's declarative, compositional view architecture. The hierarchy flows from simple to complex:

Design Tokens → Atoms → Molecules → Organisms → Templates → Pages

Each level composes the one below it. Design Tokens provide the visual foundation that all levels reference. The discipline is knowing where a component belongs — that's what makes the system scalable, consistent, and maintainable.

Design Tokens — The Visual Foundation

Design tokens are the centralized source of truth for all visual properties: colors, typography, spacing. They sit beneath atoms — every component references tokens rather than hardcoding values. This ensures consistency across the entire design system and makes sweeping visual changes (rebranding, dark mode, accessibility) a single-point update.

Why tokens matter:

  • Change a brand color once, and it propagates everywhere
  • Enable theming (light/dark, high contrast) without touching component code
  • Create a shared vocabulary between design and development
  • Prevent visual drift as the codebase grows
// Design Tokens: Centralized visual constants
struct DesignTokens {
    struct Colors {
        static let primary = Color("PrimaryColor")
        static let secondary = Color("SecondaryColor")
        static let background = Color("BackgroundColor")
        static let surface = Color(.secondarySystemGroupedBackground)
        static let textPrimary = Color.primary
        static let textSecondary = Color.secondary
    }

    struct Typography {
        static let largeTitle = Font.largeTitle.weight(.bold)
        static let title = Font.title2.weight(.semibold)
        static let headline = Font.headline.weight(.medium)
        static let body = Font.body
        static let caption = Font.caption
        static let captionBold = Font.caption2.weight(.medium)
    }

    struct Spacing {
        static let xs: CGFloat = 4
        static let sm: CGFloat = 8
        static let md: CGFloat = 16
        static let lg: CGFloat = 24
        static let xl: CGFloat = 32
    }

    struct Radius {
        static let sm: CGFloat = 8
        static let md: CGFloat = 12
        static let lg: CGFloat = 16
    }
}

Common token categories: colors, typography (font families, sizes, weights), spacing (margins, padding), corner radii, shadows/elevations, animation durations, opacity values.

Theming and Customization

Tokens become powerful when combined with SwiftUI's Environment system for runtime theming. Define theme variants and inject them through the environment so every component adapts automatically.

// Theme definition using tokens
struct AppTheme {
    let primaryColor: Color
    let secondaryColor: Color
    let backgroundColor: Color
    let textColor: Color

    static let light = AppTheme(
        primaryColor: .blue,
        secondaryColor: .gray,
        backgroundColor: .white,
        textColor: .black
    )

    static let dark = AppTheme(
        primaryColor: .cyan,
        secondaryColor: .gray,
        backgroundColor: .black,
        textColor: .white
    )
}

// Environment integration
struct AppThemeKey: EnvironmentKey {
    static let defaultValue: AppTheme = .light
}

extension EnvironmentValues {
    var appTheme: AppTheme {
        get { self[AppThemeKey.self] }
        set { self[AppThemeKey.self] = newValue }
    }
}

// Apply theme to a view hierarchy
struct ThemedModifier: ViewModifier {
    let theme: AppTheme
    func body(content: Content) -> some View {
        content.environment(\.appTheme, theme)
    }
}

extension View {
    func themed(_ theme: AppTheme) -> some View {
        modifier(ThemedModifier(theme: theme))
    }
}

Components read from @Environment(\.appTheme) instead of hardcoding colors, making the entire UI theme-switchable.

The Hierarchy

Atoms — Single-responsibility UI primitives

An atom is the smallest meaningful UI element. It does one thing and has no awareness of its context. Atoms reference Design Tokens for all visual properties — they never hardcode colors, fonts, or spacing.

What qualifies as an atom:

  • Renders a single visual concept (a badge, an icon, a divider, a label, a button)
  • Takes only primitive/value-type inputs (String, Color, Bool, CGFloat, enums)
  • Has zero business logic — purely presentational
  • Never reads from Environment or stores (except theme tokens)
  • References Design Tokens for all visual values

SwiftUI patterns for atoms:

  • Small structs, typically 10–30 lines
  • Use computed properties for style variants rather than complex switch statements in body
  • Proportional sizing (e.g., size * 0.5) so atoms scale naturally
// Atom: Colored SF Symbol in a rounded square
struct IconBadge: View {
    let icon: String
    let color: Color
    var size: CGFloat = 28
Полный SKILL.md на GitHub

Установить swiftui-atomic-design в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл swiftui-atomic-design?

Guide for building SwiftUI components using Brad Frost's Atomic Design methodology — organizing views into Atoms, Molecules, Organisms, Templates, and Pages with Design Tokens for theming. Use this skill whenever building new SwiftUI UI components, refactoring existing views into reusable pieces, creating a design system, or organizing a component library. Also trigger when the user mentions "atomic design", "design system", "component hierarchy", "reusable components", "atoms and molecules", "design tokens", or wants to decompose a complex SwiftUI view into smaller, composable parts, or needs to implement theming/customization across a SwiftUI app.

Как установить скилл swiftui-atomic-design?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл swiftui-atomic-design запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить swiftui-atomic-design с