iOS/SwiftUIアプリのデザインシステム・スタイルガイドを構築するスキル。カラーパレット、タイポグラフィ、スペーシング、コンポーネントスタイルをSwiftコードとして生成。使用シーン:(1)「スタイルガイドを作って」「デザインシステムを構築して」などの新規作成リクエスト (2)「既存のスタイルを分析して」「色やフォントを整理して」などの既存コード分析リクエスト (3) UI実装時にスタイル定義の一貫性が必要な場合
This skill inherits all available tools. When active, it can use any tool Claude has access to.
assets/templates/ButtonStyles.swiftassets/templates/Colors.swiftassets/templates/DesignSystem.swiftassets/templates/Spacing.swiftassets/templates/TextFieldStyles.swiftassets/templates/Typography.swiftreferences/design-guidelines.mdreferences/style-presets.mdiOS/SwiftUIアプリのデザインシステムをSwiftコードとして構築・管理する。
型(構造)と値(インスタンス)を分離した設計。複数テーマの切り替えや比較が可能。
// 統合struct
struct DesignSystem {
let colors: ColorPalette
let typography: Typography
let spacing: SpacingScale
let cornerRadius: CornerRadiusScale
let shadow: ShadowScale
let layout: LayoutConstants
}
// プリセットインスタンス
extension DesignSystem {
static let `default` = DesignSystem(...)
static let minimal = DesignSystem(...)
static let pop = DesignSystem(...)
}
// 使用例
let theme = DesignSystem.default
Text("Hello")
.font(theme.typography.bodyLarge)
.foregroundColor(theme.colors.textPrimary)
ユーザーリクエスト
│
▼
┌──────────────────┐
│ 新規作成 or 分析?│
└────────┬─────────┘
┌────┴────┐
▼ ▼
新規作成 既存分析
│ │
▼ ▼
世界観ヒアリング コード検索
│ │
▼ ▼
プリセット選定 パターン抽出
│ │
▼ ▼
カスタマイズ 整理・提案
│ │
└────┬────┘
▼
配置場所の確認
│
▼
Swiftコード出力
必須確認項目:
雰囲気キーワード例:
| キーワード | 対応プリセット |
|---|---|
| シンプル、洗練、クリーン | ミニマル/モダン |
| 楽しい、明るい、カラフル | ポップ/カジュアル |
| 高級、エレガント、上質 | 高級/プレミアム |
| 自然、健康、温かみ | ナチュラル/オーガニック |
| 先進的、クール、テック | ダーク/テック |
| 優しい、安心、親しみ | フレンドリー/ソフト |
| 信頼、堅実、ビジネス | ビジネス/プロフェッショナル |
| ノスタルジック、クラシック | レトロ/ヴィンテージ |
references/style-presets.md から最適なプリセットを選定ファイルを配置する場所をユーザーに確認する。
選択肢:
| 選択肢 | 説明 | 推奨ケース |
|---|---|---|
| Appターゲット内 | メインアプリのソースに直接配置 | 小規模アプリ、単一ターゲット構成 |
| 別のターゲット | 専用のFrameworkやPackageとして分離 | 複数アプリで共有、チーム開発、モジュラー設計 |
| その他の場所 | ユーザー指定のパス | 既存のプロジェクト構成に合わせる場合 |
確認事項:
assets/templates/ のテンプレートをベースにカスタマイズ。
DesignSystem/
├── DesignSystem.swift # 統合struct + テーマインスタンス
├── Colors.swift # ColorPalette struct
├── Typography.swift # Typography struct
├── Spacing.swift # SpacingScale, CornerRadiusScale, ShadowScale
└── Components/
├── ButtonStyles.swift
└── TextFieldStyles.swift
配置場所によって、アクセス修飾子(public)の付与やモジュールインポートの設定が変わる。
// カスタムテーマの定義
extension DesignSystem {
static let myBrand = DesignSystem(
colors: ColorPalette(
primaryBrand: Color(hex: "FF6B6B"),
// ...
),
typography: .rounded,
spacing: .default,
cornerRadius: .rounded,
shadow: .default,
layout: .default
)
}
// テーマ切り替え
struct ContentView: View {
@State private var theme = DesignSystem.default
var body: some View {
VStack {
Text("Title").font(theme.typography.displayLarge)
Button("Switch Theme") {
theme = (theme === .default) ? .myBrand : .default
}
.buttonStyle(PrimaryButtonStyle(theme: theme))
}
}
}
Color, Font, .padding, .cornerRadius などの使用箇所を検索| ファイル | 内容 |
|---|---|
references/style-presets.md | 世界観別カラーパレット・スタイルプリセット |
references/design-guidelines.md | 詳細なデザインガイドライン、色彩理論 |
assets/templates/DesignSystem.swift | 統合struct定義 |
assets/templates/Colors.swift | ColorPalette struct |
assets/templates/Typography.swift | Typography struct |
assets/templates/Spacing.swift | Spacing/CornerRadius/Shadow structs |
assets/templates/ButtonStyles.swift | テーマ対応ボタンスタイル |
assets/templates/TextFieldStyles.swift | テーマ対応テキストフィールド |
#Preview マクロではなく PreviewProvider を使用する(テーマ配列の拡張性のため)// ✅ 正しい: PreviewProvider を使用
struct DesignSystem_Previews: PreviewProvider {
static var themes: [DesignSystem] = [.default, .minimal, .pop]
static var previews: some View {
ForEach(themes, id: \.name) { theme in
DesignSystemPreview(theme: theme)
.previewDisplayName(theme.name)
}
}
}
// ❌ 間違い: #Preview マクロは使わない
#Preview("Theme") {
DesignSystemPreview(theme: .default)
}