@bonesofspring/ai-rules 0.2.9 → 0.2.11

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 (192) hide show
  1. package/CHANGELOG.md +21 -3
  2. package/README.md +3 -1
  3. package/bin/cli.js +2 -0
  4. package/package.json +1 -1
  5. package/presets/_shared/core/meta/preset-no-cross-stack-leakage.md +15 -2
  6. package/presets/_shared/core/meta/preset-token-budget.md +1 -1
  7. package/presets/_shared/core/meta/preset-twin-sync.md +2 -0
  8. package/presets/claude/go/rules/api-and-data/persistence-adapters.md +10 -7
  9. package/presets/claude/go/rules/architecture/application-usecases.md +9 -5
  10. package/presets/claude/go/rules/architecture/boundaries.md +6 -1
  11. package/presets/claude/go/rules/architecture/composition-root.md +14 -9
  12. package/presets/claude/go/rules/testing/e2e.md +8 -6
  13. package/presets/claude/go/rules/testing/integration.md +11 -5
  14. package/presets/claude/go/rules/tooling-and-review/preset-no-cross-stack-leakage.md +15 -2
  15. package/presets/claude/go/rules/tooling-and-review/preset-token-budget.md +1 -1
  16. package/presets/claude/go/rules/tooling-and-review/preset-twin-sync.md +2 -0
  17. package/presets/claude/go/rules/tooling-and-review/security-go.md +17 -5
  18. package/presets/claude/ios-swift/README.md +1 -1
  19. package/presets/claude/ios-swift/agents/build-verifier.md +1 -1
  20. package/presets/claude/ios-swift/rules/README.md +1 -1
  21. package/presets/claude/ios-swift/rules/tooling-and-review/preset-no-cross-stack-leakage.md +15 -2
  22. package/presets/claude/ios-swift/rules/tooling-and-review/preset-token-budget.md +1 -1
  23. package/presets/claude/ios-swift/rules/tooling-and-review/preset-twin-sync.md +2 -0
  24. package/presets/claude/java/agents/build-verifier.md +1 -1
  25. package/presets/claude/java/rules/README.md +1 -1
  26. package/presets/claude/java/rules/api-and-data/messaging-adapters.md +16 -9
  27. package/presets/claude/java/rules/architecture/boundaries.md +6 -1
  28. package/presets/claude/java/rules/tooling-and-review/preset-no-cross-stack-leakage.md +15 -2
  29. package/presets/claude/java/rules/tooling-and-review/preset-token-budget.md +1 -1
  30. package/presets/claude/java/rules/tooling-and-review/preset-twin-sync.md +2 -0
  31. package/presets/claude/mcp-ts/CLAUDE.md +13 -0
  32. package/presets/claude/mcp-ts/MCP.md +37 -0
  33. package/presets/claude/mcp-ts/README.md +11 -0
  34. package/presets/claude/mcp-ts/REPO_AGENTS.md +49 -0
  35. package/presets/claude/mcp-ts/agents/README.md +21 -0
  36. package/presets/claude/mcp-ts/agents/build-verifier.md +39 -0
  37. package/presets/claude/mcp-ts/agents/feature-developer.md +47 -0
  38. package/presets/claude/mcp-ts/agents/security-reviewer.md +21 -0
  39. package/presets/claude/mcp-ts/agents/solution-architect.md +23 -0
  40. package/presets/claude/mcp-ts/agents/task-analyst.md +25 -0
  41. package/presets/claude/mcp-ts/agents/task-router.md +73 -0
  42. package/presets/claude/mcp-ts/commands/README.md +11 -0
  43. package/presets/claude/mcp-ts/commands/feature-continue.md +19 -0
  44. package/presets/claude/mcp-ts/commands/feature-start.md +33 -0
  45. package/presets/claude/mcp-ts/commands/task-continue.md +49 -0
  46. package/presets/claude/mcp-ts/commands/task.md +49 -0
  47. package/presets/claude/mcp-ts/commands/technical-retro.md +81 -0
  48. package/presets/claude/mcp-ts/hooks/README.md +12 -0
  49. package/presets/claude/mcp-ts/hooks/chain-team-phases.sh +346 -0
  50. package/presets/claude/mcp-ts/hooks/examples/README.md +11 -0
  51. package/presets/claude/mcp-ts/hooks/examples/format-edited.example.sh +16 -0
  52. package/presets/claude/mcp-ts/hooks/examples/secret-guard.example.sh +10 -0
  53. package/presets/claude/mcp-ts/hooks/examples/test-on-save.example.sh +25 -0
  54. package/presets/claude/mcp-ts/hooks/guard-shell-command.sh +79 -0
  55. package/presets/claude/mcp-ts/mcp.json +11 -0
  56. package/presets/claude/mcp-ts/rules/README.md +52 -0
  57. package/presets/claude/mcp-ts/rules/api-and-data/README.md +3 -0
  58. package/presets/claude/mcp-ts/rules/api-and-data/mcp-auth-secrets.md +44 -0
  59. package/presets/claude/mcp-ts/rules/api-and-data/mcp-contract-testing.md +42 -0
  60. package/presets/claude/mcp-ts/rules/api-and-data/mcp-tool-design.md +37 -0
  61. package/presets/claude/mcp-ts/rules/api-and-data/mcp-transport-packaging.md +43 -0
  62. package/presets/claude/mcp-ts/rules/architecture/README.md +3 -0
  63. package/presets/claude/mcp-ts/rules/architecture/feature-delivery.md +45 -0
  64. package/presets/claude/mcp-ts/rules/architecture/mcp-server-boundaries.md +28 -0
  65. package/presets/claude/mcp-ts/rules/architecture/reference-features.md +33 -0
  66. package/presets/claude/mcp-ts/rules/stack/README.md +3 -0
  67. package/presets/claude/mcp-ts/rules/stack/mcp-ts-app-core.md +27 -0
  68. package/presets/claude/mcp-ts/rules/stack/mcp-ts-conventions.md +29 -0
  69. package/presets/claude/mcp-ts/rules/testing/README.md +3 -0
  70. package/presets/claude/mcp-ts/rules/testing/unit.md +30 -0
  71. package/presets/claude/mcp-ts/rules/tooling-and-review/README.md +3 -0
  72. package/presets/claude/mcp-ts/rules/tooling-and-review/agent-team-intake.md +23 -0
  73. package/presets/claude/mcp-ts/rules/tooling-and-review/agent-team-orchestrator.md +161 -0
  74. package/presets/claude/mcp-ts/rules/tooling-and-review/anti-sycophancy-discipline.md +34 -0
  75. package/presets/claude/mcp-ts/rules/tooling-and-review/code-quality.md +52 -0
  76. package/presets/claude/mcp-ts/rules/tooling-and-review/code-review.md +51 -0
  77. package/presets/claude/mcp-ts/rules/tooling-and-review/design-guidance.md +109 -0
  78. package/presets/claude/mcp-ts/rules/tooling-and-review/mcp-ts-tooling.md +31 -0
  79. package/presets/claude/mcp-ts/rules/tooling-and-review/post-change-test.md +30 -0
  80. package/presets/claude/mcp-ts/rules/tooling-and-review/preset-layering.md +36 -0
  81. package/presets/claude/mcp-ts/rules/tooling-and-review/preset-no-cross-stack-leakage.md +69 -0
  82. package/presets/claude/mcp-ts/rules/tooling-and-review/preset-pr-checklist.md +39 -0
  83. package/presets/claude/mcp-ts/rules/tooling-and-review/preset-token-budget.md +41 -0
  84. package/presets/claude/mcp-ts/rules/tooling-and-review/preset-twin-sync.md +46 -0
  85. package/presets/claude/mcp-ts/rules/tooling-and-review/security-mcp.md +52 -0
  86. package/presets/claude/mcp-ts/rules/tooling-and-review/technical-retro.md +20 -0
  87. package/presets/claude/mcp-ts/rules/ui-and-accessibility/README.md +3 -0
  88. package/presets/claude/mcp-ts/skills/README.md +12 -0
  89. package/presets/claude/mcp-ts/skills/code-review/SKILL.md +10 -0
  90. package/presets/claude/mcp-ts/skills/debug-investigation/SKILL.md +11 -0
  91. package/presets/claude/mcp-ts/skills/feature-delivery/SKILL.md +29 -0
  92. package/presets/claude/mcp-ts/skills/unit-testing/SKILL.md +16 -0
  93. package/presets/claude/mcp-ts/team/README.md +17 -0
  94. package/presets/claude/mcp-ts/team/conventions.md +14 -0
  95. package/presets/claude/mcp-ts/team/fixtures/bugfix-standard.json +32 -0
  96. package/presets/claude/mcp-ts/team/fixtures/feature-full.json +33 -0
  97. package/presets/claude/mcp-ts/team/fixtures/feature-light.json +34 -0
  98. package/presets/claude/next/agents/build-verifier.md +1 -1
  99. package/presets/claude/next/rules/tooling-and-review/preset-no-cross-stack-leakage.md +15 -2
  100. package/presets/claude/next/rules/tooling-and-review/preset-token-budget.md +1 -1
  101. package/presets/claude/next/rules/tooling-and-review/preset-twin-sync.md +2 -0
  102. package/presets/cursor/go/rules/README.md +8 -8
  103. package/presets/cursor/go/rules/application-usecases.mdc +9 -5
  104. package/presets/cursor/go/rules/architecture-boundaries.mdc +6 -0
  105. package/presets/cursor/go/rules/composition-root.mdc +14 -9
  106. package/presets/cursor/go/rules/persistence-adapters.mdc +10 -7
  107. package/presets/cursor/go/rules/preset-no-cross-stack-leakage.mdc +15 -2
  108. package/presets/cursor/go/rules/preset-token-budget.mdc +1 -1
  109. package/presets/cursor/go/rules/preset-twin-sync.mdc +2 -0
  110. package/presets/cursor/go/rules/security-go.mdc +17 -5
  111. package/presets/cursor/go/rules/tests-e2e.mdc +8 -6
  112. package/presets/cursor/go/rules/tests-integration.mdc +11 -5
  113. package/presets/cursor/ios-swift/agents/build-verifier.md +1 -1
  114. package/presets/cursor/ios-swift/rules/README.md +1 -1
  115. package/presets/cursor/ios-swift/rules/preset-no-cross-stack-leakage.mdc +15 -2
  116. package/presets/cursor/ios-swift/rules/preset-token-budget.mdc +1 -1
  117. package/presets/cursor/ios-swift/rules/preset-twin-sync.mdc +2 -0
  118. package/presets/cursor/java/README.md +1 -1
  119. package/presets/cursor/java/agents/build-verifier.md +1 -1
  120. package/presets/cursor/java/rules/README.md +4 -4
  121. package/presets/cursor/java/rules/architecture-boundaries.mdc +6 -0
  122. package/presets/cursor/java/rules/messaging-adapters.mdc +16 -10
  123. package/presets/cursor/java/rules/preset-no-cross-stack-leakage.mdc +15 -2
  124. package/presets/cursor/java/rules/preset-token-budget.mdc +1 -1
  125. package/presets/cursor/java/rules/preset-twin-sync.mdc +2 -0
  126. package/presets/cursor/mcp-ts/AGENTS.md +25 -0
  127. package/presets/cursor/mcp-ts/BUGBOT.md +9 -0
  128. package/presets/cursor/mcp-ts/MCP.md +37 -0
  129. package/presets/cursor/mcp-ts/README.md +19 -0
  130. package/presets/cursor/mcp-ts/REPO_AGENTS.md +49 -0
  131. package/presets/cursor/mcp-ts/agents/README.md +21 -0
  132. package/presets/cursor/mcp-ts/agents/build-verifier.md +39 -0
  133. package/presets/cursor/mcp-ts/agents/feature-developer.md +47 -0
  134. package/presets/cursor/mcp-ts/agents/security-reviewer.md +21 -0
  135. package/presets/cursor/mcp-ts/agents/solution-architect.md +23 -0
  136. package/presets/cursor/mcp-ts/agents/task-analyst.md +25 -0
  137. package/presets/cursor/mcp-ts/agents/task-router.md +73 -0
  138. package/presets/cursor/mcp-ts/commands/README.md +11 -0
  139. package/presets/cursor/mcp-ts/commands/feature-continue.md +19 -0
  140. package/presets/cursor/mcp-ts/commands/feature-start.md +33 -0
  141. package/presets/cursor/mcp-ts/commands/task-continue.md +49 -0
  142. package/presets/cursor/mcp-ts/commands/task.md +49 -0
  143. package/presets/cursor/mcp-ts/commands/technical-retro.md +81 -0
  144. package/presets/cursor/mcp-ts/hooks/README.md +12 -0
  145. package/presets/cursor/mcp-ts/hooks/chain-team-phases.sh +346 -0
  146. package/presets/cursor/mcp-ts/hooks/examples/README.md +11 -0
  147. package/presets/cursor/mcp-ts/hooks/examples/format-edited.example.sh +16 -0
  148. package/presets/cursor/mcp-ts/hooks/examples/secret-guard.example.sh +10 -0
  149. package/presets/cursor/mcp-ts/hooks/examples/test-on-save.example.sh +25 -0
  150. package/presets/cursor/mcp-ts/hooks/guard-shell-command.sh +79 -0
  151. package/presets/cursor/mcp-ts/hooks.json +17 -0
  152. package/presets/cursor/mcp-ts/mcp.json +11 -0
  153. package/presets/cursor/mcp-ts/rules/README.md +52 -0
  154. package/presets/cursor/mcp-ts/rules/agent-team-intake.mdc +21 -0
  155. package/presets/cursor/mcp-ts/rules/agent-team-orchestrator.mdc +159 -0
  156. package/presets/cursor/mcp-ts/rules/anti-sycophancy-discipline.mdc +35 -0
  157. package/presets/cursor/mcp-ts/rules/code-quality-and-refactoring.mdc +53 -0
  158. package/presets/cursor/mcp-ts/rules/code-review-mr.mdc +50 -0
  159. package/presets/cursor/mcp-ts/rules/design-guidance.mdc +108 -0
  160. package/presets/cursor/mcp-ts/rules/feature-delivery-workflow.mdc +43 -0
  161. package/presets/cursor/mcp-ts/rules/mcp-auth-secrets.mdc +45 -0
  162. package/presets/cursor/mcp-ts/rules/mcp-contract-testing.mdc +43 -0
  163. package/presets/cursor/mcp-ts/rules/mcp-server-boundaries.mdc +29 -0
  164. package/presets/cursor/mcp-ts/rules/mcp-tool-design.mdc +38 -0
  165. package/presets/cursor/mcp-ts/rules/mcp-transport-packaging.mdc +44 -0
  166. package/presets/cursor/mcp-ts/rules/mcp-ts-app-core.mdc +28 -0
  167. package/presets/cursor/mcp-ts/rules/mcp-ts-conventions.mdc +30 -0
  168. package/presets/cursor/mcp-ts/rules/mcp-ts-tooling.mdc +32 -0
  169. package/presets/cursor/mcp-ts/rules/post-change-test.mdc +26 -0
  170. package/presets/cursor/mcp-ts/rules/preset-layering.mdc +36 -0
  171. package/presets/cursor/mcp-ts/rules/preset-no-cross-stack-leakage.mdc +69 -0
  172. package/presets/cursor/mcp-ts/rules/preset-pr-checklist.mdc +39 -0
  173. package/presets/cursor/mcp-ts/rules/preset-token-budget.mdc +41 -0
  174. package/presets/cursor/mcp-ts/rules/preset-twin-sync.mdc +46 -0
  175. package/presets/cursor/mcp-ts/rules/reference-features.mdc +34 -0
  176. package/presets/cursor/mcp-ts/rules/security-mcp.mdc +53 -0
  177. package/presets/cursor/mcp-ts/rules/technical-retro.mdc +18 -0
  178. package/presets/cursor/mcp-ts/rules/tests-unit.mdc +31 -0
  179. package/presets/cursor/mcp-ts/skills/README.md +12 -0
  180. package/presets/cursor/mcp-ts/skills/code-review/SKILL.md +10 -0
  181. package/presets/cursor/mcp-ts/skills/debug-investigation/SKILL.md +11 -0
  182. package/presets/cursor/mcp-ts/skills/feature-delivery/SKILL.md +29 -0
  183. package/presets/cursor/mcp-ts/skills/unit-testing/SKILL.md +16 -0
  184. package/presets/cursor/mcp-ts/team/README.md +17 -0
  185. package/presets/cursor/mcp-ts/team/conventions.md +14 -0
  186. package/presets/cursor/mcp-ts/team/fixtures/bugfix-standard.json +32 -0
  187. package/presets/cursor/mcp-ts/team/fixtures/feature-full.json +33 -0
  188. package/presets/cursor/mcp-ts/team/fixtures/feature-light.json +34 -0
  189. package/presets/cursor/next/agents/build-verifier.md +1 -1
  190. package/presets/cursor/next/rules/preset-no-cross-stack-leakage.mdc +15 -2
  191. package/presets/cursor/next/rules/preset-token-budget.mdc +1 -1
  192. package/presets/cursor/next/rules/preset-twin-sync.mdc +2 -0
