Skip to content
cccskills
FreePublished on GitHub

swiftui-coding-guidelines

Core coding guidelines for iOS, iPadOS, macOS, watchOS, tvOS, and visionOS app development using SwiftUI and Swift. Use when implementing Views, working with @State/@Binding/@Observable/@StateObject, using NavigationStack/List/LazyVStack, designing components, or asking about SwiftUI patterns (infinite scroll, pull-to-refresh, search). Covers best practices, implementation patterns, and anti-patterns to avoid.

The English summary is being prepared. Showing the original description.

See how to install

Files included (7)

  • SKILL.md4.4 KB
  • references/anti-patterns.md21.7 KB
  • references/best-practices.md13.3 KB
  • references/patterns-forms.md11.5 KB
  • references/patterns-list.md6.1 KB
  • references/patterns-navigation.md3.9 KB
  • references/patterns-views.md11.2 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

SwiftUI Coding Guidelines

SwiftUIの日常的な開発で参照するコアガイドライン。

ディレクトリ構成

swiftui-coding-guidelines/
├── SKILL.md (このファイル)
└── references/
    ├── best-practices.md      # ベストプラクティス
    ├── patterns-list.md       # 1-x: リスト・データ表示系
    ├── patterns-navigation.md # 2-x: ナビゲーション・画面遷移系
    ├── patterns-forms.md      # 3-x: フォーム・入力系
    ├── patterns-views.md      # 4-x: View構築・レイアウト系
    └── anti-patterns.md       # アンチパターン

リファレンスファイル

references/best-practices.md

SwiftUIのベストプラクティス集:

  • 状態管理: プロパティラッパー(@State、@Binding、@StateObject等)
  • パフォーマンス最適化: View構造、LazyスタックとGrid、Equatable
  • コンポーネント設計: 責務分離、Root Views vs Content Views、ViewModifier
  • 非同期処理: .taskモディファイア、async/await、@MainActor
  • ナビゲーション: NavigationStack(iOS 16+)、型安全ルーティング
  • Layoutプロトコル: GeometryReaderの代替(iOS 16+)
  • Preview駆動開発: 複数状態プレビュー

references/patterns-list.md(1-x: リスト・データ表示系)

番号パターン
1-1無限スクロール(Pagination)
1-2プルトゥリフレッシュ
1-3フィルタリング・ソート
1-4スワイプアクション
1-5コンテキストメニュー

references/patterns-navigation.md(2-x: ナビゲーション・画面遷移系)

番号パターン
2-1タブビュー
2-2ナビゲーション(NavigationStack)
2-3モーダル表示(Sheet / FullScreenCover)
2-4アラート・ダイアログ

references/patterns-forms.md(3-x: フォーム・入力系)

番号パターン
3-1検索機能(デバウンス付き)
3-2フォーム入力(バリデーション付き)
3-3認証画面(ログイン / 新規登録 / OTP)

references/patterns-views.md(4-x: View構築・レイアウト系)

番号パターン
4-1AsyncImage(キャッシュ付き)
4-2空状態・エラー状態
4-3アニメーション
4-4View重なり(ZStack / overlay / background)
4-5ContentUnavailableView(iOS 17+)

references/anti-patterns.md

アンチパターンと解決策:

  • 状態管理、パフォーマンス、ビジネスロジック
  • 非同期処理、ナビゲーション、メモリ管理
  • ViewのIdentity: 不安定なID、ForEachでのインデックス使用
  • AnyView: 型消去によるパフォーマンス低下
  • コンポーネント設計: スペーシング管理、opacity vs if文

使用方法

新規実装時

  1. 該当するpatterns-*.mdで実装パターン確認
  2. best-practices.mdで関連ベストプラクティス確認
  3. anti-patterns.mdで避けるべきパターン確認

問題解決時

  1. anti-patterns.mdで該当パターン検索
  2. best-practices.mdで推奨実装確認

重要な原則

  1. 状態の最小化: 導出可能な状態は持たない
  2. 責務の分離: Root Views(ロジック)とContent Views(UI)を分離
  3. パフォーマンス: Lazy、Equatable、非同期処理の適切な使用
  4. ViewのIdentity: 安定したIDを使用、ForEachでインデックス禁止
  5. スペーシングは親が管理: 子コンポーネントはpaddingでスペースを作らない

関連スキル

  • swiftui-ssot: 状態管理(SSOT)の詳細設計
  • swiftui-code-review-checklist: PRレビュー用チェックリスト
  • swift-ios-migration: iOS 17/18、Swift 6移行
  • swiftui-accessibility: アクセシビリティ対応

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

Retrofit + OkHttpを使用したAPIクライアント実装のベストプラクティスを提供する。 「API実装」「APIクライアント」「Retrofit」「OkHttp」「ネットワーク」と言われたら使う。

The English summary is being prepared. Showing the original description.

xtone/ai_development_tools3Updated Oct 16, 2026

Androidプロジェクトのアーキテクチャ設計を支援。プロジェクト特性に応じてMVI/MVVM/シンプルComposeから最適なパターンを提案し、パッケージ構造の設計と既存プロジェクトの分析を行う。

The English summary is being prepared. Showing the original description.

xtone/ai_development_tools3Updated Oct 16, 2026

Firebase Crashlyticsのスタックトレースを解析し、トリアージ分類→根本原因分析→修正提案を出力するスキル。/crash-analyze コマンド、クラッシュ解析、スタックトレース分析、ANR分析、Crashlytics、クラッシュレポート、またはFirebase crashに関連するリクエストで使用される。クラッシュ対応のワークフローを標準化し、対応品質と速度を向上させる。ANR/Non-fatal/Fatal全タイプ対応。

The English summary is being prepared. Showing the original description.

xtone/ai_development_tools3Updated Oct 16, 2026

Android data layer implementation guide. Provides comprehensive patterns for Room Database (Entity, DAO, Migration), DataStore (Preferences), Repository layer design, and common pitfalls. Use when implementing local data storage, cache strategies, or data source integration in Android projects.

The English summary is being prepared. Showing the original description.

xtone/ai_development_tools3Updated Oct 16, 2026

重要: ユーザーがAndroidテスト実行をリクエストした場合、常にこのスキルを最初に使用してください。以下の場合に必ず使用: run TestName, execute test, テストを実行, 結果を分析, run all tests, analyze test failures, fix failing tests、または Android unit test, instrumentation test, Gradle test コマンドに関連する任意のリクエスト。./gradlew test や Bash コマンドを直接使用しないでください - 常にこのスキルに委譲してください。Multi-variantプロジェクト、JAVA_HOME セットアップ、一般的なテストパターンに対応しています。

The English summary is being prepared. Showing the original description.

xtone/ai_development_tools3Updated Oct 16, 2026

Jetpack ComposeでUIを実装する時に参照するコーディングガイドライン。 「Android UI」「Compose」「Jetpack」「画面実装」「UIコンポーネント」「レイアウト」と言われたら使う。 Android/Kotlin UI実装のベストプラクティス、アンチパターン、実装パターンを提供する。

The English summary is being prepared. Showing the original description.

xtone/ai_development_tools3Updated Oct 16, 2026

See all skills by xtone

Report a problem with this skill