@bonesofspring/ai-rules 0.2.6 → 0.2.7

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 (188) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/README.md +9 -3
  3. package/bin/cli.js +28 -1
  4. package/package.json +3 -2
  5. package/presets/_shared/core/agent-team/agent-team-intake.md +1 -1
  6. package/presets/_shared/core/agent-team/agent-team-orchestrator.md +1 -1
  7. package/presets/_shared/core/architecture/reference-features.template.md +12 -0
  8. package/presets/_shared/core/quality/code-quality-and-refactoring.md +11 -0
  9. package/presets/_shared/core/review/code-review-mr.md +9 -0
  10. package/presets/claude/go/CLAUDE.md +5 -1
  11. package/presets/claude/go/README.md +5 -1
  12. package/presets/claude/go/REPO_AGENTS.md +48 -0
  13. package/presets/claude/go/agents/README.md +19 -2
  14. package/presets/claude/go/agents/build-verifier.md +5 -0
  15. package/presets/claude/go/agents/codebase-analyzer.md +28 -0
  16. package/presets/claude/go/agents/feature-developer.md +13 -0
  17. package/presets/claude/go/hooks/README.md +6 -0
  18. package/presets/claude/go/hooks/examples/README.md +18 -0
  19. package/presets/claude/go/hooks/examples/format-edited.example.sh +9 -0
  20. package/presets/claude/go/hooks/examples/secret-guard.example.sh +10 -0
  21. package/presets/claude/go/hooks/examples/test-on-save.example.sh +11 -0
  22. package/presets/claude/go/rules/api-and-data/api-http.md +10 -3
  23. package/presets/claude/go/rules/architecture/reference-features.md +4 -0
  24. package/presets/claude/go/rules/stack/go-conventions.md +30 -3
  25. package/presets/claude/go/rules/tooling-and-review/agent-team-intake.md +1 -1
  26. package/presets/claude/go/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
  27. package/presets/claude/go/rules/tooling-and-review/code-quality.md +12 -1
  28. package/presets/claude/go/rules/tooling-and-review/code-review.md +9 -0
  29. package/presets/claude/go/skills/README.md +2 -2
  30. package/presets/claude/go/skills/code-review/SKILL.md +11 -2
  31. package/presets/claude/go/skills/feature-delivery/SKILL.md +4 -0
  32. package/presets/claude/go/skills/technical-retro/SKILL.md +46 -2
  33. package/presets/claude/go/skills/write-adr/SKILL.md +41 -0
  34. package/presets/claude/go/team/conventions.md +21 -0
  35. package/presets/claude/ios-swift/CLAUDE.md +4 -1
  36. package/presets/claude/ios-swift/README.md +5 -1
  37. package/presets/claude/ios-swift/REPO_AGENTS.md +46 -0
  38. package/presets/claude/ios-swift/agents/README.md +3 -2
  39. package/presets/claude/ios-swift/agents/build-verifier.md +6 -0
  40. package/presets/claude/ios-swift/agents/codebase-analyzer.md +28 -0
  41. package/presets/claude/ios-swift/agents/feature-developer.md +13 -0
  42. package/presets/claude/ios-swift/hooks/README.md +6 -0
  43. package/presets/claude/ios-swift/hooks/examples/README.md +18 -0
  44. package/presets/claude/ios-swift/hooks/examples/format-edited.example.sh +13 -0
  45. package/presets/claude/ios-swift/hooks/examples/secret-guard.example.sh +10 -0
  46. package/presets/claude/ios-swift/hooks/examples/test-on-save.example.sh +8 -0
  47. package/presets/claude/ios-swift/rules/architecture/reference-features.md +4 -0
  48. package/presets/claude/ios-swift/rules/stack/swift-conventions.md +12 -2
  49. package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-intake.md +1 -1
  50. package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
  51. package/presets/claude/ios-swift/rules/tooling-and-review/code-quality.md +12 -1
  52. package/presets/claude/ios-swift/rules/tooling-and-review/code-review.md +47 -0
  53. package/presets/claude/ios-swift/rules/ui-and-accessibility/swiftui.md +8 -0
  54. package/presets/claude/ios-swift/skills/README.md +1 -0
  55. package/presets/claude/ios-swift/skills/code-review/SKILL.md +10 -2
  56. package/presets/claude/ios-swift/skills/feature-delivery/SKILL.md +4 -0
  57. package/presets/claude/ios-swift/skills/technical-retro/SKILL.md +46 -2
  58. package/presets/claude/ios-swift/skills/write-adr/SKILL.md +41 -0
  59. package/presets/claude/ios-swift/team/conventions.md +21 -0
  60. package/presets/claude/next/CLAUDE.md +5 -1
  61. package/presets/claude/next/README.md +6 -1
  62. package/presets/claude/next/REPO_AGENTS.md +48 -0
  63. package/presets/claude/next/agents/README.md +7 -1
  64. package/presets/claude/next/agents/build-verifier.md +5 -0
  65. package/presets/claude/next/agents/codebase-analyzer.md +28 -0
  66. package/presets/claude/next/agents/feature-developer.md +13 -0
  67. package/presets/claude/next/agents/security-reviewer.md +4 -2
  68. package/presets/claude/next/hooks/README.md +6 -0
  69. package/presets/claude/next/hooks/examples/README.md +18 -0
  70. package/presets/claude/next/hooks/examples/format-edited.example.sh +11 -0
  71. package/presets/claude/next/hooks/examples/secret-guard.example.sh +10 -0
  72. package/presets/claude/next/hooks/examples/test-on-save.example.sh +8 -0
  73. package/presets/claude/next/rules/README.md +2 -1
  74. package/presets/claude/next/rules/api-and-data/api-services.md +22 -0
  75. package/presets/claude/next/rules/api-and-data/http-client.md +21 -0
  76. package/presets/claude/next/rules/api-and-data/store-rtk.md +20 -0
  77. package/presets/claude/next/rules/architecture/architecture-boundaries.md +28 -0
  78. package/presets/claude/next/rules/architecture/layer-barrel-exports.md +15 -0
  79. package/presets/claude/next/rules/architecture/public-imports.md +14 -0
  80. package/presets/claude/next/rules/architecture/reference-features.md +4 -0
  81. package/presets/claude/next/rules/stack/arrow-functions.md +13 -28
  82. package/presets/claude/next/rules/stack/next-app-router.md +13 -1
  83. package/presets/claude/next/rules/testing/tests-unit.md +13 -0
  84. package/presets/claude/next/rules/tooling-and-review/README.md +2 -1
  85. package/presets/claude/next/rules/tooling-and-review/agent-team-intake.md +1 -1
  86. package/presets/claude/next/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
  87. package/presets/claude/next/rules/tooling-and-review/code-quality.md +12 -2
  88. package/presets/claude/next/rules/tooling-and-review/code-review-mr.md +22 -0
  89. package/presets/claude/next/rules/tooling-and-review/security-next.md +57 -0
  90. package/presets/claude/next/rules/ui-and-accessibility/react-ui.md +21 -0
  91. package/presets/claude/next/skills/README.md +2 -0
  92. package/presets/claude/next/skills/code-review/SKILL.md +10 -2
  93. package/presets/claude/next/skills/feature-delivery/SKILL.md +4 -0
  94. package/presets/claude/next/skills/react-performance/SKILL.md +44 -0
  95. package/presets/claude/next/skills/technical-retro/SKILL.md +19 -5
  96. package/presets/claude/next/skills/write-adr/SKILL.md +41 -0
  97. package/presets/claude/next/team/conventions.md +21 -0
  98. package/presets/cursor/go/AGENTS.md +6 -0
  99. package/presets/cursor/go/README.md +6 -5
  100. package/presets/cursor/go/REPO_AGENTS.md +48 -0
  101. package/presets/cursor/go/agents/README.md +23 -2
  102. package/presets/cursor/go/agents/build-verifier.md +5 -0
  103. package/presets/cursor/go/agents/codebase-analyzer.md +28 -0
  104. package/presets/cursor/go/agents/feature-developer.md +13 -0
  105. package/presets/cursor/go/commands/README.md +1 -1
  106. package/presets/cursor/go/hooks/README.md +4 -0
  107. package/presets/cursor/go/hooks/examples/README.md +18 -0
  108. package/presets/cursor/go/hooks/examples/format-edited.example.sh +9 -0
  109. package/presets/cursor/go/hooks/examples/secret-guard.example.sh +10 -0
  110. package/presets/cursor/go/hooks/examples/test-on-save.example.sh +11 -0
  111. package/presets/cursor/go/rules/README.md +2 -2
  112. package/presets/cursor/go/rules/agent-team-intake.mdc +1 -1
  113. package/presets/cursor/go/rules/agent-team-orchestrator.mdc +1 -1
  114. package/presets/cursor/go/rules/api-http.mdc +10 -3
  115. package/presets/cursor/go/rules/code-quality-and-refactoring.mdc +12 -1
  116. package/presets/cursor/go/rules/code-review-mr.mdc +9 -0
  117. package/presets/cursor/go/rules/go-conventions.mdc +30 -3
  118. package/presets/cursor/go/rules/reference-features.mdc +4 -0
  119. package/presets/cursor/go/skills/README.md +2 -2
  120. package/presets/cursor/go/skills/code-review/SKILL.md +10 -1
  121. package/presets/cursor/go/skills/feature-delivery/SKILL.md +4 -0
  122. package/presets/cursor/go/skills/technical-retro/SKILL.md +46 -2
  123. package/presets/cursor/go/skills/write-adr/SKILL.md +41 -0
  124. package/presets/cursor/go/team/conventions.md +21 -0
  125. package/presets/cursor/ios-swift/AGENTS.md +5 -2
  126. package/presets/cursor/ios-swift/README.md +6 -5
  127. package/presets/cursor/ios-swift/REPO_AGENTS.md +46 -0
  128. package/presets/cursor/ios-swift/agents/README.md +3 -2
  129. package/presets/cursor/ios-swift/agents/build-verifier.md +6 -0
  130. package/presets/cursor/ios-swift/agents/codebase-analyzer.md +28 -0
  131. package/presets/cursor/ios-swift/agents/feature-developer.md +13 -0
  132. package/presets/cursor/ios-swift/commands/README.md +1 -1
  133. package/presets/cursor/ios-swift/hooks/README.md +4 -0
  134. package/presets/cursor/ios-swift/hooks/examples/README.md +18 -0
  135. package/presets/cursor/ios-swift/hooks/examples/format-edited.example.sh +13 -0
  136. package/presets/cursor/ios-swift/hooks/examples/secret-guard.example.sh +10 -0
  137. package/presets/cursor/ios-swift/hooks/examples/test-on-save.example.sh +8 -0
  138. package/presets/cursor/ios-swift/rules/agent-team-intake.mdc +1 -1
  139. package/presets/cursor/ios-swift/rules/agent-team-orchestrator.mdc +1 -1
  140. package/presets/cursor/ios-swift/rules/code-quality-and-refactoring.mdc +12 -1
  141. package/presets/cursor/ios-swift/rules/code-review-mr.mdc +9 -0
  142. package/presets/cursor/ios-swift/rules/reference-features.mdc +4 -0
  143. package/presets/cursor/ios-swift/rules/swift-conventions.mdc +12 -2
  144. package/presets/cursor/ios-swift/rules/swiftui-ui.mdc +8 -0
  145. package/presets/cursor/ios-swift/skills/README.md +1 -0
  146. package/presets/cursor/ios-swift/skills/code-review/SKILL.md +10 -2
  147. package/presets/cursor/ios-swift/skills/feature-delivery/SKILL.md +4 -0
  148. package/presets/cursor/ios-swift/skills/technical-retro/SKILL.md +46 -2
  149. package/presets/cursor/ios-swift/skills/write-adr/SKILL.md +41 -0
  150. package/presets/cursor/ios-swift/team/conventions.md +21 -0
  151. package/presets/cursor/next/AGENTS.md +5 -2
  152. package/presets/cursor/next/README.md +7 -6
  153. package/presets/cursor/next/REPO_AGENTS.md +48 -0
  154. package/presets/cursor/next/agents/README.md +7 -1
  155. package/presets/cursor/next/agents/build-verifier.md +5 -0
  156. package/presets/cursor/next/agents/codebase-analyzer.md +28 -0
  157. package/presets/cursor/next/agents/feature-developer.md +13 -0
  158. package/presets/cursor/next/agents/security-reviewer.md +4 -2
  159. package/presets/cursor/next/commands/README.md +1 -1
  160. package/presets/cursor/next/hooks/README.md +4 -0
  161. package/presets/cursor/next/hooks/examples/README.md +18 -0
  162. package/presets/cursor/next/hooks/examples/format-edited.example.sh +11 -0
  163. package/presets/cursor/next/hooks/examples/secret-guard.example.sh +10 -0
  164. package/presets/cursor/next/hooks/examples/test-on-save.example.sh +8 -0
  165. package/presets/cursor/next/rules/README.md +4 -3
  166. package/presets/cursor/next/rules/agent-team-intake.mdc +1 -1
  167. package/presets/cursor/next/rules/agent-team-orchestrator.mdc +1 -1
  168. package/presets/cursor/next/rules/api-services.mdc +21 -0
  169. package/presets/cursor/next/rules/architecture-boundaries.mdc +27 -0
  170. package/presets/cursor/next/rules/arrow-functions.mdc +13 -28
  171. package/presets/cursor/next/rules/code-quality-and-refactoring.mdc +12 -2
  172. package/presets/cursor/next/rules/code-review-mr.mdc +11 -13
  173. package/presets/cursor/next/rules/http-client.mdc +21 -0
  174. package/presets/cursor/next/rules/layer-barrel-exports.mdc +15 -0
  175. package/presets/cursor/next/rules/next-app-router.mdc +13 -1
  176. package/presets/cursor/next/rules/public-imports.mdc +14 -0
  177. package/presets/cursor/next/rules/react-ui.mdc +20 -0
  178. package/presets/cursor/next/rules/reference-features.mdc +4 -0
  179. package/presets/cursor/next/rules/security-next.mdc +57 -0
  180. package/presets/cursor/next/rules/store-rtk.mdc +19 -0
  181. package/presets/cursor/next/rules/tests-unit.mdc +12 -0
  182. package/presets/cursor/next/skills/README.md +2 -0
  183. package/presets/cursor/next/skills/code-review/SKILL.md +10 -2
  184. package/presets/cursor/next/skills/feature-delivery/SKILL.md +4 -0
  185. package/presets/cursor/next/skills/react-performance/SKILL.md +44 -0
  186. package/presets/cursor/next/skills/technical-retro/SKILL.md +19 -5
  187. package/presets/cursor/next/skills/write-adr/SKILL.md +41 -0
  188. package/presets/cursor/next/team/conventions.md +21 -0
