本文へスキップ
Skillpedia
WebサイトとUI(フロントエンド)48k · #5913

swiftui-performance-audit

できること

このツールは、SwiftUIアプリを遅くしたり、反応を鈍くしたりする問題を見つけて修正するのに役立ちます。コードを分析し、必要に応じて原因を特定するためのパフォーマンステストのデータを求めます。

使う場面

  • ✓SwiftUIアプリで情報の表示が遅いとき。
  • ✓リストや表のスクロールがカクカクしたり、ぎこちなかったりするとき。
  • ✓明確な理由がないのに、アプリがメモリやCPUを使いすぎるとき。

スキルのリンク

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/swiftui-performance-audit/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/swiftui-performance-audit/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“SwiftUIアプリで長いリストをスクロールするとカクつきます。原因は何が考えられますか?”

毎週5つの新しいスキル。1分で読めます。

仕組み

まず、このツールは動作が遅くなる一般的なミスがコードにないかを調べます。それだけで不十分な場合は、デバイス上で特定のパフォーマンステストを実行し、より多くのデータを集める手順を案内します。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

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

  1. Classify the symptom: slow rendering, janky scrolling, high CPU, memory growth, hangs, or excessive view updates.
  2. If code is available, start with a code-first review using references/code-smells.md.
  3. If code is not available, ask for the smallest useful slice: target view, data flow, reproduction steps, and deployment target.
  4. If code review is inconclusive or runtime evidence is required, guide the user through profiling with references/profiling-intake.md.
  5. 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 body or 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 ForEach and lists.
  • Move heavy work out of body into derived state updated from inputs, model-layer precomputation, memoized helpers, or background preprocessing. Use @State only 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.

…

よくある質問

「レイアウトスラッシング」とは何ですか?

アプリが画面上の要素のサイズや位置の調整を繰り返し行ってしまう状態のことです。時間を浪費し、すべての動きが重くなります。

「無効化の嵐(invalidation storms)」とは何ですか?

十分な理由がないのに、画面の多くの部分が同時に更新されてしまう状況のことです。パフォーマンスの問題の原因になります。

使うにはプログラマーである必要がありますか?

熟練したエンジニアである必要はありません。このツールは、経験の浅いプログラマーでも問題を見つけられるように設計されていますが、基本的なコードの知識があると役立ちます。

詳細

作者による元の説明

Audit SwiftUI performance issues from code review and profiling evidence.

repo: sickn33/agentic-awesome-skills

人気

GitHubのスター
48k
ランキング
#5913
ライセンス
MIT
更新日
2026/10/15

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル