@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
@@ -1,45 +1,30 @@
1
1
  ---
2
2
  paths:
3
3
  - app/src/**/*.{ts,tsx,js,jsx}
4
+ impact: LOW
4
5
  ---
5
-
6
6
  # Стрелочные функции
7
7
 
8
- При разработке **использовать стрелочный синтаксис** для функций, где это допустимо в TypeScript/JavaScript.
9
-
10
- ## Что делать
8
+ Предпочитать стрелочный синтаксис для нового кода в `app/src/**`, где это допустимо в TypeScript/JavaScript.
11
9
 
12
- - Объявлять функции как **`const имя = (...) => { ... }`** вместо **`function имя(...) { ... }`**, если не нужны особенности объявления `function`.
13
- - Колбэки и обработчики — стрелочные функции: `.map((x) => ...)`, `onClick={() => ...}`.
14
- - React-компоненты и хуки — как стрелочные функции с явной типизацией пропсов/возврата по принятому в проекте стилю.
10
+ **Style enforcement:** детальные pref в ESLint (`app/eslint.config.mjs`) и Stylelint; после правок **`post-change-lint`**. Это правило краткий intent, не дублировать линтер.
15
11
 
16
- ## Исключения (допустимо не стрелка)
12
+ ## Исключения
17
13
 
18
- - **Генераторы** (`function*`) — стрелкой не выразить.
19
- - **Методы класса** если в коде используются классы, допустимы обычные методы (`method() {}`).
20
- - Когда осознанно нужны **подъём (hoisting)** или **имя функции в стеке** только у `function` редкие случаи.
14
+ - Генераторы (`function*`)
15
+ - Методы класса, где нужен `this` прототипа
16
+ - Редкие случаи hoisting / именованного `function` в стеке
21
17
 
22
- ## Примеры
18
+ ## Incorrect
23
19
 
24
- ```typescript
25
- // ❌ Избегать для нового кода
20
+ ```ts
26
21
  function formatLabel(id: string): string {
27
22
  return id.toUpperCase()
28
23
  }
29
-
30
- // ✅ Предпочтительно
31
- const formatLabel = (id: string): string => {
32
- return id.toUpperCase()
33
- }
34
24
  ```
35
25
 
36
- ```tsx
37
- // ✅ Предпочтительно
38
- const UserCard = ({ name }: { name: string }) => {
39
- return <span>{name}</span>
40
- }
41
- ```
26
+ ## Correct
42
27
 
43
- ## Требование к агенту
44
-
45
- При генерации и правке кода **по умолчанию выбирать стрелочные функции**; отступать к `function` только в случаях из раздела исключений.
28
+ ```ts
29
+ const formatLabel = (id: string): string => id.toUpperCase()
30
+ ```
@@ -22,7 +22,7 @@ paths:
22
22
 
23
23
  ## Маршруты и UX
24
24
 
25
- - Для async routes использовать **`loading.tsx`**, **`error.tsx`**, **`not-found.tsx`** по образцу соседних routes.
25
+ - Для async data routes **обязательны** sibling **`loading.tsx`** и **`error.tsx`** (и `not-found.tsx` где уместно) — по образцу соседних routes.
26
26
  - **Suspense** — для медленных client/server секций; fallback согласован с дизайн-системой.
27
27
  - Навигация — `stack/navigation-router.md` + router/link паттерны проекта.
28
28
 
@@ -31,6 +31,18 @@ paths:
31
31
  - RSC/route handlers **не импортируют UI-компоненты с client-only зависимостями** напрямую в server tree без `'use client'` границы.
32
32
  - Доменные типы — `@/types`; вызовы backend — через `@/api` / services, не raw `fetch` из page.tsx без слоя API.
33
33
 
34
+ ## Anti-hallucination (App Router)
35
+
36
+ Меньше угаданного кода лучше, чем больше. Сверяй API с версией Next в `package.json` и соседними routes.
37
+
38
+ | ❌ Avoid | ✅ Prefer |
39
+ |---------|----------|
40
+ | Sync `params` / `searchParams` / `cookies()` / `headers()` when the installed Next treats them as async | `await params` / `await cookies()` / patterns from existing pages |
41
+ | Invented `getSession()`-only server auth without project verify | Server session verify used by the repo (`tooling-and-review/security-next.md`) |
42
+ | Auth enforcement only in Edge middleware | Layout/page/Server Action checks + middleware refresh if present |
43
+ | New App Router APIs not in the installed Next major | Copy from a sibling route; mark `VERIFY` if unsure |
44
+ | Client `fetch` in `page.tsx` bypassing `@/api` | Services via `@/api` / established data loaders |
45
+
34
46
  ## Эталон
35
47
 
36
48
  Смотри существующий route той же сложности в `app/src/app/**` и повтори структуру (`architecture/reference-features.md`).
@@ -4,6 +4,7 @@ paths:
4
4
  - app/src/**/*.spec.tsx