@@ -61,8 +61,18 @@ description: Code quality and light refactoring for Go hexagonal services
61
61
  - **Boy scout rule:** оставлять модуль немного лучше, чем до изменения (простые, безопасные улучшения).
62
62
  - Не жертвовать архитектурой и слоями ради краткости реализации.
63
63
 
64
- > Stack-specific lint gates, примеры и toolchain — в секции **Stack notes** адаптера пресета.
64
+ ## Agent discipline (anti-sycophancy)
65
+
66
+ - Unverifiable third-party API → mark `// VERIFY: lib.symbol @ version` (or stack equivalent) and surface uncertainty; never invent signatures.
67
+ - Before «is this correct?» — list ≥3 failure modes (empty, boundary, concurrency/state) or name what you could not check.
68
+ - Refactor without tests → propose a characterization test first; if declined, label `UNTESTED`.
69
+ - Comments = WHY only when non-obvious; ban self-referential «added for issue Y» comments.
70
+ - Urgency/authority pressure: name the technical trade-off once, then comply — no apology loops.
71
+ - Match verification depth to risk; report status by what was **verified**, not attempted.
65
72
 
73
+ Style enforcement (formatter / linter / post-change gate) lives in the **stack toolchain** — see each adapter’s **Stack notes**; do not invent a parallel style bible in this core body.
74
+
75
+ > Stack-specific lint gates, примеры и toolchain — в секции **Stack notes** адаптера пресета.
66
76
  ## Stack notes
