@mmerterden/multi-agent-pipeline 20.37.0 → 20.38.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (469) hide show
  1. package/CHANGELOG.md +123 -49
  2. package/README.md +12 -10
  3. package/README.tr.md +12 -10
  4. package/docs/adr/0006-skills-core-external-split.md +5 -5
  5. package/docs/adr/0010-own-code-graph.md +6 -7
  6. package/docs/adr/0013-lsp-code-intelligence.md +6 -8
  7. package/docs/adr/0017-change-impact-from-the-graph.md +4 -5
  8. package/docs/adr/0018-cross-repo-links-not-a-global-graph.md +1 -1
  9. package/docs/adr/README.md +1 -1
  10. package/docs/ecosystem.md +53 -41
  11. package/docs/facts.json +15 -13
  12. package/docs/features.md +2 -2
  13. package/docs/recovery-guide.md +1 -1
  14. package/install/_dev-only-files.mjs +3 -0
  15. package/install/_platform-filter.mjs +1 -23
  16. package/install/catalog-history.json +1 -1
  17. package/install/claude.mjs +8 -1
  18. package/install/codex.mjs +0 -2
  19. package/install/copilot.mjs +0 -2
  20. package/install/templates/claude-hooks.json +47 -1
  21. package/manifest.json +455 -332
  22. package/package.json +5 -2
  23. package/pipeline/agents/security-auditor.md +58 -6
  24. package/pipeline/commands/multi-agent/build-optimize/SKILL.md +1 -2
  25. package/pipeline/commands/multi-agent/complaint-analysis/SKILL.md +1 -1
  26. package/pipeline/commands/multi-agent/design-check/SKILL.md +1 -1
  27. package/pipeline/commands/multi-agent/graph/SKILL.md +12 -3
  28. package/pipeline/commands/multi-agent/manual-test/SKILL.md +12 -7
  29. package/pipeline/commands/multi-agent/research/SKILL.md +2 -2
  30. package/pipeline/commands/multi-agent/search/SKILL.md +10 -1
  31. package/pipeline/commands/multi-agent/security-review/SKILL.md +4 -0
  32. package/pipeline/commands/multi-agent/setup/SKILL.md +1 -0
  33. package/pipeline/commands/multi-agent/stack/SKILL.md +8 -0
  34. package/pipeline/commands/multi-agent/store-ready/SKILL.md +1 -1
  35. package/pipeline/commands/sim-test.md +34 -1
  36. package/pipeline/lib/context-budget.mjs +103 -0
  37. package/pipeline/lib/credential-inventory.sh +2 -3
  38. package/pipeline/lib/identifier-scan.mjs +145 -0
  39. package/pipeline/lib/outbound-gate.mjs +28 -1
  40. package/pipeline/lib/unattended-profile-check.mjs +13 -4
  41. package/pipeline/multi-agent-refs/analysis/locked.md +1 -1
  42. package/pipeline/multi-agent-refs/analysis/redesign.md +17 -3
  43. package/pipeline/multi-agent-refs/analysis-template-corporate.md +8 -4
  44. package/pipeline/multi-agent-refs/analysis-template.md +7 -5
  45. package/pipeline/multi-agent-refs/audit-guide.md +20 -0
  46. package/pipeline/multi-agent-refs/complaint-analysis/phases.md +1 -0
  47. package/pipeline/multi-agent-refs/features/autopilot-circuit-breaker.md +1 -1
  48. package/pipeline/multi-agent-refs/features/code-graph.md +25 -0
  49. package/pipeline/multi-agent-refs/features/commit-multi-repo.md +63 -0
  50. package/pipeline/multi-agent-refs/features/design-conformance.md +20 -4
  51. package/pipeline/multi-agent-refs/features/dev-multi-repo.md +51 -0
  52. package/pipeline/multi-agent-refs/features/free-models.md +10 -3
  53. package/pipeline/multi-agent-refs/features/research.md +4 -3
  54. package/pipeline/multi-agent-refs/features/security-audit.md +25 -3
  55. package/pipeline/multi-agent-refs/features/test-gap.md +40 -0
  56. package/pipeline/multi-agent-refs/features/unattended-security.md +20 -0
  57. package/pipeline/multi-agent-refs/features/worktree-finalize.md +1 -1
  58. package/pipeline/multi-agent-refs/help/en.md +15 -9
  59. package/pipeline/multi-agent-refs/help/tr.md +15 -9
  60. package/pipeline/multi-agent-refs/knowledge.md +17 -0
  61. package/pipeline/multi-agent-refs/orchestrator/phase-3-user-test.md +12 -9
  62. package/pipeline/multi-agent-refs/outside-the-pipeline.md +9 -0
  63. package/pipeline/multi-agent-refs/phases/log-format.md +5 -0
  64. package/pipeline/multi-agent-refs/phases/operations.md +3 -5
  65. package/pipeline/multi-agent-refs/phases/phase-1-plan.md +4 -4
  66. package/pipeline/multi-agent-refs/phases/phase-2-dev.md +8 -47
  67. package/pipeline/multi-agent-refs/phases/phase-3-review.md +21 -65
  68. package/pipeline/multi-agent-refs/phases/phase-4-commit.md +9 -59
  69. package/pipeline/multi-agent-refs/phases/phase-5-report.md +0 -31
  70. package/pipeline/multi-agent-refs/picker-contract.md +1 -1
  71. package/pipeline/multi-agent-refs/research/engine.md +2 -1
  72. package/pipeline/multi-agent-refs/rules.md +1 -1
  73. package/pipeline/multi-agent-refs/setup/free-models.md +10 -0
  74. package/pipeline/multi-agent-refs/store-ready/gate-3-policy.md +15 -0
  75. package/pipeline/multi-agent-refs/web-guide.md +2 -1
  76. package/pipeline/office/index.html +8 -9
  77. package/pipeline/office/toolkit.json +1 -1
  78. package/pipeline/rules/figma-pipeline.md +6 -3
  79. package/pipeline/rules/outside-the-pipeline.md +1 -1
  80. package/pipeline/schemas/learnings-ledger.schema.json +7 -2
  81. package/pipeline/schemas/prefs.schema.json +17 -4
  82. package/pipeline/schemas/reviewer-output.schema.json +113 -5
  83. package/pipeline/schemas/secret-patterns.json +49 -0
  84. package/pipeline/schemas/security-finding.schema.json +49 -5
  85. package/pipeline/scripts/_code-graph.mjs +3 -3
  86. package/pipeline/scripts/_graph-analysis.mjs +51 -0
  87. package/pipeline/scripts/_memory-policy.mjs +37 -7
  88. package/pipeline/scripts/_secret-scan.mjs +1 -1
  89. package/pipeline/scripts/_skill-practices.mjs +178 -0
  90. package/pipeline/scripts/_stack-routing.mjs +1 -0
  91. package/pipeline/scripts/autopilot-runner.mjs +8 -3
  92. package/pipeline/scripts/build-stack-plugins.mjs +8 -44
  93. package/pipeline/scripts/capture-resume.sh +19 -0
  94. package/pipeline/scripts/checkpoint-fold.sh +59 -0
  95. package/pipeline/scripts/file-context.mjs +306 -70
  96. package/pipeline/scripts/gate-ledger.mjs +1 -1
  97. package/pipeline/scripts/gen-skills-index.mjs +1 -1
  98. package/pipeline/scripts/graph-hint.mjs +197 -0
  99. package/pipeline/scripts/graph-hint.sh +20 -0
  100. package/pipeline/scripts/graph-query.mjs +306 -11
  101. package/pipeline/scripts/graph-report.mjs +29 -1
  102. package/pipeline/scripts/learnings-ledger.mjs +71 -15
  103. package/pipeline/scripts/note-agent-event.mjs +160 -0
  104. package/pipeline/scripts/note-agent-event.sh +19 -0
  105. package/pipeline/scripts/office-control.mjs +41 -15
  106. package/pipeline/scripts/offload-ref.sh +1 -1
  107. package/pipeline/scripts/parity-score.mjs +139 -0
  108. package/pipeline/scripts/pre-commit-check.sh +25 -4
  109. package/pipeline/scripts/pre-push-check.sh +3 -0
  110. package/pipeline/scripts/repo-recommend.mjs +321 -0
  111. package/pipeline/scripts/rework-rulings.mjs +5 -3
  112. package/pipeline/scripts/scan-agent-config.sh +1 -2
  113. package/pipeline/scripts/scope-check-gate.mjs +15 -2
  114. package/pipeline/scripts/security-evidence-gate.mjs +282 -0
  115. package/pipeline/scripts/unattended_policy.py +3 -2
  116. package/pipeline/scripts/user-test-handoff.sh +203 -0
  117. package/pipeline/scripts/validate-analysis-doc.mjs +17 -1
  118. package/pipeline/scripts/validate-planning.mjs +5 -3
  119. package/pipeline/scripts/validate-triage.mjs +2 -1
  120. package/pipeline/scripts/write-state.mjs +13 -4
  121. package/pipeline/skills/.skill-manifest.json +73 -69
  122. package/pipeline/skills/shared/README.md +41 -40
  123. package/pipeline/skills/shared/core/apple-archive-compliance/SKILL.md +6 -6
  124. package/pipeline/skills/shared/core/apple-archive-compliance/references/examples.md +1 -1
  125. package/pipeline/skills/shared/core/apple-archive-compliance/references/version-history.md +1 -1
  126. package/pipeline/skills/shared/core/google-play-compliance/SKILL.md +1 -1
  127. package/pipeline/skills/shared/core/google-play-compliance/references/notes.md +1 -1
  128. package/pipeline/skills/shared/core/multi-agent/SKILL.md +1 -1
  129. package/pipeline/skills/shared/core/multi-agent-build-optimize/SKILL.md +0 -1
  130. package/pipeline/skills/shared/core/multi-agent-complaint-analysis/SKILL.md +1 -1
  131. package/pipeline/skills/shared/core/multi-agent-design-check/SKILL.md +5 -5
  132. package/pipeline/skills/shared/core/multi-agent-graph/SKILL.md +10 -0
  133. package/pipeline/skills/shared/core/multi-agent-manual-test/SKILL.md +12 -7
  134. package/pipeline/skills/shared/core/multi-agent-research/SKILL.md +2 -2
  135. package/pipeline/skills/shared/core/multi-agent-search/SKILL.md +9 -0
  136. package/pipeline/skills/shared/core/multi-agent-security-review/SKILL.md +3 -2
  137. package/pipeline/skills/shared/core/multi-agent-setup/SKILL.md +1 -0
  138. package/pipeline/skills/shared/core/multi-agent-stack/SKILL.md +8 -0
  139. package/pipeline/skills/shared/core/multi-agent-store-ready/SKILL.md +4 -3
  140. package/pipeline/skills/shared/core/multi-agent-test/SKILL.md +1 -1
  141. package/pipeline/skills/shared/core/multi-agent-test-accessibility/SKILL.md +1 -1
  142. package/pipeline/skills/shared/core/multi-agent-test-dark-mode/SKILL.md +1 -1
  143. package/pipeline/skills/shared/core/multi-agent-test-dynamic-type/SKILL.md +1 -1
  144. package/pipeline/skills/shared/core/multi-agent-test-gen/SKILL.md +1 -1
  145. package/pipeline/skills/shared/core/multi-agent-test-screenshots/SKILL.md +1 -1
  146. package/pipeline/skills/shared/core/multi-agent-testflight-validation/SKILL.md +2 -2
  147. package/pipeline/skills/shared/external/accessibility-compliance-accessibility-audit/evals/evals.json +44 -0
  148. package/pipeline/skills/shared/external/agent-introspection-debugging/evals/evals.json +42 -0
  149. package/pipeline/skills/shared/external/android-architecture/SKILL.md +1 -1
  150. package/pipeline/skills/shared/external/android-architecture/evals/evals.json +45 -0
  151. package/pipeline/skills/shared/external/android-build-quality-gates/evals/evals.json +45 -0
  152. package/pipeline/skills/shared/external/android-datastore/evals/evals.json +45 -0
  153. package/pipeline/skills/shared/external/android-design-tokens-codegen/evals/evals.json +43 -0
  154. package/pipeline/skills/shared/external/android-jetpack-compose-expert/evals/evals.json +43 -0
  155. package/pipeline/skills/shared/external/android-mvi-viewmodel/evals/evals.json +45 -0
  156. package/pipeline/skills/shared/external/android-performance/SKILL.md +1 -1
  157. package/pipeline/skills/shared/external/android-performance/evals/evals.json +44 -0
  158. package/pipeline/skills/shared/external/android-security/SKILL.md +1 -1
  159. package/pipeline/skills/shared/external/android-security/evals/evals.json +45 -0
  160. package/pipeline/skills/shared/external/api-patterns/evals/evals.json +43 -0
  161. package/pipeline/skills/shared/external/api-security-best-practices/evals/evals.json +44 -0
  162. package/pipeline/skills/shared/external/app-store-changelog/SKILL.md +65 -49
  163. package/pipeline/skills/shared/external/app-store-changelog/evals/evals.json +40 -0
  164. package/pipeline/skills/shared/external/app-store-changelog/references/release-notes-guidelines.md +64 -34
  165. package/pipeline/skills/shared/external/app-store-changelog/scripts/collect_release_changes.sh +21 -23
  166. package/pipeline/skills/shared/external/app-store-optimization/SKILL.md +4 -1
  167. package/pipeline/skills/shared/external/app-store-review/SKILL.md +6 -0
  168. package/pipeline/skills/shared/external/architecture/evals/evals.json +42 -0
  169. package/pipeline/skills/shared/external/backlog/evals/evals.json +42 -0
  170. package/pipeline/skills/shared/external/ci-cd-pipelines/evals/evals.json +44 -0
  171. package/pipeline/skills/shared/external/clean-code/evals/evals.json +45 -0
  172. package/pipeline/skills/shared/external/compose-components/SKILL.md +1 -1
  173. package/pipeline/skills/shared/external/compose-components/evals/evals.json +44 -0
  174. package/pipeline/skills/shared/external/compose-navigation/SKILL.md +1 -1
  175. package/pipeline/skills/shared/external/compose-navigation/evals/evals.json +43 -0
  176. package/pipeline/skills/shared/external/compose-testing/SKILL.md +1 -1
  177. package/pipeline/skills/shared/external/compose-testing/evals/evals.json +44 -0
  178. package/pipeline/skills/shared/external/context-compression/evals/evals.json +43 -0
  179. package/pipeline/skills/shared/external/core-data/SKILL.md +1 -1
  180. package/pipeline/skills/shared/external/council/evals/evals.json +41 -0
  181. package/pipeline/skills/shared/external/css-modern/evals/evals.json +44 -0
  182. package/pipeline/skills/shared/external/css-modern/references/code-examples.md +5 -0
  183. package/pipeline/skills/shared/external/database-patterns/evals/evals.json +46 -0
  184. package/pipeline/skills/shared/external/database-patterns/references/orm-examples.md +5 -0
  185. package/pipeline/skills/shared/external/debugging-strategies/evals/evals.json +43 -0
  186. package/pipeline/skills/shared/external/docker-expert/evals/evals.json +45 -0
  187. package/pipeline/skills/shared/external/e2e-testing/SKILL.md +21 -21
  188. package/pipeline/skills/shared/external/e2e-testing/evals/evals.json +44 -0
  189. package/pipeline/skills/shared/external/e2e-testing/references/document-fixtures.md +5 -5
  190. package/pipeline/skills/shared/external/evidence-github/evals/evals.json +41 -0
  191. package/pipeline/skills/shared/external/evidence-registry/SKILL.md +1 -1
  192. package/pipeline/skills/shared/external/evidence-registry/evals/evals.json +41 -0
  193. package/pipeline/skills/shared/external/fastapi-pro/evals/evals.json +57 -0
  194. package/pipeline/skills/shared/external/firebase/SKILL.md +132 -54
  195. package/pipeline/skills/shared/external/firebase/evals/evals.json +42 -0
  196. package/pipeline/skills/shared/external/firebase/references/functions-and-products.md +51 -0
  197. package/pipeline/skills/shared/external/firebase/references/security-rules.md +59 -0
  198. package/pipeline/skills/shared/external/fix-review-verdicts/evals/evals.json +57 -0
  199. package/pipeline/skills/shared/external/free-llm-apis/SKILL.md +70 -0
  200. package/pipeline/skills/shared/external/free-llm-apis/evals/evals.json +44 -0
  201. package/pipeline/skills/shared/external/free-llm-apis/references/providers.md +33 -0
  202. package/pipeline/skills/shared/external/github-actions-templates/evals/evals.json +44 -0
  203. package/pipeline/skills/shared/external/gradle-kotlin-dsl/SKILL.md +1 -1
  204. package/pipeline/skills/shared/external/gradle-kotlin-dsl/evals/evals.json +58 -0
  205. package/pipeline/skills/shared/external/handle-request/SKILL.md +2 -2
  206. package/pipeline/skills/shared/external/handle-request/evals/evals.json +44 -0
  207. package/pipeline/skills/shared/external/hig-app-icons/SKILL.md +2 -2
  208. package/pipeline/skills/shared/external/hig-app-icons/references/icon-workflow.md +1 -1
  209. package/pipeline/skills/shared/external/hig-components-content/evals/evals.json +43 -0
  210. package/pipeline/skills/shared/external/hig-components-status/evals/evals.json +43 -0
  211. package/pipeline/skills/shared/external/hig-components-system/evals/evals.json +43 -0
  212. package/pipeline/skills/shared/external/hig-inputs/evals/evals.json +44 -0
  213. package/pipeline/skills/shared/external/hig-patterns/evals/evals.json +46 -0
  214. package/pipeline/skills/shared/external/hig-platforms/evals/evals.json +45 -0
  215. package/pipeline/skills/shared/external/hig-technologies/evals/evals.json +44 -0
  216. package/pipeline/skills/shared/external/html-semantic/evals/evals.json +46 -0
  217. package/pipeline/skills/shared/external/humanizer/evals/evals.json +46 -0
  218. package/pipeline/skills/shared/external/ios-coding-standard/evals/evals.json +44 -0
  219. package/pipeline/skills/shared/external/ios-debugger-agent/SKILL.md +91 -52
  220. package/pipeline/skills/shared/external/ios-debugger-agent/evals/evals.json +41 -0
  221. package/pipeline/skills/shared/external/ios-design-review/SKILL.md +12 -12
  222. package/pipeline/skills/shared/external/ios-design-review/references/appearance-matrix.md +16 -16
  223. package/pipeline/skills/shared/external/ios-design-review/references/checklist.md +1 -1
  224. package/pipeline/skills/shared/external/ios-iphone-duo/SKILL.md +0 -1
  225. package/pipeline/skills/shared/external/ios-module-structure/evals/evals.json +42 -0
  226. package/pipeline/skills/shared/external/ios-security/SKILL.md +1 -1
  227. package/pipeline/skills/shared/external/ios-security/evals/evals.json +45 -0
  228. package/pipeline/skills/shared/external/kotlin-coroutines-expert/evals/evals.json +43 -0
  229. package/pipeline/skills/shared/external/localization-reuse-map/evals/evals.json +45 -0
  230. package/pipeline/skills/shared/external/macos-menubar-tuist-app/SKILL.md +170 -74
  231. package/pipeline/skills/shared/external/macos-menubar-tuist-app/evals/evals.json +52 -0
  232. package/pipeline/skills/shared/external/macos-spm-app-packaging/SKILL.md +119 -77
  233. package/pipeline/skills/shared/external/macos-spm-app-packaging/assets/templates/bootstrap/Package.swift +5 -5
  234. package/pipeline/skills/shared/external/macos-spm-app-packaging/assets/templates/bootstrap/Sources/MyApp/MyApp.swift +24 -0
  235. package/pipeline/skills/shared/external/macos-spm-app-packaging/assets/templates/bootstrap/version.env +2 -0
  236. package/pipeline/skills/shared/external/macos-spm-app-packaging/assets/templates/build_icon.sh +46 -39
  237. package/pipeline/skills/shared/external/macos-spm-app-packaging/assets/templates/compile_and_run.sh +70 -49
  238. package/pipeline/skills/shared/external/macos-spm-app-packaging/assets/templates/launch.sh +24 -17
  239. package/pipeline/skills/shared/external/macos-spm-app-packaging/assets/templates/make_appcast.sh +74 -59
  240. package/pipeline/skills/shared/external/macos-spm-app-packaging/assets/templates/package_app.sh +201 -170
  241. package/pipeline/skills/shared/external/macos-spm-app-packaging/assets/templates/setup_dev_signing.sh +50 -42
  242. package/pipeline/skills/shared/external/macos-spm-app-packaging/assets/templates/sign-and-notarize.sh +65 -35
  243. package/pipeline/skills/shared/external/macos-spm-app-packaging/assets/templates/version.env +2 -0
  244. package/pipeline/skills/shared/external/macos-spm-app-packaging/evals/evals.json +45 -0
  245. package/pipeline/skills/shared/external/macos-spm-app-packaging/references/packaging.md +49 -17
  246. package/pipeline/skills/shared/external/macos-spm-app-packaging/references/release.md +48 -23
  247. package/pipeline/skills/shared/external/macos-spm-app-packaging/references/scaffold.md +74 -44
  248. package/pipeline/skills/shared/external/monorepo-architect/evals/evals.json +45 -0
  249. package/pipeline/skills/shared/external/nextjs-app-router/SKILL.md +14 -3
  250. package/pipeline/skills/shared/external/nextjs-app-router/evals/evals.json +43 -0
  251. package/pipeline/skills/shared/external/nextjs-app-router/references/app-router-examples.md +3 -0
  252. package/pipeline/skills/shared/external/nodejs-backend-patterns/evals/evals.json +45 -0
  253. package/pipeline/skills/shared/external/observability-engineer/evals/evals.json +45 -0
  254. package/pipeline/skills/shared/external/passkit-wallet/SKILL.md +10 -0
  255. package/pipeline/skills/shared/external/photos-camera-media/evals/evals.json +45 -0
  256. package/pipeline/skills/shared/external/play-store-review/evals/evals.json +45 -0
  257. package/pipeline/skills/shared/external/python-patterns/evals/evals.json +46 -0
  258. package/pipeline/skills/shared/external/react-best-practices/evals/evals.json +43 -0
  259. package/pipeline/skills/shared/external/rest-api-design/evals/evals.json +46 -0
  260. package/pipeline/skills/shared/external/retrofit-networking/SKILL.md +1 -1
  261. package/pipeline/skills/shared/external/retrofit-networking/evals/evals.json +43 -0
  262. package/pipeline/skills/shared/external/room-database/SKILL.md +1 -1
  263. package/pipeline/skills/shared/external/room-database/evals/evals.json +43 -0
  264. package/pipeline/skills/shared/external/scenario-gap-analysis/SKILL.md +1 -1
  265. package/pipeline/skills/shared/external/scenario-gap-analysis/evals/evals.json +43 -0
  266. package/pipeline/skills/shared/external/search-first/evals/evals.json +42 -0
  267. package/pipeline/skills/shared/external/security-review/SKILL.md +14 -3
  268. package/pipeline/skills/shared/external/security-review/evals/evals.json +48 -0
  269. package/pipeline/skills/shared/external/security-review/references/agentic-systems.md +93 -0
  270. package/pipeline/skills/shared/external/security-review/references/firebase-rules.md +100 -0
  271. package/pipeline/skills/shared/external/security-review/references/graphql.md +82 -0
  272. package/pipeline/skills/shared/external/security-review/references/llm-prompt-injection.md +93 -0
  273. package/pipeline/skills/shared/external/security-review/references/oauth-oidc.md +100 -0
  274. package/pipeline/skills/shared/external/security-review/references/owasp-mobile-top10-2024.md +1 -1
  275. package/pipeline/skills/shared/external/security-review/references/owasp-web-api-top10-2021.md +1 -1
  276. package/pipeline/skills/shared/external/security-review/references/supabase.md +73 -0
  277. package/pipeline/skills/shared/external/signal-community/SKILL.md +29 -10
  278. package/pipeline/skills/shared/external/signal-community/evals/evals.json +42 -0
  279. package/pipeline/skills/shared/external/skill-creator/evals/evals.json +43 -0
  280. package/pipeline/skills/shared/external/skill-creator/template.md +1 -3
  281. package/pipeline/skills/shared/external/spm-build-analysis/SKILL.md +80 -61
  282. package/pipeline/skills/shared/external/spm-build-analysis/evals/evals.json +56 -0
  283. package/pipeline/skills/shared/external/spm-build-analysis/references/build-optimization-sources.md +83 -133
  284. package/pipeline/skills/shared/external/spm-build-analysis/references/recommendation-format.md +41 -40
  285. package/pipeline/skills/shared/external/spm-build-analysis/references/spm-analysis-checks.md +89 -87
  286. package/pipeline/skills/shared/external/spm-build-analysis/scripts/check_spm_pins.py +90 -85
  287. package/pipeline/skills/shared/external/swift-concurrency-expert/SKILL.md +78 -69
  288. package/pipeline/skills/shared/external/swift-concurrency-expert/evals/evals.json +54 -0
  289. package/pipeline/skills/shared/external/swift-concurrency-expert/references/approachable-concurrency.md +52 -48
  290. package/pipeline/skills/shared/external/swift-concurrency-expert/references/swift-6-2-concurrency.md +118 -184
  291. package/pipeline/skills/shared/external/swift-concurrency-expert/references/swiftui-concurrency-tour-wwdc.md +68 -22
  292. package/pipeline/skills/shared/external/swift-concurrency-pro/SKILL.md +117 -94
  293. package/pipeline/skills/shared/external/swift-concurrency-pro/evals/evals.json +57 -0
  294. package/pipeline/skills/shared/external/swift-concurrency-pro/references/actors.md +102 -97
  295. package/pipeline/skills/shared/external/swift-concurrency-pro/references/async-streams.md +36 -37
  296. package/pipeline/skills/shared/external/swift-concurrency-pro/references/bridging.md +82 -34
  297. package/pipeline/skills/shared/external/swift-concurrency-pro/references/bug-patterns.md +90 -52
  298. package/pipeline/skills/shared/external/swift-concurrency-pro/references/cancellation.md +55 -55
  299. package/pipeline/skills/shared/external/swift-concurrency-pro/references/diagnostics.md +66 -43
  300. package/pipeline/skills/shared/external/swift-concurrency-pro/references/hotspots.md +39 -23
  301. package/pipeline/skills/shared/external/swift-concurrency-pro/references/interop.md +66 -68
  302. package/pipeline/skills/shared/external/swift-concurrency-pro/references/new-features.md +152 -131
  303. package/pipeline/skills/shared/external/swift-concurrency-pro/references/structured.md +60 -57
  304. package/pipeline/skills/shared/external/swift-concurrency-pro/references/testing.md +131 -118
  305. package/pipeline/skills/shared/external/swift-concurrency-pro/references/unstructured.md +37 -29
  306. package/pipeline/skills/shared/external/swift-formatstyle/evals/evals.json +43 -0
  307. package/pipeline/skills/shared/external/swift-testing-pro/SKILL.md +77 -58
  308. package/pipeline/skills/shared/external/swift-testing-pro/evals/evals.json +59 -0
  309. package/pipeline/skills/shared/external/swift-testing-pro/references/async-tests.md +139 -144
  310. package/pipeline/skills/shared/external/swift-testing-pro/references/core-rules.md +90 -28
  311. package/pipeline/skills/shared/external/swift-testing-pro/references/migrating-from-xctest.md +38 -21
  312. package/pipeline/skills/shared/external/swift-testing-pro/references/new-features.md +139 -156
  313. package/pipeline/skills/shared/external/swift-testing-pro/references/writing-better-tests.md +173 -147
  314. package/pipeline/skills/shared/external/swiftdata-pro/SKILL.md +75 -59
  315. package/pipeline/skills/shared/external/swiftdata-pro/evals/evals.json +50 -0
  316. package/pipeline/skills/shared/external/swiftdata-pro/references/cloudkit.md +34 -7
  317. package/pipeline/skills/shared/external/swiftdata-pro/references/indexing.md +20 -14
  318. package/pipeline/skills/shared/external/swiftdata-pro/references/inheritance.md +127 -0
  319. package/pipeline/skills/shared/external/swiftdata-pro/references/model-rules.md +141 -0
  320. package/pipeline/skills/shared/external/swiftdata-pro/references/predicates.md +37 -44
  321. package/pipeline/skills/shared/external/swiftlint/evals/evals.json +44 -0
  322. package/pipeline/skills/shared/external/swiftui-expert-skill/SKILL.md +89 -88
  323. package/pipeline/skills/shared/external/swiftui-expert-skill/evals/evals.json +55 -0
  324. package/pipeline/skills/shared/external/swiftui-expert-skill/references/accessibility-patterns.md +104 -122
  325. package/pipeline/skills/shared/external/swiftui-expert-skill/references/animation-advanced.md +73 -93
  326. package/pipeline/skills/shared/external/swiftui-expert-skill/references/animation-basics.md +144 -169
  327. package/pipeline/skills/shared/external/swiftui-expert-skill/references/animation-transitions.md +122 -133
  328. package/pipeline/skills/shared/external/swiftui-expert-skill/references/charts-accessibility.md +141 -99
  329. package/pipeline/skills/shared/external/swiftui-expert-skill/references/charts.md +273 -333
  330. package/pipeline/skills/shared/external/swiftui-expert-skill/references/image-optimization.md +105 -128
  331. package/pipeline/skills/shared/external/swiftui-expert-skill/references/latest-apis.md +199 -312
  332. package/pipeline/skills/shared/external/swiftui-expert-skill/references/layout-best-practices.md +129 -169
  333. package/pipeline/skills/shared/external/swiftui-expert-skill/references/liquid-glass.md +17 -30
  334. package/pipeline/skills/shared/external/swiftui-expert-skill/references/list-patterns.md +198 -258
  335. package/pipeline/skills/shared/external/swiftui-expert-skill/references/macos-scenes.md +145 -218
  336. package/pipeline/skills/shared/external/swiftui-expert-skill/references/macos-views.md +150 -249
  337. package/pipeline/skills/shared/external/swiftui-expert-skill/references/macos-window-styling.md +109 -208
  338. package/pipeline/skills/shared/external/swiftui-expert-skill/references/performance-patterns.md +225 -271
  339. package/pipeline/skills/shared/external/swiftui-expert-skill/references/scroll-patterns.md +117 -210
  340. package/pipeline/skills/shared/external/swiftui-expert-skill/references/sheet-navigation-patterns.md +171 -237
  341. package/pipeline/skills/shared/external/swiftui-expert-skill/references/state-management.md +196 -260
  342. package/pipeline/skills/shared/external/swiftui-expert-skill/references/view-structure.md +167 -230
  343. package/pipeline/skills/shared/external/swiftui-gestures/evals/evals.json +43 -0
  344. package/pipeline/skills/shared/external/swiftui-layout-components/evals/evals.json +43 -0
  345. package/pipeline/skills/shared/external/swiftui-navigation/evals/evals.json +44 -0
  346. package/pipeline/skills/shared/external/swiftui-navigation/references/navigationstack.md +1 -2
  347. package/pipeline/skills/shared/external/swiftui-patterns/evals/evals.json +43 -0
  348. package/pipeline/skills/shared/external/swiftui-performance/evals/evals.json +44 -0
  349. package/pipeline/skills/shared/external/swiftui-performance-audit/SKILL.md +71 -79
  350. package/pipeline/skills/shared/external/swiftui-performance-audit/evals/evals.json +55 -0
  351. package/pipeline/skills/shared/external/swiftui-performance-audit/references/audit-layout.md +50 -0
  352. package/pipeline/skills/shared/external/swiftui-performance-audit/references/capture-checklist.md +51 -0
  353. package/pipeline/skills/shared/external/swiftui-performance-audit/references/hangs.md +34 -0
  354. package/pipeline/skills/shared/external/swiftui-performance-audit/references/instruments-guide.md +68 -0
  355. package/pipeline/skills/shared/external/swiftui-performance-audit/references/smell-catalog.md +191 -0
  356. package/pipeline/skills/shared/external/swiftui-performance-audit/references/update-model.md +69 -0
  357. package/pipeline/skills/shared/external/swiftui-pro/SKILL.md +65 -63
  358. package/pipeline/skills/shared/external/swiftui-pro/evals/evals.json +45 -0
  359. package/pipeline/skills/shared/external/swiftui-pro/references/accessibility.md +40 -13
  360. package/pipeline/skills/shared/external/swiftui-pro/references/api.md +74 -29
  361. package/pipeline/skills/shared/external/swiftui-pro/references/data.md +44 -24
  362. package/pipeline/skills/shared/external/swiftui-pro/references/design.md +45 -31
  363. package/pipeline/skills/shared/external/swiftui-pro/references/hygiene.md +17 -8
  364. package/pipeline/skills/shared/external/swiftui-pro/references/navigation.md +19 -9
  365. package/pipeline/skills/shared/external/swiftui-pro/references/performance.md +50 -34
  366. package/pipeline/skills/shared/external/swiftui-pro/references/swift.md +73 -45
  367. package/pipeline/skills/shared/external/swiftui-pro/references/views.md +48 -23
  368. package/pipeline/skills/shared/external/swiftui-ui-patterns/SKILL.md +89 -83
  369. package/pipeline/skills/shared/external/swiftui-ui-patterns/evals/evals.json +44 -0
  370. package/pipeline/skills/shared/external/swiftui-ui-patterns/references/app-wiring.md +119 -114
  371. package/pipeline/skills/shared/external/swiftui-ui-patterns/references/async-state.md +76 -61
  372. package/pipeline/skills/shared/external/swiftui-ui-patterns/references/components-index.md +63 -46
  373. package/pipeline/skills/shared/external/swiftui-ui-patterns/references/controls.md +32 -31
  374. package/pipeline/skills/shared/external/swiftui-ui-patterns/references/deeplinks.md +49 -38
  375. package/pipeline/skills/shared/external/swiftui-ui-patterns/references/focus.md +77 -49
  376. package/pipeline/skills/shared/external/swiftui-ui-patterns/references/form.md +61 -44
  377. package/pipeline/skills/shared/external/swiftui-ui-patterns/references/grids.md +40 -42
  378. package/pipeline/skills/shared/external/swiftui-ui-patterns/references/input-toolbar.md +44 -31
  379. package/pipeline/skills/shared/external/swiftui-ui-patterns/references/lightweight-clients.md +90 -64
  380. package/pipeline/skills/shared/external/swiftui-ui-patterns/references/list.md +48 -49
  381. package/pipeline/skills/shared/external/swiftui-ui-patterns/references/loading-placeholders.md +36 -25
  382. package/pipeline/skills/shared/external/swiftui-ui-patterns/references/macos-settings.md +30 -30
  383. package/pipeline/skills/shared/external/swiftui-ui-patterns/references/matched-transitions.md +49 -32
  384. package/pipeline/skills/shared/external/swiftui-ui-patterns/references/media.md +49 -41
  385. package/pipeline/skills/shared/external/swiftui-ui-patterns/references/menu-bar.md +52 -48
  386. package/pipeline/skills/shared/external/swiftui-ui-patterns/references/navigationstack.md +119 -104
  387. package/pipeline/skills/shared/external/swiftui-ui-patterns/references/overlay.md +30 -27
  388. package/pipeline/skills/shared/external/swiftui-ui-patterns/references/performance.md +33 -31
  389. package/pipeline/skills/shared/external/swiftui-ui-patterns/references/previews.md +27 -27
  390. package/pipeline/skills/shared/external/swiftui-ui-patterns/references/scroll-reveal.md +79 -86
  391. package/pipeline/skills/shared/external/swiftui-ui-patterns/references/scrollview.md +47 -40
  392. package/pipeline/skills/shared/external/swiftui-ui-patterns/references/searchable.md +55 -40
  393. package/pipeline/skills/shared/external/swiftui-ui-patterns/references/sheets.md +113 -84
  394. package/pipeline/skills/shared/external/swiftui-ui-patterns/references/split-views.md +37 -34
  395. package/pipeline/skills/shared/external/swiftui-ui-patterns/references/tabview.md +75 -75
  396. package/pipeline/skills/shared/external/swiftui-ui-patterns/references/theming.md +37 -32
  397. package/pipeline/skills/shared/external/swiftui-ui-patterns/references/title-menus.md +41 -51
  398. package/pipeline/skills/shared/external/swiftui-ui-patterns/references/top-bar.md +46 -30
  399. package/pipeline/skills/shared/external/swiftui-uikit-interop/evals/evals.json +44 -0
  400. package/pipeline/skills/shared/external/swiftui-view-refactor/SKILL.md +152 -121
  401. package/pipeline/skills/shared/external/swiftui-view-refactor/evals/evals.json +56 -0
  402. package/pipeline/skills/shared/external/swiftui-view-refactor/references/mv-patterns.md +107 -98
  403. package/pipeline/skills/shared/external/swiftui-webkit/evals/evals.json +44 -0
  404. package/pipeline/skills/shared/external/tailwind-css/evals/evals.json +43 -0
  405. package/pipeline/skills/shared/external/test-result-triage/SKILL.md +2 -2
  406. package/pipeline/skills/shared/external/test-result-triage/evals/evals.json +44 -0
  407. package/pipeline/skills/shared/external/testing-backend/evals/evals.json +42 -0
  408. package/pipeline/skills/shared/external/tipkit/evals/evals.json +44 -0
  409. package/pipeline/skills/shared/external/typescript-patterns/evals/evals.json +42 -0
  410. package/pipeline/skills/shared/external/valven-rules/evals/evals.json +44 -0
  411. package/pipeline/skills/shared/external/vision-framework/evals/evals.json +44 -0
  412. package/pipeline/skills/shared/external/vue-composition/evals/evals.json +42 -0
  413. package/pipeline/skills/shared/external/weatherkit/evals/evals.json +42 -0
  414. package/pipeline/skills/shared/external/web-accessibility/evals/evals.json +43 -0
  415. package/pipeline/skills/shared/external/web-performance/evals/evals.json +44 -0
  416. package/pipeline/skills/shared/external/web-testing/SKILL.md +2 -2
  417. package/pipeline/skills/shared/external/web-testing/evals/evals.json +43 -0
  418. package/pipeline/skills/shared/external/web-testing/references/testing-examples.md +2 -2
  419. package/pipeline/skills/shared/external/widgetkit/evals/evals.json +44 -0
  420. package/pipeline/skills/shared/external/xcode-build-benchmark/SKILL.md +61 -55
  421. package/pipeline/skills/shared/external/xcode-build-benchmark/evals/evals.json +42 -0
  422. package/pipeline/skills/shared/external/xcode-build-benchmark/references/benchmark-artifacts.md +69 -67
  423. package/pipeline/skills/shared/external/xcode-build-benchmark/references/benchmarking-workflow.md +39 -47
  424. package/pipeline/skills/shared/external/xcode-build-benchmark/schemas/build-benchmark.schema.json +72 -154
  425. package/pipeline/skills/shared/external/xcode-build-benchmark/scripts/benchmark_builds.py +207 -245
  426. package/pipeline/skills/shared/external/xcode-build-fixer/SKILL.md +145 -139
  427. package/pipeline/skills/shared/external/xcode-build-fixer/evals/evals.json +54 -0
  428. package/pipeline/skills/shared/external/xcode-build-fixer/references/build-settings-best-practices.md +81 -175
  429. package/pipeline/skills/shared/external/xcode-build-fixer/references/fix-patterns.md +188 -143
  430. package/pipeline/skills/shared/external/xcode-build-fixer/references/recommendation-format.md +41 -40
  431. package/pipeline/skills/shared/external/xcode-build-fixer/scripts/benchmark_builds.py +207 -245
  432. package/pipeline/skills/shared/external/xcode-build-orchestrator/SKILL.md +107 -98
  433. package/pipeline/skills/shared/external/xcode-build-orchestrator/evals/evals.json +54 -0
  434. package/pipeline/skills/shared/external/xcode-build-orchestrator/references/benchmark-artifacts.md +69 -67
  435. package/pipeline/skills/shared/external/xcode-build-orchestrator/references/build-settings-best-practices.md +81 -175
  436. package/pipeline/skills/shared/external/xcode-build-orchestrator/references/orchestration-report-template.md +81 -69
  437. package/pipeline/skills/shared/external/xcode-build-orchestrator/references/recommendation-format.md +41 -40
  438. package/pipeline/skills/shared/external/xcode-build-orchestrator/scripts/benchmark_builds.py +207 -245
  439. package/pipeline/skills/shared/external/xcode-build-orchestrator/scripts/diagnose_compilation.py +155 -210
  440. package/pipeline/skills/shared/external/xcode-build-orchestrator/scripts/generate_optimization_report.py +355 -480
  441. package/pipeline/skills/shared/external/xcode-compilation-analyzer/SKILL.md +70 -69
  442. package/pipeline/skills/shared/external/xcode-compilation-analyzer/evals/evals.json +54 -0
  443. package/pipeline/skills/shared/external/xcode-compilation-analyzer/references/build-optimization-sources.md +83 -133
  444. package/pipeline/skills/shared/external/xcode-compilation-analyzer/references/code-compilation-checks.md +85 -73
  445. package/pipeline/skills/shared/external/xcode-compilation-analyzer/references/recommendation-format.md +41 -40
  446. package/pipeline/skills/shared/external/xcode-compilation-analyzer/scripts/diagnose_compilation.py +155 -210
  447. package/pipeline/skills/shared/external/xcode-project-analyzer/SKILL.md +54 -52
  448. package/pipeline/skills/shared/external/xcode-project-analyzer/evals/evals.json +54 -0
  449. package/pipeline/skills/shared/external/xcode-project-analyzer/references/build-optimization-sources.md +83 -133
  450. package/pipeline/skills/shared/external/xcode-project-analyzer/references/build-settings-best-practices.md +81 -175
  451. package/pipeline/skills/shared/external/xcode-project-analyzer/references/project-audit-checks.md +115 -83
  452. package/pipeline/skills/shared/external/xcode-project-analyzer/references/recommendation-format.md +41 -40
  453. package/pipeline/scripts/_notices.mjs +0 -171
  454. package/pipeline/skills/shared/external/NOTICE-avdlee-swiftui-agent-skill.md +0 -48
  455. package/pipeline/skills/shared/external/NOTICE-dimillian-skills.md +0 -63
  456. package/pipeline/skills/shared/external/NOTICE-paul-hudson-skills.md +0 -54
  457. package/pipeline/skills/shared/external/NOTICE-vibeship-spawner-skills.md +0 -203
  458. package/pipeline/skills/shared/external/NOTICE-xcode-build-skills.md +0 -60
  459. package/pipeline/skills/shared/external/ios-iphone-duo/NOTICE.md +0 -53
  460. package/pipeline/skills/shared/external/macos-spm-app-packaging/assets/templates/bootstrap/Sources/MyApp/main.swift +0 -11
  461. package/pipeline/skills/shared/external/swiftdata-pro/references/class-inheritance.md +0 -104
  462. package/pipeline/skills/shared/external/swiftdata-pro/references/core-rules.md +0 -20
  463. package/pipeline/skills/shared/external/swiftui-performance-audit/references/code-smells.md +0 -158
  464. package/pipeline/skills/shared/external/swiftui-performance-audit/references/demystify-swiftui-performance-wwdc23.md +0 -46
  465. package/pipeline/skills/shared/external/swiftui-performance-audit/references/optimizing-swiftui-performance-instruments.md +0 -29
  466. package/pipeline/skills/shared/external/swiftui-performance-audit/references/profiling-intake.md +0 -44
  467. package/pipeline/skills/shared/external/swiftui-performance-audit/references/report-template.md +0 -47
  468. package/pipeline/skills/shared/external/swiftui-performance-audit/references/understanding-hangs-in-your-app.md +0 -33
  469. package/pipeline/skills/shared/external/swiftui-performance-audit/references/understanding-improving-swiftui-performance.md +0 -52