5
5
  - app/src/**/*.test.ts
6
6
  - app/src/**/*.test.tsx
7
+ impact: MEDIUM
7
8
  ---
8
9
 
9
10
  # Общие правила тестирования
@@ -64,3 +65,15 @@ it('Returns empty list when user is guest', () => {})
64
65
  - для **компонентов UI** — **не создавать** поддиректорию `__tests__` внутри папки компонента; тест — соседний `*.spec.tsx`.
65
66
  - в **других модулях** (например `api/services`) допустима уже существующая схема с `__tests__` — не ломать ради единообразия с UI.
66
67
  - **новые** файлы — `*.spec.ts` / `*.spec.tsx` (см. блок «Имена файлов» выше).
68
+ ## Incorrect
69
+
70
+ ```ts
71
+ it('returns empty list when guest', () => {})
72
+ it('Возвращает пустой список. пользователь не авторизован', () => {})
73
+ ```
74
+
75
+ ## Correct
76
+
77
+ ```ts
78
+ it('Возвращает пустой список. Пользователь не авторизован', () => {})
79
+ ```
@@ -9,6 +9,7 @@ Lint, package manager, качество кода, agent team, code review MR.
9
9
  | `code-quality.md` | Boy scout rule, рефакторинг, ESLint | session start |
10
10
  | `agent-team-intake.md` | Когда предлагать `/task` и router pipeline | `paths:` commands/team |
11
11
  | `agent-team-orchestrator.md` | Dynamic agent team: router, pipeline, gates | `paths:` commands/team/agents |
12
- | `code-review-mr.md` | Чеклист ревью merge request | `paths:` review-related |
12
+ | `code-review-mr.md` | Чеклист ревью merge request + output contract | `paths:` review-related |
13
+ | `security-next.md` | Secrets, auth, XSS, Server Actions (coding-time) | `paths:` app/auth/env |
13
14
 
14
15
  On-demand (не rule): **`commands/technical-retro.md`** (фасилитация ретро).
