🛠️ SwiftuiPerformance監査
iPhoneアプリなどの画面を作る技術「SwiftUI」で開発
📺 まず動画で見る(YouTube)
▶ 【衝撃】最強のAIエージェント「Claude Code」の最新機能・使い方・プログラミングをAIで効率化する超実践術を解説! ↗
※ jpskill.com 編集部が参考用に選んだ動画です。動画の内容と Skill の挙動は厳密には一致しないことがあります。
📜 元の英語説明(参考)
Audit SwiftUI performance issues from code review and profiling evidence.
🇯🇵 日本人クリエイター向け解説
iPhoneアプリなどの画面を作る技術「SwiftUI」で開発
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o swiftui-performance-audit.zip https://jpskill.com/download/3560.zip && unzip -o swiftui-performance-audit.zip && rm swiftui-performance-audit.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/3560.zip -OutFile "$d\swiftui-performance-audit.zip"; Expand-Archive "$d\swiftui-performance-audit.zip" -DestinationPath $d -Force; ri "$d\swiftui-performance-audit.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
swiftui-performance-audit.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
swiftui-performance-auditフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-17
- 取得日時
- 2026-05-17
- 同梱ファイル
- 8
💬 こう話しかけるだけ — サンプルプロンプト
- › Swiftui Performance Audit を使って、最小構成のサンプルコードを示して
- › Swiftui Performance Audit の主な使い方と注意点を教えて
- › Swiftui Performance Audit を既存プロジェクトに組み込む方法を教えて
これをClaude Code に貼るだけで、このSkillが自動発動します。
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
SwiftUI パフォーマンス監査
クイックスタート
このスキルを使用して、まずコードから SwiftUI のパフォーマンス問題を診断し、コードレビューだけでは症状を説明できない場合にプロファイリングの証拠を要求してください。
使用するタイミング
- ユーザーが SwiftUI でレンダリングの遅延、スクロールのガタつき、レイアウトスラッシング、または高い CPU 使用率を報告した場合。
- コードファーストの監査に加え、プロファイリングの証拠が必要な場合に Instruments のガイダンスが必要な場合。
ワークフロー
- 症状を分類します: レンダリングの遅延、スクロールのガタつき、高い CPU 使用率、メモリ増加、ハング、または過剰なビューの更新。
- コードが利用可能な場合は、
references/code-smells.mdを使用してコードファーストのレビューから開始します。 - コードが利用できない場合は、最も有用な最小限の情報を要求します: ターゲットビュー、データフロー、再現手順、およびデプロイターゲット。
- コードレビューで結論が出ない場合、またはランタイムの証拠が必要な場合は、
references/profiling-intake.mdを使用してプロファイリングをユーザーに案内します。 references/report-template.mdを使用して、考えられる原因、証拠、修正、および検証手順を要約します。
1. 取り込み
収集する情報:
- ターゲットビューまたは機能のコード。
- 症状と正確な再現手順。
- データフロー:
@State、@Binding、環境依存性、およびオブザーバブルモデル。 - 問題がデバイスまたはシミュレーターのどちらで発生するか、また Debug または Release のどちらで観測されたか。
可能であれば、ユーザーに問題を分類するよう依頼します:
- CPU スパイクまたはバッテリー消費
- スクロールのガタつきまたはフレーム落ち
- 高いメモリ使用量または画像負荷
- ハングまたは応答しないインタラクション
- 過剰または予期せず広範囲なビューの更新
プロファイリング取り込みチェックリストの全容については、references/profiling-intake.md をお読みください。
2. コードファーストレビュー
重点を置く点:
- 広範囲な観測または環境読み取りによる無効化の嵐。
- リストと
ForEachにおける不安定なアイデンティティ。 bodyまたはビュービルダーにおける重い派生作業。- 複雑な階層、
GeometryReader、またはプリファレンスチェーンによるレイアウトスラッシング。 - メインスレッドでの大きな画像のデコードまたはリサイズ作業。
- 広範囲に適用されすぎたアニメーションまたはトランジション作業。
詳細なコードの臭いカタログと修正ガイダンスについては、references/code-smells.md を使用してください。
提供する情報:
- コード参照付きの考えられる根本原因。
- 提案される修正とリファクタリング。
- 必要に応じて、最小限の再現コードまたは計測の提案。
3. ユーザーをプロファイリングに誘導する
コードレビューで問題が説明できない場合は、ランタイムの証拠を要求します:
- トレースのエクスポート、またはSwiftUIタイムラインとTime Profilerコールツリーのスクリーンショット。
- デバイス/OS/ビルド構成。
- プロファイリングされている正確なインタラクション。
- ユーザーが変更を比較している場合は、変更前/変更後のメトリクス。
正確なチェックリストと収集手順については、references/profiling-intake.md を使用してください。
4. 分析と診断
- 証拠を最も可能性の高いカテゴリにマッピングします: 無効化、アイデンティティのチャーン、レイアウトスラッシング、メインスレッド作業、画像コスト、またはアニメーションコスト。
- 問題を、説明のしやすさではなく、影響度で優先順位付けします。
- コードレベルの疑念とトレースに裏付けられた証拠を区別します。
- プロファイリングがまだ不十分な場合と、不確実性を減らすためにどのような追加の証拠が必要かを指摘します。
5. 修正
ターゲットを絞った修正を適用します:
- 状態のスコープを狭め、広範囲な観測のファンアウトを減らします。
ForEachとリストのアイデンティティを安定させます。- 重い作業を
bodyから、入力から更新される派生状態、モデル層の事前計算、メモ化されたヘルパー、またはバックグラウンドでの前処理に移動します。@Stateはビューが所有する状態にのみ使用し、任意の計算のためのアドホックなキャッシュとしては使用しないでください。 equatable()は、サブツリーの再計算よりも等価性のチェックが安価であり、入力が真に値セマンティクスである場合にのみ使用します。- レンダリング前に画像をダウンサンプリングします。
- レイアウトの複雑さを軽減するか、可能な場合は固定サイズを使用します。
例、Observation固有のファンアウトガイダンス、および修正パターンについては、references/code-smells.md を使用してください。
6. 検証
ユーザーに同じキャプチャを再実行し、ベースラインメトリクスと比較するよう依頼します。 提供された場合は、デルタ(CPU、フレーム落ち、メモリピーク)を要約します。
出力
提供する情報:
- 短いメトリクステーブル(利用可能な場合は変更前/変更後)。
- 主要な問題(影響度順)。
- 推定される労力を含む提案された修正。
最終的な監査をフォーマットする際は、references/report-template.md を使用してください。
参考文献
- プロファイリングの取り込みと収集チェックリスト:
references/profiling-intake.md - 一般的なコードの臭いと修正パターン:
references/code-smells.md - 監査出力テンプレート:
references/report-template.md - ユーザーから提供された Apple のドキュメントと WWDC リソースを
references/に追加します。 - Instruments を使用した SwiftUI パフォーマンスの最適化:
references/optimizing-swiftui-performance-instruments.md - SwiftUI パフォーマンスの理解と改善:
references/understanding-improving-swiftui-performance.md - アプリのハングを理解する:
references/understanding-hangs-in-your-app.md - SwiftUI パフォーマンスの解明 (WWDC23):
references/demystify-swiftui-performance-wwdc23.md
制限事項
- このスキルは、タスクが上記で説明されているスコープと明確に一致する場合にのみ使用してください。
- 出力を、環境固有の検証、テスト、または専門家によるレビューの代替として扱わないでください。
- 必要な入力、権限、安全境界、または成功基準が不足している場合は、停止して説明を求めてください。
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
SwiftUI Performance Audit
Quick start
Use this skill to diagnose SwiftUI performance issues from code first, then request profiling evidence when code review alone cannot explain the symptoms.
When to Use
- When the user reports slow rendering, janky scrolling, layout thrash, or high CPU in SwiftUI.
- When you need a code-first audit plus Instruments guidance if profiling evidence is required.
Workflow
- Classify the symptom: slow rendering, janky scrolling, high CPU, memory growth, hangs, or excessive view updates.
- If code is available, start with a code-first review using
references/code-smells.md. - If code is not available, ask for the smallest useful slice: target view, data flow, reproduction steps, and deployment target.
- If code review is inconclusive or runtime evidence is required, guide the user through profiling with
references/profiling-intake.md. - Summarize likely causes, evidence, remediation, and validation steps using
references/report-template.md.
1. Intake
Collect:
- Target view or feature code.
- Symptoms and exact reproduction steps.
- Data flow:
@State,@Binding, environment dependencies, and observable models. - Whether the issue shows up on device or simulator, and whether it was observed in Debug or Release.
Ask the user to classify the issue if possible:
- CPU spike or battery drain
- Janky scrolling or dropped frames
- High memory or image pressure
- Hangs or unresponsive interactions
- Excessive or unexpectedly broad view updates
For the full profiling intake checklist, read references/profiling-intake.md.
2. Code-First Review
Focus on:
- Invalidation storms from broad observation or environment reads.
- Unstable identity in lists and
ForEach. - Heavy derived work in
bodyor view builders. - Layout thrash from complex hierarchies,
GeometryReader, or preference chains. - Large image decode or resize work on the main thread.
- Animation or transition work applied too broadly.
Use references/code-smells.md for the detailed smell catalog and fix guidance.
Provide:
- Likely root causes with code references.
- Suggested fixes and refactors.
- If needed, a minimal repro or instrumentation suggestion.
3. Guide the User to Profile
If code review does not explain the issue, ask for runtime evidence:
- A trace export or screenshots of the SwiftUI timeline and Time Profiler call tree.
- Device/OS/build configuration.
- The exact interaction being profiled.
- Before/after metrics if the user is comparing a change.
Use references/profiling-intake.md for the exact checklist and collection steps.
4. Analyze and Diagnose
- Map the evidence to the most likely category: invalidation, identity churn, layout thrash, main-thread work, image cost, or animation cost.
- Prioritize problems by impact, not by how easy they are to explain.
- Distinguish code-level suspicion from trace-backed evidence.
- Call out when profiling is still insufficient and what additional evidence would reduce uncertainty.
5. Remediate
Apply targeted fixes:
- Narrow state scope and reduce broad observation fan-out.
- Stabilize identities for
ForEachand lists. - Move heavy work out of
bodyinto derived state updated from inputs, model-layer precomputation, memoized helpers, or background preprocessing. Use@Stateonly for view-owned state, not as an ad hoc cache for arbitrary computation. - Use
equatable()only when equality is cheaper than recomputing the subtree and the inputs are truly value-semantic. - Downsample images before rendering.
- Reduce layout complexity or use fixed sizing where possible.
Use references/code-smells.md for examples, Observation-specific fan-out guidance, and remediation patterns.
6. Verify
Ask the user to re-run the same capture and compare with baseline metrics. Summarize the delta (CPU, frame drops, memory peak) if provided.
Outputs
Provide:
- A short metrics table (before/after if available).
- Top issues (ordered by impact).
- Proposed fixes with estimated effort.
Use references/report-template.md when formatting the final audit.
References
- Profiling intake and collection checklist:
references/profiling-intake.md - Common code smells and remediation patterns:
references/code-smells.md - Audit output template:
references/report-template.md - Add Apple documentation and WWDC resources under
references/as they are supplied by the user. - Optimizing SwiftUI performance with Instruments:
references/optimizing-swiftui-performance-instruments.md - Understanding and improving SwiftUI performance:
references/understanding-improving-swiftui-performance.md - Understanding hangs in your app:
references/understanding-hangs-in-your-app.md - Demystify SwiftUI performance (WWDC23):
references/demystify-swiftui-performance-wwdc23.md
Limitations
- Use this skill only when the task clearly matches the scope described above.
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
同梱ファイル
※ ZIPに含まれるファイル一覧。`SKILL.md` 本体に加え、参考資料・サンプル・スクリプトが入っている場合があります。
- 📄 SKILL.md (5,359 bytes)
- 📎 references/code-smells.md (3,753 bytes)
- 📎 references/demystify-swiftui-performance-wwdc23.md (1,813 bytes)
- 📎 references/optimizing-swiftui-performance-instruments.md (1,837 bytes)
- 📎 references/profiling-intake.md (1,904 bytes)
- 📎 references/report-template.md (1,201 bytes)
- 📎 references/understanding-hangs-in-your-app.md (1,267 bytes)
- 📎 references/understanding-improving-swiftui-performance.md (2,262 bytes)