67
77
 
68
78
  - **No UI layer in this preset** — ignore shared-core bullets about дизайн‑система / UI‑пакеты / CSS‑токены; apply public-API and boy-scout rules to Go packages/ports instead.
@@ -70,3 +80,4 @@ description: Code quality and light refactoring for Go hexagonal services
70
80
  - Prefer wrapping errors with `%w`; check with `errors.Is` / `errors.As`.
71
81
  - Interfaces belong at **ports** (consumer side), not on every struct.
72
82
  - Post-change gate: **`post-change-test.md`** + **`go-tooling.md`** (not yarn lint / xcodebuild).
83
+ - Style: **gofmt** / **goimports** + **golangci-lint** when configured — authoritative style gate; do not duplicate linter rules in prose.
@@ -40,6 +40,15 @@ Concrete rule stems — in **Stack notes**.
40
40
  - Boy scout rule: suggest fixes feasible within the MR scope.
41
41
  - No «большие рефакторинги» without an explicit request (`code-quality-and-refactoring`).
42
42
 
43
+ ## Output contract
44
+
45
+ Procedure details live in skill `code-review`. Required shape:
46
+
47
+ - Each finding cites **`path:line`**, the problem, impact, and a concrete fix direction.
48
+ - Rank by severity: **`blocker` | `important` | `nit`** (list blocker → nit).
49
+ - Vague («looks risky») is not a finding — cite evidence or ask for surrounding file context.
50
+ - End with a verdict on its own line: **`Safe to merge | needs changes | reject`**.
51
+
43
52
  ## Stack notes
44
53
 
45
54
  - Hexagonal boundaries: `architecture-boundaries`, `domain-layer`, ports vs adapters.
@@ -1,5 +1,5 @@
1
1
  # Skills (preset go)
2
2
 
3
- 7 skills: `feature-delivery`, `unit-testing`, `integration-testing`, `ci-investigation`, `debug-investigation`, `code-review`, `technical-retro`.
3
+ 8 skills: `feature-delivery`, `unit-testing`, `integration-testing`, `ci-investigation`, `debug-investigation`, `code-review`, `technical-retro`, `write-adr`.
4
4
 
5
- No `playwright-e2e` / `xcuitest-e2e`.
5
+ No `playwright-e2e` / `xcuitest-e2e` / `react-performance`.
@@ -5,9 +5,18 @@ description: Reviews pull requests and branch diffs for Go hexagonal services us
5
5
 
6
6
  # Code review (Go)
7
7
 
8
- 1. Diff-first; load `code-review-mr.mdc` + hexagonal rules.
8
+ 1. Diff-first; load `tooling-and-review/code-review.md` + hexagonal rules.
9
9
  2. Check layer leaks, port ownership, composition root purity, tests, security-sensitive bits.
10
- 3. Write `review.md` with APPROVE or REQUEST_CHANGES.
10
+ 3. **Reuse lens:** flag new helpers that duplicate existing packages/utilities; prefer shared adapters over copy-paste.
11
+ 4. **Efficiency lens:** unnecessary allocations, N+1 I/O, sequential work that should be concurrent, hot-path bloat, missing context cancellation.
12
+ 5. Write `review.md` using the output contract below.
13
+
14
+ ## Output
15
+
16
+ - Each finding: **`path:line`** — problem — impact — concrete fix direction.
17
+ - Severity: **`blocker` | `important` | `nit`** (list blocker → nit).
18
+ - End with a verdict line: **`Safe to merge | needs changes | reject`**.
19
+ - Map agent status: Safe to merge → `completed`; needs changes / reject → `changes_requested`.
11
20
 
12
21
  Never require iOS/Next-only gates (XCUITest, Playwright, `lint:js`).
