@mmerterden/multi-agent-pipeline 20.6.0 → 20.8.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 (326) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/LICENSE +0 -10
  3. package/docs/facts.json +1 -1
  4. package/manifest.json +328 -329
  5. package/package.json +2 -2
  6. package/pipeline/multi-agent-refs/features/design-conformance.md +62 -64
  7. package/pipeline/scripts/_notices.mjs +12 -1
  8. package/pipeline/scripts/gen-skills-index.mjs +1 -1
  9. package/pipeline/skills/.skill-manifest.json +106 -106
  10. package/pipeline/skills/shared/README.md +71 -71
  11. package/pipeline/skills/shared/external/agent-introspection-debugging/SKILL.md +1 -0
  12. package/pipeline/skills/shared/external/alarmkit/SKILL.md +373 -381
  13. package/pipeline/skills/shared/external/alarmkit/evals/evals.json +23 -18
  14. package/pipeline/skills/shared/external/alarmkit/references/alarmkit-patterns.md +328 -378
  15. package/pipeline/skills/shared/external/android-architecture/SKILL.md +2 -0
  16. package/pipeline/skills/shared/external/android-performance/SKILL.md +2 -0
  17. package/pipeline/skills/shared/external/android-security/SKILL.md +2 -0
  18. package/pipeline/skills/shared/external/app-clips/SKILL.md +260 -160
  19. package/pipeline/skills/shared/external/app-clips/evals/evals.json +27 -27
  20. package/pipeline/skills/shared/external/app-clips/references/data-handoff-notifications-location.md +150 -83
  21. package/pipeline/skills/shared/external/app-clips/references/routing-and-experiences.md +135 -83
  22. package/pipeline/skills/shared/external/app-clips/references/size-capabilities-and-promotion.md +143 -85
  23. package/pipeline/skills/shared/external/app-intents/SKILL.md +302 -304
  24. package/pipeline/skills/shared/external/app-intents/evals/evals.json +21 -21
  25. package/pipeline/skills/shared/external/app-intents/references/appintents-advanced.md +594 -894
  26. package/pipeline/skills/shared/external/app-store-optimization/SKILL.md +339 -277
  27. package/pipeline/skills/shared/external/app-store-optimization/evals/evals.json +27 -23
  28. package/pipeline/skills/shared/external/app-store-optimization/references/keyword-research-methodology.md +105 -122
  29. package/pipeline/skills/shared/external/app-store-optimization/references/product-page-variants.md +143 -166
  30. package/pipeline/skills/shared/external/app-store-review/SKILL.md +307 -326
  31. package/pipeline/skills/shared/external/app-store-review/evals/evals.json +21 -21
  32. package/pipeline/skills/shared/external/app-store-review/references/privacy-manifest.md +105 -67
  33. package/pipeline/skills/shared/external/app-store-review/references/review-checklists.md +114 -101
  34. package/pipeline/skills/shared/external/apple-on-device-ai/SKILL.md +333 -360
  35. package/pipeline/skills/shared/external/apple-on-device-ai/evals/evals.json +24 -27
  36. package/pipeline/skills/shared/external/apple-on-device-ai/references/coreml-conversion.md +215 -322
  37. package/pipeline/skills/shared/external/apple-on-device-ai/references/coreml-optimization.md +161 -256
  38. package/pipeline/skills/shared/external/apple-on-device-ai/references/foundation-models.md +277 -387
  39. package/pipeline/skills/shared/external/apple-on-device-ai/references/mlx-swift.md +196 -210
  40. package/pipeline/skills/shared/external/authentication/SKILL.md +265 -381
  41. package/pipeline/skills/shared/external/authentication/evals/evals.json +25 -25
  42. package/pipeline/skills/shared/external/authentication/references/keychain-biometric.md +133 -178
  43. package/pipeline/skills/shared/external/authentication/references/passkeys.md +111 -147
  44. package/pipeline/skills/shared/external/avkit/SKILL.md +267 -364
  45. package/pipeline/skills/shared/external/avkit/evals/evals.json +26 -26
  46. package/pipeline/skills/shared/external/avkit/references/avkit-patterns.md +375 -493
  47. package/pipeline/skills/shared/external/background-processing/SKILL.md +270 -382
  48. package/pipeline/skills/shared/external/background-processing/evals/evals.json +22 -22
  49. package/pipeline/skills/shared/external/background-processing/references/background-task-patterns.md +169 -317
  50. package/pipeline/skills/shared/external/backlog/BACKLOG.md +1 -1
  51. package/pipeline/skills/shared/external/backlog/SKILL.md +56 -33
  52. package/pipeline/skills/shared/external/callkit-voip/SKILL.md +290 -371
  53. package/pipeline/skills/shared/external/callkit-voip/evals/evals.json +24 -24
  54. package/pipeline/skills/shared/external/callkit-voip/references/callkit-patterns.md +175 -343
  55. package/pipeline/skills/shared/external/ci-cd-pipelines/SKILL.md +1 -0
  56. package/pipeline/skills/shared/external/cloudkit-sync/SKILL.md +292 -381
  57. package/pipeline/skills/shared/external/cloudkit-sync/evals/evals.json +33 -30
  58. package/pipeline/skills/shared/external/cloudkit-sync/references/cloudkit-patterns.md +227 -355
  59. package/pipeline/skills/shared/external/compose-components/SKILL.md +2 -0
  60. package/pipeline/skills/shared/external/compose-navigation/SKILL.md +3 -2
  61. package/pipeline/skills/shared/external/compose-testing/SKILL.md +2 -0
  62. package/pipeline/skills/shared/external/contacts-framework/SKILL.md +197 -346
  63. package/pipeline/skills/shared/external/contacts-framework/evals/evals.json +19 -21
  64. package/pipeline/skills/shared/external/contacts-framework/references/contacts-patterns.md +169 -308
  65. package/pipeline/skills/shared/external/core-bluetooth/SKILL.md +226 -376
  66. package/pipeline/skills/shared/external/core-bluetooth/evals/evals.json +25 -22
  67. package/pipeline/skills/shared/external/core-bluetooth/references/ble-patterns.md +257 -337
  68. package/pipeline/skills/shared/external/core-data/SKILL.md +292 -368
  69. package/pipeline/skills/shared/external/core-data/evals/evals.json +30 -27
  70. package/pipeline/skills/shared/external/core-motion/SKILL.md +235 -324
  71. package/pipeline/skills/shared/external/core-motion/evals/evals.json +31 -27
  72. package/pipeline/skills/shared/external/core-motion/references/motion-patterns.md +210 -310
  73. package/pipeline/skills/shared/external/core-nfc/SKILL.md +292 -366
  74. package/pipeline/skills/shared/external/core-nfc/evals/evals.json +22 -24
  75. package/pipeline/skills/shared/external/core-nfc/references/nfc-patterns.md +233 -329
  76. package/pipeline/skills/shared/external/coreml/SKILL.md +323 -367
  77. package/pipeline/skills/shared/external/coreml/evals/evals.json +24 -21
  78. package/pipeline/skills/shared/external/coreml/references/coreml-swift-integration.md +562 -565
  79. package/pipeline/skills/shared/external/council/SKILL.md +1 -0
  80. package/pipeline/skills/shared/external/cryptokit/SKILL.md +253 -394
  81. package/pipeline/skills/shared/external/cryptokit/evals/evals.json +20 -18
  82. package/pipeline/skills/shared/external/cryptokit/references/cryptokit-patterns.md +299 -488
  83. package/pipeline/skills/shared/external/css-modern/SKILL.md +1 -0
  84. package/pipeline/skills/shared/external/database-patterns/SKILL.md +1 -0
  85. package/pipeline/skills/shared/external/debugging-instruments/SKILL.md +270 -323
  86. package/pipeline/skills/shared/external/debugging-instruments/evals/evals.json +27 -30
  87. package/pipeline/skills/shared/external/debugging-instruments/references/instruments-guide.md +167 -315
  88. package/pipeline/skills/shared/external/debugging-instruments/references/lldb-patterns.md +140 -193
  89. package/pipeline/skills/shared/external/device-integrity/SKILL.md +230 -353
  90. package/pipeline/skills/shared/external/device-integrity/evals/evals.json +25 -21
  91. package/pipeline/skills/shared/external/device-integrity/references/device-integrity-patterns.md +159 -197
  92. package/pipeline/skills/shared/external/energykit/SKILL.md +225 -392
  93. package/pipeline/skills/shared/external/energykit/evals/evals.json +29 -28
  94. package/pipeline/skills/shared/external/energykit/references/energykit-patterns.md +174 -470
  95. package/pipeline/skills/shared/external/eventkit-calendar/SKILL.md +261 -383
  96. package/pipeline/skills/shared/external/eventkit-calendar/evals/evals.json +25 -22
  97. package/pipeline/skills/shared/external/eventkit-calendar/references/eventkit-patterns.md +165 -268
  98. package/pipeline/skills/shared/external/evidence-github/SKILL.md +2 -0
  99. package/pipeline/skills/shared/external/evidence-registry/SKILL.md +2 -0
  100. package/pipeline/skills/shared/external/gradle-kotlin-dsl/SKILL.md +2 -0
  101. package/pipeline/skills/shared/external/healthkit/SKILL.md +252 -303
  102. package/pipeline/skills/shared/external/healthkit/evals/evals.json +24 -23
  103. package/pipeline/skills/shared/external/healthkit/references/healthkit-patterns.md +369 -523
  104. package/pipeline/skills/shared/external/homekit-matter/SKILL.md +233 -348
  105. package/pipeline/skills/shared/external/homekit-matter/evals/evals.json +27 -22
  106. package/pipeline/skills/shared/external/homekit-matter/references/matter-commissioning.md +199 -305
  107. package/pipeline/skills/shared/external/html-semantic/SKILL.md +1 -0
  108. package/pipeline/skills/shared/external/humanizer/SKILL.md +1 -0
  109. package/pipeline/skills/shared/external/ios-accessibility/SKILL.md +368 -340
  110. package/pipeline/skills/shared/external/ios-accessibility/evals/evals.json +28 -27
  111. package/pipeline/skills/shared/external/ios-accessibility/references/a11y-patterns.md +314 -260
  112. package/pipeline/skills/shared/external/ios-accessibility/references/media-accessibility.md +97 -67
  113. package/pipeline/skills/shared/external/ios-accessibility/references/nutrition-labels.md +165 -101
  114. package/pipeline/skills/shared/external/ios-coding-standard/SKILL.md +1 -0
  115. package/pipeline/skills/shared/external/ios-localization/SKILL.md +258 -371
  116. package/pipeline/skills/shared/external/ios-localization/evals/evals.json +23 -23
  117. package/pipeline/skills/shared/external/ios-localization/references/formatstyle-locale.md +283 -491
  118. package/pipeline/skills/shared/external/ios-localization/references/string-catalogs.md +313 -440
  119. package/pipeline/skills/shared/external/ios-module-structure/SKILL.md +1 -0
  120. package/pipeline/skills/shared/external/ios-networking/SKILL.md +265 -341
  121. package/pipeline/skills/shared/external/ios-networking/evals/evals.json +24 -24
  122. package/pipeline/skills/shared/external/ios-networking/references/background-websocket.md +425 -652
  123. package/pipeline/skills/shared/external/ios-networking/references/file-storage-patterns.md +143 -285
  124. package/pipeline/skills/shared/external/ios-networking/references/lightweight-clients.md +93 -53
  125. package/pipeline/skills/shared/external/ios-networking/references/network-framework.md +231 -456
  126. package/pipeline/skills/shared/external/ios-networking/references/urlsession-patterns.md +517 -784
  127. package/pipeline/skills/shared/external/ios-security/SKILL.md +2 -0
  128. package/pipeline/skills/shared/external/ios-simulator/SKILL.md +265 -393
  129. package/pipeline/skills/shared/external/ios-simulator/evals/evals.json +21 -21
  130. package/pipeline/skills/shared/external/ios-simulator/references/simctl-commands.md +177 -270
  131. package/pipeline/skills/shared/external/live-activities/SKILL.md +318 -360
  132. package/pipeline/skills/shared/external/live-activities/evals/evals.json +21 -21
  133. package/pipeline/skills/shared/external/live-activities/references/activitykit-patterns.md +478 -710
  134. package/pipeline/skills/shared/external/localization-reuse-map/SKILL.md +91 -283
  135. package/pipeline/skills/shared/external/localization-reuse-map/reference/format-and-output.md +119 -151
  136. package/pipeline/skills/shared/external/localization-reuse-map/reference/publish-and-snapshot.md +60 -90
  137. package/pipeline/skills/shared/external/localization-reuse-map/reference/sources-and-recipes.md +119 -156
  138. package/pipeline/skills/shared/external/localization-reuse-map/scripts/build-artifact.py +726 -787
  139. package/pipeline/skills/shared/external/localization-reuse-map/scripts/build-spreadsheet.py +253 -288
  140. package/pipeline/skills/shared/external/localization-reuse-map/scripts/fetch-annotations.py +243 -304
  141. package/pipeline/skills/shared/external/localization-reuse-map/scripts/fetch-legacy-labels.py +88 -104
  142. package/pipeline/skills/shared/external/localization-reuse-map/scripts/publish-confluence.py +181 -235
  143. package/pipeline/skills/shared/external/localization-reuse-map/scripts/render-key-shots.py +198 -263
  144. package/pipeline/skills/shared/external/localization-reuse-map/scripts/render-overlay.py +461 -466
  145. package/pipeline/skills/shared/external/localization-reuse-map/scripts/resolve-legacy-values.py +145 -151
  146. package/pipeline/skills/shared/external/localization-reuse-map/scripts/resolve-new-values.py +123 -141
  147. package/pipeline/skills/shared/external/localization-reuse-map/scripts/scan-screen-keys.py +146 -157
  148. package/pipeline/skills/shared/external/localization-reuse-map/scripts/snapshot-resources.sh +22 -19
  149. package/pipeline/skills/shared/external/localization-reuse-map/scripts/verify-map.py +156 -140
  150. package/pipeline/skills/shared/external/mapkit-location/SKILL.md +295 -267
  151. package/pipeline/skills/shared/external/mapkit-location/evals/evals.json +28 -24
  152. package/pipeline/skills/shared/external/mapkit-location/references/mapkit-corelocation-patterns.md +378 -532
  153. package/pipeline/skills/shared/external/mapkit-location/references/mapkit-patterns.md +397 -499
  154. package/pipeline/skills/shared/external/metrickit-diagnostics/SKILL.md +165 -348
  155. package/pipeline/skills/shared/external/metrickit-diagnostics/evals/evals.json +26 -23
  156. package/pipeline/skills/shared/external/metrickit-diagnostics/references/metrickit-patterns.md +123 -130
  157. package/pipeline/skills/shared/external/musickit-audio/SKILL.md +189 -315
  158. package/pipeline/skills/shared/external/musickit-audio/evals/evals.json +22 -21
  159. package/pipeline/skills/shared/external/musickit-audio/references/musickit-patterns.md +181 -270
  160. package/pipeline/skills/shared/external/natural-language/SKILL.md +188 -340
  161. package/pipeline/skills/shared/external/natural-language/evals/evals.json +21 -21
  162. package/pipeline/skills/shared/external/natural-language/references/translation-patterns.md +171 -225
  163. package/pipeline/skills/shared/external/nextjs-app-router/SKILL.md +1 -0
  164. package/pipeline/skills/shared/external/passkit-wallet/SKILL.md +258 -392
  165. package/pipeline/skills/shared/external/passkit-wallet/evals/evals.json +30 -29
  166. package/pipeline/skills/shared/external/passkit-wallet/references/wallet-passes.md +164 -231
  167. package/pipeline/skills/shared/external/pdfkit/SKILL.md +312 -344
  168. package/pipeline/skills/shared/external/pdfkit/evals/evals.json +19 -19
  169. package/pipeline/skills/shared/external/pdfkit/references/pdfkit-patterns.md +413 -624
  170. package/pipeline/skills/shared/external/pencilkit-drawing/SKILL.md +242 -358
  171. package/pipeline/skills/shared/external/pencilkit-drawing/evals/evals.json +25 -21
  172. package/pipeline/skills/shared/external/pencilkit-drawing/references/pencilkit-patterns.md +161 -226
  173. package/pipeline/skills/shared/external/permissionkit/SKILL.md +282 -400
  174. package/pipeline/skills/shared/external/permissionkit/evals/evals.json +27 -30
  175. package/pipeline/skills/shared/external/permissionkit/references/permissionkit-patterns.md +237 -350
  176. package/pipeline/skills/shared/external/photos-camera-media/SKILL.md +276 -325
  177. package/pipeline/skills/shared/external/photos-camera-media/references/av-playback.md +299 -545
  178. package/pipeline/skills/shared/external/photos-camera-media/references/camera-capture.md +344 -588
  179. package/pipeline/skills/shared/external/photos-camera-media/references/image-loading-caching.md +316 -660
  180. package/pipeline/skills/shared/external/photos-camera-media/references/photokit-patterns.md +270 -416
  181. package/pipeline/skills/shared/external/play-store-review/SKILL.md +2 -0
  182. package/pipeline/skills/shared/external/push-notifications/SKILL.md +312 -340
  183. package/pipeline/skills/shared/external/push-notifications/evals/evals.json +27 -26
  184. package/pipeline/skills/shared/external/push-notifications/references/notification-patterns.md +328 -485
  185. package/pipeline/skills/shared/external/push-notifications/references/rich-notifications.md +327 -560
  186. package/pipeline/skills/shared/external/python-patterns/SKILL.md +1 -0
  187. package/pipeline/skills/shared/external/react-best-practices/SKILL.md +1 -0
  188. package/pipeline/skills/shared/external/realitykit-ar/SKILL.md +218 -410
  189. package/pipeline/skills/shared/external/realitykit-ar/evals/evals.json +24 -27
  190. package/pipeline/skills/shared/external/realitykit-ar/references/realitykit-patterns.md +221 -348
  191. package/pipeline/skills/shared/external/rest-api-design/SKILL.md +1 -0
  192. package/pipeline/skills/shared/external/retrofit-networking/SKILL.md +2 -0
  193. package/pipeline/skills/shared/external/room-database/SKILL.md +2 -0
  194. package/pipeline/skills/shared/external/search-first/SKILL.md +1 -0
  195. package/pipeline/skills/shared/external/shareplay-activities/SKILL.md +222 -393
  196. package/pipeline/skills/shared/external/shareplay-activities/evals/evals.json +23 -24
  197. package/pipeline/skills/shared/external/shareplay-activities/references/shareplay-patterns.md +280 -420
  198. package/pipeline/skills/shared/external/signal-community/SKILL.md +2 -0
  199. package/pipeline/skills/shared/external/skill-creator/SKILL.md +80 -41
  200. package/pipeline/skills/shared/external/skill-creator/audit.md +63 -59
  201. package/pipeline/skills/shared/external/skill-creator/checklist.md +28 -20
  202. package/pipeline/skills/shared/external/skill-creator/examples.md +40 -40
  203. package/pipeline/skills/shared/external/skill-creator/label-check.md +48 -36
  204. package/pipeline/skills/shared/external/skill-creator/scripts/audit-panel.js +91 -100
  205. package/pipeline/skills/shared/external/skill-creator/template.md +51 -39
  206. package/pipeline/skills/shared/external/speech-recognition/SKILL.md +217 -421
  207. package/pipeline/skills/shared/external/speech-recognition/evals/evals.json +23 -26
  208. package/pipeline/skills/shared/external/speech-recognition/references/speechanalyzer-patterns.md +133 -125
  209. package/pipeline/skills/shared/external/storekit/SKILL.md +228 -204
  210. package/pipeline/skills/shared/external/storekit/evals/evals.json +27 -24
  211. package/pipeline/skills/shared/external/storekit/references/app-review-guidelines.md +98 -109
  212. package/pipeline/skills/shared/external/storekit/references/core-patterns.md +298 -242
  213. package/pipeline/skills/shared/external/storekit/references/storekit-advanced.md +356 -649
  214. package/pipeline/skills/shared/external/swift-api-design-guidelines/SKILL.md +274 -399
  215. package/pipeline/skills/shared/external/swift-api-design-guidelines/evals/evals.json +22 -24
  216. package/pipeline/skills/shared/external/swift-api-design-guidelines/references/argument-labels-and-parameters.md +107 -108
  217. package/pipeline/skills/shared/external/swift-api-design-guidelines/references/conventions-and-special-rules.md +93 -165
  218. package/pipeline/skills/shared/external/swift-api-design-guidelines/references/naming-and-clarity.md +99 -137
  219. package/pipeline/skills/shared/external/swift-api-design-guidelines/references/side-effects-and-mutating-pairs.md +77 -120
  220. package/pipeline/skills/shared/external/swift-architecture/SKILL.md +334 -350
  221. package/pipeline/skills/shared/external/swift-architecture/evals/evals.json +22 -22
  222. package/pipeline/skills/shared/external/swift-charts/SKILL.md +208 -394
  223. package/pipeline/skills/shared/external/swift-charts/evals/evals.json +27 -30
  224. package/pipeline/skills/shared/external/swift-charts/references/charts-patterns.md +351 -762
  225. package/pipeline/skills/shared/external/swift-codable/SKILL.md +339 -343
  226. package/pipeline/skills/shared/external/swift-codable/evals/evals.json +20 -20
  227. package/pipeline/skills/shared/external/swift-concurrency/SKILL.md +303 -351
  228. package/pipeline/skills/shared/external/swift-concurrency/evals/evals.json +27 -24
  229. package/pipeline/skills/shared/external/swift-concurrency/references/approachable-concurrency.md +65 -80
  230. package/pipeline/skills/shared/external/swift-concurrency/references/async-algorithms.md +48 -84
  231. package/pipeline/skills/shared/external/swift-concurrency/references/bridging-interop.md +134 -79
  232. package/pipeline/skills/shared/external/swift-concurrency/references/concurrency-patterns.md +145 -167
  233. package/pipeline/skills/shared/external/swift-concurrency/references/diagnostics.md +62 -50
  234. package/pipeline/skills/shared/external/swift-concurrency/references/swiftui-concurrency.md +92 -121
  235. package/pipeline/skills/shared/external/swift-concurrency/references/synchronization-primitives.md +177 -241
  236. package/pipeline/skills/shared/external/swift-formatstyle/SKILL.md +258 -234
  237. package/pipeline/skills/shared/external/swift-language/SKILL.md +342 -382
  238. package/pipeline/skills/shared/external/swift-language/evals/evals.json +24 -27
  239. package/pipeline/skills/shared/external/swift-language/references/swift-attributes-interop.md +79 -56
  240. package/pipeline/skills/shared/external/swift-language/references/swift-patterns-extended.md +297 -340
  241. package/pipeline/skills/shared/external/swift-security/SKILL.md +180 -161
  242. package/pipeline/skills/shared/external/swift-security/evals/evals.json +25 -25
  243. package/pipeline/skills/shared/external/swift-security/references/biometric-authentication.md +314 -469
  244. package/pipeline/skills/shared/external/swift-security/references/certificate-trust.md +408 -476
  245. package/pipeline/skills/shared/external/swift-security/references/common-anti-patterns.md +260 -530
  246. package/pipeline/skills/shared/external/swift-security/references/compliance-owasp-mapping.md +270 -477
  247. package/pipeline/skills/shared/external/swift-security/references/credential-storage-patterns.md +573 -571
  248. package/pipeline/skills/shared/external/swift-security/references/cryptokit-public-key.md +370 -441
  249. package/pipeline/skills/shared/external/swift-security/references/cryptokit-symmetric.md +332 -433
  250. package/pipeline/skills/shared/external/swift-security/references/keychain-access-control.md +346 -468
  251. package/pipeline/skills/shared/external/swift-security/references/keychain-fundamentals.md +352 -472
  252. package/pipeline/skills/shared/external/swift-security/references/keychain-item-classes.md +431 -432
  253. package/pipeline/skills/shared/external/swift-security/references/keychain-sharing.md +328 -425
  254. package/pipeline/skills/shared/external/swift-security/references/migration-legacy-stores.md +341 -579
  255. package/pipeline/skills/shared/external/swift-security/references/secure-enclave.md +396 -457
  256. package/pipeline/skills/shared/external/swift-security/references/testing-security-code.md +354 -614
  257. package/pipeline/skills/shared/external/swift-testing/SKILL.md +188 -175
  258. package/pipeline/skills/shared/external/swift-testing/evals/evals.json +26 -24
  259. package/pipeline/skills/shared/external/swift-testing/references/testing-advanced.md +80 -84
  260. package/pipeline/skills/shared/external/swift-testing/references/testing-patterns.md +317 -433
  261. package/pipeline/skills/shared/external/swiftdata/SKILL.md +392 -256
  262. package/pipeline/skills/shared/external/swiftdata/evals/evals.json +24 -24
  263. package/pipeline/skills/shared/external/swiftdata/references/core-data-coexistence.md +206 -402
  264. package/pipeline/skills/shared/external/swiftdata/references/indexing.md +59 -52
  265. package/pipeline/skills/shared/external/swiftdata/references/predicate-pitfalls.md +57 -33
  266. package/pipeline/skills/shared/external/swiftdata/references/swiftdata-advanced.md +354 -747
  267. package/pipeline/skills/shared/external/swiftdata/references/swiftdata-queries.md +300 -508
  268. package/pipeline/skills/shared/external/swiftlint/SKILL.md +175 -226
  269. package/pipeline/skills/shared/external/swiftlint/references/adoption-and-configuration.md +141 -208
  270. package/pipeline/skills/shared/external/swiftlint/references/custom-rules-and-analyze.md +100 -109
  271. package/pipeline/skills/shared/external/swiftlint/references/plugins-run-scripts-and-integrations.md +159 -179
  272. package/pipeline/skills/shared/external/swiftlint/references/rule-reference.md +383 -18
  273. package/pipeline/skills/shared/external/swiftlint/references/rules-suppressions-and-baselines.md +143 -229
  274. package/pipeline/skills/shared/external/swiftui-animation/SKILL.md +283 -366
  275. package/pipeline/skills/shared/external/swiftui-animation/references/animation-advanced.md +396 -608
  276. package/pipeline/skills/shared/external/swiftui-animation/references/core-animation-bridge.md +336 -385
  277. package/pipeline/skills/shared/external/swiftui-gestures/SKILL.md +239 -349
  278. package/pipeline/skills/shared/external/swiftui-gestures/references/gesture-patterns.md +228 -310
  279. package/pipeline/skills/shared/external/swiftui-layout-components/SKILL.md +260 -249
  280. package/pipeline/skills/shared/external/swiftui-layout-components/references/form.md +92 -74
  281. package/pipeline/skills/shared/external/swiftui-layout-components/references/grids.md +112 -177
  282. package/pipeline/skills/shared/external/swiftui-layout-components/references/list.md +61 -64
  283. package/pipeline/skills/shared/external/swiftui-layout-components/references/scrollview.md +94 -134
  284. package/pipeline/skills/shared/external/swiftui-liquid-glass/SKILL.md +193 -225
  285. package/pipeline/skills/shared/external/swiftui-liquid-glass/references/liquid-glass.md +173 -327
  286. package/pipeline/skills/shared/external/swiftui-navigation/SKILL.md +193 -168
  287. package/pipeline/skills/shared/external/swiftui-navigation/references/deeplinks.md +127 -150
  288. package/pipeline/skills/shared/external/swiftui-navigation/references/navigationstack.md +132 -133
  289. package/pipeline/skills/shared/external/swiftui-navigation/references/sheets.md +152 -117
  290. package/pipeline/skills/shared/external/swiftui-navigation/references/tabview.md +106 -140
  291. package/pipeline/skills/shared/external/swiftui-patterns/SKILL.md +316 -252
  292. package/pipeline/skills/shared/external/swiftui-patterns/references/architecture-patterns.md +341 -332
  293. package/pipeline/skills/shared/external/swiftui-patterns/references/deprecated-migration.md +547 -854
  294. package/pipeline/skills/shared/external/swiftui-patterns/references/design-polish.md +485 -537
  295. package/pipeline/skills/shared/external/swiftui-patterns/references/platform-and-sharing.md +417 -499
  296. package/pipeline/skills/shared/external/swiftui-performance/SKILL.md +213 -376
  297. package/pipeline/skills/shared/external/swiftui-performance/references/demystify-swiftui-performance-wwdc23.md +86 -175
  298. package/pipeline/skills/shared/external/swiftui-performance/references/optimizing-swiftui-performance-instruments.md +89 -195
  299. package/pipeline/skills/shared/external/swiftui-performance/references/understanding-hangs-in-your-app.md +95 -182
  300. package/pipeline/skills/shared/external/swiftui-performance/references/understanding-improving-swiftui-performance.md +71 -149
  301. package/pipeline/skills/shared/external/swiftui-performance/references/wwdc-session-sources.md +21 -27
  302. package/pipeline/skills/shared/external/swiftui-uikit-interop/SKILL.md +303 -295
  303. package/pipeline/skills/shared/external/swiftui-uikit-interop/references/hosting-migration.md +204 -387
  304. package/pipeline/skills/shared/external/swiftui-uikit-interop/references/representable-recipes.md +469 -683
  305. package/pipeline/skills/shared/external/swiftui-webkit/SKILL.md +140 -186
  306. package/pipeline/skills/shared/external/swiftui-webkit/references/loading-and-observation.md +75 -86
  307. package/pipeline/skills/shared/external/swiftui-webkit/references/local-content-and-custom-schemes.md +63 -60
  308. package/pipeline/skills/shared/external/swiftui-webkit/references/migration-and-fallbacks.md +69 -137
  309. package/pipeline/skills/shared/external/swiftui-webkit/references/navigation-and-javascript.md +95 -67
  310. package/pipeline/skills/shared/external/tailwind-css/SKILL.md +1 -0
  311. package/pipeline/skills/shared/external/testing-backend/SKILL.md +1 -0
  312. package/pipeline/skills/shared/external/tipkit/SKILL.md +220 -335
  313. package/pipeline/skills/shared/external/tipkit/references/tipkit-patterns.md +356 -494
  314. package/pipeline/skills/shared/external/typescript-patterns/SKILL.md +1 -0
  315. package/pipeline/skills/shared/external/vision-framework/SKILL.md +260 -375
  316. package/pipeline/skills/shared/external/vision-framework/references/vision-requests.md +393 -515
  317. package/pipeline/skills/shared/external/vision-framework/references/visionkit-scanner.md +363 -539
  318. package/pipeline/skills/shared/external/vue-composition/SKILL.md +1 -0
  319. package/pipeline/skills/shared/external/weatherkit/SKILL.md +152 -310
  320. package/pipeline/skills/shared/external/weatherkit/references/weatherkit-patterns.md +288 -407
  321. package/pipeline/skills/shared/external/web-accessibility/SKILL.md +1 -0
  322. package/pipeline/skills/shared/external/web-performance/SKILL.md +1 -0
  323. package/pipeline/skills/shared/external/web-testing/SKILL.md +1 -0
  324. package/pipeline/skills/shared/external/widgetkit/SKILL.md +216 -288
  325. package/pipeline/skills/shared/external/widgetkit/references/widgetkit-advanced.md +414 -719
  326. package/pipeline/skills/shared/external/NOTICE-swift-ios-skills.md +0 -39