@@ -12,6 +12,6 @@ When the user message looks like a **work request** (implement, add, fix, refact
12
12
 
13
13
  1. Prefer **`/task <their request>`** or invoke **task-router** first.
14
14
  2. Do not jump straight to coding without router + pipeline when scope is non-trivial.
15
- 3. Pure questions («как работает X», «объясни») — answer normally, no `/task`.
15
+ 3. Pure questions («как работает X», «объясни») — prefer agent **`codebase-analyzer`** (explain-as-is); trivial one-liners may be answered inline. Do not open `/task`.
16
16
 
17
17
  Exceptions: user explicitly says «без pipeline», «просто сделай», or continues an active slug.
@@ -146,7 +146,7 @@ If `pipeline.json` is missing (old `/feature-start` tasks), fall back to fixed p
146
146
 
147
147
  Do **not** run `/task` + router for:
148
148
 
149
- - Pure questions («как работает X», «объясни»).
149
+ - Pure questions («как работает X», «объясни») — prefer agent **`codebase-analyzer`** for deep traces; inline OK for trivial one-liners.
150
150
  - Typo / one-file fix / trivial config with no architecture risk.
151
151
  - User explicitly says «без pipeline», «просто сделай», or continues an active slug.
152
152
  - Single-line `docs-only` with no code impact.
@@ -61,10 +61,20 @@ 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
  - Public API: index/barrel‑файлы (`architecture/public-imports.md`, `architecture/layer-barrel-exports.md`).
69
79
  - Примеры: общий хук/утилита; `any`/`unknown`; разделение компонента; CSS‑токены.
70
- - Lint/stylelint — только **`tooling-and-review/post-change-lint.md`**; ESLint: `app/eslint.config.mjs`. `eslint-disable` — точечно с комментарием «зачем».
80
+ - Lint/stylelint — только **`tooling-and-review/post-change-lint.md`**; ESLint: `app/eslint.config.mjs`. `eslint-disable` — точечно с комментарием «зачем». Style prose in domain rules stays thin — prefer ESLint/Stylelint over duplicating formatter recipes.
@@ -37,3 +37,25 @@ Concrete rule stems — in **Stack notes**.
37
37
  - Use local `git diff` — do not invent hosting metadata.
38
38
  - Boy scout rule: suggest fixes feasible within the MR scope.
39
39
  - No «большие рефакторинги» without an explicit request (`code-quality-and-refactoring`).
40
+
41
+ ## Output contract
42
+
43
+ Procedure details live in skill `code-review`. Required shape:
44
+
45
+ - Each finding cites **`path:line`**, the problem, impact, and a concrete fix direction.
46
+ - Rank by severity: **`blocker` | `important` | `nit`** (list blocker → nit).
47
+ - Vague («looks risky») is not a finding — cite evidence or ask for surrounding file context.
48
+ - End with a verdict on its own line: **`Safe to merge | needs changes | reject`**.
49
+
50
+ ## Stack notes
51
+
52
+ On-demand rule for review flows. **Procedure and output format:** skill `code-review`.
53
+
54
+ ### Checklist references
55
+
56
+ - Architecture layers: `architecture/architecture-boundaries.md`, `stack/next-app-core.md`; network: `api-and-data/http-client.md`
57
+ - Imports: `architecture/public-imports.md`, `architecture/layer-barrel-exports.md`
58
+ - UI: `ui-and-accessibility/react-ui.md`
59
+ - Security: `tooling-and-review/security-next.md`
60
+ - Tests: `testing/tests-unit.md`, `testing/playwright-agents.md`, `testing/tests-e2e-structure.md`
61
+ - Lint gate before final report: `tooling-and-review/post-change-lint.md`
@@ -0,0 +1,57 @@
1
+ ---
2
+ description: Next.js frontend security — secrets, auth, XSS, Server Actions, env
3
+ paths:
4
+ - "app/src/**/*.{ts,tsx}"
5
+ - "app/**/app/**/*.{ts,tsx}"
6
+ - "**/*Auth*.{ts,tsx}"
7
+ - "**/*Session*.{ts,tsx}"
8
+ - "**/.env*"
9
+ - .claude/commands/**/*
10
+ - .claude/agents/**/*
11
+ ---
12
+
13
+ # Security (Next.js)
14
+
15
+ Coding-time checklist. Full audit → agent `security-reviewer` + skill `code-review`.
16
+
17
+ ## Secrets and env
18
+
19
+ - Never put service / secret keys in `NEXT_PUBLIC_*` or client bundles (`sk_`, private API keys, DB URLs).
20
+ - Do not commit `.env*` with real secrets; use CI / secret manager patterns already in the repo.
21
+ - Prefer server-only modules for privileged clients; do not import them into Client Components.
22
+
23
+ ## Auth and session
24
+
25
+ - Enforce auth on the **server** (layouts, pages, Server Actions, route handlers) — not only Edge middleware.
26
+ - Middleware may refresh sessions; do not treat middleware alone as authorization.
27
+ - Prefer httpOnly secure cookies over `localStorage` for tokens when the repo pattern allows.
28
+ - Never trust client-only session claims without a server verify step used by the project.
29
+
30
+ ## Mutations and input
31
+
32
+ - Server Actions / route handlers: validate untrusted input at the edge (Zod or the repo’s schema pattern).
33
+ - Prefer an explicit success/error response shape over throwing opaque errors to the client.
34
+ - CSRF / origin checks — follow existing repo middleware and form patterns for state-changing requests.
35
+
36
+ ## XSS and output
37
+
38
+ - Avoid `dangerouslySetInnerHTML` unless sanitized and unavoidable; prefer text nodes / safe components.
39
+ - Sanitize or encode user-generated HTML/markdown before render.
40
+ - Open redirects: validate redirect targets against an allowlist or same-origin paths.
41
+
42
+ ## Data exposure
43
+
44
+ - Do not log tokens, passwords, or full PII in client or server logs.
45
+ - Do not return full privileged records to the client — map to the minimum domain fields the UI needs.
46
+
47
+ ## Anti-hallucination
48
+
49
+ | ❌ Avoid | ✅ Prefer |
50
+ |---------|----------|
51
+ | Invented auth helpers not in `package.json` / codebase | Copy patterns from existing auth routes |
52
+ | Putting secrets in `NEXT_PUBLIC_*` | Server-only env + server modules |
53
+ | Auth only in middleware | Server `getUser` / session verify in layout/page/action |
54
+
55
+ ## Agent requirement
56
+
57
+ On auth, forms, payments, or env changes — load this rule and `tooling-and-review/code-review-mr.md`. Route sensitive features through `security-reviewer`.
@@ -2,6 +2,7 @@
2
2
  paths:
3
3
  - app/src/ui/**/*.tsx
4
4
  - app/src/ui/**/*.ts
5
+ impact: HIGH
5
6
  ---
6
7
 
7
8
  # Общие правила компонентов
@@ -89,3 +90,23 @@ paths:
89
90
  - **Testing Library** для React, как принято в проекте;
90
91
  - проверять поведение и бизнес‑правила, а не конкретные CSS‑классы.
91
92
  - В тестах ориентироваться на текст, роли и aria‑атрибуты.
93
+ ## Incorrect
94
+
95
+ ```tsx
96
+ import { mapUserDto } from '@/api/services/UsersApi/userResponseMappers'
97
+
98
+ export const UserBadge = ({ dto }: { dto: unknown }) => {
99
+ const user = mapUserDto(dto as any) // mapping + deep import in UI
100
+ return <span>{user.name}</span>
101
+ }
102
+ ```
103
+
104
+ ## Correct
105
+
106
+ ```tsx
107
+ import type { TUserProfile } from '@/types'
108
+
109
+ export const UserBadge = ({ user }: { user: TUserProfile }) => {
110
+ return <span>{user.name}</span>
111
+ }
112
+ ```
@@ -11,5 +11,7 @@
11
11
  | `unit-testing` | Planning, generating, or healing unit test coverage |
12
12
  | `playwright-e2e` | Planning, generating, or healing Playwright e2e coverage |
13
13
  | `technical-retro` | Technical retrospective for a task, sprint, incident, or agent pipeline |
14
+ | `write-adr` | Author an Architecture Decision Record (context / decision / consequences) |
15
+ | `react-performance` | Implementer checklist: bundle, RSC/client, memo, waterfalls, CWV (not a perf audit agent) |
14
16
 
15
17
  Папка копируется в `.claude/skills/` при `ai-rules init claude --preset next`, если существует.
@@ -17,11 +17,19 @@ Use the local repository as the source of truth: `git status`, `git diff`, task
17
17
  4. Check public imports through `@/types` and `@/api`, plus barrel updates for new public symbols.
18
18
  5. Review UI consistency, styling conventions, and prop shape.
19
19
  6. Check tests: unit for mapper/domain logic, behavior tests for HTTP client changes, e2e plan/spec updates for user flows.
20
- 7. Report validation gaps: lint, stylelint, type-check, or relevant tests not run.
20
+ 7. **Reuse lens:** flag new helpers that duplicate existing utilities; prefer adjacent shared modules over copy-paste.
21
+ 8. **Efficiency lens:** unnecessary work, sequential ops that should be parallel, hot-path bloat, no-op store updates, overly broad reads.
22
+ 9. Report validation gaps: lint, stylelint, type-check, or relevant tests not run.
21
23
 
22
24
  ## Output
23
25
 
24
- 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.
26
+ Lead with findings ordered by severity. Required shape (also in `code-review-mr`):
27
+
28
+ - Each finding: **`path:line`** — problem — impact — concrete fix direction.
29
+ - Severity: **`blocker` | `important` | `nit`** (list blocker → nit).
30
+ - Vague («looks risky») is not a finding — cite evidence or ask for surrounding context.
31
+ - End with a verdict line: **`Safe to merge | needs changes | reject`**.
32
+ - If there are no findings, say so and call out remaining test or validation risk.
25
33
 
26
34
  For agent team tasks, write `.claude/team/tasks/<slug>/review.md` and set `status.json` to `completed` or `changes_requested`.
27
35
 
@@ -10,6 +10,10 @@ description: Delivers Next.js frontend features end-to-end across domain types,
10
10
  3. Add or update focused tests for changed behavior.
11
11
  4. Validation from `app/`: **invoke** **`rules/tooling-and-review/post-change-lint.md`** after code edits (requestable, not session-start — but mandatory when code changed). Pipeline: scoped lint OK if next step is `build-verifier`.
12
12
 
13
+ ## Scope discipline
14
+
15
+ Implement only the current AC / decomposition task. Clarify ambiguity before coding; do not add unrelated hardening, polish, or refactors. See `feature-developer` → **Zero improvisation**.
16
+
13
17
  ## Handoff
14
18
 
15
19
  Summarize by layer, validation results, and known gaps. Agent team: update `.claude/team/tasks/<slug>/status.json`.
@@ -0,0 +1,44 @@
1
+ ---
2
+ name: react-performance
3
+ description: Next.js React performance checklist for implementers — bundle, RSC/client boundaries, memoization discipline, data-fetch waterfalls, Core Web Vitals. Use while coding a next feature; not a substitute for the performance-auditor agent when the user asks for an audit report.
4
+ ---
5
+
6
+ # React performance (next)
7
+
8
+ On-demand checklist for **implementers** shipping Next.js UI. For a formal diff audit report, use the **`performance-auditor`** agent instead — this skill does not replace it.
9
+
10
+ ## Bundle
11
+
12
+ - Prefer route-level and component-level code splitting for heavy UI (charts, editors).
13
+ - Avoid importing large libraries into shared layouts; keep client entry points small.
14
+ - Check that barrel files do not re-export heavy modules into every consumer.
15
+
16
+ ## RSC / client boundaries
17
+
18
+ - Default to Server Components; add `"use client"` only when hooks, browser APIs, or interactivity require it.
19
+ - Keep client leaves small; pass serializable props from server parents.
20
+ - Do not pull server-only modules (secrets, Node APIs) into client components.
21
+
22
+ ## Memoization discipline
23
+
24
+ - Do **not** add `useMemo` / `useCallback` by default — follow the repo’s React Compiler / team guidance.
25
+ - Memoize when profiling shows unstable props causing expensive subtree re-renders, or when an existing pattern already does.
26
+ - Prefer fixing state placement and list keys over blanket memo wrappers.
27
+
28
+ ## Data-fetch waterfalls
29
+
30
+ - Avoid sequential awaits that could be parallel (`Promise.all`) when independent.
31
+ - Lift shared fetches to a layout/parent when multiple children need the same data.
32
+ - Prefer store/thunk or server fetch patterns already used in the feature’s reference slice — do not invent a second data layer.
33
+
34
+ ## Core Web Vitals (quick)
35
+
36
+ | Metric | Implementer checks |
37
+ |--------|--------------------|
38
+ | LCP | Hero/media not blocked by unnecessary client JS; sensible image sizing |
39
+ | INP | Click handlers lean; avoid long sync work on the main thread |
40
+ | CLS | Reserve space for images/skeleton; stable fonts |
41
+
42
+ ## Handoff
43
+
44
+ If the user asks for a **performance audit report** of a diff/deliverable, route to **`performance-auditor`** (readonly `perf-report.md`), not this skill alone.
@@ -29,12 +29,26 @@ Ask for missing period, focus, task slug, participants, or format constraints. I
29
29
 
30
30
  For `/task` pipelines, include router, analyst, developer, **build-verifier**, reviewer, QA/e2e, hooks, and rules.
31
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
+
32
46
  ## Preset feedback loop
33
47
 
34
- If the same issue appeared in 2+ tasks, add section **Preset updates**:
48
+ If the same issue appeared in **2+** tasks (or **3+** for packaging a new rule/skill — Rule of Three), add section **Preset updates**:
35
49
 
36
- - Proposed change to `.claude/rules/`, `.claude/agents/`, or `.claude/skills/`
37
- - One concrete diff or file path to update
38
- - Whether it belongs in session-start rules vs `paths:` vs skill
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)
39
53
 
