@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.
- package/CHANGELOG.md +47 -0
- package/README.md +9 -3
- package/bin/cli.js +28 -1
- package/package.json +3 -2
- package/presets/_shared/core/agent-team/agent-team-intake.md +1 -1
- package/presets/_shared/core/agent-team/agent-team-orchestrator.md +1 -1
- package/presets/_shared/core/architecture/reference-features.template.md +12 -0
- package/presets/_shared/core/quality/code-quality-and-refactoring.md +11 -0
- package/presets/_shared/core/review/code-review-mr.md +9 -0
- package/presets/claude/go/CLAUDE.md +5 -1
- package/presets/claude/go/README.md +5 -1
- package/presets/claude/go/REPO_AGENTS.md +48 -0
- package/presets/claude/go/agents/README.md +19 -2
- package/presets/claude/go/agents/build-verifier.md +5 -0
- package/presets/claude/go/agents/codebase-analyzer.md +28 -0
- package/presets/claude/go/agents/feature-developer.md +13 -0
- package/presets/claude/go/hooks/README.md +6 -0
- package/presets/claude/go/hooks/examples/README.md +18 -0
- package/presets/claude/go/hooks/examples/format-edited.example.sh +9 -0
- package/presets/claude/go/hooks/examples/secret-guard.example.sh +10 -0
- package/presets/claude/go/hooks/examples/test-on-save.example.sh +11 -0
- package/presets/claude/go/rules/api-and-data/api-http.md +10 -3
- package/presets/claude/go/rules/architecture/reference-features.md +4 -0
- package/presets/claude/go/rules/stack/go-conventions.md +30 -3
- package/presets/claude/go/rules/tooling-and-review/agent-team-intake.md +1 -1
- package/presets/claude/go/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
- package/presets/claude/go/rules/tooling-and-review/code-quality.md +12 -1
- package/presets/claude/go/rules/tooling-and-review/code-review.md +9 -0
- package/presets/claude/go/skills/README.md +2 -2
- package/presets/claude/go/skills/code-review/SKILL.md +11 -2
- package/presets/claude/go/skills/feature-delivery/SKILL.md +4 -0
- package/presets/claude/go/skills/technical-retro/SKILL.md +46 -2
- package/presets/claude/go/skills/write-adr/SKILL.md +41 -0
- package/presets/claude/go/team/conventions.md +21 -0
- package/presets/claude/ios-swift/CLAUDE.md +4 -1
- package/presets/claude/ios-swift/README.md +5 -1
- package/presets/claude/ios-swift/REPO_AGENTS.md +46 -0
- package/presets/claude/ios-swift/agents/README.md +3 -2
- package/presets/claude/ios-swift/agents/build-verifier.md +6 -0
- package/presets/claude/ios-swift/agents/codebase-analyzer.md +28 -0
- package/presets/claude/ios-swift/agents/feature-developer.md +13 -0
- package/presets/claude/ios-swift/hooks/README.md +6 -0
- package/presets/claude/ios-swift/hooks/examples/README.md +18 -0
- package/presets/claude/ios-swift/hooks/examples/format-edited.example.sh +13 -0
- package/presets/claude/ios-swift/hooks/examples/secret-guard.example.sh +10 -0
- package/presets/claude/ios-swift/hooks/examples/test-on-save.example.sh +8 -0
- package/presets/claude/ios-swift/rules/architecture/reference-features.md +4 -0
- package/presets/claude/ios-swift/rules/stack/swift-conventions.md +12 -2
- package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-intake.md +1 -1
- package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
- package/presets/claude/ios-swift/rules/tooling-and-review/code-quality.md +12 -1
- package/presets/claude/ios-swift/rules/tooling-and-review/code-review.md +47 -0
- package/presets/claude/ios-swift/rules/ui-and-accessibility/swiftui.md +8 -0
- package/presets/claude/ios-swift/skills/README.md +1 -0
- package/presets/claude/ios-swift/skills/code-review/SKILL.md +10 -2
- package/presets/claude/ios-swift/skills/feature-delivery/SKILL.md +4 -0
- package/presets/claude/ios-swift/skills/technical-retro/SKILL.md +46 -2
- package/presets/claude/ios-swift/skills/write-adr/SKILL.md +41 -0
- package/presets/claude/ios-swift/team/conventions.md +21 -0
- package/presets/claude/next/CLAUDE.md +5 -1
- package/presets/claude/next/README.md +6 -1
- package/presets/claude/next/REPO_AGENTS.md +48 -0
- package/presets/claude/next/agents/README.md +7 -1
- package/presets/claude/next/agents/build-verifier.md +5 -0
- package/presets/claude/next/agents/codebase-analyzer.md +28 -0
- package/presets/claude/next/agents/feature-developer.md +13 -0
- package/presets/claude/next/agents/security-reviewer.md +4 -2
- package/presets/claude/next/hooks/README.md +6 -0
- package/presets/claude/next/hooks/examples/README.md +18 -0
- package/presets/claude/next/hooks/examples/format-edited.example.sh +11 -0
- package/presets/claude/next/hooks/examples/secret-guard.example.sh +10 -0
- package/presets/claude/next/hooks/examples/test-on-save.example.sh +8 -0
- package/presets/claude/next/rules/README.md +2 -1
- package/presets/claude/next/rules/api-and-data/api-services.md +22 -0
- package/presets/claude/next/rules/api-and-data/http-client.md +21 -0
- package/presets/claude/next/rules/api-and-data/store-rtk.md +20 -0
- package/presets/claude/next/rules/architecture/architecture-boundaries.md +28 -0
- package/presets/claude/next/rules/architecture/layer-barrel-exports.md +15 -0
- package/presets/claude/next/rules/architecture/public-imports.md +14 -0
- package/presets/claude/next/rules/architecture/reference-features.md +4 -0
- package/presets/claude/next/rules/stack/arrow-functions.md +13 -28
- package/presets/claude/next/rules/stack/next-app-router.md +13 -1
- package/presets/claude/next/rules/testing/tests-unit.md +13 -0
- package/presets/claude/next/rules/tooling-and-review/README.md +2 -1
- package/presets/claude/next/rules/tooling-and-review/agent-team-intake.md +1 -1
- package/presets/claude/next/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
- package/presets/claude/next/rules/tooling-and-review/code-quality.md +12 -2
- package/presets/claude/next/rules/tooling-and-review/code-review-mr.md +22 -0
- package/presets/claude/next/rules/tooling-and-review/security-next.md +57 -0
- package/presets/claude/next/rules/ui-and-accessibility/react-ui.md +21 -0
- package/presets/claude/next/skills/README.md +2 -0
- package/presets/claude/next/skills/code-review/SKILL.md +10 -2
- package/presets/claude/next/skills/feature-delivery/SKILL.md +4 -0
- package/presets/claude/next/skills/react-performance/SKILL.md +44 -0
- package/presets/claude/next/skills/technical-retro/SKILL.md +19 -5
- package/presets/claude/next/skills/write-adr/SKILL.md +41 -0
- package/presets/claude/next/team/conventions.md +21 -0
- package/presets/cursor/go/AGENTS.md +6 -0
- package/presets/cursor/go/README.md +6 -5
- package/presets/cursor/go/REPO_AGENTS.md +48 -0
- package/presets/cursor/go/agents/README.md +23 -2
- package/presets/cursor/go/agents/build-verifier.md +5 -0
- package/presets/cursor/go/agents/codebase-analyzer.md +28 -0
- package/presets/cursor/go/agents/feature-developer.md +13 -0
- package/presets/cursor/go/commands/README.md +1 -1
- package/presets/cursor/go/hooks/README.md +4 -0
- package/presets/cursor/go/hooks/examples/README.md +18 -0
- package/presets/cursor/go/hooks/examples/format-edited.example.sh +9 -0
- package/presets/cursor/go/hooks/examples/secret-guard.example.sh +10 -0
- package/presets/cursor/go/hooks/examples/test-on-save.example.sh +11 -0
- package/presets/cursor/go/rules/README.md +2 -2
- package/presets/cursor/go/rules/agent-team-intake.mdc +1 -1
- package/presets/cursor/go/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/go/rules/api-http.mdc +10 -3
- package/presets/cursor/go/rules/code-quality-and-refactoring.mdc +12 -1
- package/presets/cursor/go/rules/code-review-mr.mdc +9 -0
- package/presets/cursor/go/rules/go-conventions.mdc +30 -3
- package/presets/cursor/go/rules/reference-features.mdc +4 -0
- package/presets/cursor/go/skills/README.md +2 -2
- package/presets/cursor/go/skills/code-review/SKILL.md +10 -1
- package/presets/cursor/go/skills/feature-delivery/SKILL.md +4 -0
- package/presets/cursor/go/skills/technical-retro/SKILL.md +46 -2
- package/presets/cursor/go/skills/write-adr/SKILL.md +41 -0
- package/presets/cursor/go/team/conventions.md +21 -0
- package/presets/cursor/ios-swift/AGENTS.md +5 -2
- package/presets/cursor/ios-swift/README.md +6 -5
- package/presets/cursor/ios-swift/REPO_AGENTS.md +46 -0
- package/presets/cursor/ios-swift/agents/README.md +3 -2
- package/presets/cursor/ios-swift/agents/build-verifier.md +6 -0
- package/presets/cursor/ios-swift/agents/codebase-analyzer.md +28 -0
- package/presets/cursor/ios-swift/agents/feature-developer.md +13 -0
- package/presets/cursor/ios-swift/commands/README.md +1 -1
- package/presets/cursor/ios-swift/hooks/README.md +4 -0
- package/presets/cursor/ios-swift/hooks/examples/README.md +18 -0
- package/presets/cursor/ios-swift/hooks/examples/format-edited.example.sh +13 -0
- package/presets/cursor/ios-swift/hooks/examples/secret-guard.example.sh +10 -0
- package/presets/cursor/ios-swift/hooks/examples/test-on-save.example.sh +8 -0
- package/presets/cursor/ios-swift/rules/agent-team-intake.mdc +1 -1
- package/presets/cursor/ios-swift/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/ios-swift/rules/code-quality-and-refactoring.mdc +12 -1
- package/presets/cursor/ios-swift/rules/code-review-mr.mdc +9 -0
- package/presets/cursor/ios-swift/rules/reference-features.mdc +4 -0
- package/presets/cursor/ios-swift/rules/swift-conventions.mdc +12 -2
- package/presets/cursor/ios-swift/rules/swiftui-ui.mdc +8 -0
- package/presets/cursor/ios-swift/skills/README.md +1 -0
- package/presets/cursor/ios-swift/skills/code-review/SKILL.md +10 -2
- package/presets/cursor/ios-swift/skills/feature-delivery/SKILL.md +4 -0
- package/presets/cursor/ios-swift/skills/technical-retro/SKILL.md +46 -2
- package/presets/cursor/ios-swift/skills/write-adr/SKILL.md +41 -0
- package/presets/cursor/ios-swift/team/conventions.md +21 -0
- package/presets/cursor/next/AGENTS.md +5 -2
- package/presets/cursor/next/README.md +7 -6
- package/presets/cursor/next/REPO_AGENTS.md +48 -0
- package/presets/cursor/next/agents/README.md +7 -1
- package/presets/cursor/next/agents/build-verifier.md +5 -0
- package/presets/cursor/next/agents/codebase-analyzer.md +28 -0
- package/presets/cursor/next/agents/feature-developer.md +13 -0
- package/presets/cursor/next/agents/security-reviewer.md +4 -2
- package/presets/cursor/next/commands/README.md +1 -1
- package/presets/cursor/next/hooks/README.md +4 -0
- package/presets/cursor/next/hooks/examples/README.md +18 -0
- package/presets/cursor/next/hooks/examples/format-edited.example.sh +11 -0
- package/presets/cursor/next/hooks/examples/secret-guard.example.sh +10 -0
- package/presets/cursor/next/hooks/examples/test-on-save.example.sh +8 -0
- package/presets/cursor/next/rules/README.md +4 -3
- package/presets/cursor/next/rules/agent-team-intake.mdc +1 -1
- package/presets/cursor/next/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/next/rules/api-services.mdc +21 -0
- package/presets/cursor/next/rules/architecture-boundaries.mdc +27 -0
- package/presets/cursor/next/rules/arrow-functions.mdc +13 -28
- package/presets/cursor/next/rules/code-quality-and-refactoring.mdc +12 -2
- package/presets/cursor/next/rules/code-review-mr.mdc +11 -13
- package/presets/cursor/next/rules/http-client.mdc +21 -0
- package/presets/cursor/next/rules/layer-barrel-exports.mdc +15 -0
- package/presets/cursor/next/rules/next-app-router.mdc +13 -1
- package/presets/cursor/next/rules/public-imports.mdc +14 -0
- package/presets/cursor/next/rules/react-ui.mdc +20 -0
- package/presets/cursor/next/rules/reference-features.mdc +4 -0
- package/presets/cursor/next/rules/security-next.mdc +57 -0
- package/presets/cursor/next/rules/store-rtk.mdc +19 -0
- package/presets/cursor/next/rules/tests-unit.mdc +12 -0
- package/presets/cursor/next/skills/README.md +2 -0
- package/presets/cursor/next/skills/code-review/SKILL.md +10 -2
- package/presets/cursor/next/skills/feature-delivery/SKILL.md +4 -0
- package/presets/cursor/next/skills/react-performance/SKILL.md +44 -0
- package/presets/cursor/next/skills/technical-retro/SKILL.md +19 -5
- package/presets/cursor/next/skills/write-adr/SKILL.md +41 -0
- package/presets/cursor/next/team/conventions.md +21 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Optional: format/lint edited JS/TS under app/ after save.
|
|
3
|
+
# NOT in default hooks.json. Requires yarn scripts in app/.
|
|
4
|
+
set -euo pipefail
|
|
5
|
+
ROOT="${CURSOR_PROJECT_DIR:-.}"
|
|
6
|
+
cd "$ROOT/app" 2>/dev/null || cd "$ROOT"
|
|
7
|
+
# Prefer project scripts; adjust names to match package.json
|
|
8
|
+
if command -v yarn >/dev/null 2>&1; then
|
|
9
|
+
yarn lint:js --fix 2>/dev/null || yarn eslint --fix . 2>/dev/null || true
|
|
10
|
+
fi
|
|
11
|
+
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: scoped unit tests for changed files under app/src.
|
|
3
|
+
# NOT in default hooks.json. No Playwright here.
|
|
4
|
+
set -euo pipefail
|
|
5
|
+
ROOT="${CURSOR_PROJECT_DIR:-.}"
|
|
6
|
+
cd "$ROOT/app" 2>/dev/null || exit 0
|
|
7
|
+
yarn test --findRelatedTests --passWithNoTests 2>/dev/null || yarn test --passWithNoTests 2>/dev/null || true
|
|
8
|
+
exit 0
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
|
|
22
22
|
- **`alwaysApply: true`** (Cursor) / **без `paths:`** (Claude) — только базовые инварианты (**3**):
|
|
23
23
|
- `next-app-core`, `package-manager`, `code-quality-and-refactoring`
|
|
24
|
-
- **On-demand / requestable** — `post-change-lint` (**обязателен после правок кода**, не always-on), `agent-team-intake` (через orchestrator/commands), `agent-team-orchestrator`, architecture, imports, UI, tests, feature-delivery-workflow, `design-guidance`, reference-features, next-app-router, react-a11y-coding, `technical-retro`
|
|
24
|
+
- **On-demand / requestable** — `post-change-lint` (**обязателен после правок кода**, не always-on), `agent-team-intake` (через orchestrator/commands), `agent-team-orchestrator`, architecture, imports, UI, tests, feature-delivery-workflow, `design-guidance`, reference-features, next-app-router, `security-next`, react-a11y-coding, `technical-retro`
|
|
25
25
|
- **Preset author meta** (globs `packages/ai-rules/presets/**`, never alwaysApply): `preset-layering`, `preset-twin-sync`, `preset-token-budget`, `preset-pr-checklist`, `preset-no-cross-stack-leakage`
|
|
26
26
|
- **Skills** — длинные процедуры (`feature-delivery`, `code-review`, …)
|
|
27
27
|
|
|
@@ -69,7 +69,8 @@ Claude twins + Cursor→Claude map: `presets/claude/next/rules/README.md`.
|
|
|
69
69
|
| Файл | Назначение |
|
|
70
70
|
|------|------------|
|
|
71
71
|
| `reference-features.mdc` | Эталонные пути UI/store/API/types/tests |
|
|
72
|
-
| `next-app-router.mdc` | App Router, RSC, loading/error |
|
|
72
|
+
| `next-app-router.mdc` | App Router, RSC, loading/error, anti-hallucination banlist |
|
|
73
|
+
| `security-next.mdc` | Secrets, auth, XSS, Server Actions (coding-time) |
|
|
73
74
|
| `react-a11y-coding.mdc` | A11y при написании UI |
|
|
74
75
|
| `feature-delivery-workflow.mdc` | Сквозной чеклист (on-demand, не always-on) |
|
|
75
76
|
| `agent-team-intake.mdc` | Подсказка `/task` при work-запросе (on-demand, через orchestrator) |
|
|
@@ -89,7 +90,7 @@ Claude twins + Cursor→Claude map: `presets/claude/next/rules/README.md`.
|
|
|
89
90
|
| `layer-barrel-exports.mdc` | Двухуровневые barrel для слоёв с public API (`@/api`, `@/types`, `@/core`, …) |
|
|
90
91
|
| `types-jsdoc.mdc` | JSDoc для типов в `app/src/types` (русский текст, `[computed]`, без `@param`/`@returns`) |
|
|
91
92
|
| `no-type-assertion-as-import-export.mdc` | Ограничение `as`, в т.ч. `instanceof` для ошибок транспорта в `catch` |
|
|
92
|
-
| `code-review-mr.mdc` | Чеклист ревью MR
|
|
93
|
+
| `code-review-mr.mdc` | Чеклист ревью MR + output contract (`path:line`, severity, verdict) |
|
|
93
94
|
| `tests-unit.mdc` | Unit‑тесты и behavior‑тесты HTTP‑клиента |
|
|
94
95
|
| `playwright-agents.mdc`, `tests-e2e-structure.mdc` | E2E |
|
|
95
96
|
| `react-ui.mdc` | React/Next UI: структура компонентов, соседние `ComponentName.data.ts` / `.utils.ts`, стили, пропсы |
|
|
@@ -11,6 +11,6 @@ When the user message looks like a **work request** (implement, add, fix, refact
|
|
|
11
11
|
|
|
12
12
|
1. Prefer **`/task <their request>`** or invoke **task-router** first.
|
|
13
13
|
2. Do not jump straight to coding without router + pipeline when scope is non-trivial.
|
|
14
|
-
3. Pure questions («как работает X», «объясни») —
|
|
14
|
+
3. Pure questions («как работает X», «объясни») — prefer agent **`codebase-analyzer`** (explain-as-is); trivial one-liners may be answered inline. Do not open `/task`.
|
|
15
15
|
|
|
16
16
|
Exceptions: user explicitly says «без pipeline», «просто сделай», or continues an active slug.
|
|
@@ -151,7 +151,7 @@ If `pipeline.json` is missing (old `/feature-start` tasks), fall back to fixed p
|
|
|
151
151
|
|
|
152
152
|
Do **not** run `/task` + router for:
|
|
153
153
|
|
|
154
|
-
- Pure questions («как работает X», «объясни»).
|
|
154
|
+
- Pure questions («как работает X», «объясни») — prefer agent **`codebase-analyzer`** for deep traces; inline OK for trivial one-liners.
|
|
155
155
|
- Typo / one-file fix / trivial config with no architecture risk.
|
|
156
156
|
- User explicitly says «без pipeline», «просто сделай», or continues an active slug.
|
|
157
157
|
- Single-line `docs-only` with no code impact.
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
description: Конвенции API сервисов и мапперов
|
|
3
3
|
globs: app/src/api/services/**/*.ts
|
|
4
4
|
alwaysApply: false
|
|
5
|
+
impact: HIGH
|
|
5
6
|
---
|
|
6
7
|
|
|
7
8
|
# Роль API слоя
|
|
@@ -55,4 +56,24 @@ alwaysApply: false
|
|
|
55
56
|
- компоненты не должны зависеть от DTO;
|
|
56
57
|
- store не должен сам собирать URL/коды эндпоинтов и не обходить сервисы; **транспортный тип ответа** и **контракт ошибки** из `@/types` (как у прикладного клиента) допустимы во thunk при разборе `catch`/payload, если так выстроен сервис (см. `store-rtk.mdc`, `http-client.mdc`).
|
|
57
58
|
- При использовании API‑сервисов в UI, store и утилитах **вне** `app/src/api/**` импортировать **только** из `@/api` (корневой barrel), см. **`public-imports.mdc`**; внутри слоя API — по относительным путям или `@/api/services/**` / `@/api/clients/**`, не дублируя публичный контракт мимо корневого barrel для внешних потребителей.
|
|
59
|
+
## Incorrect
|
|
58
60
|
|
|
61
|
+
```ts
|
|
62
|
+
// Returning raw DTO to store/UI without mapping
|
|
63
|
+
export const getCard = async (id: string) => {
|
|
64
|
+
const { data } = await cardsClient.get(`/cards/${id}`)
|
|
65
|
+
return data // backend DTO leaked upward
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Correct
|
|
70
|
+
|
|
71
|
+
```ts
|
|
72
|
+
import type { TCard } from '@/types'
|
|
73
|
+
import { mapCardResponse } from './cardResponseMappers'
|
|
74
|
+
|
|
75
|
+
export const getCard = async (id: string): Promise<TCard> => {
|
|
76
|
+
const { data } = await cardsClient.get(`/cards/${id}`)
|
|
77
|
+
return mapCardResponse(data)
|
|
78
|
+
}
|
|
79
|
+
```
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
description: Архитектурные границы и правила импортов
|
|
3
3
|
globs: app/src/api/**/*,app/src/store/**/*,app/src/types/**/*,app/src/lib/**/*
|
|
4
4
|
alwaysApply: false
|
|
5
|
+
impact: CRITICAL
|
|
5
6
|
---
|
|
6
7
|
|
|
7
8
|
# Границы между слоями
|
|
@@ -63,4 +64,30 @@ alwaysApply: false
|
|
|
63
64
|
- Разместить файлы в **соответствующих слоях**.
|
|
64
65
|
- Проверить существующие фичи с аналогичной структурой и **повторить их организацию**.
|
|
65
66
|
- Не "коротить" слои (например, не вызывать API прямо из компонента только ради упрощения).
|
|
67
|
+
## Incorrect
|
|
66
68
|
|
|
69
|
+
```ts
|
|
70
|
+
// UI calling HTTP client / deep service path directly
|
|
71
|
+
import { httpClient } from '@/lib/clients/HttpClient'
|
|
72
|
+
import { fetchOrders } from '@/api/services/OrdersApi/orders.service'
|
|
73
|
+
|
|
74
|
+
export const OrdersPage = () => {
|
|
75
|
+
// bypasses store and @/api barrel
|
|
76
|
+
void httpClient.get('/orders')
|
|
77
|
+
return null
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Correct
|
|
82
|
+
|
|
83
|
+
```ts
|
|
84
|
+
import { useAppDispatch } from '@/store'
|
|
85
|
+
import { loadOrders } from '@/store/slices/Orders'
|
|
86
|
+
|
|
87
|
+
export const OrdersPage = () => {
|
|
88
|
+
const dispatch = useAppDispatch()
|
|
89
|
+
// UI → store → services from @/api (inside thunk)
|
|
90
|
+
void dispatch(loadOrders())
|
|
91
|
+
return null
|
|
92
|
+
}
|
|
93
|
+
```
|
|
@@ -2,45 +2,30 @@
|
|
|
2
2
|
description: Предпочитать стрелочные функции при написании кода
|
|
3
3
|
globs: app/src/**/*.{ts,tsx,js,jsx}
|
|
4
4
|
alwaysApply: false
|
|
5
|
+
impact: LOW
|
|
5
6
|
---
|
|
6
|
-
|
|
7
7
|
# Стрелочные функции
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
## Что делать
|
|
9
|
+
Предпочитать стрелочный синтаксис для нового кода в `app/src/**`, где это допустимо в TypeScript/JavaScript.
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
- Колбэки и обработчики — стрелочные функции: `.map((x) => ...)`, `onClick={() => ...}`.
|
|
15
|
-
- React-компоненты и хуки — как стрелочные функции с явной типизацией пропсов/возврата по принятому в проекте стилю.
|
|
11
|
+
**Style enforcement:** детальные pref — в ESLint (`app/eslint.config.mjs`) и Stylelint; после правок — **`post-change-lint`**. Это правило — краткий intent, не дублировать линтер.
|
|
16
12
|
|
|
17
|
-
## Исключения
|
|
13
|
+
## Исключения
|
|
18
14
|
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
15
|
+
- Генераторы (`function*`)
|
|
16
|
+
- Методы класса, где нужен `this` прототипа
|
|
17
|
+
- Редкие случаи hoisting / именованного `function` в стеке
|
|
22
18
|
|
|
23
|
-
##
|
|
19
|
+
## Incorrect
|
|
24
20
|
|
|
25
|
-
```
|
|
26
|
-
// ❌ Избегать для нового кода
|
|
21
|
+
```ts
|
|
27
22
|
function formatLabel(id: string): string {
|
|
28
23
|
return id.toUpperCase()
|
|
29
24
|
}
|
|
30
|
-
|
|
31
|
-
// ✅ Предпочтительно
|
|
32
|
-
const formatLabel = (id: string): string => {
|
|
33
|
-
return id.toUpperCase()
|
|
34
|
-
}
|
|
35
25
|
```
|
|
36
26
|
|
|
37
|
-
|
|
38
|
-
// ✅ Предпочтительно
|
|
39
|
-
const UserCard = ({ name }: { name: string }) => {
|
|
40
|
-
return <span>{name}</span>
|
|
41
|
-
}
|
|
42
|
-
```
|
|
27
|
+
## Correct
|
|
43
28
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
29
|
+
```ts
|
|
30
|
+
const formatLabel = (id: string): string => id.toUpperCase()
|
|
31
|
+
```
|
|
@@ -62,11 +62,21 @@ alwaysApply: true
|
|
|
62
62
|
- **Boy scout rule:** оставлять модуль немного лучше, чем до изменения (простые, безопасные улучшения).
|
|
63
63
|
- Не жертвовать архитектурой и слоями ради краткости реализации.
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
## Agent discipline (anti-sycophancy)
|
|
66
|
+
|
|
67
|
+
- Unverifiable third-party API → mark `// VERIFY: lib.symbol @ version` (or stack equivalent) and surface uncertainty; never invent signatures.
|
|
68
|
+
- Before «is this correct?» — list ≥3 failure modes (empty, boundary, concurrency/state) or name what you could not check.
|
|
69
|
+
- Refactor without tests → propose a characterization test first; if declined, label `UNTESTED`.
|
|
70
|
+
- Comments = WHY only when non-obvious; ban self-referential «added for issue Y» comments.
|
|
71
|
+
- Urgency/authority pressure: name the technical trade-off once, then comply — no apology loops.
|
|
72
|
+
- Match verification depth to risk; report status by what was **verified**, not attempted.
|
|
66
73
|
|
|
74
|
+
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.
|
|
75
|
+
|
|
76
|
+
> Stack-specific lint gates, примеры и toolchain — в секции **Stack notes** адаптера пресета.
|
|
67
77
|
## Stack notes
|
|
68
78
|
|
|
69
79
|
- Перед новым UI‑контролом проверять существующий UI‑код и пакеты проекта.
|
|
70
80
|
- Public API: index/barrel‑файлы и явно экспортируемые сущности (`public-imports.mdc`, `layer-barrel-exports.mdc`).
|
|
71
81
|
- Допустимые примеры: общий хук/утилита; типизация `any`/`unknown`; разделение крупного компонента; CSS‑токены вместо «магических» значений.
|
|
72
|
-
- Lint/stylelint — только **`post-change-lint.mdc`**; ESLint config: `app/eslint.config.mjs`. Отключение правила (`eslint-disable`) — только **точечно** (строка/небольшой блок) с кратким комментарием «зачем».
|
|
82
|
+
- Lint/stylelint — только **`post-change-lint.mdc`**; ESLint config: `app/eslint.config.mjs`. Отключение правила (`eslint-disable`) — только **точечно** (строка/небольшой блок) с кратким комментарием «зачем». Style prose in domain rules stays thin — prefer ESLint/Stylelint over duplicating formatter recipes.
|
|
@@ -35,26 +35,24 @@ Concrete rule stems — in **Stack notes**.
|
|
|
35
35
|
- Boy scout rule: suggest fixes feasible within the MR scope.
|
|
36
36
|
- No «большие рефакторинги» without an explicit request (`code-quality-and-refactoring`).
|
|
37
37
|
|
|
38
|
+
## Output contract
|
|
39
|
+
|
|
40
|
+
Procedure details live in skill `code-review`. Required shape:
|
|
41
|
+
|
|
42
|
+
- Each finding cites **`path:line`**, the problem, impact, and a concrete fix direction.
|
|
43
|
+
- Rank by severity: **`blocker` | `important` | `nit`** (list blocker → nit).
|
|
44
|
+
- Vague («looks risky») is not a finding — cite evidence or ask for surrounding file context.
|
|
45
|
+
- End with a verdict on its own line: **`Safe to merge | needs changes | reject`**.
|
|
46
|
+
|
|
38
47
|
## Stack notes
|
|
39
48
|
|
|
40
49
|
On-demand rule for review flows. **Procedure and output format:** skill `code-review`.
|
|
41
50
|
|
|
42
|
-
|
|
51
|
+
### Checklist references
|
|
43
52
|
|
|
44
53
|
- Architecture layers: `architecture-boundaries.mdc`, `next-app-core.mdc`; network: `http-client.mdc`
|
|
45
54
|
- Imports: `public-imports.mdc`, `layer-barrel-exports.mdc`
|
|
46
55
|
- UI: `react-ui.mdc`
|
|
56
|
+
- Security: `security-next.mdc`
|
|
47
57
|
- Tests: `tests-unit.mdc`, `playwright-agents.mdc`, `tests-e2e-structure.mdc`
|
|
48
58
|
- Lint gate before final report: `post-change-lint.mdc`
|
|
49
|
-
|
|
50
|
-
## When to load
|
|
51
|
-
|
|
52
|
-
- User asks for review/MR/diff
|
|
53
|
-
- Pipeline step `code-reviewer`
|
|
54
|
-
- BUGBOT automated review
|
|
55
|
-
|
|
56
|
-
## Constraints
|
|
57
|
-
|
|
58
|
-
- Focus on MR diff, not the whole repo.
|
|
59
|
-
- Use local `git diff` — do not invent hosting metadata.
|
|
60
|
-
- Boy scout rule: suggest fixes feasible within the MR scope.
|
|
@@ -4,6 +4,7 @@ globs:
|
|
|
4
4
|
- app/src/lib/clients/HttpClient/**/*.ts
|
|
5
5
|
- app/src/api/clients/**/*.ts
|
|
6
6
|
alwaysApply: false
|
|
7
|
+
impact: HIGH
|
|
7
8
|
---
|
|
8
9
|
|
|
9
10
|
# HTTP-транспорт
|
|
@@ -40,3 +41,23 @@ alwaysApply: false
|
|
|
40
41
|
|
|
41
42
|
- Меняя реализацию общего клиента — **обновить или добавить behavior‑тесты** рядом с модулем клиента (`tests-unit.mdc`).
|
|
42
43
|
- Не вводить **второй полноценный HTTP‑стек** без явной задачи и согласования с архитектурой репозитория.
|
|
44
|
+
## Incorrect
|
|
45
|
+
|
|
46
|
+
```ts
|
|
47
|
+
// Inside api/services — ad-hoc fetch bypasses shared client
|
|
48
|
+
export const getSettings = async () => {
|
|
49
|
+
const res = await fetch('/api/settings')
|
|
50
|
+
return res.json()
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Correct
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
import { appHttpClient } from '@/api/clients/appHttpClient'
|
|
58
|
+
|
|
59
|
+
export const getSettings = async () => {
|
|
60
|
+
const { data } = await appHttpClient.get('/settings')
|
|
61
|
+
return mapSettingsResponse(data)
|
|
62
|
+
}
|
|
63
|
+
```
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
description: Двухуровневые barrel-экспорты для слоёв с регламентированным public API
|
|
3
3
|
globs: app/src/**/index.ts
|
|
4
4
|
alwaysApply: false
|
|
5
|
+
impact: MEDIUM
|
|
5
6
|
---
|
|
6
7
|
|
|
7
8
|
# Barrel-экспорты слоёв с public API
|
|
@@ -57,3 +58,17 @@ alwaysApply: false
|
|
|
57
58
|
| Core | `app/src/core/index.ts` | ESLint: `@/core/index` |
|
|
58
59
|
|
|
59
60
|
Иллюстрация двух уровней (API): локальный `services/.../<Feature>/index.ts` → фасад `*ApiService.ts` → `app/src/api/index.ts`.
|
|
61
|
+
## Incorrect
|
|
62
|
+
|
|
63
|
+
```ts
|
|
64
|
+
// app/src/api/index.ts — leaking internals
|
|
65
|
+
export { mapCardResponse } from './services/CardsApi/cardResponseMappers'
|
|
66
|
+
export { rawCardsClient } from './clients/rawCardsClient'
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Correct
|
|
70
|
+
|
|
71
|
+
```ts
|
|
72
|
+
// app/src/api/index.ts — public facade only
|
|
73
|
+
export { cardsApi } from './services/CardsApi'
|
|
74
|
+
```
|
|
@@ -22,7 +22,7 @@ alwaysApply: false
|
|
|
22
22
|
|
|
23
23
|
## Маршруты и UX
|
|
24
24
|
|
|
25
|
-
- Для async routes
|
|
25
|
+
- Для async data routes **обязательны** sibling **`loading.tsx`** и **`error.tsx`** (и `not-found.tsx` где уместно) — по образцу соседних routes.
|
|
26
26
|
- **Suspense** — для медленных client/server секций; fallback согласован с дизайн-системой.
|
|
27
27
|
- Навигация — `navigation-router-stack.mdc` + router/link паттерны проекта.
|
|
28
28
|
|
|
@@ -31,6 +31,18 @@ alwaysApply: false
|
|
|
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 (`security-next.mdc`) |
|
|
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/**` и повтори структуру (`reference-features.mdc`).
|
|
@@ -7,6 +7,7 @@ globs:
|
|
|
7
7
|
- app/src/types/**/*
|
|
8
8
|
- app/src/api/**/*
|
|
9
9
|
alwaysApply: false
|
|
10
|
+
impact: HIGH
|
|
10
11
|
---
|
|
11
12
|
|
|
12
13
|
# Публичные импорты (`@/types`, `@/api`)
|
|
@@ -46,3 +47,16 @@ import { MedcardApiService } from '@/api/services/MedcardApiService/MedcardApiSe
|
|
|
46
47
|
```
|
|
47
48
|
|
|
48
49
|
Новые публичные символы API — реэкспорт в `app/src/api/index.ts` по **`layer-barrel-exports.mdc`**.
|
|
50
|
+
## Incorrect
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
import type { TUserProfile } from '@/types/User.types'
|
|
54
|
+
import { OrdersApi } from '@/api/services/OrdersApi'
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Correct
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
import type { TUserProfile } from '@/types'
|
|
61
|
+
import { ordersApi } from '@/api'
|
|
62
|
+
```
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
description: Паттерны React/Next UI и стилей (preset)
|
|
3
3
|
globs: app/src/ui/**/*.tsx,app/src/ui/**/*.ts
|
|
4
4
|
alwaysApply: false
|
|
5
|
+
impact: HIGH
|
|
5
6
|
---
|
|
6
7
|
|
|
7
8
|
# Общие правила компонентов
|
|
@@ -89,4 +90,23 @@ alwaysApply: false
|
|
|
89
90
|
- **Testing Library** для React, как принято в проекте;
|
|
90
91
|
- проверять поведение и бизнес‑правила, а не конкретные CSS‑классы.
|
|
91
92
|
- В тестах ориентироваться на текст, роли и aria‑атрибуты.
|
|
93
|
+
## Incorrect
|
|
92
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
|
+
```
|
|
@@ -38,6 +38,10 @@ Taxonomy / shared core: [`presets/_shared/README.md`](../../../../_shared/README
|
|
|
38
38
|
3. Зеркаль именование, порядок файлов, паттерны импортов и тестов.
|
|
39
39
|
4. Если эталона нет — выбери **самую близкую** существующую фичу того же слоя и зафиксируй выбор в handoff.
|
|
40
40
|
|
|
41
|
+
## Living conventions
|
|
42
|
+
|
|
43
|
+
Post-init gotchas / patterns / decisions: **`.cursor/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.
|
|
44
|
+
|
|
41
45
|
## Связанные правила
|
|
42
46
|
|
|
43
47
|
- `code-quality-and-refactoring.mdc` — повторять паттерны, не deep-import.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Next.js frontend security — secrets, auth, XSS, Server Actions, env
|
|
3
|
+
globs:
|
|
4
|
+
- "app/src/**/*.{ts,tsx}"
|
|
5
|
+
- "app/**/app/**/*.{ts,tsx}"
|
|
6
|
+
- "**/*Auth*.{ts,tsx}"
|
|
7
|
+
- "**/*Session*.{ts,tsx}"
|
|
8
|
+
- "**/.env*"
|
|
9
|
+
alwaysApply: false
|
|
10
|
+
impact: CRITICAL
|
|
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 `code-review-mr.mdc`. Route sensitive features through `security-reviewer`.
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
description: Redux Toolkit и состояние приложения
|
|
3
3
|
globs: app/src/store/**/*.ts
|
|
4
4
|
alwaysApply: false
|
|
5
|
+
impact: HIGH
|
|
5
6
|
---
|
|
6
7
|
|
|
7
8
|
# Общие принципы
|
|
@@ -63,4 +64,22 @@ alwaysApply: false
|
|
|
63
64
|
- Строго типизировать state и actions.
|
|
64
65
|
- Использовать единый стиль именования actions и селекторов, как в существующих слайсах.
|
|
65
66
|
- При работе с ошибками и ответами HTTP опираться на **`http-client.mdc`** и контракты из `@/types`, а не на типы внешних HTTP‑библиотек вне зависимостей проекта.
|
|
67
|
+
## Incorrect
|
|
66
68
|
|
|
69
|
+
```ts
|
|
70
|
+
export const loadProfile = createAsyncThunk('profile/load', async () => {
|
|
71
|
+
const res = await fetch('/api/profile')
|
|
72
|
+
return res.json() // raw DTO into slice
|
|
73
|
+
})
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Correct
|
|
77
|
+
|
|
78
|
+
```ts
|
|
79
|
+
import { profileApi } from '@/api'
|
|
80
|
+
|
|
81
|
+
export const loadProfile = createAsyncThunk('profile/load', async () => {
|
|
82
|
+
// service returns domain model already mapped
|
|
83
|
+
return profileApi.getProfile()
|
|
84
|
+
})
|
|
85
|
+
```
|
|
@@ -4,6 +4,7 @@ globs:
|
|
|
4
4
|
- app/src/**/*.spec.{ts,tsx}
|
|
5
5
|
- app/src/**/*.test.{ts,tsx}
|
|
6
6
|
alwaysApply: false
|
|
7
|
+
impact: MEDIUM
|
|
7
8
|
---
|
|
8
9
|
|
|
9
10
|
# Общие правила тестирования
|
|
@@ -63,4 +64,15 @@ it('Returns empty list when user is guest', () => {})
|
|
|
63
64
|
- для **компонентов UI** — **не создавать** поддиректорию `__tests__` внутри папки компонента; тест — соседний `*.spec.tsx`.
|
|
64
65
|
- в **других модулях** (например `api/services`) допустима уже существующая схема с `__tests__` — не ломать ради единообразия с UI.
|
|
65
66
|
- **новые** файлы — `*.spec.ts` / `*.spec.tsx` (см. блок «Имена файлов» выше).
|
|
67
|
+
## Incorrect
|
|
66
68
|
|
|
69
|
+
```ts
|
|
70
|
+
it('returns empty list when guest', () => {})
|
|
71
|
+
it('Возвращает пустой список. пользователь не авторизован', () => {})
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Correct
|
|
75
|
+
|
|
76
|
+
```ts
|
|
77
|
+
it('Возвращает пустой список. Пользователь не авторизован', () => {})
|
|
78
|
+
```
|
|
@@ -11,5 +11,7 @@ Project skills for Cursor. They keep long workflows out of always-on rules while
|
|
|
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
|
Skills are copied to `.cursor/skills/` by `ai-rules init cursor --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.
|
|
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.
|
|
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 `.cursor/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** **`post-change-lint.mdc`** after code edits (requestable, not always-on — 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 `.cursor/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.
|