@@ -1,451 +1,326 @@
1
1
  ---
2
2
  name: swift-api-design-guidelines
3
- description: "Swift API Design Guidelines: clarity at the point of use, naming for readability over brevity, argument labels and prepositional phrases, method vs property choice, mutating/nonmutating pairs, protocol naming, generic parameter names, and documentation comment conventions. Use when naming a type, method or parameter, deciding between a method and a property, writing doc comments, or reviewing an API surface for consistency with the standard library."
3
+ description: "Swift API Design Guidelines: call-site clarity over brevity, argument labels and prepositions, method versus property, side-effect naming, mutating and nonmutating pairs, make factories, protocol and generic parameter names, casing, doc comments, complexity notes. Use when naming types, methods, properties or parameters, writing doc comments or reviewing an API for standard-library consistency. Not for language features, concurrency or lint config."
4
4
  metadata:
5
- source: "dpearson2699/swift-ios-skills (PolyForm Perimeter 1.0.0)"
5
+ source: multi-agent-pipeline
6
6
  ---
7
7
 
8
8
  # Swift API Design Guidelines
9
9
 
10
- Apply the Swift API Design Guidelines when naming types, methods, properties, parameters, and argument labels. Targets Swift 6.3. For language features and syntax, see `swift-language`. For concurrency patterns, see `swift-concurrency`. For mixed requests, answer the API naming portion briefly, then route Swift type-system details to `swift-language` and lint configuration to `swiftlint` instead of implementing those sibling domains here.
11
-
12
- ## Contents
13
-
14
- - [Argument Label Rules](#argument-label-rules)
15
- - [Side-Effect Naming](#side-effect-naming)
16
- - [Mutating and Nonmutating Pairs](#mutating-and-nonmutating-pairs)
17
- - [Documentation Comments](#documentation-comments)
18
- - [Clarity and Naming](#clarity-and-naming)
19
- - [Fluent Usage and Protocols](#fluent-usage-and-protocols)
20
- - [General Conventions](#general-conventions)
21
- - [Common Mistakes](#common-mistakes)
22
- - [Review Checklist](#review-checklist)
23
- - [References](#references)
24
-
25
- ## Argument Label Rules
26
-
27
- Argument labels determine how a call site reads. Apply these rules in order.
28
-
29
- ### When to omit the first argument label
30
-
31
- **Grammatical phrase rule.** When the first argument forms a grammatical phrase with the base name, omit the label. Move any leading words from what would be the label into the base name instead.
32
-
33
- ```swift
34
- // GOOD - reads as "add subview y"
35
- view.addSubview(y)
36
-
37
- // BAD - redundant label breaks the phrase
38
- view.add(subview: y)
39
- ```
40
-
41
- **Value-preserving type conversions.** When an initializer performs a value-preserving (widening) conversion, omit the first argument label.
42
-
43
- ```swift
44
- // GOOD - widening conversion, no label
45
- let value = Int64(someUInt32)
46
- let str = String(someCharacter)
47
-
48
- // Narrowing or lossy conversions keep a label
49
- let approx = Int64(truncating: someDecimal)
50
- let str = String(describing: someObject)
51
- ```
52
-
53
- **Indistinguishable arguments.** When all arguments cannot be usefully distinguished, omit all labels.
54
-
55
- ```swift
56
- // GOOD - arguments are peers
57
- let smaller = min(x, y)
58
- zip(sequence1, sequence2)
59
- ```
60
-
61
- ### When to use a prepositional label
62
-
63
- **Prepositional phrase rule.** When the first argument completes a prepositional phrase with the base name, label it with the preposition.
64
-
65
- ```swift
66
- // GOOD - "remove boxes having length 12"
67
- x.removeBoxes(havingLength: 12)
68
-
69
- // GOOD - "fade from red"
70
- view.fade(from: red)
71
-
72
- // GOOD - "relative path from root"
73
- path.relativePath(from: root)
74
- ```
75
-
76
- **Exception - abstraction boundary.** When the first two arguments represent parts of a single abstraction, fold the preposition into the base name so each component gets its own label.
77
-
78
- ```swift
79
- // GOOD - x and y are parts of a single abstraction (a point)
80
- a.moveTo(x: b, y: c)
81
-
82
- // BAD - preposition attaches to first arg, leaving y unlabeled
83
- a.move(toX: b, y: c)
84
- ```
85
-
86
- ### Default: label everything else
87
-
88
- When no special rule above applies, label the argument.
89
-
90
- ```swift
91
- // GOOD
92
- array.split(maxSplits: 2)
93
- button.setTitle("OK", for: .normal)
94
- controller.dismiss(animated: true)
95
- array.sorted(by: >)
96
- ```
97
-
98
- ### Argument label decision table
10
+ Use this when choosing names for types, methods, properties, parameters and
11
+ argument labels, and when writing the doc comments that go with them. Baseline:
12
+ Swift 6.3.
13
+
14
+ Out of scope, with where it goes instead:
15
+
16
+ - Language features and syntax, such as `some` versus `any`: `swift-language`.
17
+ - Concurrency: `swift-concurrency`.
18
+ - Lint rules and configuration: `swiftlint`.
19
+
20
+ When a request mixes these, answer the naming part briefly, then point to the
21
+ sibling skill for the rest. Do not start implementing the sibling's domain.
22
+
23
+ ## Argument labels
24
+
25
+ Decide the first argument's label by testing these in order; the first rule
26
+ that applies wins.
27
+
28
+ 1. **Grammatical phrase.** If the first argument reads as part of a phrase that
29
+ starts in the base name, drop its label and move any leading words into the
30
+ base name: `addSubview(y)`, not `add(subview: y)`.
31
+ 2. **Conversion initializer.** A value-preserving (widening) conversion takes
32
+ no first label: `Int64(someUInt32)`, `String(someCharacter)`. A narrowing
33
+ or lossy one keeps a label that says so: `Int64(truncating:)`,
34
+ `String(describing:)`.
35
+ 3. **Indistinguishable peers.** When the arguments cannot usefully be told
36
+ apart, label none of them: `min(x, y)`, `zip(names, scores)`.
37
+ 4. **Prepositional phrase.** When the base name ends in a preposition that the
38
+ first argument finishes, the preposition becomes the label: `removeBoxes(havingLength: 12)`,
39
+ `fade(from: red)`, `relativePath(from: root)`.
40
+ 5. **One abstraction, several arguments.** If the first two arguments are parts
41
+ of a single idea, keep the preposition in the base name so each part gets
42
+ its own label: `moveTo(x: b, y: c)`, not `move(toX: b, y: c)`.
43
+ 6. **Otherwise, label it:** `split(maxSplits: 2)`, `setTitle("OK", for: .normal)`,
44
+ `dismiss(animated: true)`, `sorted(by: >)`.
99
45
 
100
46
  | Situation | Rule | Example |
101
- |-----------|------|---------|
102
- | First arg completes grammatical phrase | Omit label, merge words into base name | `addSubview(y)` |
103
- | Value-preserving init conversion | Omit first label | `Int64(someUInt32)` |
104
- | Arguments are indistinguishable peers | Omit all labels | `min(x, y)` |
105
- | First arg completes prepositional phrase | Label with preposition | `fade(from: red)` |
106
- | First two args form a single abstraction | Fold preposition into base name | `moveTo(x: b, y: c)` |
107
- | Everything else | Label it | `split(maxSplits: 2)` |
108
-
109
- For extended examples and edge cases, see [references/argument-labels-and-parameters.md](references/argument-labels-and-parameters.md).
110
-
111
- ## Side-Effect Naming
47
+ |---|---|---|
48
+ | Reads as a grammatical phrase | no label; merge words into the base name | `addSubview(y)` |
49
+ | Value-preserving init | no first label | `Int64(someUInt32)` |
50
+ | Peers | no labels | `min(x, y)` |
51
+ | Prepositional phrase | preposition is the label | `fade(from: red)` |
52
+ | Two args, one abstraction | preposition in the base name | `cellAt(row:column:)` |
53
+ | Anything else | label | `split(maxSplits: 2)` |
112
54
 
113
- Name functions and methods by their side effects.
55
+ Edge cases, conversion kinds, parameter names and default arguments:
56
+ [the argument labels reference](references/argument-labels-and-parameters.md).
114
57
 
115
- ### Functions with side effects - imperative verbs
58
+ ## Method or property
116
59
 
117
- When a function mutates state, name it as an imperative verb phrase.
60
+ A property answers a question about the receiver. Make it a property when it
61
+ takes no arguments, has no side effects and cannot fail; callers will assume
62
+ it is cheap, so if it is not O(1), document the cost. Make it a method when it
63
+ needs input, changes state, can throw or suspend, or does work heavy enough
64
+ that a property would mislead.
118
65
 
119
66
  ```swift
120
- // Mutates - imperative verb
121
- array.sort()
122
- array.append(newElement)
123
- list.remove(at: index)
124
- timer.invalidate()
125
- ```
126
-
127
- ### Functions without side effects - nouns or adjective phrases
128
-
129
- When a function returns a result without mutating anything, name it as a noun phrase, adjective phrase, or read as a description of what it returns.
130
-
131
- ```swift
132
- // Pure - noun/description
133
- let d = point.distance(to: origin)
134
- let area = rect.intersection(other)
135
- let line = text.trimmingCharacters(in: .whitespaces)
136
- ```
137
-
138
- ### Boolean properties and methods
139
-
140
- Boolean properties and methods read as assertions about the receiver.
141
-
142
- ```swift
143
- // GOOD - reads as "line is empty"
144
- line.isEmpty
145
- set.contains(element)
146
- url.isFileURL
147
-
148
- // BAD - not an assertion
149
- line.empty // verb? adjective?
150
- set.includes // incomplete phrase
67
+ protocol TrackList {
68
+ var trackCount: Int { get } // a fact about the receiver
69
+ var isEmpty: Bool { get }
70
+ func tracks(by artist: Artist) -> [Track] // needs input
71
+ mutating func shuffle() // changes state
72
+ func loadArtwork() async throws -> Image // real work that can fail
73
+ }
151
74
  ```
152
75
 
153
- For more examples, see [references/side-effects-and-mutating-pairs.md](references/side-effects-and-mutating-pairs.md).
154
-
155
- ## Mutating and Nonmutating Pairs
76
+ More in [the naming reference](references/naming-and-clarity.md).
156
77
 
157
- When an operation has both mutating and nonmutating variants, name them as a pair.
78
+ ## Naming by side effect
158
79
 
159
- ### Verb-described operations - -ed/-ing suffix
80
+ - **Mutating** operations are imperative verb phrases: `sort()`,
81
+ `append(newElement)`, `remove(at:)`, `invalidate()`.
82
+ - **Non-mutating** operations read as noun phrases, adjective phrases or a
83
+ description of what comes back: `distance(to:)`, `intersection(_:)`,
84
+ `trimmingCharacters(in:)`.
85
+ - **Booleans** should state something true or false about the receiver: `isEmpty`,
86
+ `contains(_:)`, `isFileURL`. Avoid `empty` (verb or adjective?) and
87
+ `includes` (an unfinished phrase).
160
88
 
161
- When the operation is naturally described by a verb:
162
- - **Mutating:** imperative verb (`sort`, `append`, `reverse`)
163
- - **Nonmutating:** past participle `-ed` or present participle `-ing`
89
+ ### Mutating and non-mutating pairs
164
90
 
165
- Default to `-ed` (past participle) when the phrase naturally describes the returned value. Use `-ing` (present participle) only when the `-ed` form is ungrammatical or describes the direct object rather than the returned receiver or result. A direct object is a clue to check the grammar, not the rule by itself.
91
+ When both forms exist, name them as a pair.
166
92
 
167
- | Mutating | Nonmutating | Why |
168
- |----------|-------------|-----|
169
- | `sort()` | `sorted()` | `-ed` - "a sorted array" |
170
- | `reverse()` | `reversed()` | `-ed` - "a reversed collection" |
171
- | `sortLines()` | `sortedLines()` | `-ed` - "sorted lines" describes the result |
172
- | `append(y)` | `appending(y)` | `-ing` - `appended` does not describe the returned receiver clearly |
173
- | `stripNewlines()` | `strippingNewlines()` | `-ing` - direct-object pattern from the guidelines |
93
+ **Verb operations.** The mutating form is the imperative verb. The
94
+ non-mutating form adds `-ed` by default, when "a [verb]-ed [noun]" describes
95
+ the result. Fall back to `-ing` only when `-ed` is ungrammatical or would
96
+ describe the direct object instead of the returned value. A direct object is a
97
+ hint to run that grammar check, not a rule by itself.
174
98
 
175
- ### Noun-described operations - form- prefix
99
+ | Mutating | Non-mutating | Why |
100
+ |---|---|---|
101
+ | `sort()` | `sorted()` | `-ed` default |
102
+ | `reverse()` | `reversed()` | `-ed` default |
103
+ | `sortLines()` | `sortedLines()` | `-ed` describes the result |
104
+ | `append(y)` | `appending(y)` | `appended` would not describe the returned receiver |
105
+ | `stripNewlines()` | `strippingNewlines()` | `-ed` would name the removed newlines |
176
106
 
177
- When the operation is naturally described by a noun:
178
- - **Nonmutating:** the noun itself (`union`, `intersection`)
179
- - **Mutating:** `form` prefix (`formUnion`, `formIntersection`)
107
+ **Noun operations.** The non-mutating form is the noun; the mutating form
108
+ takes a `form` prefix:
180
109
 
181
110
  ```swift
182
- // Nonmutating - returns new value
183
- let combined = a.union(b)
184
-
185
- // Mutating - modifies in place
186
- a.formUnion(b)
111
+ let both = weekdays.union(weekend) // new value
112
+ weekdays.formUnion(weekend) // in place
187
113
  ```
188
114
 
189
- ### Factory methods - make- prefix
190
-
191
- Factory methods that create a new value start with `make`.
192
-
193
- ```swift
194
- let iterator = collection.makeIterator()
195
- let buffer = parser.makeBuffer()
196
- ```
197
-
198
- In mixed routing answers, briefly validate existing `make...` factory names before handing off unrelated type-system or linting details to sibling skills.
199
-
200
- ### Pair decision table
201
-
202
- | Operation described by | Mutating name | Nonmutating name | Example pair |
203
- |------------------------|---------------|-------------------|-------------|
204
- | Verb (default) | verb | verb + `-ed` | `sort()` / `sorted()` |
205
- | Verb (`-ed` is ungrammatical) | verb | verb + `-ing` | `stripNewlines()` / `strippingNewlines()` |
206
- | Noun | `form` + Noun | noun | `formUnion(b)` / `union(b)` |
207
-
208
- For the full -ed/-ing decision tree and expanded naming patterns, see [references/side-effects-and-mutating-pairs.md](references/side-effects-and-mutating-pairs.md).
115
+ | Kind | Mutating | Non-mutating |
116
+ |---|---|---|
117
+ | Verb (default) | verb | verb + `-ed` |
118
+ | Verb where `-ed` fails | verb | verb + `-ing` |
119
+ | Noun | `form` + Noun | noun |
209
120
 
210
- ## Documentation Comments
121
+ **Factories** get a `make` prefix whenever they produce a fresh value: `makeIterator()`,
122
+ `makeBuffer()`. If a mixed request already uses `make...` names, confirm them
123
+ in a line before routing the rest.
211
124
 
212
- Every public declaration must have a documentation comment.
125
+ Decision tree, `form` rules, Boolean and factory patterns:
126
+ [the side-effects reference](references/side-effects-and-mutating-pairs.md).
213
127
 
214
- ### Summary rules by declaration kind
128
+ ## Documentation comments
215
129
 
216
- | Declaration | Summary describes |
217
- |-------------|-------------------|
218
- | Function / method | What it does and what it returns |
219
- | Subscript | What it accesses |
220
- | Initializer | What it creates |
221
- | Type / property / variable | What it **is** |
130
+ Every public declaration gets one. The summary is a single sentence fragment
131
+ ending in a period, starting with a verb for actions and a noun phrase for
132
+ entities. What it says depends on the declaration:
222
133
 
223
- Write summaries as a single sentence fragment, beginning with a verb (for actions) or a noun phrase (for entities), ending in a period.
134
+ | Declaration | Summary says |
135
+ |---|---|
136
+ | function or method | the action and its result |
137
+ | subscript | what it accesses |
138
+ | initializer | what it creates |
139
+ | type, property, variable | the thing itself |
224
140
 
225
141
  ```swift
226
- /// Returns the element at the specified index.
227
- func element(at index: Int) -> Element { ... }
142
+ protocol ReadingLog {
143
+ /// Returns the reading closest to `time`, or `nil` if there are none.
144
+ func reading(nearest time: Date) -> Reading?
228
145
 
229
- /// The number of elements in the collection.
230
- var count: Int { ... }
146
+ /// The number of readings recorded today.
147
+ var todayCount: Int { get }
231
148
 
232
- /// Creates a new array with the given elements.
233
- init(_ elements: some Sequence<Element>) { ... }
149
+ /// Creates a log that keeps at most `limit` readings.
150
+ init(limit: Int)
234
151
 
235
- /// Accesses the element at the specified position.
236
- subscript(index: Int) -> Element { ... }
152
+ /// Accesses the reading at `position`.
153
+ subscript(position: Int) -> Reading { get }
154
+ }
237
155
  ```
238
156
 
239
- ### Symbol markup
240
-
241
- Use standard symbol markup after the summary when relevant:
242
-
243
- - `- Parameter name:` for individual parameters
244
- - `- Parameters:` block for multiple parameters
245
- - `- Returns:` for the return value
246
- - `- Throws:` for errors thrown
247
- - `- Complexity:` for algorithmic complexity
157
+ After the summary, use symbol markup: `- Parameter name:`, a `- Parameters:`
158
+ block, `- Returns:`, `- Throws:`, `- Complexity:`.
248
159
 
249
160
  ```swift
250
- /// Removes and returns the element at the specified position.
251
- ///
252
- /// - Parameter index: The position of the element to remove.
253
- /// - Returns: The removed element.
254
- /// - Complexity: O(*n*), where *n* is the length of the collection.
255
- mutating func remove(at index: Int) -> Element { ... }
161
+ protocol EditableReadingLog: ReadingLog {
162
+ /// Removes the reading at `position` and hands it back.
163
+ ///
164
+ /// - Parameter position: The index of the reading to remove. Must be a
165
+ /// valid index of the log.
166
+ /// - Returns: The reading that was removed.
167
+ /// - Complexity: O(*n*) in the log's length.
168
+ @discardableResult
169
+ mutating func remove(at position: Int) -> Reading
170
+ }
256
171
  ```
257
172
 
258
- ### O(1) complexity rule
259
-
260
- Document the complexity of any computed property that is not O(1). Callers assume properties are O(1) by default. If a property does more than constant-time work, state the complexity explicitly.
173
+ A property looks free to call, so readers expect constant time. When a computed
174
+ property costs more, the doc comment has to say so:
261
175
 
262
176
  ```swift
263
- /// The total weight of all items.
177
+ /// The combined mass of every item in the crate.
264
178
  ///
265
- /// - Complexity: O(*n*), where *n* is the number of items.
266
- var totalWeight: Double {
267
- items.reduce(0) { $0 + $1.weight }
179
+ /// - Complexity: O(*n*) in the item count.
180
+ var totalMass: Measurement<UnitMass> {
181
+ items.map(\.mass).reduce(Measurement(value: 0, unit: .kilograms), +)
268
182
  }
269
183
  ```
270
184
 
271
- For documentation patterns and examples, see [references/conventions-and-special-rules.md](references/conventions-and-special-rules.md).
272
-
273
- ## Clarity and Naming
274
-
275
- Clarity at the point of use is the most important goal. Every design decision serves the person reading a call site.
276
-
277
- **Clarity over brevity.** Longer names are acceptable when they remove ambiguity. Do not abbreviate.
278
-
279
- ```swift
280
- // GOOD
281
- employees.remove(at: position)
282
-
283
- // BAD - ambiguous: remove the element? remove at position?
284
- employees.remove(position)
285
- ```
286
-
287
- **Include words needed to avoid ambiguity.** If omitting a word makes the call site unclear, keep it.
288
-
289
- ```swift
290
- // GOOD - "at" clarifies the argument's role
291
- friends.remove(at: index)
292
-
293
- // BAD - is "index" the element to remove or the position?
294
- friends.remove(index)
295
- ```
296
-
297
- **Omit needless words.** Do not repeat type information already available from the context.
298
-
299
- ```swift
300
- // GOOD
301
- allViews.remove(cancelButton)
302
-
303
- // BAD - "Element" repeats the type
304
- allViews.removeElement(cancelButton)
305
- ```
306
-
307
- **Name variables and parameters by role, not type.** Use the entity's role in the current context, not its type name.
308
-
309
- ```swift
310
- // GOOD - describes the role
311
- var greeting: String
312
- func add(_ observer: NSObject, for keyPath: String)
313
-
314
- // BAD - names the type
315
- var string: String
316
- func add(_ object: NSObject, for string: String)
317
- ```
318
-
319
- **Compensate for weak type information.** When a parameter type is `Any`, `AnyObject`, or a fundamental type like `Int` or `String`, add role-clarifying words to the name.
320
-
321
- ```swift
322
- // GOOD - role is clear despite weak types
323
- func addObserver(_ observer: NSObject, forKeyPath path: String)
324
-
325
- // BAD - what does "string" mean here?
326
- func add(_ object: NSObject, for string: String)
327
- ```
328
-
329
- For extended naming examples and patterns, see [references/naming-and-clarity.md](references/naming-and-clarity.md).
330
-
331
- ## Fluent Usage and Protocols
332
-
333
- **Call sites read as grammatical English.** Prefer names that form grammatical phrases at the point of use.
334
-
335
- ```swift
336
- // GOOD - reads fluently
337
- x.insert(y, at: z) // "x, insert y at z"
338
- x.subviews.remove(at: i) // "x's subviews, remove at i"
339
- x.makeIterator() // "x, make iterator"
340
-
341
- // BAD - ungrammatical
342
- x.insert(y, position: z)
343
- x.subviews.remove(i)
344
- ```
345
-
346
- **Initializer first argument.** The first argument to an initializer should not form a phrase continuing the type name.
347
-
348
- ```swift
349
- // GOOD
350
- let foreground = Color(red: 32, green: 64, blue: 128)
351
-
352
- // BAD - "Color with red" reads awkwardly
353
- let foreground = Color(havingRGBValuesRed: 32, green: 64, blue: 128)
354
- ```
355
-
356
- **Protocol naming conventions:**
357
-
358
- | Protocol describes | Naming pattern | Examples |
359
- |--------------------|----------------|----------|
360
- | What something **is** | Noun | `Collection`, `IteratorProtocol` |
361
- | A **capability** | `-able`, `-ible`, or `-ing` suffix | `Equatable`, `Hashable`, `Sendable` |
362
-
363
- ## General Conventions
364
-
365
- **Casing.** Types and protocols use `UpperCamelCase`. Everything else uses `lowerCamelCase`. Acronyms that are commonly all-caps in American English appear uniformly upper- or lower-cased based on position.
366
-
367
- ```swift
368
- var utf8Bytes: [UTF8.CodeUnit]
369
- var isRepresentableAsASCII = true
370
- var userSMTPServer: SMTPServer
371
- ```
372
-
373
- **Methods and properties over free functions.** Prefer methods and properties. Use free functions only when:
374
- 1. There is no obvious `self` - `min(x, y)`
375
- 2. The function is an unconstrained generic - `print(value)`
376
- 3. The function syntax is established domain notation - `sin(x)`
377
-
378
- **Default arguments over method families.** Prefer a single method with default parameters over a family of methods that differ only in which parameters they accept. Place defaulted parameters at the end. Parameters with default values should always have argument labels - defaulted parameters are usually omitted at call sites, so their labels must be clear when they do appear.
379
-
380
- ```swift
381
- // GOOD - labeled with defaults
382
- func decode(_ data: Data, encoding: String.Encoding = .utf8) -> String?
383
-
384
- // BAD - method family
385
- func decode(_ data: Data) -> String?
386
- func decode(_ data: Data, encoding: String.Encoding) -> String?
387
- ```
388
-
389
- **Overload safety.** Methods may share a base name when they operate in different type domains or when their meaning is clear from context. Avoid return-type-only overloads that cause ambiguity at the call site.
390
-
391
- For casing edge cases, overload patterns, and tuple/closure naming, see [references/conventions-and-special-rules.md](references/conventions-and-special-rules.md).
392
-
393
- ## Common Mistakes
394
-
395
- 1. **Omitting needed argument labels.** Using `remove(position)` instead of `remove(at: position)` when the role of the argument is ambiguous without the label.
396
-
397
- 2. **Using -ed when -ing is correct.** Applying `stripped()` when the past participle is ungrammatical - use `stripping()` instead. Test: does "a [verb]-ed [noun]" read naturally?
398
-
399
- 3. **Using verb names for side-effect-free operations.** Naming a nonmutating method `sort()` that returns a new collection - use `sorted()` to signal no mutation.
400
-
401
- 4. **Naming by type instead of role.** Using `string` instead of `greeting`, or `array` instead of `elements`, when the role would be more informative.
402
-
403
- 5. **Missing documentation comments.** Leaving public declarations undocumented, or writing summaries that describe the implementation rather than the purpose.
404
-
405
- 6. **Not documenting non-O(1) computed properties.** Exposing a linear-time computed property without a `Complexity:` note, causing callers to assume O(1) and use it in loops.
406
-
407
- 7. **Applying form- prefix to verb-based operations.** Writing `formSort()` instead of just `sort()` - the `form` prefix is only for noun-based operations (`formUnion`).
408
-
409
- 8. **Factory methods without make- prefix.** Naming factory methods as `createIterator()` or `buildBuffer()` instead of `makeIterator()` and `makeBuffer()`.
410
-
411
- 9. **Repeating type information in names.** Writing `removeElement(cancelButton)` or `stringValue: String` when the type is already evident from context.
412
-
413
- 10. **Return-type-only overloads.** Defining overloads that differ only in return type, creating ambiguity when the compiler cannot infer the expected type.
414
-
415
- 11. **Unlabeled tuple members and closure parameters.** Exposing tuples or closures in public API without naming their components, forcing callers to use positional access.
416
-
417
- ## Review Checklist
418
-
419
- ### Argument Labels
420
- - [ ] First argument follows the correct label rule (grammatical phrase, prepositional, conversion, or labeled)
421
- - [ ] Prepositional labels do not incorrectly group independent arguments
422
- - [ ] Value-preserving conversion initializers omit the first label
423
- - [ ] All non-special-case arguments have labels
424
-
425
- ### Naming Semantics
426
- - [ ] Mutating methods use imperative verb form
427
- - [ ] Nonmutating methods use -ed/-ing or noun form
428
- - [ ] Mutating/nonmutating pairs follow the correct pattern (verb pair or noun/form-noun pair)
429
- - [ ] Boolean properties read as assertions (`isEmpty`, `isValid`, `contains`)
430
- - [ ] Variables and parameters are named by role, not type
431
-
432
- ### Documentation
433
- - [ ] Every public declaration has a doc comment
434
- - [ ] Summaries are single sentence fragments ending in a period
435
- - [ ] Summaries describe the correct thing per declaration kind (action, access, creation, entity)
436
- - [ ] Non-O(1) computed properties document their complexity
437
- - [ ] Parameters, return values, and thrown errors are documented with symbol markup
438
-
439
- ### Conventions
440
- - [ ] Types and protocols use UpperCamelCase; everything else uses lowerCamelCase
441
- - [ ] Acronyms are uniformly cased based on position
442
- - [ ] Default arguments are preferred over method families
443
- - [ ] Overloads do not differ only in return type
444
- - [ ] Protocol names follow the noun (is-a) or suffix (capability) convention
185
+ ## Clarity
186
+
187
+ The top priority is how the call reads where it is used; every other choice
188
+ serves that reader.
189
+
190
+ - **Clarity beats brevity.** A longer name that removes doubt is better. Do not
191
+ abbreviate. `remove(at: position)` says what `remove(position)` leaves open.
192
+ - **Include the words needed to avoid ambiguity.**
193
+ `friends.remove(at: index)`, not `friends.remove(index)`.
194
+ - **Omit words that only repeat type information.**
195
+ `allViews.remove(cancelButton)`, not `allViews.removeElement(cancelButton)`.
196
+ - **Name by role, not type.** `var greeting: String`, not `var string: String`;
197
+ `track(_ subscriber: Subscriber, for topic: String)`, not
198
+ `track(_ object: Subscriber, for string: String)`.
199
+ - **Compensate for weak types.** When a parameter is `Any`, `AnyObject`, `Int`
200
+ or `String`, the type says little; add a role word, as in
201
+ `addObserver(_:forKeyPath:)`, where `forKeyPath` explains the `String`.
202
+
203
+ Examples and terminology: [the naming reference](references/naming-and-clarity.md).
204
+
205
+ ## Fluent call sites and protocols
206
+
207
+ Call sites should read as grammatical English: `insert(y, at: z)`,
208
+ `subviews.remove(at: i)`, `makeIterator()`. Not `insert(y, position: z)` or
209
+ `subviews.remove(i)`.
210
+
211
+ An initializer's first argument should not continue the type name as a
212
+ phrase: `Color(red:green:blue:)`, not `Color(havingRGBValuesRed:green:blue:)`.
213
+
214
+ Protocols:
215
+
216
+ - that say what something **is** are nouns: `Collection`, `IteratorProtocol`;
217
+ - that describe a **capability** end in `-able`, `-ible` or `-ing`:
218
+ `Equatable`, `Hashable`, `Sendable`.
219
+
220
+ Generic parameters follow the role rule too: `Element`, `Key`, `Value`,
221
+ `Base` when the parameter has a meaning in the API; a single letter such as
222
+ `T` only when it has none. Details in
223
+ [the naming reference](references/naming-and-clarity.md).
224
+
225
+ ## Conventions
226
+
227
+ - Types and protocols are `UpperCamelCase`; everything else is
228
+ `lowerCamelCase`.
229
+ - Acronyms that are usually all capitals in American English are all upper or
230
+ all lower case depending on position: `utf8Bytes`, `isRepresentableAsASCII`,
231
+ `userSMTPServer`.
232
+ - Reach for a method or property before a free function. A free function fits
233
+ in three cases only: nothing is naturally `self` (`max(a, b)`), the function is
234
+ an unconstrained generic (`print(value)`), or the notation is established
235
+ in the domain (`sin(x)`).
236
+ - Give one method defaulted parameters rather than writing several methods
237
+ that vary only in the parameter list. Put defaulted parameters at the
238
+ end, and give them labels: they are usually left out, so when present they
239
+ must explain themselves.
240
+
241
+ ```swift
242
+ // One entry point
243
+ func render(_ page: Page, scale: Double = 1, includesMargins: Bool = true) -> Image {
244
+ PageRasterizer(scale: scale, margins: includesMargins).draw(page)
245
+ }
246
+
247
+ // Not a family such as render(_:), render(_:scale:) and
248
+ // render(_:scale:includesMargins:)
249
+ ```
250
+
251
+ - Two overloads can use one base name if they act on different kinds of types
252
+ or the shared meaning is obvious. Never overload on return type alone.
253
+
254
+ Casing tables, complexity, free functions, overloads, tuples and closures:
255
+ [the conventions reference](references/conventions-and-special-rules.md).
256
+
257
+ ## Common mistakes
258
+
259
+ 1. Dropping a needed label: `friends.remove(i)` where `friends.remove(at: i)`
260
+ is meant.
261
+ 2. `-ed` where `-ing` is right: `stripped()` rather than `stripping()`. Test
262
+ whether "a [verb]-ed [noun]" reads naturally.
263
+ 3. A verb for a side-effect-free operation: a non-mutating `sort()` should be
264
+ `sorted()`.
265
+ 4. Naming by type: `string` for `greeting`, `array` for `elements`.
266
+ 5. No doc comment, or a summary that describes the implementation instead of
267
+ the purpose.
268
+ 6. An expensive computed property with no complexity note, so callers use it in
269
+ a loop.
270
+ 7. `form` on a verb operation (`formSort()`); `form` is for noun operations
271
+ only.
272
+ 8. Factories without `make`: `createIterator()`, `buildBuffer()`.
273
+ 9. Repeating type information: `removeElement(cancelButton)`,
274
+ `stringValue: String`.
275
+ 10. Overloads that differ only by return type, which confuse inference.
276
+ 11. Unlabelled tuple members or closure parameters in public API, forcing
277
+ `.0` and `.1`.
278
+
279
+ ## Review checklist
280
+
281
+ Argument labels
282
+
283
+ - [ ] The first argument follows the right rule: grammatical phrase,
284
+ prepositional, conversion, or labelled
285
+ - [ ] Prepositional labels do not tie together arguments that are independent
286
+ - [ ] Lossless conversion initializers take an unlabelled first argument
287
+ - [ ] Every argument not covered by a special rule has a label
288
+
289
+ Naming
290
+
291
+ - [ ] Mutating operations are imperative verbs
292
+ - [ ] Non-mutating operations use `-ed`, `-ing` or a noun
293
+ - [ ] Pairs follow the verb pattern or the noun / `form`-noun pattern
294
+ - [ ] Boolean names state a fact: `isEmpty`, `isValid`, `contains`
295
+ - [ ] Names describe roles, not types
296
+
297
+ Documentation
298
+
299
+ - [ ] Every public declaration is documented
300
+ - [ ] Each summary is one sentence fragment with a closing period
301
+ - [ ] The summary fits the declaration: action, access, creation or entity
302
+ - [ ] Non-O(1) computed properties state their complexity
303
+ - [ ] Symbol markup covers parameters, the return value and thrown errors
304
+
305
+ Conventions
306
+
307
+ - [ ] `UpperCamelCase` for types and protocols, `lowerCamelCase` for the rest
308
+ - [ ] Acronyms are cased uniformly by position
309
+ - [ ] Defaulted parameters instead of method families
310
+ - [ ] No overloads that differ only by return type
311
+ - [ ] Protocol names are nouns (what it is) or carry a capability suffix
445
312
 
446
313
  ## References
447
314
 
448
- - Naming clarity, role-based naming, weak-type compensation, and terminology: [references/naming-and-clarity.md](references/naming-and-clarity.md)
449
- - Argument label edge cases, parameter naming, and default argument strategy: [references/argument-labels-and-parameters.md](references/argument-labels-and-parameters.md)
450
- - Side-effect naming examples, -ed/-ing decision tree, form- prefix patterns, and factory methods: [references/side-effects-and-mutating-pairs.md](references/side-effects-and-mutating-pairs.md)
451
- - Casing edge cases, complexity documentation, overload safety, tuple/closure naming, and free function exceptions: [references/conventions-and-special-rules.md](references/conventions-and-special-rules.md)
315
+ - [Argument labels and parameters](references/argument-labels-and-parameters.md):
316
+ prepositional edge cases, grammatical-phrase examples, conversion kinds,
317
+ parameter names for documentation, default arguments and ordering.
318
+ - [Naming and clarity](references/naming-and-clarity.md): needed and needless
319
+ words, role naming, weak types, method versus property, generic parameter
320
+ names, terminology.
321
+ - [Side effects and mutating pairs](references/side-effects-and-mutating-pairs.md):
322
+ in-place and copying examples, how to pick `-ed` or `-ing`, the `form`
323
+ prefix, Booleans, `make` factories.
324
+ - [Conventions and special rules](references/conventions-and-special-rules.md):
325
+ casing and acronyms, complexity notes, free-function exceptions, overload
326
+ safety, tuple and closure naming, unconstrained polymorphism.