@@ -1,410 +1,364 @@
1
- # SwiftUI Performance Patterns Reference
1
+ # SwiftUI Performance
2
2
 
3
3
  <!-- toc -->
4
- - [Table of Contents](#table-of-contents)
5
- - [Performance Optimization](#performance-optimization)
6
- - [Anti-Patterns](#anti-patterns)
7
- - [Summary Checklist](#summary-checklist)
4
+ - [Where SwiftUI time goes](#where-swiftui-time-goes)
5
+ - [Fewer state writes](#fewer-state-writes)
6
+ - [Narrow dependencies](#narrow-dependencies)
7
+ - [Cheaper diffing](#cheaper-diffing)
8
+ - [Lazy containers](#lazy-containers)
9
+ - [Async work tied to the view](#async-work-tied-to-the-view)
10
+ - [Closures that may run off the main thread](#closures-that-may-run-off-the-main-thread)
11
+ - [Finding the trigger of an update](#finding-the-trigger-of-an-update)
12
+ - [Body anti-patterns](#body-anti-patterns)
13
+ - [Checklist](#checklist)
8
14
  <!-- /toc -->
9
15
 
10
- ## Table of Contents
16
+ Treat every item here as a suggestion to weigh, not a rule to enforce. When a screen is actually slow, recommend profiling it with the SwiftUI template in Instruments before changing code.
11
17
 
12
- - [Performance Optimization](#performance-optimization)
13
- - [Anti-Patterns](#anti-patterns)
14
- - [Summary Checklist](#summary-checklist)
18
+ ## Where SwiftUI time goes
15
19
 
16
- ## Performance Optimization
20
+ The usual culprits:
17
21
 
18
- ### 1. Avoid Redundant State Updates
22
+ - Broad state changes that invalidate many views at once
23
+ - Lists with unstable identity, which force extra diffing
24
+ - Expensive work inside `body`: formatting, sorting, decoding images
25
+ - Layout thrash from deeply nested stacks or long preference chains
19
26
 
20
- SwiftUI doesn't compare values before triggering updates:
27
+ ## Fewer state writes
21
28
 
22
- ```swift
23
- // BAD - triggers update even if value unchanged
24
- .onReceive(publisher) { value in
25
- self.currentValue = value // Always triggers body re-evaluation
26
- }
29
+ ### Skip writes that change nothing
27
30
 
28
- // GOOD - only update when different
29
- .onReceive(publisher) { value in
30
- if self.currentValue != value {
31
- self.currentValue = value
32
- }
31
+ Assigning to state schedules an update whether or not the new value differs. SwiftUI does not compare first, so the guard is yours:
32
+
33
+ ```swift
34
+ .onReceive(batteryMonitor.levelPublisher) { level in
35
+ guard level != batteryLevel else { return }
36
+ batteryLevel = level
33
37
  }
34
38
  ```
35
39
 
36
- ### 2. Optimize Hot Paths
40
+ Writing `batteryLevel = level` unconditionally re-evaluates `body` on every emission, even repeated values.
37
41
 
38
- Hot paths are frequently executed code (scroll handlers, animations, gestures):
42
+ ### Guard hot paths
39
43
 
40
- ```swift
41
- // BAD - updates state on every scroll position change
42
- .onPreferenceChange(ScrollOffsetKey.self) { offset in
43
- shouldShowTitle = offset.y <= -32 // Fires constantly during scroll!
44
- }
44
+ Scroll callbacks, gesture handlers and animation ticks fire many times per second. Write to state only when a derived value actually flips:
45
45
 
46
- // GOOD - only update when threshold crossed
47
- .onPreferenceChange(ScrollOffsetKey.self) { offset in
48
- let shouldShow = offset.y <= -32
49
- if shouldShow != shouldShowTitle {
50
- shouldShowTitle = shouldShow // Fires only when crossing threshold
46
+ ```swift
47
+ .onPreferenceChange(HeaderOffsetKey.self) { offsetY in
48
+ let collapsed = offsetY < -48
49
+ if collapsed != isHeaderCollapsed {
50
+ isHeaderCollapsed = collapsed
51
51
  }
52
52
  }
53
53
  ```
54
54
 
55
- ### 3. Pass Only What Views Need
55
+ Assigning `isHeaderCollapsed = offsetY < -48` on every callback triggers an update on each scroll frame; the comparison limits it to the moment the threshold is crossed.
56
+
57
+ ## Narrow dependencies
58
+
59
+ ### Hand views only what they read
56
60
 
57
- **Avoid passing large "config" or "context" objects.** Pass only the specific values each view needs.
61
+ Do not pass a big settings or context object to a view that uses one field of it:
58
62
 
59
63
  ```swift
60
- // Good - pass specific values
61
- ThemeSelector(theme: config.theme)
62
- FontSizeSlider(fontSize: config.fontSize)
64
+ // Narrow: each control depends on one value
65
+ AccentPicker(accent: settings.accent)
66
+ LineSpacingSlider(spacing: settings.lineSpacing)
63
67
 
64
- // Avoid - passing entire config (creates broad dependency)
65
- ThemeSelector(config: config) // Notified of ALL config changes
68
+ // Broad: the picker now hears about every settings change
69
+ AccentPicker(settings: settings)
66
70
  ```
67
71
 
68
- With `ObservableObject`, any `@Published` change triggers all observers. With `@Observable`, views update only when accessed properties change, but passing entire objects still creates broader dependencies than necessary.
72
+ With `ObservableObject`, any `@Published` change notifies every observer. `@Observable` only updates views whose read properties changed, but passing the whole object still widens the dependency surface more than needed.
69
73
 
70
- ### 4. Use Equatable Views
71
-
72
- For views with expensive bodies, conform to `Equatable`:
74
+ The same applies to rows that pull a whole model from the environment just for one value:
73
75
 
74
76
  ```swift
75
- struct ExpensiveView: View, Equatable {
76
- let data: SomeData
77
-
78
- static func == (lhs: Self, rhs: Self) -> Bool {
79
- lhs.data.id == rhs.data.id // Custom equality check
80
- }
81
-
82
- var body: some View {
83
- // Expensive computation
84
- }
77
+ // Broad: the row depends on the shared model
78
+ struct TransactionRow: View {
79
+ @Environment(LedgerModel.self) private var ledger
80
+ let entry: Entry
81
+ var body: some View { Text(entry.memo).foregroundStyle(ledger.palette.income) }
85
82
  }
86
83
 
87
- // Usage
88
- ExpensiveView(data: data)
89
- .equatable() // Use custom equality
84
+ // Narrow: the row gets exactly what it draws
85
+ struct TransactionRow: View {
86
+ let entry: Entry
87
+ let incomeColor: Color
88
+ var body: some View { Text(entry.memo).foregroundStyle(incomeColor) }
89
+ }
90
90
  ```
91
91
 
92
- **Caution**: If you add new state or dependencies to your view, remember to update your `==` function!
92
+ ### Keep fast-changing values out of the environment
93
+
94
+ When an environment value changes, SwiftUI checks every view that reads the environment, including views that never read that particular key. With many views and frequent updates (geometry, timers) this adds up, so such values should travel another way. (WWDC25 session 306, on optimizing SwiftUI with Instruments.)
93
95
 
94
- ### 5. POD Views for Fast Diffing
96
+ ### One observable per row
95
97
 
96
- **POD (Plain Old Data) views use `memcmp` for fastest diffing.** A view is POD if it only contains simple value types and no property wrappers.
98
+ When every row reads the same `@Observable` collection, mutating one element invalidates all rows. Giving each row its own small observable state narrows the update to the row that changed.
97
99
 
98
100
  ```swift
99
- // POD view - fastest diffing
100
- struct FastView: View {
101
- let title: String
102
- let count: Int
103
-
104
- var body: some View {
105
- Text("\(title): \(count)")
106
- }
101
+ // Every row depends on the whole set
102
+ @Observable
103
+ final class PodcastLibrary {
104
+ var downloaded: Set<Episode.ID> = []
105
+ func isDownloaded(_ episode: Episode) -> Bool { downloaded.contains(episode.id) }
107
106
  }
108
107
 
109
- // Non-POD view - uses reflection or custom equality
110
- struct SlowerView: View {
111
- let title: String
112
- @State private var isExpanded = false // Property wrapper makes it non-POD
113
-
108
+ struct EpisodeRow: View {
109
+ let episode: Episode
110
+ @Environment(PodcastLibrary.self) private var library
111
+
114
112
  var body: some View {
115
- Text(title)
113
+ HStack {
114
+ Text(episode.title)
115
+ if library.isDownloaded(episode) {
116
+ Image(systemName: "arrow.down.circle.fill")
117
+ }
118
+ }
116
119
  }
117
120
  }
118
121
  ```
119
122
 
120
- **Advanced Pattern**: Wrap expensive non-POD views in POD parent views:
121
-
122
123
  ```swift
123
- // POD wrapper for fast diffing
124
- struct ExpensiveView: View {
125
- let value: Int
126
-
127
- var body: some View {
128
- ExpensiveViewInternal(value: value)
129
- }
124
+ // Each row observes only its own state
125
+ @Observable
126
+ final class EpisodeState {
127
+ var isDownloaded = false
130
128
  }
131
129
 
132
- // Internal view with state
133
- private struct ExpensiveViewInternal: View {
134
- let value: Int
135
- @State private var item: Item?
136
-
130
+ struct EpisodeRow: View {
131
+ let episode: Episode
132
+ let state: EpisodeState
133
+
137
134
  var body: some View {
138
- // Expensive rendering
135
+ HStack {
136
+ Text(episode.title)
137
+ if state.isDownloaded {
138
+ Image(systemName: "arrow.down.circle.fill")
139
+ }
140
+ }
139
141
  }
140
142
  }
141
143
  ```
142
144
 
143
- **Why**: The POD parent uses fast `memcmp` comparison. Only when `value` changes does the internal view get diffed.
145
+ In the first version, downloading one episode changes the shared set and every `EpisodeRow` re-runs `body`. In the second, only the row whose `EpisodeState` changed does. Adopt per-item holders where they measurably cut updates. (WWDC25 session 306.)
146
+
147
+ ## Cheaper diffing
144
148
 
145
- ### 6. Lazy Loading
149
+ ### Equatable views
146
150
 
147
- Use lazy containers for large collections:
151
+ A view with an expensive body can conform to `Equatable` and be wrapped with `.equatable()`, so SwiftUI uses your comparison:
148
152
 
149
153
  ```swift
150
- // BAD - creates all views immediately
151
- ScrollView {
152
- VStack {
153
- ForEach(items) { item in
154
- ExpensiveRow(item: item)
155
- }
154
+ struct WaveformView: View, Equatable {
155
+ let clip: AudioClip
156
+
157
+ static func == (lhs: WaveformView, rhs: WaveformView) -> Bool {
158
+ lhs.clip.id == rhs.clip.id && lhs.clip.revision == rhs.clip.revision
156
159
  }
157
- }
158
160
 
159
- // GOOD - creates views on demand
160
- ScrollView {
161
- LazyVStack {
162
- ForEach(items) { item in
163
- ExpensiveRow(item: item)
161
+ var body: some View {
162
+ Canvas { context, size in
163
+ // costly drawing
164
164
  }
165
165
  }
166
166
  }
167
- ```
168
167
 
169
- **iOS 26+ note**: Nested scroll views containing lazy stacks now automatically defer loading their children until they are about to appear, matching the behavior of top-level lazy stacks. This benefits patterns like horizontal photo carousels inside a vertical scroll view.
168
+ WaveformView(clip: clip)
169
+ .equatable()
170
+ ```
170
171
 
171
- > Source: "What's new in SwiftUI" (WWDC25, session 256)
172
+ Whenever the view gains a new input or state, update `==` to match, or the view will stop refreshing when it should.
172
173
 
173
- ### 7. Task Cancellation
174
+ ### POD views
174
175
 
175
- Cancel async work when view disappears:
176
+ A view whose stored properties are only plain value types, with no property wrappers, is POD (plain old data). SwiftUI diffs POD views with `memcmp`, the fastest path. Adding any wrapper such as `@State` makes it non-POD, which falls back to reflection or custom equality.
176
177
 
177
178
  ```swift
178
- struct DataView: View {
179
- @State private var data: [Item] = []
180
-
181
- var body: some View {
182
- List(data) { item in
183
- Text(item.name)
184
- }
185
- .task {
186
- // Automatically cancelled when view disappears
187
- data = await fetchData()
188
- }
189
- }
179
+ // POD: compared with memcmp
180
+ struct ScoreLabel: View {
181
+ let team: String
182
+ let points: Int
183
+ var body: some View { Text("\(team) \(points)") }
190
184
  }
191
- ```
192
-
193
- ### 8. Debug View Updates
194
185
 
195
- **Use `Self._printChanges()` or `Self._logChanges()` to debug unexpected view updates.**
196
-
197
- ```swift
198
- struct DebugView: View {
199
- @State private var count = 0
200
- @State private var name = ""
201
-
202
- var body: some View {
203
- #if DEBUG
204
- let _ = Self._logChanges() // Xcode 15.1+: logs to com.apple.SwiftUI subsystem
205
- #endif
206
-
207
- VStack {
208
- Text("Count: \(count)")
209
- Text("Name: \(name)")
210
- }
211
- }
186
+ // Non-POD: the @State wrapper rules out memcmp
187
+ struct ScoreCard: View {
188
+ let team: String
189
+ @State private var showsHistory = false
190
+ var body: some View { Text(team) }
212
191
  }
213
192
  ```
214
193
 
215
- - `Self._printChanges()`: Prints which properties changed to standard output.
216
- - `Self._logChanges()` (iOS 17+): Logs to the `com.apple.SwiftUI` subsystem with category "Changed Body Properties", using `os_log` for structured output.
217
-
218
- Both print `@self` when the view value itself changed and `@identity` when the view's persistent data was recycled.
219
-
220
- **Why**: This helps identify which state changes are causing view updates. Isolating redraw triggers into single-responsibility subviews is often the fix -- extracting a subview means SwiftUI can skip its body when its inputs haven't changed.
221
-
222
- ### 9. Eliminate Unnecessary Dependencies
223
-
224
- **Narrow state scope to reduce update fan-out.** Instead of passing an entire `@Observable` model to a row view (which creates a dependency on all accessed properties), pass only the specific values the view needs as `let` properties.
194
+ An advanced variant puts a POD shell around a stateful, expensive view. The shell is compared with `memcmp`, and the inner view is diffed only when the shell's input changes:
225
195
 
226
196
  ```swift
227
- // Bad - broad dependency on entire model
228
- struct ItemRow: View {
229
- @Environment(AppModel.self) private var model
230
- let item: Item
231
- var body: some View { Text(item.name).foregroundStyle(model.theme.primaryColor) }
197
+ struct StockChart: View {
198
+ let symbolID: Int
199
+ var body: some View { StockChartContent(symbolID: symbolID) }
232
200
  }
233
201
 
234
- // Good - narrow dependency
235
- struct ItemRow: View {
236
- let item: Item
237
- let themeColor: Color
238
- var body: some View { Text(item.name).foregroundStyle(themeColor) }
202
+ private struct StockChartContent: View {
203
+ let symbolID: Int
204
+ @State private var quotes: [Quote] = []
205
+ var body: some View { EmptyView() /* expensive rendering */ }
239
206
  }
240
207
  ```
241
208
 
242
- **Avoid storing frequently-changing values in the environment.** Even when a view doesn't read the changed key, SwiftUI still checks all environment readers. This cost adds up with many views and frequent updates (geometry values, timers).
243
-
244
- > Source: "Optimize SwiftUI performance with Instruments" (WWDC25, session 306)
209
+ ## Lazy containers
245
210
 
246
- ### 10. @Observable Dependency Granularity
247
-
248
- **Consider per-item `@Observable` state holders (one per row/item) to narrow update scope.** When multiple list items share a dependency on the same `@Observable` array, changing one element causes all items to re-evaluate their bodies.
211
+ Large collections in a scroll view belong in a lazy stack, which builds rows as they come on screen instead of all at once:
249
212
 
250
213
  ```swift
251
- // BAD - all item views depend on the full favorites array
252
- @Observable
253
- class ModelData {
254
- var favorites: [Landmark] = []
255
-
256
- func isFavorite(_ landmark: Landmark) -> Bool {
257
- favorites.contains(landmark)
214
+ ScrollView {
215
+ LazyVStack {
216
+ ForEach(messages) { message in
217
+ MessageBubble(message: message)
218
+ }
258
219
  }
259
220
  }
221
+ ```
260
222
 
261
- struct LandmarkRow: View {
262
- let landmark: Landmark
263
- @Environment(ModelData.self) private var model
223
+ A plain `VStack` in the same place creates every `MessageBubble` immediately.
264
224
 
265
- var body: some View {
266
- HStack {
267
- Text(landmark.name)
268
- if model.isFavorite(landmark) {
269
- Image(systemName: "heart.fill")
270
- }
271
- }
272
- }
273
- }
225
+ From iOS 26, lazy stacks inside nested scroll views also wait until their children are about to appear, the same as a top-level lazy stack. A horizontal carousel inside a vertical feed is the typical beneficiary. (WWDC25 session 256, what's new in SwiftUI.)
274
226
 
275
- // GOOD - each item has its own observable view model
276
- @Observable
277
- class LandmarkViewModel {
278
- var isFavorite: Bool = false
279
- }
227
+ ## Async work tied to the view
280
228
 
281
- struct LandmarkRow: View {
282
- let landmark: Landmark
283
- let viewModel: LandmarkViewModel
229
+ `.task` starts work when the view appears and cancels it automatically when the view goes away:
230
+
231
+ ```swift
232
+ struct ForecastScreen: View {
233
+ @State private var days: [DayForecast] = []
284
234
 
285
235
  var body: some View {
286
- HStack {
287
- Text(landmark.name)
288
- if viewModel.isFavorite {
289
- Image(systemName: "heart.fill")
290
- }
291
- }
236
+ List(days) { day in Text(day.summary) }
237
+ .task { days = await WeatherService.loadWeek() }
292
238
  }
293
239
  }
294
240
  ```
295
241
 
296
- **Why**: With the bad pattern, toggling one favorite marks the entire array as changed, causing every `LandmarkRow` to re-run its body. With per-item view models, only the toggled item's body runs.
297
-
298
- > Source: "Optimize SwiftUI performance with Instruments" (WWDC25, session 306)
242
+ ## Closures that may run off the main thread
299
243
 
300
- ### 11. Off-Main-Thread Closures
244
+ For speed, SwiftUI may call some closures on a background thread. They must be `Sendable` and must not touch `@MainActor` state directly; copy what they need through the capture list instead. The closures in question:
301
245
 
302
- **SwiftUI may call certain closures on a background thread for performance.** These closures must be `Sendable` and should avoid accessing `@MainActor`-isolated state directly. Instead, capture needed values in the closure's capture list.
303
-
304
- Closures that may run off the main thread:
305
246
  - `Shape.path(in:)`
306
- - `visualEffect` closure
247
+ - the `visualEffect` closure
307
248
  - `Layout` protocol methods
308
- - `onGeometryChange` transform closure
249
+ - the transform closure of `onGeometryChange`
309
250
 
310
251
  ```swift
311
- // BAD - accessing @MainActor state directly
312
- .visualEffect { content, geometry in
313
- content.blur(radius: self.pulse ? 5 : 0) // Compiler error: @MainActor isolated
252
+ // Does not compile: reads main-actor state from a Sendable closure
253
+ .visualEffect { content, proxy in
254
+ content.scaleEffect(self.isHighlighted ? 1.1 : 1)
314
255
  }
315
256
 
316
- // GOOD - capture the value
317
- .visualEffect { [pulse] content, geometry in
318
- content.blur(radius: pulse ? 5 : 0)
257
+ // Compiles: the value is captured up front
258
+ .visualEffect { [isHighlighted] content, proxy in
259
+ content.scaleEffect(isHighlighted ? 1.1 : 1)
319
260
  }
320
261
  ```
321
262
 
322
- > Source: "Explore concurrency in SwiftUI" (WWDC25, session 266)
263
+ (WWDC25 session 266, on concurrency in SwiftUI.)
264
+
265
+ ## Finding the trigger of an update
266
+
267
+ `Self._printChanges()` and `Self._logChanges()` report why a body ran:
323
268
 
324
- ### 12. Common Performance Issues
269
+ ```swift
270
+ struct CartSummary: View {
271
+ @State private var itemCount = 0
272
+ @State private var couponCode = ""
273
+
274
+ var body: some View {
275
+ #if DEBUG
276
+ let _ = Self._logChanges()
277
+ #endif
278
+ VStack {
279
+ Text("Items: \(itemCount)")
280
+ Text("Coupon: \(couponCode)")
281
+ }
282
+ }
283
+ }
284
+ ```
325
285
 
326
- **Be aware of common performance bottlenecks in SwiftUI:**
286
+ - `Self._printChanges()` writes the changed properties to standard output.
287
+ - `Self._logChanges()` (iOS 17+, Xcode 15.1+) sends the same through `os_log` to the `com.apple.SwiftUI` subsystem, category "Changed Body Properties".
327
288
 
328
- - View invalidation storms from broad state changes
329
- - Unstable identity in lists causing excessive diffing
330
- - Heavy work in `body` (formatting, sorting, image decoding)
331
- - Layout thrash from deep stacks or preference chains
289
+ Both report `@self` when the view value itself changed and `@identity` when the view's persistent storage was recycled. The usual remedy is to move the triggering state into a focused subview, whose body SwiftUI can then skip while its inputs stay the same.
332
290
 
333
- **When performance issues arise**, suggest the user profile with Instruments (SwiftUI template) to identify specific bottlenecks.
291
+ ## Body anti-patterns
334
292
 
335
- ## Anti-Patterns
293
+ ### Allocating in body
336
294
 
337
- ### 1. Creating Objects in Body
295
+ `body` runs often, so objects built there are rebuilt every time. Keep formatters and similar objects static or stored:
338
296
 
339
297
  ```swift
340
- // BAD - creates new formatter every body call
298
+ // Rebuilt on each evaluation
341
299
  var body: some View {
342
- let formatter = DateFormatter()
343
- formatter.dateStyle = .long
344
- return Text(formatter.string(from: date))
300
+ let formatter = NumberFormatter()
301
+ formatter.numberStyle = .currency
302
+ return Text(formatter.string(from: price as NSNumber) ?? "")
345
303
  }
346
304
 
347
- // GOOD - static or stored formatter
348
- private static let dateFormatter: DateFormatter = {
349
- let f = DateFormatter()
350
- f.dateStyle = .long
351
- return f
305
+ // Built once
306
+ private static let currency: NumberFormatter = {
307
+ let formatter = NumberFormatter()
308
+ formatter.numberStyle = .currency
309
+ return formatter
352
310
  }()
353
311
 
354
312
  var body: some View {
355
- Text(Self.dateFormatter.string(from: date))
313
+ Text(Self.currency.string(from: price as NSNumber) ?? "")
356
314
  }
357
315
  ```
358
316
 
359
- ### 2. Heavy Computation in Body
317
+ ### Heavy logic in body
360
318
 
361
- **Keep view body simple and pure.** Avoid side effects, dispatching, or complex logic.
319
+ `body` should be a pure, simple description of state: no side effects, no dispatching, no complex logic. Sorting, filtering and formatting move into the model or a computed property, or are recomputed only when the input changes:
362
320
 
363
321
  ```swift
364
- // BAD - sorts array every body call
322
+ // Sorts on every evaluation
365
323
  var body: some View {
366
- List(items.sorted { $0.name < $1.name }) { item in Text(item.name) }
324
+ List(contacts.sorted { $0.lastName < $1.lastName }) { Text($0.lastName) }
367
325
  }
368
326
 
369
- // GOOD - compute once, update via onChange or a computed property in the model
370
- @State private var sortedItems: [Item] = []
327
+ // Sorts only when the source changes
328
+ @State private var sortedContacts: [Contact] = []
371
329
 
372
330
  var body: some View {
373
- List(sortedItems) { item in Text(item.name) }
374
- .onChange(of: items) { _, newItems in
375
- sortedItems = newItems.sorted { $0.name < $1.name }
331
+ List(sortedContacts) { Text($0.lastName) }
332
+ .onChange(of: contacts) { _, latest in
333
+ sortedContacts = latest.sorted { $0.lastName < $1.lastName }
376
334
  }
377
335
  }
378
336
  ```
379
337
 
380
- Move sorting, filtering, and formatting into models or computed properties. The `body` should be a pure structural representation of state.
338
+ ### Storing derived values
381
339
 
382
- ### 3. Unnecessary State
340
+ Values that can be computed from other state should not be stored next to it:
383
341
 
384
342
  ```swift
385
- // BAD - derived state stored separately
386
- @State private var items: [Item] = []
387
- @State private var itemCount: Int = 0 // Unnecessary!
388
-
389
- // GOOD - compute derived values
390
- @State private var items: [Item] = []
391
-
392
- var itemCount: Int { items.count } // Computed property
343
+ @State private var tasks: [TaskItem] = []
344
+ var openTaskCount: Int { tasks.filter { !$0.isDone }.count }
393
345
  ```
394
346
 
395
- ## Summary Checklist
396
-
397
- - [ ] State updates check for value changes before assigning
398
- - [ ] Hot paths minimize state updates
399
- - [ ] Pass only needed values to views (avoid large config objects)
400
- - [ ] Large lists use `LazyVStack`/`LazyHStack`
401
- - [ ] No object creation in `body`
402
- - [ ] Heavy computation moved out of `body`
403
- - [ ] Body kept simple and pure (no side effects)
404
- - [ ] Derived state computed, not stored
405
- - [ ] Use `Self._logChanges()` or `Self._printChanges()` to debug unexpected updates
406
- - [ ] Equatable conformance for expensive views (when appropriate)
407
- - [ ] Consider POD view wrappers for advanced optimization
408
- - [ ] Consider using granular @Observable dependencies for list items (smaller observable units per row when it measurably reduces updates)
409
- - [ ] Frequently-changing values not stored in the environment
410
- - [ ] Sendable closures (Shape, visualEffect, Layout) capture values instead of accessing @MainActor state
347
+ A separate `@State private var openTaskCount = 0` is redundant and can drift out of sync.
348
+
349
+ ## Checklist
350
+
351
+ - [ ] State is assigned only when the value really changes
352
+ - [ ] Hot paths (scroll, gesture, animation) write state as rarely as possible
353
+ - [ ] Views receive the values they need, not large config objects
354
+ - [ ] Big collections use `LazyVStack` or `LazyHStack`
355
+ - [ ] No object allocation inside `body`
356
+ - [ ] Heavy computation lives outside `body`
357
+ - [ ] `body` is simple and free of side effects
358
+ - [ ] Derived values are computed, not stored
359
+ - [ ] `Self._logChanges()` or `Self._printChanges()` used to chase unexpected updates
360
+ - [ ] Expensive views use `Equatable` where it fits
361
+ - [ ] POD wrappers considered as an advanced optimization
362
+ - [ ] Per-row `@Observable` state considered where it measurably reduces updates
363
+ - [ ] Fast-changing values kept out of the environment
364
+ - [ ] Sendable closures (Shape, visualEffect, Layout, onGeometryChange) capture values instead of reading `@MainActor` state