{"id":24738,"plugin_id":"plugins~Plugin_f1b845ac33888191ac156169c58733c2","kind":"skill","collection_source":null,"comparison_source":null,"observed_at":"2026-09-30T23:18:36.360Z","digest":"8bebc480c0486c8226e888c69fc626b571df4395b093512d102e3240e0ce6d44","against":null,"payload":{"description":"Audit SwiftUI runtime performance from code first. Use when diagnosing slow rendering, janky scrolling, expensive updates, or profiling needs.","included_files":[{"relative_path":"agents/openai.yaml","size_in_bytes":242},{"relative_path":"references/code-smells.md","size_in_bytes":3753},{"relative_path":"references/demystify-swiftui-performance-wwdc23.md","size_in_bytes":1813},{"relative_path":"references/optimizing-swiftui-performance-instruments.md","size_in_bytes":1837},{"relative_path":"references/profiling-intake.md","size_in_bytes":1904},{"relative_path":"references/report-template.md","size_in_bytes":1201},{"relative_path":"references/understanding-hangs-in-your-app.md","size_in_bytes":1267},{"relative_path":"references/understanding-improving-swiftui-performance.md","size_in_bytes":2262}],"name":"swiftui-performance-audit","skill_md_contents":"---\nname: swiftui-performance-audit\ndescription: Audit SwiftUI runtime performance from code first. Use when diagnosing slow rendering, janky scrolling, expensive updates, or profiling needs.\n---\n\n# SwiftUI Performance Audit\n\n## Quick start\n\nUse this skill to diagnose SwiftUI performance issues from code first, then request profiling evidence when code review alone cannot explain the symptoms.\n\n## Workflow\n\n1. Classify the symptom: slow rendering, janky scrolling, high CPU, memory growth, hangs, or excessive view updates.\n2. If code is available, start with a code-first review using `references/code-smells.md`.\n3. If code is not available, ask for the smallest useful slice: target view, data flow, reproduction steps, and deployment target.\n4. If code review is inconclusive or runtime evidence is required, guide the user through profiling with `references/profiling-intake.md`.\n5. Summarize likely causes, evidence, remediation, and validation steps using `references/report-template.md`.\n\n## 1. Intake\n\nCollect:\n- Target view or feature code.\n- Symptoms and exact reproduction steps.\n- Data flow: `@State`, `@Binding`, environment dependencies, and observable models.\n- Whether the issue shows up on device or simulator, and whether it was observed in Debug or Release.\n\nAsk the user to classify the issue if possible:\n- CPU spike or battery drain\n- Janky scrolling or dropped frames\n- High memory or image pressure\n- Hangs or unresponsive interactions\n- Excessive or unexpectedly broad view updates\n\nFor the full profiling intake checklist, read `references/profiling-intake.md`.\n\n## 2. Code-First Review\n\nFocus on:\n- Invalidation storms from broad observation or environment reads.\n- Unstable identity in lists and `ForEach`.\n- Heavy derived work in `body` or view builders.\n- Layout thrash from complex hierarchies, `GeometryReader`, or preference chains.\n- Large image decode or resize work on the main thread.\n- Animation or transition work applied too broadly.\n\nUse `references/code-smells.md` for the detailed smell catalog and fix guidance.\n\nProvide:\n- Likely root causes with code references.\n- Suggested fixes and refactors.\n- If needed, a minimal repro or instrumentation suggestion.\n\n## 3. Guide the User to Profile\n\nIf code review does not explain the issue, ask for runtime evidence:\n- A trace export or screenshots of the SwiftUI timeline and Time Profiler call tree.\n- Device/OS/build configuration.\n- The exact interaction being profiled.\n- Before/after metrics if the user is comparing a change.\n\nUse `references/profiling-intake.md` for the exact checklist and collection steps.\n\n## 4. Analyze and Diagnose\n\n- Map the evidence to the most likely category: invalidation, identity churn, layout thrash, main-thread work, image cost, or animation cost.\n- Prioritize problems by impact, not by how easy they are to explain.\n- Distinguish code-level suspicion from trace-backed evidence.\n- Call out when profiling is still insufficient and what additional evidence would reduce uncertainty.\n\n## 5. Remediate\n\nApply targeted fixes:\n- Narrow state scope and reduce broad observation fan-out.\n- Stabilize identities for `ForEach` and lists.\n- 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.\n- Use `equatable()` only when equality is cheaper than recomputing the subtree and the inputs are truly value-semantic.\n- Downsample images before rendering.\n- Reduce layout complexity or use fixed sizing where possible.\n\nUse `references/code-smells.md` for examples, Observation-specific fan-out guidance, and remediation patterns.\n\n## 6. Verify\n\nAsk the user to re-run the same capture and compare with baseline metrics.\nSummarize the delta (CPU, frame drops, memory peak) if provided.\n\n## Outputs\n\nProvide:\n- A short metrics table (before/after if available).\n- Top issues (ordered by impact).\n- Proposed fixes with estimated effort.\n\nUse `references/report-template.md` when formatting the final audit.\n\n## References\n\n- Profiling intake and collection checklist: `references/profiling-intake.md`\n- Common code smells and remediation patterns: `references/code-smells.md`\n- Audit output template: `references/report-template.md`\n- Add Apple documentation and WWDC resources under `references/` as they are supplied by the user.\n- Optimizing SwiftUI performance with Instruments: `references/optimizing-swiftui-performance-instruments.md`\n- Understanding and improving SwiftUI performance: `references/understanding-improving-swiftui-performance.md`\n- Understanding hangs in your app: `references/understanding-hangs-in-your-app.md`\n- Demystify SwiftUI performance (WWDC23): `references/demystify-swiftui-performance-wwdc23.md`\n- In addition to the references above, use web search to consult current Apple Developer documentation when Instruments workflows or SwiftUI performance guidance may have changed.\n"},"changes":[],"summary":"First saved snapshot. No earlier version is available for comparison.","summary_kind":"deterministic","summary_metadata":{}}