40
- Do not apply preset changes without user approval.
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
+ -
@@ -1,5 +1,7 @@
1
1
  # Go hexagonal stack — Cursor agent team
2
2
 
3
+ **Repo-root agents:** see [`AGENTS.md`](../../AGENTS.md) at the project root (cross-tool setup, commands, security, living conventions pointers).
4
+
3
5
  | Задача | Куда смотреть |
4
6
  |--------|----------------|
5
7
  | Новая work-задача | `/task` → `commands/task.md` + `agent-team-orchestrator.mdc` |
@@ -8,6 +10,8 @@
8
10
  | После правок Go | `post-change-test.mdc` (+ `go-tooling.mdc`) |
9
11
  | Integration tests | `integration-test-*` + skill `integration-testing` |
10
12
  | Code review | skill `code-review` + `code-review-mr.mdc` |
13
+ | ADR | skill `write-adr` (on-demand) |
14
+ | Как работает X | agent `codebase-analyzer` (explain-as-is; без `/task`) |
11
15
 
12
16
  ## Install
13
17
 
@@ -15,6 +19,8 @@
15
19
  npx @bonesofspring/ai-rules init cursor --preset go
16
20
  ```
17
21
 
22
+ Копирует rules/agents/hooks/skills/team + `REPO_AGENTS.md` → корневой `AGENTS.md`.
23
+
18
24
  ## Dogfood (5 сценариев)
19
25
 
20
26
  1. `/task` — новый use case (domain → ports → adapters → wire).
@@ -10,14 +10,15 @@ npx @bonesofspring/ai-rules init cursor --preset go
10
10
 
11
11
  | Path | Содержание |
12
12
  |------|------------|
13
- | `AGENTS.md` | Quick-start |
13
+ | `REPO_AGENTS.md` | → repo-root `AGENTS.md` (cross-tool) |
14
+ | `AGENTS.md` | → `.cursor/AGENTS.md` quick-start |
14
15
  | `BUGBOT.md` | Bugbot review priorities (Go) |
15
16
  | `rules/**` | `.mdc` + README (alwaysApply ≤3) |
16
- | `agents/**` | **20** ролей (+ README) |
17
- | `skills/**` | **7** skills (в т.ч. `integration-testing`) |
17
+ | `agents/**` | **21** ролей (+ README; includes on-demand `codebase-analyzer`) |
18
+ | `skills/**` | **8** skills (incl. `integration-testing`, `write-adr`; no `react-performance`) |
18
19
  | `commands/**` | task, task-continue, feature-start/continue, technical-retro |
19
- | `hooks.json` + `hooks/**` | guard-shell + chain-team-phases |
20
- | `team/**` | fixtures + README |
20
+ | `hooks.json` + `hooks/**` | guard-shell + chain-team-phases; optional `hooks/examples/` |
21
+ | `team/**` | fixtures + `conventions.md` + README |
21
22
  | `mcp.json` + `MCP.md` | Context7 + Figma (same as ios baseline) |
22
23
 
23
24
  ## alwaysApply (≤3)
@@ -0,0 +1,48 @@
1
+ # Go — 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 go
13
+ npx @bonesofspring/ai-rules init claude --preset go
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
+ Prefer hexagonal / ports-and-adapters layout from stack rules (`go-app-core`, `architecture-boundaries`).
21
+
22
+ | Gate | Typical command |
23
+ |------|-----------------|
24
+ | Test | `go test ./...` (or package-scoped) |
25
+ | Vet | `go vet ./...` |
26
+ | Lint | **golangci-lint** when configured |
27
+ | Format | `gofmt` / `goimports` |
28
+
29
+ After code edits: invoke **`post-change-test`** (requestable). Full gate: agent `build-verifier`.
30
+
31
+ ## Security basics
32
+
33
+ - Do not commit secrets (tokens, `.env`, private keys).
34
+ - Review destructive git before running; respect shell hooks.
35
+ - Do not weaken CI or skip hooks unless the user explicitly asks.
36
+
37
+ ## Tool entry points
38
+
39
+ | Tool | Map |
40
+ |------|-----|
41
+ | Cursor | `.cursor/AGENTS.md` (optional if Cursor not installed) |
42
+ | Claude Code | `.claude/CLAUDE.md` (optional if Claude not installed) |
43
+
44
+ Rules: `.cursor/rules/` or `.claude/rules/`. Skills: `.cursor/skills/` or `.claude/skills/`.
45
+
46
+ ## Living conventions
47
+
48
+ Gotchas, local patterns, and team decisions: **`.cursor/team/conventions.md`** and/or **`.claude/team/conventions.md`** (fill after init).
@@ -1,8 +1,19 @@
1
1
  # `.cursor/agents` (preset go)
2
2
 
3
+ Ролевые subagents для командного пайплайна Cursor (Go hexagonal).
4
+
5
+ ## Analysis (on-demand)
6
+
7
+ | Agent | Файл | Production-код |
8
+ |-------|------|----------------|
9
+ | Codebase analyzer | `codebase-analyzer.md` | no (explain-as-is only) |
10
+
11
+ ## Roster (21)
12
+
3
13
  | Agent | Production writes |
4
14
  |-------|-------------------|
5
15
  | task-router, task-analyst, solution-architect | team only |
16
+ | codebase-analyzer | no (explain-as-is only) |
6
17
  | feature-developer | yes (Go sources) |
7
18
  | build-verifier | no (report only) |
8
19
  | debugger, ci-investigator | minimal |
@@ -10,6 +21,16 @@
10
21
  | migration-specialist, api-contract-reviewer, tech-writer | team / docs |
11
22
  | qa-tester, unit-test-*, integration-test-* | tests |
12
23
 
13
- **Roster:** 20 agents. **No** `accessibility-reviewer`, Playwright, or XCUITest stems.
24
+ **No** `accessibility-reviewer`, Playwright, or XCUITest stems. Replace those intents with **`integration-test-*`**.
25
+
26
+ ## Frontmatter `readonly`
27
+
28
+ Все agents — **`readonly: false`** (нужна запись в `.cursor/team/**`). Ограничения production — в теле промпта.
29
+
30
+ ## Model matrix (frontmatter `model`)
14
31
 
15
- Replace Playwright/XCUITest intents with **`integration-test-*`**.
32
+ | Tier | Frontmatter | Agents |
33
+ |------|-------------|--------|
34
+ | **cheap** | `fast` | router, analyst, build-verifier, code-reviewer, tech-writer, codebase-analyzer |
35
+ | **standard** | `inherit` | developer, debugger, ci-investigator, api-contract, qa, unit-*, integration-* |
36
+ | **strong** | `claude-opus-4-8[effort=high]` | solution-architect, migration-specialist, security-reviewer, performance-auditor |
@@ -28,3 +28,8 @@ yarn check:preset-structure
28
28
  Hard gates: twin-map (stacks include **go**), token-budget (alwaysApply/session-start = 3), leakage (`GO_FORBIDDEN_*`, chain forks go≠next≠ios-swift).
29
29
 
30
30
  Document PASS/FAIL in `validation-report.md`.
31
+
32
+ 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.
33
+ 10. **Hooks cookbook:** default `hooks.json` must **not** reference `hooks/examples/` → **FAIL** if it does.
34
+ 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`.
35
+ 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`.