@@ -0,0 +1,52 @@
1
+ ---
2
+ description: Code quality and light refactoring for TypeScript MCP servers
3
+ ---
4
+
5
+ <!-- shared-core: quality/code-quality-and-refactoring.md -->
6
+
7
+ # Поддержка существующего стиля
8
+
9
+ - Следовать существующим паттернам (имена, структура, типизация / DI / error handling); минимизировать стилистический шум (лишний format/rename).
10
+ - Перед новым решением: искать аналог и **повторять подход**; проверять дизайн‑систему / UI‑пакеты; ходить только через **public API** (deep‑импорты — повод для рефакторинга).
11
+
12
+ # Принципы
13
+
14
+ - **KISS:** самое простое изменение в паттернах репозитория.
15
+ - **DRY + Rule of Three:** общее — только после 3-го повторения (ошибочная абстракция дороже дублирования).
16
+ - **YAGNI:** без API, флагов, слоёв «на будущее» без текущего требования.
17
+ - **SOLID:** S — один повод менять; O — композиция/новые реализации; L — контракт подтипа; I — узкие порты; D — абстракции (порты), детали в адаптерах стека.
18
+ - **CUPID:** Composable; Unix philosophy (одна ответственность); Predictable; Idiomatic (репо); Domain-based.
19
+ - **Composition over inheritance;** Law of Demeter — без цепочек `a.b.c.d`; через public API / facade.
20
+
21
+ # Рефакторинг при изменениях
22
+
23
+ - Лёгкий refactor OK, если меньше дублирования, выше читаемость, без ломки публичных контрактов.
24
+ - Примеры: общая утилита/хук/mapper/use case; сузить unsafe-типы; разбить крупный модуль; токены вместо «магии»; deep‑импорт → public API.
25
+ - Не делать «большой» рефакторинг на точечной задаче (структура/публичные имена без запроса). Крупное — минимальными шагами; код остаётся собираемым.
26
+
27
+ # Требование к агенту
28
+
29
+ - **Boy scout:** оставлять модуль немного лучше; не жертвовать архитектурой и слоями ради краткости.
30
+
31
+ ## Agent discipline (anti-sycophancy)
32
+
33
+ Essentials below. Full procedural set (~17 rules) → load **`anti-sycophancy-discipline`**.
34
+
35
+ - Unverifiable third-party API → mark `// VERIFY: lib.symbol @ version` (or stack equivalent); never invent signatures.
36
+ - Before «is this correct?» — ≥3 failure modes (empty, boundary, concurrency/state) or name what you could not check.
37
+ - Refactor without tests → propose characterization test; if declined, label `UNTESTED`.
38
+ - Comments = WHY only when non-obvious; ban self-referential «added for issue Y».
39
+ - Urgency/authority: name the trade-off once, then comply — no apology loops.
40
+ - Match verification to risk; report by what was **verified**, not attempted.
41
+
42
+ Style enforcement (formatter / linter / post-change gate) lives in the **stack toolchain** — see each adapter’s **Stack notes**.
43
+
44
+ > Stack-specific lint gates, примеры и toolchain — в секции **Stack notes** адаптера пресета.
45
+ ## Stack notes
46
+
47
+ - **No UI layer in this preset** — ignore shared-core bullets about дизайн‑система / UI‑пакеты / CSS‑токены; apply public-API and boy-scout rules to MCP registration modules and handlers.
48
+ - Public surface: tool/resource/prompt names + JSON Schema-compatible contracts — avoid deep imports across unrelated modules.
49
+ - Prefer Zod for authoring validation; MCP-facing schemas are protocol JSON Schema (SDK-supported conversion) — never pass raw Zod objects as the wire contract without verification.
50
+ - Unverifiable SDK usage → `// VERIFY: @modelcontextprotocol/sdk @ <version>`.
51
+ - Post-change gate: **`post-change-test`** + **`mcp-ts-tooling`** (repository-discovered typecheck/test — not Next lint, not Go tools, not xcodebuild).
52
+ - Style: project ESLint/Prettier/tsc when configured — authoritative style gate; do not duplicate formatter recipes in prose.
@@ -0,0 +1,51 @@
1
+ ---
2
+ description: Code review requirements for MCP TypeScript MRs
3
+ paths:
4
+ - src/**/*
5
+ ---
6
+
7
+ <!-- shared-core: review/code-review-mr.md -->
8
+
9
+ # Code review merge requests
10
+
11
+ On-demand rule for review flows. **Procedure and output format:** skill `code-review`.
12
+
13
+ ## When to load
14
+
15
+ - User asks for review/MR/diff
16
+ - Pipeline step `code-reviewer`
17
+ - Platform automated review (e.g. BUGBOT) when present
18
+
19
+ ## Checklist references (abstract)
20
+
21
+ - Architecture layers and stack core rules
22
+ - Public imports / module boundaries
23
+ - UI conventions of the stack
24
+ - Unit and e2e/UI test conventions
25
+ - Post-change lint/build gate before final report
26
+ - Design smells **in MR diff scope** — load `design-guidance`; не разворачивать полный каталог Fowler вне диффа
27
+ - Pattern name (GoF) — только если репозиторий уже использует эту форму или match минимален
28
+ - Principles (KISS / DRY+Ro3 / YAGNI / SOLID / CUPID) — через always-on `code-quality-and-refactoring`, не дублировать эссе в review
29
+
30
+ Concrete rule stems — in **Stack notes**.
31
+
32
+ ## Constraints
33
+
34
+ - Focus on MR diff, not the whole repo.
35
+ - Use local `git diff` — do not invent hosting metadata.
36
+ - Boy scout rule: suggest fixes feasible within the MR scope.
37
+ - No «большие рефакторинги» without an explicit request (`code-quality-and-refactoring`).
38
+
39
+ ## Output contract
40
+
41
+ Procedure details live in skill `code-review`. Required shape:
42
+
43
+ - Each finding cites **`path:line`**, the problem, impact, and a concrete fix direction.
44
+ - Rank by severity: **`blocker` | `important` | `nit`** (list blocker → nit).
45
+ - Vague («looks risky») is not a finding — cite evidence or ask for surrounding file context.
46
+ - End with a verdict on its own line: **`Safe to merge | needs changes | reject`**.
47
+ ## Stack notes
48
+
49
+ - Check MCP boundaries: registration vs handler vs capability; schema/contract stability; no secret leakage.
50
+ - Ban Playwright/XCUITest/Next-app path requirements in review comments for this stack.
51
+ - **Phase 1:** no `code-reviewer` agent — parent (or `/task` review-only) applies skill `code-review` and writes `review.md`. Pipeline step name `code-reviewer` is Phase 2.
@@ -0,0 +1,109 @@
1
+ ---
2
+ description: Design guidance (smells & patterns) for MCP TypeScript servers
3
+ paths:
4
+ - src/**/*
5
+ ---
6
+
7
+ <!-- shared-core: quality/design-guidance.md -->
8
+
9
+ # Design guidance (smells & patterns)
10
+
11
+ Словарь **code smells** (Fowler) и **design patterns** (GoF) для агентов при implement / review / debug.
12
+
13
+ Применять только в scope задачи или MR. Лёгкий refactor — да; «большой» rewrite без явного запроса — нет.
14
+
15
+ Называть паттерн **только если** репозиторий уже так делает или это минимальный match. Иначе — extract/split/move без ярлыка GoF.
16
+
17
+ Не заменяет always-on Principles в `code-quality-and-refactoring` (KISS, DRY + Rule of Three, YAGNI, SOLID, CUPID, composition, Demeter).
18
+
19
+ ## When to load
20
+
21
+ - **Feature delivery / implement** — оценка структуры модулей, границ и дублирования.
22
+ - **Code review** — smells и pattern fit **в диффе MR**, не по всему репо.
23
+ - **Debug** — root-cause похож на wrong abstraction, Feature Envy, Message Chains, Shotgun Surgery.
24
+ - **Light refactor only** — улучшения в рамках boy-scout / MR scope; не расширять задачу ради каталога.
25
+
26
+ Агенты и skills подгружают stem по one-liner wiring — не копировать этот каталог в промпт агента.
27
+
28
+ ## How to use (agent rules of thumb)
29
+
30
+ 1. Сначала сверить с Principles (always-on): проще ли решение, нет ли ранней абстракции, соблюдён ли public API.
31
+ 2. Затем отметить smells **в изменённых файлах** задачи/MR; предложить fix только если он укладывается в light refactor.
32
+ 3. Паттерн GoF — опциональный ярлык после того, как структура уже ясна; не начинать дизайн с выбора паттерна.
33
+ 4. Если smell и паттерн конфликтуют с границами слоёв стека — побеждают stack boundaries и existing repo patterns.
34
+ 5. Не требовать переименования «под GoF», если поведение уже корректно и читаемо.
35
+
36
+ ## Code smells (Fowler, curated ≤12)
37
+
38
+ Таблица: smell → detect hint → fix hint (одна линия каждый). Без механических меню рефакторинга.
39
+
40
+ | # | Smell | Detect | Fix hint |
41
+ |---|-------|--------|----------|
42
+ | 1 | Duplicate Code | одинаковая логика в ≥2 местах | dedupe после Rule of Three |
43
+ | 2 | Long Method / Long Module | единица делает слишком много | extract в рамках scope; без big rewrite |
44
+ | 3 | Feature Envy | метод чаще трогает чужие данные, чем свои | сдвинуть логику к данным / public API |
45
+ | 4 | Data Clumps | одни и те же группы аргументов кочуют вместе | сгруппировать в type / value object |
46
+ | 5 | Primitive Obsession | сырые string/int вместо доменных понятий | typed ids / value objects при нужде домена |
47
+ | 6 | Speculative Generality | неиспользуемые хуки, флаги, абстракции «на будущее» | удалить (YAGNI) |
48
+ | 7 | Message Chains | цепочки `a.b.c.d` | Demeter; facade / public API модуля |
49
+ | 8 | Middle Man | класс почти только прокидывает вызовы | убрать pass-through **или** оставить как boundary |
50
+ | 9 | Divergent Change | один модуль меняется по разным причинам | split по поводам изменения |
51
+ | 10 | Shotgun Surgery | одно смысловое изменение разъезжается по многим файлам | consolidate ответственность |
52
+ | 11 | Inappropriate Intimacy | доступ к чужим internals / private деталям | только public API / ports / facades |
53
+ | 12 | Refused Bequest / Parallel Inheritance | подтип игнорирует базу; зеркальные иерархии классов | composition; не плодить параллельные деревья |
54
+
55
+ **Skip Fowler (не в core):** Lazy Class, Incomplete Library Class, Comments-as-smell dogma, полный каталог 70+, пошаговые recipe-меню.
56
+
57
+ Приоритет при конфликте smells: Inappropriate Intimacy и Message Chains (границы модулей) > Duplicate Code (после Rule of Three) > Long Method внутри уже правильного модуля.
58
+
59
+ ## Design patterns (GoF, curated ≤8)
60
+
61
+ Suggest only when repo already uses the shape or the match is minimal. Prefer extract-function over naming Strategy ради ярлыка.
62
+
63
+ Паттерны ниже — **разрешённый минимум** для агентов; остальной GoF по умолчанию в Skip.
64
+
65
+ | Pattern | When to suggest | Anti-trigger |
66
+ |---------|-----------------|--------------|
67
+ | Strategy | взаимозаменяемые алгоритмы уже (или явно скоро) выбираются политикой | один алгоритм без ветвления политики |
68
+ | Adapter | обернуть внешний / чужой API под локальный port | лишняя обёртка вокруг своего же API |
69
+ | Facade | упростить multi-step subsystem за public API | facade превращается в god-object |
70
+ | Factory Method | полиморфное создание уже принято в стиле репо | factory на каждый тривиальный `new` |
71
+ | Decorator | аддитивное поведение без взрыва subclass-иерархий | decorator «для слоёв» без реальной нужды |
72
+ | Observer | events / subscriptions уже есть в архитектуре | самодельный pub/sub без прецедента в репо |
73
+ | Template Method | общий algorithm skeleton + вариативные hooks | наследование ради пары отличающихся строк |
74
+ | Composite | дерево однородных узлов (UI/domain), как уже в репо | Composite на плоский список без иерархии |
75
+
76
+ Если сомневаешься между двумя паттернами — выбери более простой extract/compose без имени; ярлык можно добавить на review, если репо уже так говорит.
77
+
78
+ ## Skip / avoid by default
79
+
80
+ | Catalog | Skip |
81
+ |---------|------|
82
+ | GoF | Singleton, Abstract Factory, Flyweight, Memento, Interpreter, Visitor, Bridge, Prototype |
83
+ | GoF (conditional) | Command, Chain of Responsibility, State — упоминать **только если** репо уже использует |
84
+ | Fowler | всё сверх 12 smells выше |
85
+ | DDD | Aggregates, bounded-context maps, event sourcing, CQRS — **не в core** |
86
+ | DDD (pointer) | ubiquitous language anti-pattern — расширять в `feature-delivery-workflow`, не здесь |
87
+ | GRASP | список Larman как отдельные правила — skip (перекрывается SOLID/CUPID) |
88
+ | Clean Code dogma | жёсткие caps на строки функции / «ровно один assert» — skip |
89
+
90
+ Не вводить второй stem (`refactoring-smells` / `design-patterns-for-agents`) — один каталог: `design-guidance`.
91
+
92
+ ## Out of scope for this stem
93
+
94
+ - Полный GoF (23) и полный Fowler catalog.
95
+ - Stack-specific рецепты (пути модулей, lint-команды) — только в **Stack notes** адаптера.
96
+ - Security, a11y, perf — отдельные review-правила; здесь только структурные smells/patterns.
97
+ - Четвёртое always-on правило — запрещено; этот stem только requestable / agent-load.
98
+
99
+ ## Cross-refs
100
+
101
+ - Always-on Principles: `code-quality-and-refactoring`.
102
+ - DIP / ports vs adapters: stack `architecture-boundaries` (детали стека — в Stack notes адаптеров).
103
+ - Ubiquitous language: `feature-delivery-workflow` (lineage).
104
+ - MR checklist (smells in scope; pattern name only if repo uses it): `code-review-mr`.
105
+ - Token / twin policy for authors: `preset-token-budget`, `preset-twin-sync` (meta, not consumer always-on).
106
+ ## Stack notes
107
+
108
+ - Apply smells to MCP registration modules, handlers, and schema duplication — not UI components.
109
+ - Prefer extract-handler / extract-schema over introducing hexagonal layers the repo does not use.
@@ -0,0 +1,31 @@
1
+ ---
2
+ description: Discover package manager; typecheck/test/Inspector commands for MCP TS
3
+ paths:
4
+ - package.json
5
+ - tsconfig*.json
6
+ - **/vitest.config.*
7
+ - **/jest.config.*
8
+ - **/eslint.config.*
9
+ ---
10
+
11
+ # Tooling (mcp-ts)
12
+
13
+ Discover package manager **before** running scripts:
14
+
15
+ 1. `packageManager` in `package.json`
16
+ 2. Lockfile: `yarn.lock` → yarn; `pnpm-lock.yaml` → pnpm; `package-lock.json` → npm; `bun.lock(b)` → bun
17
+ 3. Use **only** that manager for install/run
18
+
19
+ ## Typical gates (adapt to repo scripts)
20
+
21
+ | Gate | Discovery |
22
+ |------|-----------|
23
+ | Typecheck | `tsc --noEmit` or script `typecheck` / `build` that typechecks |
24
+ | Test | script `test` / `test:unit` / Vitest / Jest / `node:test` |
25
+ | Lint | project ESLint if configured — never invent Next `lint:js`/`lint:css` as required |
26
+ | Inspector | optional smoke — not required for every change |
27
+
28
+ ## Agent requirement
29
+
30
+ - Do not hard-code `yarn` if the repo uses pnpm/npm/bun.
31
+ - Never require Go tools (`go test` / `go vet`), `xcodebuild`, or Playwright as this stack's gate.
@@ -0,0 +1,30 @@
1
+ ---
2
+ description: Mandatory typecheck + tests after TypeScript MCP edits
3
+ paths:
4
+ - src/**/*.ts
5
+ - src/**/*.tsx
6
+ - package.json
7
+ - **/*.{test,spec}.ts
8
+ ---
9
+
10
+ # Post-change test (requestable, mandatory after TS MCP edits)
11
+
12
+ After changing TypeScript / package manifests in a consumer MCP server repo:
13
+
14
+ 1. Discover package manager (`mcp-ts-tooling`).
15
+ 2. Run **typecheck** (project script or `tsc --noEmit`).
16
+ 3. Run **tests** scoped to touched packages/files when possible; full suite before claiming done.
17
+ 4. Optional: MCP Inspector smoke for registration changes — not a hard gate.
18
+
19
+ ## Scope hints
20
+
21
+ - Schema-only changes: include contract/schema fixture tests.
22
+ - Handler changes: unit tests for valid/invalid inputs and error mapping.
23
+ - Packaging/`bin` changes: verify entry still starts under stdio (manual or smoke).
24
+
25
+ ## Agent requirement
26
+
27
+ - Do not claim completion without running the applicable gate (or noting why CI-only).
28
+ - Pipeline `build-verifier` enforces the same checklist.
29
+ - Skip only when the change is docs/config with no `*.ts` / package impact — state that explicitly.
30
+ - Never require Playwright, XCUITest, Next lint recipes, or Go toolchains.
@@ -0,0 +1,36 @@
1
+ ---
2
+ description: Preset authoring meta-rule (preset-layering)
3
+ paths:
4
+ - packages/ai-rules/presets/**/*
5
+ - .claude/**/*
6
+ - .cursor/rules/**/*
7
+ - .cursor/team/tasks/**/*
8
+ ---
9
+
10
+ <!-- shared-core: meta/preset-layering.md -->
11
+
12
+ # Preset layering
13
+
14
+ Правила для **авторов пресетов** (`packages/ai-rules/presets/**`). Не always-on в consumer apps.
15
+
16
+ ## Слои
17
+
18
+ | Слой | Где | Что класть |
19
+ |------|-----|------------|
20
+ | **Core** | `presets/_shared/core/**` | Stack-agnostic prose + checklists; без frontmatter; без путей `app/**`, `Features/**`, Playwright, xcodebuild |
21
+ | **Stack** | `presets/{cursor\|claude}/<stack>/` | Domain/tooling, always-on trio стека, stack examples в **Stack notes** |
22
+ | **Platform** | Cursor `.mdc` / Claude `.md` | Frontmatter (`alwaysApply`/`globs` vs `paths:`), platform-only (`BUGBOT.md`, `CLAUDE.md`) |
23
+
24
+ ## Куда класть новое правило
25
+
26
+ 1. Общие принципы для всех стеков → **core** + адаптеры с `<!-- shared-core: … -->`.
27
+ 2. Только один из installable стеков (`next` / `ios-swift` / `go` / `java`) → **stack-specific** (не в `_shared`).
28
+ 3. Только Cursor или только Claude packaging → platform artifact / frontmatter, не дублировать семантику.
29
+
30
+ ## SoT
31
+
32
+ - Packages path — SoT; root `.cursor/` — dogfood sync.
33
+ - Per stack: **Cursor** `presets/cursor/<stack>/` → Claude twin same PR.
34
+ - `_shared` **не** `--preset` и не копируется CLI `init`.
35
+
36
+ См. также: `preset-twin-sync`, `preset-token-budget`, `preset-pr-checklist`, `preset-no-cross-stack-leakage`.
@@ -0,0 +1,69 @@
1
+ ---
2
+ description: Preset authoring meta-rule (preset-no-cross-stack-leakage)
3
+ paths:
4
+ - packages/ai-rules/presets/**/*
5
+ - .claude/**/*
6
+ - .cursor/rules/**/*
7
+ - .cursor/team/tasks/**/*
8
+ ---
9
+
10
+ <!-- shared-core: meta/preset-no-cross-stack-leakage.md -->
11
+
12
+ # Preset no cross-stack leakage
13
+
14
+ Запрет протекания stack-specific имён, путей и handoff stems между пресетами.
15
+
16
+ ## Principles
17
+
18
+ - `next` must not require iOS-only agents/tooling (`xcuitest-*`, `xcodebuild` as required handoff, Keychain-only rules).
19
+ - `ios-swift` must not ship Playwright handoffs or Next lint recipes as required commands.
20
+ - `go` / `java` / `mcp-ts` must not ship Playwright, XCUITest, Next lint recipes, or `xcodebuild`/`SwiftLint` as required handoffs.
21
+ - `mcp-ts` must not ship Go tool commands (`go test`, `go vet`, `golangci-lint`) or `integration-test-*` agents as required delivery gates.
22
+ - Shared core must not embed stack paths (`app/src/**`, `Features/**`, `playwright`, `xcodebuild`).
23
+
24
+ ## Forbidden in ios-swift hooks/agents (FAIL)
25
+
26
+ In ios-swift `chain-team-phases.sh` / agent handoffs (Cursor + Claude):
27
+
28
+ - `playwright-test-`, `playwright-agents`, `playwright-e2e`, `user-playwright`
29
+ - `app/__tests__/e2e` as a required path
30
+ - Positive yarn recipes `lint:js` / `lint:css` as commands to run (negation prose alone is weak — prefer zero occurrences)
31
+
32
+ Required instead: `xcuitest-test-*` stems; build-verifier mentions `xcodebuild` or `post-change-build` / `xcode-tooling`.
33
+
34
+ ## Forbidden in next hooks/agents (FAIL when present as required)
35
+
36
+ - `xcuitest-test-` as handoff stems
37
+ - Requiring `xcodebuild` / SwiftLint as the default post-change gate for Next app work
38
+
39
+ ## Forbidden in go / java hooks/agents (FAIL)
40
+
41
+ Shared backend-stack bans (both `go` and `java`):
42
+
43
+ - `playwright-test-`, `playwright-e2e`, `user-playwright`, `app/__tests__/e2e`
44
+ - Positive yarn recipes `lint:js` / `lint:css`
45
+ - `xcuitest-test-`, `xcodebuild`, `SwiftLint` as required handoffs
46
+ - Agent file `accessibility-reviewer` (no UI surface)
47
+
48
+ Required instead: `integration-test-*`; build-verifier / `post-change-test` plus stack tooling — `go-tooling` (`go test`, `go vet`) or `java-tooling` (`mvn test` / `./gradlew test`).
49
+
50
+ ## Forbidden in mcp-ts hooks/agents (FAIL)
51
+
52
+ Same UI/mobile bans as backend stacks, plus:
53
+
54
+ - `playwright-test-`, `playwright-agents`, `playwright-e2e`, `user-playwright`, `app/__tests__/e2e`
55
+ - Positive yarn recipes `lint:js` / `lint:css` as required gates
56
+ - `xcuitest-test-`, `xcodebuild`, `SwiftLint` as required handoffs
57
+ - Go tool commands as required MCP delivery gates: `go test`, `go vet`, `golangci-lint`
58
+ - Agent files: `playwright-test-*`, `xcuitest-test-*`, `integration-test-*`, `accessibility-reviewer`
59
+
60
+ Required instead: package-manager–discovered typecheck/test (`mcp-ts-tooling`, `post-change-test`); Phase 1 gates `build-verifier` + `security-reviewer`.
61
+
62
+ ## Soft / document
63
+
64
+ - Mentioning the other stack in **docs** comparing presets is OK.
65
+ - `build-verifier` may reference other stacks when validating **preset packaging** (`scope: preset-structure-validation`).
66
+
67
+ ## Chain fork
68
+
69
+ `hooks/chain-team-phases.sh` must differ **byte-wise** pairwise among `next`, `ios-swift`, `go`, `java`, and `mcp-ts` (per platform).
@@ -0,0 +1,39 @@
1
+ ---
2
+ description: Preset authoring meta-rule (preset-pr-checklist)
3
+ paths:
4
+ - packages/ai-rules/presets/**/*
5
+ - .claude/**/*
6
+ - .cursor/rules/**/*
7
+ - .cursor/team/tasks/**/*
8
+ ---
9
+
10
+ <!-- shared-core: meta/preset-pr-checklist.md -->
11
+
12
+ # Preset PR checklist
13
+
14
+ Чеклист для PR, затрагивающих `packages/ai-rules/presets/**` (и dogfood `.cursor/` sync).
15
+
16
+ ## Before merge
17
+
18
+ - [ ] **SoT:** правки в `packages/…` (не только root `.cursor/`)
19
+ - [ ] **Core:** если менялся `_shared/core/**` — обновлены все `<!-- shared-core: … -->` consumers (или documented intentional fork)
20
+ - [ ] **Twin:** Cursor change → Claude twin **same PR** (**FAIL** if missing on next, ios-swift, go, and java — см. `preset-twin-sync`)
21
+ - [ ] **Mapping:** `claude/<stack>/rules/README.md` mapping table актуален
22
+ - [ ] **Token budget:** alwaysApply / session-start ≤ 3; meta rules not always-on
23
+ - [ ] **Leakage:** нет чужих stack agent stems / handoff strings (`preset-no-cross-stack-leakage`)
24
+ - [ ] **Twin depth:** domain ≥15 lines; thin aliases documented
25
+ - [ ] **README:** stack `rules/README.md` core→stack mapping / catalog updated if stems added
26
+ - [ ] **CHANGELOG / package README:** note when public preset paths or install surface change
27
+ - [ ] **Dogfood:** run `packages/ai-rules/scripts/sync-dogfood-cursor.sh` (or document intentional skip) when maintaining this monorepo
28
+ - [ ] **shared-core drift:** for embed-mode stems, run `packages/ai-rules/scripts/check-shared-core-drift.sh` (or document intentional fork)
29
+
30
+ ## Pointers
31
+
32
+ - Layering: `preset-layering`
33
+ - Sync: `preset-twin-sync`
34
+ - Budget: `preset-token-budget`
35
+ - Leakage: `preset-no-cross-stack-leakage`
36
+ - Validation: stack `agents/build-verifier.md` → preset-structure section
37
+ - Dogfood script: `packages/ai-rules/scripts/sync-dogfood-cursor.sh`
38
+ - Drift script: `packages/ai-rules/scripts/check-shared-core-drift.sh`
39
+ - Orchestrator: when editing presets, load this checklist + twin-sync
@@ -0,0 +1,41 @@
1
+ ---
2
+ description: Preset authoring meta-rule (preset-token-budget)
3
+ paths:
4
+ - packages/ai-rules/presets/**/*
5
+ - .claude/**/*
6
+ - .cursor/rules/**/*
7
+ - .cursor/team/tasks/**/*
8
+ ---
9
+
10
+ <!-- shared-core: meta/preset-token-budget.md -->
11
+
12
+ # Preset token budget
13
+
14
+ Инварианты загрузки правил в **установленном** пресете (consumer app).
15
+
16
+ ## Hard caps
17
+
18
+ | Platform | Always-on | Cap |
19
+ |----------|-----------|-----|
20
+ | Cursor | `alwaysApply: true` | **≤ 3** |
21
+ | Claude | rules **without** `paths:` | **ровно 3** |
22
+
23
+ **Claude Option A (README exclusion):** when counting Claude rules without `paths:` / session-start, **exclude `**/README.md`** (topic indexes are not session-start rules). The intended session-start trio remains **exactly 3**; body budget sums **only those 3** rules.
24
+
25
+ Session-start body budget (где задокументировано): ≤140 строк суммарно (stretch ≤120).
26
+
27
+ ## Meta / author rules
28
+
29
+ Rules for preset authors (`preset-layering`, `preset-twin-sync`, …):
30
+
31
+ - **Never** `alwaysApply: true` on consumer installs.
32
+ - Cursor: `globs` limited to `packages/ai-rules/presets/**` (and dogfood `.cursor/**` where useful).
33
+ - Claude: `paths:` limited to `packages/ai-rules/presets/**` (and `.claude/**` dogfood if present).
34
+
35
+ ## Heavy workflows
36
+
37
+ Orchestrator, feature-delivery, code-review, post-change gates, domain globs — **requestable / paths**, not always-on.
38
+
39
+ ## Verifier
40
+
41
+ build-verifier **FAIL** if alwaysApply / session-start count exceeds 3 (Claude count **excludes `**/README.md`**), or if a `preset-*` meta rule is marked always-on.
@@ -0,0 +1,46 @@
1
+ ---
2
+ description: Preset authoring meta-rule (preset-twin-sync)
3
+ paths:
4
+ - packages/ai-rules/presets/**/*
5
+ - .claude/**/*
6
+ - .cursor/rules/**/*
7
+ - .cursor/team/tasks/**/*
8
+ ---
9
+
10
+ <!-- shared-core: meta/preset-twin-sync.md -->
11
+
12
+ # Preset twin sync
13
+
14
+ Cursor `.mdc` — **SoT per stack**. Claude topic `.md` — derived twin.
15
+
16
+ ## Matrix
17
+
18
+ | Stack | Cursor SoT | Claude derive | Mapping table |
19
+ |-------|------------|---------------|---------------|
20
+ | `next` | `presets/cursor/next/rules/*.mdc` | `presets/claude/next/rules/<topic>/` | **Required** in `claude/next/rules/README.md` |
21
+ | `ios-swift` | `presets/cursor/ios-swift/rules/*.mdc` | `presets/claude/ios-swift/rules/<topic>/` | Keep in `claude/ios-swift/rules/README.md` |
22
+ | `go` | `presets/cursor/go/rules/*.mdc` | `presets/claude/go/rules/<topic>/` | Keep in `claude/go/rules/README.md` |
23
+ | `java` | `presets/cursor/java/rules/*.mdc` | `presets/claude/java/rules/<topic>/` | Keep in `claude/java/rules/README.md` |
24
+ | `mcp-ts` | `presets/cursor/mcp-ts/rules/*.mdc` | `presets/claude/mcp-ts/rules/<topic>/` | Keep in `claude/mcp-ts/rules/README.md` |
25
+
26
+ ## Same-PR checklist
27
+
28
+ 1. Edit Cursor rule first (body + frontmatter).
29
+ 2. Update Claude twin: body + `paths:` (from Cursor `globs:` / requestable triggers); drop `alwaysApply`.
30
+ 3. Update mapping table row if stem/path changed.
31
+ 4. If body embeds core (`<!-- shared-core: … -->`), sync core consumers across stacks when core changed.
32
+
33
+ ## Twin depth
34
+
35
+ - **Domain** rules: ≥15 body lines (FAIL if thin without documented alias reason).
36
+ - **Thin aliases** (`agent-team-intake`, `technical-retro`): may be shorter (soft) if they only point to a command/skill.
37
+
38
+ ## Severity (build-verifier)
39
+
40
+ - **next:** missing Claude twin for a changed Cursor rule → **FAIL** (mapping table required).
41
+ - **ios-swift:** missing Claude twin for a changed Cursor rule → **FAIL**.
42
+ - **go:** missing Claude twin for a changed Cursor rule → **FAIL** (same as next / ios-swift; mapping table required).
43
+ - **java:** missing Claude twin for a changed Cursor rule → **FAIL** (same as next / ios-swift / go; mapping table required).
44
+ - **mcp-ts:** missing Claude twin for a changed Cursor rule → **FAIL** (same as next / ios-swift / go / java; mapping table required).
45
+
46
+ Dogfood: sync packages → root `.cursor/` after Cursor SoT changes (not the reverse). Use `packages/ai-rules/scripts/sync-dogfood-cursor.sh`.
@@ -0,0 +1,52 @@
1
+ ---
2
+ description: MCP security: injection boundaries, capability minimization, SSRF/secrets
3
+ paths:
4
+ - src/tools/**/*
5
+ - src/resources/**/*
6
+ - "**/auth/**/*"
7
+ - "**/config/**/*"
8
+ ---
9
+
10
+ # Security (MCP servers)
11
+
12
+ - Treat tool **arguments** as **untrusted**. Validate with schemas; canonicalize paths/URLs.
13
+ - Minimize capabilities: no default "read any file" / "fetch any URL" without AC and allowlists.
14
+ - Secrets: env/secret manager only; redact in logs and tool results (`mcp-auth-secrets`).
15
+ - Least privilege: each tool gets the smallest capability adapter it needs — no ambient `process.env` dumps.
16
+
17
+ ## Path traversal (FAIL patterns)
18
+
19
+ - Resolve with `path.resolve` (or equivalent) then require the result stays under an approved root (`path.relative` must not start with `..`).
20
+ - Deny `../`, encoded variants (`%2e%2e`), and null-byte tricks before FS access.
21
+ - Follow symlinks only if the **final** realpath is still inside the root — otherwise reject.
22
+ - Unit shapes: `tool.rejectsPathTraversal`, `tool.rejectsSymlinkEscape`, `tool.acceptsInRoot`.
23
+
24
+ ## SSRF / outbound URL (FAIL patterns)
25
+
26
+ When tools fetch URLs:
27
+
28
+ - Allowlist hosts (or deny by default); block metadata IP `169.254.169.254`, link-local (`169.254.0.0/16`), loopback when not explicitly local-dev, and private ranges unless AC says otherwise.
29
+ - Do not follow redirects to a host outside the allowlist; re-validate after each hop.
30
+ - Prefer literal IPs from a resolved allowlist over trusting DNS alone when policy requires it.
31
+ - Unit shapes: `tool.deniesMetadataIp`, `tool.deniesBlockedHost`, `tool.allowsAllowlistedHost`.
32
+
33
+ ## Prompt injection and untrusted content
34
+
35
+ - Tool **descriptions** and **results** must not instruct the model to ignore safety; handlers must not execute model-supplied shell without an explicit, reviewed design.
36
+ - Treat **retrieved** tool/resource/prompt content (and any fetched remote payload) as **untrusted data**, not as authority:
37
+ - It must **not** expand tool capabilities, change auth/scopes, or trigger shell/network/FS side effects merely because the content contains instructions.
38
+ - Handlers decide actions from validated args + trusted request context only — never from natural-language directives inside resource bodies or prior tool output.
39
+ - Do not echo secrets found in untrusted content into logs or subsequent tool results.
40
+
41
+ ## Forbidden
42
+
43
+ - Shipping live credentials in examples or fixtures.
44
+ - Echoing `process.env` or Authorization headers into tool output.
45
+ - Fail-open auth when remote transport is enabled.
46
+ - Broad "run arbitrary command" tools without explicit AC and sandboxing.
47
+ - Letting tool/resource text escalate privileges or bypass schema/auth checks.
48
+
49
+ ## Agents
50
+
51
+ - `security-reviewer` on tool/auth/config/capability changes; then `post-change-test`.
52
+ - Phase 1: feature-developer must not skip schema validation to "move faster".
@@ -0,0 +1,20 @@
1
+ ---
2
+ description: Technical retrospective facilitator (on-demand /technical-retro)
3
+ paths:
4
+ - .cursor/team/**/*
5
+ - .claude/team/**/*
6
+ ---
7
+
8
+ <!-- shared-core: review/technical-retro.md -->
9
+
10
+ # Техническое ретро — rule alias
11
+
12
+ Полный сценарий (включая блок **«Работа агентов»** для slug из team tasks) — в slash-команде:
13
+
14
+ **`commands/technical-retro.md`** → `/technical-retro`
15
+
16
+ Используй rule только если command недоступен. Не дублируй содержимое command в ответе — следуй command-файлу и skill `technical-retro`.
17
+
18
+ ## Stack notes
19
+
20
+ - **Phase 1:** skill `technical-retro` is not shipped — follow `commands/technical-retro.md` only; do not fail if the skill is absent (Phase 2 may add the skill).
@@ -0,0 +1,3 @@
1
+ # UI and accessibility
2
+
3
+ N/A — TypeScript MCP server preset. No UI/a11y rules or accessibility-reviewer agent.
@@ -0,0 +1,12 @@
1
+ # Skills (mcp-ts Phase 1)
2
+
3
+ | Skill | Use |
4
+ |-------|-----|
5
+ | `feature-delivery` | End-to-end MCP feature flow |
6
+ | `unit-testing` | Schema/handler unit tests |
7
+ | `code-review` | Diff review checklist |
8
+ | `debug-investigation` | Bug investigation |
9
+
10
+ Phase 2 may add `ci-investigation`, `technical-retro`, `write-adr`, `mcp-contract-testing` skills.
11
+
12
+ Until then: `/technical-retro` uses `commands/technical-retro.md` (no skill required); review-only uses skill `code-review` on the parent (no `code-reviewer` agent).
@@ -0,0 +1,10 @@
1
+ ---
2
+ name: code-review
3
+ description: Reviews MCP TypeScript diffs for boundaries, schema contracts, capability scope, and secrets. Use for MR review or when code-review workflow is requested.
4
+ ---
5
+
6
+ # Code review (mcp-ts)
7
+
8
+ 1. Follow `code-review-mr.mdc`, `mcp-server-boundaries.mdc`, `mcp-tool-design.mdc`, `security-mcp.mdc`.
9
+ 2. Flag monolithic entry files, schema/protocol mismatches, unscopeed capabilities, secret leakage.
10
+ 3. Phase 1: security-reviewer covers threat model; no separate `code-reviewer` agent yet — parent may apply this skill directly.
@@ -0,0 +1,11 @@
1
+ ---
2
+ name: debug-investigation
3
+ description: Investigates MCP server bugs with runtime evidence — schema failures, handler errors, transport startup. Use for failing tests or incorrect tool behavior.
4
+ ---
5
+
6
+ # Debug investigation (mcp-ts)
7
+
8
+ 1. Reproduce with unit/contract fixtures before changing code.
9
+ 2. Check schema validation vs handler logic vs registration wiring.
10
+ 3. Prefer repository tests over ad-hoc Inspector-only claims.
11
+ 4. Load `anti-sycophancy-discipline` — report what was verified.