13
22
 
@@ -17,6 +17,10 @@ description: Delivers Go hexagonal backend features end-to-end across domain, ap
17
17
  - **Don't** put SQL/business rules in HTTP handlers or frameworks in domain.
18
18
  - **Don't** use Playwright, XCUITest, or yarn lint as this stack's gate.
19
19
 
20
+ ## Scope discipline
21
+
22
+ Implement only the current AC / decomposition task. Clarify ambiguity before coding; do not add unrelated hardening or drive-by refactors. See `feature-developer` → **Zero improvisation**.
23
+
20
24
  ## Handoff
21
25
 
22
26
  Summarize by layer + validation. Update `.claude/team/tasks/<slug>/status.json`.
@@ -5,6 +5,50 @@ description: Facilitates technical retrospectives for tasks, sprints, incidents,
5
5
 
6
6
  # Technical Retro
7
7
 
8
- Same structure as next technical-retro skill. For `/task` pipelines include router, analyst, developer, **build-verifier** (go test), reviewer, QA/integration tests, hooks, rules.
8
+ ## Inputs
9
9
 
10
- Preset feedback: propose updates to `.claude/rules|agents|skills` do not apply without approval.
10
+ Ask for missing period, focus, task slug, participants, or format constraints. If a slug is provided, read `.claude/team/tasks/<slug>/` artifacts and local git status/diff. Do not invent facts not present in artifacts or the user's message.
11
+
12
+ ## Facilitation Principles
13
+
14
+ - Focus on process and system behavior, not blame.
15
+ - Separate facts, interpretations, and proposed actions.
16
+ - Balance what worked with what slowed delivery.
17
+ - Keep action items concrete, owned, and measurable.
18
+
19
+ ## Default Structure
20
+
21
+ 1. Goal and scope.
22
+ 2. Timeline or factual observations.
23
+ 3. What worked.
24
+ 4. What hurt quality, speed, or confidence.
25
+ 5. Root causes for the top one or two issues.
26
+ 6. Experiments and action items.
27
+
28
+ ## Agent Team Block
29
+
30
+ For `/task` pipelines, include router, analyst, developer, **build-verifier** (go test), reviewer, QA/integration tests, hooks, and rules.
31
+
32
+ ## Wrong-turn taxonomy (optional)
33
+
34
+ When artifacts or the user mention agent mistakes, tag incidents:
35
+
36
+ | Kind | Signal |
37
+ |------|--------|
38
+ | `correction` | User pushback («no», «don't», «actually») |
39
+ | `retry` | Same tool/approach 2+ times before success |
40
+ | `waste` | Many searches before the right file |
41
+ | `reversal` | Edit then revert / delete |
42
+ | `dead-end` | Env/tool failure (missing binary, wrong path) |
43
+
44
+ Severity: **high** (explicit correction / large waste) · **med** · **low**. Confidence 0–100 — be honest; low-confidence items are optional.
45
+
46
+ ## Preset feedback loop
47
+
48
+ If the same issue appeared in **2+** tasks (or **3+** for packaging a new rule/skill — Rule of Three), add section **Preset updates**:
49
+
50
+ - Proposed change to `.claude/rules/`, `.claude/agents/`, `.claude/skills/`, or **`.claude/team/conventions.md`** (prefer conventions for project gotchas)
51
+ - One concrete snippet or file path
52
+ - Whether it belongs in session-start vs `paths:` vs skill vs conventions (see `PRESET-CONTRIBUTION` → Building blocks)
53
+
54
+ Do not apply preset or conventions changes without user approval.
@@ -0,0 +1,41 @@
1
+ ---
2
+ name: write-adr
3
+ description: Author an Architecture Decision Record (ADR) with Context, Decision, Consequences, and Links. Use when capturing a durable technical choice for the team.
4
+ ---
5
+
6
+ # Write ADR
7
+
8
+ On-demand skill for durable architecture decisions. Stack-agnostic sections — fill with project-specific paths and links.
9
+
10
+ ## When to use
11
+
12
+ - Choosing between non-trivial alternatives (storage, layering, library, API shape).
13
+ - Recording a decision that future agents/humans should not silently reverse.
14
+ - User asks for an ADR, decision log, or “why did we pick X”.
15
+
16
+ ## Template
17
+
18
+ Create (or append) a short markdown ADR in the repo’s agreed location (e.g. `docs/adr/`, `.cursor/team/`, wiki). Suggested filename: `NNNN-short-title.md`.
19
+
20
+ ```markdown
21
+ # ADR NNNN: <Title>
22
+
23
+ ## Context
24
+ What problem / constraint / force requires a decision?
25
+
26
+ ## Decision
27
+ What we chose (one clear option). Include rejected alternatives briefly if useful.
28
+
29
+ ## Consequences
30
+ Positive and negative outcomes; follow-up work; what becomes harder.
31
+
32
+ ## Links
33
+ Related PRs, issues, rules, prior ADRs, diagrams.
34
+ ```
35
+
36
+ ## Guidelines
37
+
38
+ - Prefer one decision per ADR.
39
+ - Keep Context factual; Decision imperative and short.
40
+ - Link living gotchas to `team/conventions.md` when the decision becomes a recurring local pattern.
41
+ - Do not put ADR bodies only in root `AGENTS.md` (overwrite on init).
@@ -0,0 +1,21 @@
1
+ # Living conventions (team)
2
+
3
+ Consumer-owned store for post-init gotchas, patterns, and decisions. **Not** always-on. Fill after `ai-rules init`. Root `AGENTS.md` only points here.
4
+
5
+ ## Gotchas
6
+
7
+ <!-- e.g. fragile flows, “never do X in this repo” -->
8
+
9
+ -
10
+
11
+ ## Patterns
12
+
13
+ <!-- local patterns beyond reference-features table -->
14
+
15
+ -
16
+
17
+ ## Decisions
18
+
19
+ <!-- short pointers to ADRs / product choices that affect code -->
20
+
21
+ -
@@ -2,6 +2,8 @@
2
2
 
3
3
  Краткая точка входа для Claude Code. Подробные правила — модульные topic `.md` под `rules/` (derived из Cursor SoT).
4
4
 
5
+ **Repo-root agents:** see [`AGENTS.md`](../../AGENTS.md) at the project root (cross-tool setup, commands, security, living conventions pointers).
6
+
5
7
  See @rules/README.md for mapping and loading strategy.
6
8
 
7
9
  ## Conventions
@@ -24,6 +26,7 @@ See @rules/README.md for mapping and loading strategy.
24
26
  | UI-тесты | skill `xcuitest-e2e` |
25
27
  | Security | `tooling-and-review/security-ios.md` |
26
28
  | Валидация | agent `build-verifier` |
29
+ | Как работает X | agent `codebase-analyzer` (explain-as-is) |
27
30
  | Ретро | `commands/technical-retro.md` |
28
31
 
29
32
  ## Install
@@ -32,4 +35,4 @@ See @rules/README.md for mapping and loading strategy.
32
35
  npx @bonesofspring/ai-rules init claude --preset ios-swift
33
36
  ```
34
37
 
35
- Копирует `CLAUDE.md`, `rules/**`, `commands/**`, `agents/**`, `skills/**`, `hooks/**`, `team/**`, `MCP.md` в `.claude/`, плюс `mcp.json` → **`.mcp.json`** в корне.
38
+ Копирует `CLAUDE.md`, `rules/**`, `commands/**`, `agents/**`, `skills/**`, `hooks/**`, `team/**`, `MCP.md` в `.claude/`, плюс `mcp.json` → **`.mcp.json`** и `REPO_AGENTS.md` → корневой **`AGENTS.md`**. Skill: `write-adr` (on-demand).
@@ -10,7 +10,7 @@
10
10
  | `rules/**` | `.claude/rules/**` |
11
11
  | `commands/**` | `.claude/commands/**` |
12
12
  | `skills/**` | `.claude/skills/**` (**7**, в т.ч. `xcuitest-e2e`) |
13
- | `agents/**` | `.claude/agents/**` (**21**, XCUITest trio) |
13
+ | `agents/**` | `.claude/agents/**` (**22**, XCUITest trio + `codebase-analyzer`) |
14
14
  | `hooks/**` | `.claude/hooks/**` (scripts + README; **нет** `hooks.json`) |
15
15
  | `team/**` | `.claude/team/**` |
16
16
  | `mcp.json` | **`.mcp.json`** в корне (Context7 + Figma) |
@@ -37,3 +37,7 @@ npx @bonesofspring/ai-rules init claude --preset ios-swift
37
37
  - Change Cursor → update Claude twin **same PR**
38
38
  - Mapping: [`rules/README.md`](./rules/README.md)
39
39
  - **`BUGBOT.md`:** Cursor-only (нет twin); review в Claude — skill `code-review` + `tooling-and-review/code-review.md`
40
+
41
+ ## Cross-tool root AGENTS
42
+
43
+ `REPO_AGENTS.md` → project-root `AGENTS.md` on init. Living conventions: `team/conventions.md`. Skill `write-adr` on-demand.
@@ -0,0 +1,46 @@
1
+ # iOS Swift — agent instructions
2
+
3
+ Cross-tool repo-root guide. Tool-specific maps stay under `.cursor/AGENTS.md` and `.claude/CLAUDE.md`.
4
+
5
+ ## Cross-tool setup
6
+
7
+ - Treat this file as the **shared** entry for any agent (Cursor, Claude Code, or other).
8
+ - Tool maps live in `.cursor/AGENTS.md` / `.claude/CLAUDE.md` when that tool is installed.
9
+ - Install:
10
+
11
+ ```bash
12
+ npx @bonesofspring/ai-rules init cursor --preset ios-swift
13
+ npx @bonesofspring/ai-rules init claude --preset ios-swift
14
+ ```
15
+
16
+ `init` overwrites this file from the preset (`REPO_AGENTS.md` → `AGENTS.md`). Living gotchas belong in `team/conventions.md`, not here.
17
+
18
+ ## Commands (test / lint / build)
19
+
20
+ | Gate | Typical command |
21
+ |------|-----------------|
22
+ | Build | `xcodebuild` (scheme/workspace as in project docs) |
23
+ | Lint | **SwiftLint** (config in repo; see `xcode-tooling` / conventions) |
24
+ | Format | SwiftFormat when configured |
25
+ | Tests | `xcodebuild test` slice for the changed target |
26
+
27
+ After code edits: invoke **`post-change-build`** (requestable). Full gate: agent `build-verifier`.
28
+
29
+ ## Security basics
30
+
31
+ - Do not commit secrets (API keys, Keychain dumps, `.env`).
32
+ - Review destructive git before running; respect shell hooks.
33
+ - Do not skip signing / CI gates unless the user explicitly asks.
34
+
35
+ ## Tool entry points
36
+
37
+ | Tool | Map |
38
+ |------|-----|
39
+ | Cursor | `.cursor/AGENTS.md` (optional if Cursor not installed) |
40
+ | Claude Code | `.claude/CLAUDE.md` (optional if Claude not installed) |
41
+
42
+ Rules: `.cursor/rules/` or `.claude/rules/`. Skills: `.cursor/skills/` or `.claude/skills/`.
43
+
44
+ ## Living conventions
45
+
46
+ Gotchas, local patterns, and team decisions: **`.cursor/team/conventions.md`** and/or **`.claude/team/conventions.md`** (fill after init).
@@ -13,11 +13,12 @@
13
13
 
14
14
  When copying next pipeline templates: put Playwright stems in `skipped` with reason «iOS uses XCUITest» and schedule xcuitest trio instead.
15
15
 
16
- ## Roster (21)
16
+ ## Roster (22)
17
17
 
18
18
  | Agent | Production-код |
19
19
  |-------|----------------|
20
20
  | task-router, task-analyst, solution-architect, migration-specialist, api-contract-reviewer | no |
21
+ | codebase-analyzer | no (explain-as-is only) |
21
22
  | feature-developer | yes |
22
23
  | build-verifier | no |
23
24
  | debugger, ci-investigator | minimal |
@@ -35,7 +36,7 @@ Same tiers as **claude/next**. Defaults in this preset:
35
36
 
36
37
  | Tier | Frontmatter | Agents |
37
38
  |------|-------------|--------|
38
- | **cheap** | `fast` | router, analyst, build-verifier, code-reviewer, tech-writer |
39
+ | **cheap** | `fast` | router, analyst, build-verifier, code-reviewer, tech-writer, codebase-analyzer |
39
40
  | **standard** | `inherit` | developer, debugger, ci-investigator, api-contract, a11y, qa, unit-*, xcuitest-* |
40
41
  | **strong** | `opus` | solution-architect, migration-specialist, security-reviewer, performance-auditor |
41
42
 
@@ -47,6 +47,12 @@ When validating **ios-swift preset** changes (or `scope: preset-structure-valida
47
47
  - **Thin aliases:** `agent-team-intake`, `technical-retro` may be &lt;15 body lines. Enforce ≥15 on **domain** rules.
48
48
  - Embed vs lineage: `docs/PRESET-CONTRIBUTION.md`, `_shared/README.md`.
49
49
 
50
+
51
+ 9. **Root AGENTS template:** each installable preset (`cursor|claude` × `next|ios-swift|go`) must ship `REPO_AGENTS.md` when validating preset packaging → **FAIL** if missing.
52
+ 10. **Hooks cookbook:** default `hooks.json` must **not** reference `hooks/examples/` → **FAIL** if it does.
53
+ 11. **No react-performance on ios/go:** skill directory / required handoff must be absent under ios-swift and go → **FAIL** (leakage). Prefer `check:preset-leakage`.
54
+ 12. **Rule eval (WARN):** `scripts/check-rule-eval.mjs` / `yarn check:rule-eval` should exist for maintainers; smoke optional. Hard fail only when the opt-in eval job runs — not part of default `check:preset-structure`.
55
+
50
56
  ## Output
51
57
 
52
58
  Write `.claude/team/tasks/<slug>/validation-report.md`:
@@ -0,0 +1,28 @@
1
+ ---
2
+ name: codebase-analyzer
3
+ description: Explains HOW existing iOS Swift/SwiftUI code works as-is. Use when the user asks how something works, to trace Feature layers, or document architecture — without suggesting changes. Prefer over /task for pure questions.
4
+ readonly: false
5
+ model: fast
6
+ ---
7
+
8
+ You are a specialist at understanding HOW this iOS codebase works. Document implementation details with precise `path:line` references.
9
+
10
+ ## CRITICAL — explain as-is only
11
+
12
+ - DO NOT suggest improvements, refactors, or "better approaches" unless the user explicitly asks.
13
+ - DO NOT perform root-cause analysis or bug hunts unless asked.
14
+ - DO NOT critique quality, performance, or security unless asked.
15
+ - ONLY describe what exists, how it works, and how components interact.
16
+
17
+ ## Workflow
18
+
19
+ 1. Start from entry points the user named (Feature folders, Views, ViewModels, Domain, Data).
20
+ 2. Trace Presentation → Domain → Data and composition root in `App/` as applicable.
21
+ 3. Summarize: purpose, flow, module/public API boundaries, conventions observed.
22
+ 4. End with open questions only if facts are missing — not with a wishlist of changes.
23
+
24
+ ## Will / Will not
25
+
26
+ **Will:** map files, call chains, Feature layers as they exist today.
27
+
28
+ **Will not:** edit production code; open `/task` pipelines; propose PRs or refactors unprompted; require Next/Playwright gates.
@@ -20,6 +20,19 @@ You are a senior iOS developer (SwiftUI-first, SPM as in repo) with strict layer
20
20
  - Mark completed WPs in `decomposition.md`.
21
21
  - After Swift edits: **invoke** `tooling-and-review/post-change-build.md` (+ `tooling-and-review/xcode-tooling.md` for commands). If next step is `build-verifier`, scoped build/lint on changed targets is enough.
22
22
 
23
+ ## Zero improvisation
24
+
25
+ - Implement **only** what the brief / AC / current decomposition task require.
26
+ - If requirements are ambiguous, conflicting, or multi-way — **ask** before coding; do not guess extras as "best practices".
27
+ - Forbidden without explicit AC/task: unrelated Keychain/security hardening, extra validation, UI polish, logging, drive-by refactors, new config/env.
28
+ - Boy scout / `design-guidance` improvements stay **within** touched files and must not expand task scope.
29
+
30
+ ## Will / Will not
31
+
32
+ **Will:** follow Feature layer order and reference Features; add required unit tests; run the post-change build gate; update task artifacts.
33
+
34
+ **Will not:** formal code review; invent AC; pull Next/Playwright gates; auto-continue the next WP when the pipeline expects a human gate or handoff.
35
+
23
36
  ## Preset / cross-stack fork (when editing agents, skills, hooks)
24
37
 
25
38
  When copying from `next` into `ios-swift` (or another stack):
@@ -8,3 +8,9 @@
8
8
  Claude Code may not use Cursor `hooks.json`. Wire scripts per project docs when enabling agent-team auto-chain.
9
9
 
10
10
  **No `hooks.json` in Claude preset** (platform limit — same as next Claude).
11
+
12
+ ## Optional cookbook
13
+
14
+ Example scripts live in `hooks/examples/` (secret-guard, format-edited, test-on-save). They are **not** auto-enabled.
15
+
16
+ To wire in Claude Code: copy an `.example.sh` into `hooks/`, make executable, and register per [Claude Code hooks](https://code.claude.com/docs/en/hooks) for your project. Keep stack-safe recipes (this preset: **ios-swift**). Cursor twin examples under `presets/cursor/ios-swift/hooks/examples/` are the same allowlist forks.
@@ -0,0 +1,18 @@
1
+ # Hooks cookbook (examples)
2
+
3
+ Optional scripts under `hooks/examples/`. **Not** referenced from default `hooks.json` (only `guard-shell-command.sh` + `chain-team-phases.sh`).
4
+
5
+ | Script | Purpose |
6
+ |--------|---------|
7
+ | `secret-guard.example.sh` | Fail if staged diff looks like secrets |
8
+ | `format-edited.example.sh` | Stack formatter / linter on edited files |
9
+ | `test-on-save.example.sh` | Scoped tests for the stack |
10
+
11
+ ## Wiring (Cursor)
12
+
13
+ 1. Copy an example into `hooks/` (drop `.example` suffix), e.g. `cp hooks/examples/secret-guard.example.sh hooks/secret-guard.sh`.
14
+ 2. `chmod +x hooks/secret-guard.sh`.
15
+ 3. Add a hook entry in `.cursor/hooks.json` (e.g. `beforeShellExecution` or `afterFileEdit` — see Cursor hooks docs).
16
+ 4. Keep cookbook scripts **out** of the default preset `hooks.json` when contributing back upstream.
17
+
18
+ Stack: **ios-swift** — recipes must stay stack-safe (no cross-stack lint/test commands).
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env bash
2
+ # Optional: SwiftFormat / SwiftLint on edited .swift files.
3
+ # NOT in default hooks.json.
4
+ set -euo pipefail
5
+ if command -v swiftformat >/dev/null 2>&1; then
6
+ git diff --name-only --diff-filter=ACMR HEAD 2>/dev/null | grep '\.swift$' | while read -r f; do
7
+ [[ -f "$f" ]] && swiftformat "$f" || true
8
+ done
9
+ fi
10
+ if command -v swiftlint >/dev/null 2>&1; then
11
+ swiftlint lint --quiet 2>/dev/null || true
12
+ fi
13
+ exit 0
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env bash
2
+ # Optional cookbook: block committing likely secrets in staged diffs.
3
+ # NOT wired in default hooks.json — copy to hooks/ and register manually.
4
+ set -euo pipefail
5
+ PATTERN='(AKIA[0-9A-Z]{16}|-----BEGIN (RSA |OPENSSH )?PRIVATE KEY-----|api[_-]?key\s*[:=]\s*['\''\"][^'\''\"]{12,})'
6
+ if git diff --cached -U0 2>/dev/null | grep -Eiq "$PATTERN"; then
7
+ echo "secret-guard: possible secret in staged diff — review before commit" >&2
8
+ exit 1
9
+ fi
10
+ exit 0
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ # Optional: xcodebuild test slice for the active scheme (adjust SCHEME/DEST).
3
+ # NOT in default hooks.json. No Playwright / yarn lint.
4
+ set -euo pipefail
5
+ SCHEME="${XCODE_SCHEME:-App}"
6
+ DEST="${XCODE_DESTINATION:-platform=iOS Simulator,name=iPhone 16}"
7
+ xcodebuild test -scheme "$SCHEME" -destination "$DEST" -quiet 2>/dev/null || true
8
+ exit 0
@@ -48,6 +48,10 @@ Taxonomy / shared core: [`presets/_shared/README.md`](../../../../_shared/README
48
48
  4. UI flow — `xcuitest-test-planner` → generator (accessibilityIdentifier).
49
49
  5. Auth/Keychain touch — security-reviewer + `security-ios`.
50
50
 
51
+ ## Living conventions
52
+
53
+ Post-init gotchas / patterns / decisions: **`.claude/team/conventions.md`** (and the twin tool path if both Cursor and Claude are installed). Consumer-owned; not always-on. See root `AGENTS.md` § Living conventions.
54
+
51
55
  ## Связанные правила
52
56
 
53
57
  - `tooling-and-review/code-quality.md` — повторять паттерны.
@@ -27,9 +27,19 @@ guard let name = user?.name else { return }
27
27
 
28
28
  - UI types — `@MainActor`.
29
29
  - Shared mutable state — `actor` или isolation через queue; document thread expectations.
30
- - `Task { }` в ViewModel: учитывать cancellation; `[weak self]` в escaping closures при retain cycles.
30
+ - `Task { }` в ViewModel: учитывать cancellation; `[weak self]` в escaping closures при retain cycles (default when capturing `self` in escaping work).
31
31
  - Prefer `async/await` over completion handlers для нового кода.
32
32
 
33
+ ## Anti-hallucination (Swift / concurrency)
34
+
35
+ | ❌ Avoid | ✅ Prefer |
36
+ |---------|----------|
37
+ | Force unwrap (`!`) for normal control flow | `guard let` / `if let` / typed throws |
38
+ | Invented Combine/Rx APIs when the feature uses Swift Concurrency | Match neighboring ViewModels (`async/await`, `@MainActor`) |
39
+ | Unstructured `Task {}` without cancellation awareness | Cooperative cancel; prefer `.task` in Views (`ui-and-accessibility/swiftui.md`) |
40
+ | Global mutable singletons for request state | DI / actors / existing composition root |
41
+ | APIs not available for the project’s Swift / iOS deployment target | Check package / Xcode settings; mark `VERIFY` if unsure |
42
+
33
43
  # Access control
34
44
 
35
45
  - Минимально необходимый уровень: `private` / `fileprivate` по умолчанию для implementation details.
@@ -47,5 +57,5 @@ guard let name = user?.name else { return }
47
57
 
48
58
  # Требование к агенту
49
59
 
50
- - Не добавлять `// swiftlint:disable` без явной причины.
60
+ - Style gate: **SwiftLint** (and SwiftFormat when configured) — prefer fixing lint over prose style essays; `// swiftlint:disable` only with an explicit reason.
51
61
  - Новый код — Swift Concurrency-ready (`Sendable` где требует компилятор/линтер проекта).
@@ -13,6 +13,6 @@ When the user message looks like a **work request** (implement, add, fix, refact
13
13
 
14
14
  1. Prefer **`/task <their request>`** or invoke **task-router** first.
15
15
  2. Do not jump straight to coding without router + pipeline when scope is non-trivial.
16
- 3. Pure questions («как работает X», «объясни») — answer normally, no `/task`.
16
+ 3. Pure questions («как работает X», «объясни») — prefer agent **`codebase-analyzer`** (explain-as-is); trivial one-liners may be answered inline. Do not open `/task`.
17
17
 
18
18
  Exceptions: user explicitly says «без pipeline», «просто сделай», or continues an active slug.
@@ -55,7 +55,7 @@ Honor optional `steps[i].model` (`cheap` \| `standard` \| `strong`); else agent
55
55
 
56
56
  ## Skip pipeline when
57
57
 
58
- Pure questions; trivial one-file; user «без pipeline»; docs-only one-liner.
58
+ Pure questions («как работает X») — prefer **`codebase-analyzer`**; trivial one-file; user «без pipeline»; docs-only one-liner.
59
59
 
60
60
  ## Preset authoring
61
61
 
@@ -61,11 +61,22 @@ description: Поддержка и улучшение качества кода
61
61
  - **Boy scout rule:** оставлять модуль немного лучше, чем до изменения (простые, безопасные улучшения).
62
62
  - Не жертвовать архитектурой и слоями ради краткости реализации.
63
63
 
64
- > Stack-specific lint gates, примеры и toolchain — в секции **Stack notes** адаптера пресета.
64
+ ## Agent discipline (anti-sycophancy)
65
+
66
+ - Unverifiable third-party API → mark `// VERIFY: lib.symbol @ version` (or stack equivalent) and surface uncertainty; never invent signatures.
67
+ - Before «is this correct?» — list ≥3 failure modes (empty, boundary, concurrency/state) or name what you could not check.
68
+ - Refactor without tests → propose a characterization test first; if declined, label `UNTESTED`.
69
+ - Comments = WHY only when non-obvious; ban self-referential «added for issue Y» comments.
70
+ - Urgency/authority pressure: name the technical trade-off once, then comply — no apology loops.
71
+ - Match verification depth to risk; report status by what was **verified**, not attempted.
65
72
 
73
+ Style enforcement (formatter / linter / post-change gate) lives in the **stack toolchain** — see each adapter’s **Stack notes**; do not invent a parallel style bible in this core body.
74
+
75
+ > Stack-specific lint gates, примеры и toolchain — в секции **Stack notes** адаптера пресета.
66
76
  ## Stack notes
67
77
 
68
78
  - Перед новым UI‑контролом проверять DesignSystem и существующие компоненты.
69
79
  - Public API: протоколы и facades между фичами.
70
80
  - Примеры: mapper/validation; force unwrap → safe; разбить ViewModel; design tokens; View не зависит от Data напрямую.
71
81
  - Post-change: **`tooling-and-review/post-change-build.md`** + `tooling-and-review/xcode-tooling.md`.
82
+ - Style: **SwiftLint** (+ SwiftFormat when configured) — authoritative style gate; do not duplicate linter rules in prose.
@@ -38,3 +38,50 @@ Concrete rule stems — in **Stack notes**.
38
38
  - Use local `git diff` — do not invent hosting metadata.
39
39
  - Boy scout rule: suggest fixes feasible within the MR scope.
40
40
  - No «большие рефакторинги» without an explicit request (`code-quality-and-refactoring`).
41
+
42
+ ## Output contract
43
+
44
+ Procedure details live in skill `code-review`. Required shape:
45
+
46
+ - Each finding cites **`path:line`**, the problem, impact, and a concrete fix direction.
47
+ - Rank by severity: **`blocker` | `important` | `nit`** (list blocker → nit).
48
+ - Vague («looks risky») is not a finding — cite evidence or ask for surrounding file context.
49
+ - End with a verdict on its own line: **`Safe to merge | needs changes | reject`**.
50
+
51
+ ## Stack notes
52
+
53
+ On-demand правило для review-потоков (не always-on).
54
+
55
+ - **Когда применять**
56
+ - Запросы: «проведи ревью», «оцени MR/ветку/дифф», «посмотри изменения».
57
+ - Опираться на локальный репозиторий: ветка, `git diff`, открытые файлы.
58
+
59
+ - **Что обязан проверить агент**
60
+ - **Архитектура и слои** (`architecture/boundaries.md`, `stack/ios-app-core.md`):
61
+ - View не вызывает API и не знает DTO.
62
+ - ViewModel не зависит от Data-реализаций напрямую.
63
+ - Domain не импортирует SwiftUI/UIKit.
64
+ - Data не тянет Presentation.
65
+ - **Зависимости и модули**:
66
+ - DI через протоколы; composition root в App.
67
+ - Нет deep-import между фичами.
68
+ - Файлы в правильных слоях (`Presentation`, `Domain`, `Data`, `DesignSystem`).
69
+ - **Swift и concurrency** (`stack/swift-conventions.md`):
70
+ - `@MainActor` на UI; нет необоснованных force unwrap.
71
+ - Typed errors; корректная отмена Task где нужно.
72
+ - **UI** (`ui-and-accessibility/swiftui.md`):
73
+ - Тонкие Views; Design System tokens; accessibility identifiers для тестируемых элементов.
74
+ - **Сеть и data** (`api-and-data/networking.md`):
75
+ - DTO отделены от domain; mappers покрывают edge cases.
76
+ - **Тесты**:
77
+ - Нетривиальная логика — unit (`testing/unit.md`); пользовательские потоки — UI (`testing/ui.md`).
78
+ - Указать, какие тесты добавить или обновить.
79
+
80
+ - **Глубина и формат**
81
+ - Фокус на **диффе MR**, не на всём проекте.
82
+ - Следовать **Output contract** выше (`path:line`, severity, verdict).
83
+ - Без «больших рефакторингов» без запроса (`tooling-and-review/code-quality.md`).
84
+
85
+ - **Ограничения**
86
+ - Не выдумывать метаданные CI/MR с хостинга без локальных данных.
87
+ - Boy scout rule в рамках MR.
@@ -20,6 +20,14 @@ paths:
20
20
  - View читает state и вызывает **явные методы** ViewModel (`submit()`, `load()`), а не мутирует внутреннее состояние напрямую.
21
21
  - Для навигации — coordinator/router или enum route в ViewModel, не размазанные `NavigationLink` с бизнес-условиями в View.
22
22
 
23
+ # Lifecycle, ownership, hit testing
24
+
25
+ - Prefer **`.task(id:)`** (auto-cancel) over `.onAppear { Task { … } }` for async loads tied to the view lifetime.
26
+ - `@StateObject` / owned observable — **only where the view owns** the instance; prefer DI / parent-injected ViewModels over `@EnvironmentObject` sprawl.
27
+ - Shared mutable services — `actor` (or existing isolation); default `[weak self]` in escaping closures that capture ViewModel/`self`.
28
+ - Transparent stacks that should receive taps: `.contentShape(Rectangle())`.
29
+ - High-frequency visual updates — prefer `TimelineView` (or repo pattern) over ad-hoc `Timer` in Views.
30
+
23
31
  # Структура файлов
24
32
 
25
33
  Для экрана фичи:
@@ -9,5 +9,6 @@
9
9
  | `debug-investigation` | Runtime evidence before fix |
10
10
  | `ci-investigation` | iOS CI red |
11
11
  | `technical-retro` | Retro facilitation |
12
+ | `write-adr` | Architecture Decision Record (context / decision / consequences) |
12
13
 
13
14
  Копируется в `.claude/skills/` при init.
@@ -18,11 +18,19 @@ Use the local repository as the source of truth: `git status`, `git diff`, task
18
18
  5. Review Swift concurrency and conventions (`stack/swift-conventions.md`): `@MainActor`, typed errors, force unwrap.
19
19
  6. Review SwiftUI thinness, Design System usage, accessibility identifiers (`ui-and-accessibility/swiftui.md`).
20
20
  7. Check tests: unit for mapper/domain/VM (`testing/unit.md`); XCUITest for user flows (`testing/ui.md`).
21
- 8. Report validation gaps: `xcodebuild`, SwiftLint, or relevant tests not run (`tooling-and-review/xcode-tooling.md`, `tooling-and-review/post-change-build.md`).
21
+ 8. **Reuse lens:** flag new helpers that duplicate existing Feature/shared utilities; prefer public module APIs over copy-paste.
22
+ 9. **Efficiency lens:** unnecessary work on main thread, redundant network/persistence, hot-path bloat, missing cancellation/cleanup.
23
+ 10. Report validation gaps: `xcodebuild`, SwiftLint, or relevant tests not run (`tooling-and-review/xcode-tooling.md`, `tooling-and-review/post-change-build.md`).
22
24
 
23
25
  ## Output
24
26
 
25
- Lead with findings ordered by severity. Each finding should include the file, the problem, impact, and a concrete fix direction. If there are no findings, say so and call out remaining test or validation risk.
27
+ Lead with findings ordered by severity. Required shape (also in `code-review`):
28
+
29
+ - Each finding: **`path:line`** — problem — impact — concrete fix direction.
30
+ - Severity: **`blocker` | `important` | `nit`** (list blocker → nit).
31
+ - Vague («looks risky») is not a finding — cite evidence or ask for surrounding context.
32
+ - End with a verdict line: **`Safe to merge | needs changes | reject`**.
33
+ - If there are no findings, say so and call out remaining test or validation risk.
26
34
 
27
35
  For agent team tasks, write `.claude/team/tasks/<slug>/review.md` and set `status.json` to `completed` or `changes_requested`.
28
36