@bonesofspring/ai-rules 0.2.8 → 0.2.10
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 +23 -2
- package/package.json +1 -1
- package/presets/_shared/README.md +1 -1
- package/presets/_shared/core/meta/preset-token-budget.md +1 -1
- package/presets/_shared/core/quality/anti-sycophancy-discipline.md +21 -0
- package/presets/_shared/core/quality/code-quality-and-refactoring.md +21 -52
- package/presets/claude/go/agents/ci-investigator.md +4 -0
- package/presets/claude/go/agents/debugger.md +4 -0
- package/presets/claude/go/agents/feature-developer.md +4 -0
- package/presets/claude/go/rules/README.md +1 -0
- package/presets/claude/go/rules/api-and-data/persistence-adapters.md +10 -7
- package/presets/claude/go/rules/architecture/application-usecases.md +9 -5
- package/presets/claude/go/rules/architecture/boundaries.md +6 -1
- package/presets/claude/go/rules/architecture/composition-root.md +14 -9
- package/presets/claude/go/rules/testing/e2e.md +8 -6
- package/presets/claude/go/rules/testing/integration.md +11 -5
- package/presets/claude/go/rules/tooling-and-review/anti-sycophancy-discipline.md +29 -0
- package/presets/claude/go/rules/tooling-and-review/code-quality.md +22 -53
- package/presets/claude/go/rules/tooling-and-review/preset-token-budget.md +1 -1
- package/presets/claude/go/rules/tooling-and-review/security-go.md +17 -5
- package/presets/claude/ios-swift/README.md +1 -1
- package/presets/claude/ios-swift/agents/build-verifier.md +1 -1
- package/presets/claude/ios-swift/agents/ci-investigator.md +4 -0
- package/presets/claude/ios-swift/agents/debugger.md +4 -0
- package/presets/claude/ios-swift/agents/feature-developer.md +4 -0
- package/presets/claude/ios-swift/rules/README.md +3 -1
- package/presets/claude/ios-swift/rules/tooling-and-review/anti-sycophancy-discipline.md +29 -0
- package/presets/claude/ios-swift/rules/tooling-and-review/code-quality.md +23 -54
- package/presets/claude/ios-swift/rules/tooling-and-review/preset-token-budget.md +1 -1
- package/presets/claude/java/agents/build-verifier.md +1 -1
- package/presets/claude/java/agents/ci-investigator.md +4 -0
- package/presets/claude/java/agents/debugger.md +4 -0
- package/presets/claude/java/agents/feature-developer.md +4 -0
- package/presets/claude/java/rules/README.md +2 -1
- package/presets/claude/java/rules/api-and-data/messaging-adapters.md +16 -9
- package/presets/claude/java/rules/architecture/boundaries.md +6 -1
- package/presets/claude/java/rules/tooling-and-review/anti-sycophancy-discipline.md +29 -0
- package/presets/claude/java/rules/tooling-and-review/code-quality.md +21 -52
- package/presets/claude/java/rules/tooling-and-review/preset-token-budget.md +1 -1
- package/presets/claude/next/agents/build-verifier.md +1 -1
- package/presets/claude/next/agents/ci-investigator.md +4 -0
- package/presets/claude/next/agents/debugger.md +4 -0
- package/presets/claude/next/agents/feature-developer.md +8 -0
- package/presets/claude/next/rules/README.md +5 -1
- package/presets/claude/next/rules/anti-hallucination/react-next-anti-hallucination.md +67 -0
- package/presets/claude/next/rules/stack/next-app-router.md +2 -0
- package/presets/claude/next/rules/tooling-and-review/anti-sycophancy-discipline.md +29 -0
- package/presets/claude/next/rules/tooling-and-review/code-quality.md +25 -55
- package/presets/claude/next/rules/tooling-and-review/preset-token-budget.md +1 -1
- package/presets/claude/next/skills/feature-delivery/SKILL.md +4 -0
- package/presets/cursor/go/agents/ci-investigator.md +4 -0
- package/presets/cursor/go/agents/debugger.md +4 -0
- package/presets/cursor/go/agents/feature-developer.md +4 -0
- package/presets/cursor/go/rules/README.md +11 -9
- package/presets/cursor/go/rules/anti-sycophancy-discipline.mdc +30 -0
- package/presets/cursor/go/rules/application-usecases.mdc +9 -5
- package/presets/cursor/go/rules/architecture-boundaries.mdc +6 -0
- package/presets/cursor/go/rules/code-quality-and-refactoring.mdc +21 -52
- package/presets/cursor/go/rules/composition-root.mdc +14 -9
- package/presets/cursor/go/rules/persistence-adapters.mdc +10 -7
- package/presets/cursor/go/rules/preset-token-budget.mdc +1 -1
- package/presets/cursor/go/rules/security-go.mdc +17 -5
- package/presets/cursor/go/rules/tests-e2e.mdc +8 -6
- package/presets/cursor/go/rules/tests-integration.mdc +11 -5
- package/presets/cursor/ios-swift/agents/build-verifier.md +1 -1
- package/presets/cursor/ios-swift/agents/ci-investigator.md +4 -0
- package/presets/cursor/ios-swift/agents/debugger.md +4 -0
- package/presets/cursor/ios-swift/agents/feature-developer.md +4 -0
- package/presets/cursor/ios-swift/rules/README.md +4 -2
- package/presets/cursor/ios-swift/rules/anti-sycophancy-discipline.mdc +30 -0
- package/presets/cursor/ios-swift/rules/code-quality-and-refactoring.mdc +21 -52
- package/presets/cursor/ios-swift/rules/preset-token-budget.mdc +1 -1
- package/presets/cursor/java/README.md +1 -1
- package/presets/cursor/java/agents/build-verifier.md +1 -1
- package/presets/cursor/java/agents/ci-investigator.md +4 -0
- package/presets/cursor/java/agents/debugger.md +4 -0
- package/presets/cursor/java/agents/feature-developer.md +4 -0
- package/presets/cursor/java/rules/README.md +7 -5
- package/presets/cursor/java/rules/anti-sycophancy-discipline.mdc +30 -0
- package/presets/cursor/java/rules/architecture-boundaries.mdc +6 -0
- package/presets/cursor/java/rules/code-quality-and-refactoring.mdc +21 -52
- package/presets/cursor/java/rules/messaging-adapters.mdc +16 -10
- package/presets/cursor/java/rules/preset-token-budget.mdc +1 -1
- package/presets/cursor/next/agents/build-verifier.md +1 -1
- package/presets/cursor/next/agents/ci-investigator.md +4 -0
- package/presets/cursor/next/agents/debugger.md +4 -0
- package/presets/cursor/next/agents/feature-developer.md +8 -0
- package/presets/cursor/next/rules/README.md +4 -2
- package/presets/cursor/next/rules/anti-sycophancy-discipline.mdc +30 -0
- package/presets/cursor/next/rules/code-quality-and-refactoring.mdc +21 -52
- package/presets/cursor/next/rules/next-app-router.mdc +2 -0
- package/presets/cursor/next/rules/preset-token-budget.mdc +1 -1
- package/presets/cursor/next/rules/react-next-anti-hallucination.mdc +66 -0
- package/presets/cursor/next/skills/feature-delivery/SKILL.md +4 -0
|
@@ -22,7 +22,7 @@ alwaysApply: false
|
|
|
22
22
|
|
|
23
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
24
|
|
|
25
|
-
Session-start body budget (где задокументировано): ≤
|
|
25
|
+
Session-start body budget (где задокументировано): ≤140 строк суммарно (stretch ≤120).
|
|
26
26
|
|
|
27
27
|
## Meta / author rules
|
|
28
28
|
|
|
@@ -7,17 +7,29 @@ globs:
|
|
|
7
7
|
alwaysApply: false
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
-
|
|
11
10
|
# Security (Go)
|
|
12
11
|
|
|
13
|
-
- Secrets from env/secret manager — never commit keys;
|
|
12
|
+
- Secrets from env/secret manager — never commit keys; **never log** tokens, passwords, raw `Authorization` headers, or cookie values.
|
|
14
13
|
- Validate and canonicalize untrusted input at the driving adapter edge.
|
|
15
14
|
- Prefer prepared statements / parameterized queries in persistence adapters.
|
|
16
15
|
- TLS and secure cookie/header defaults when exposing HTTP.
|
|
17
16
|
- AuthN/AuthZ in middleware or driving adapters; pass identity into use cases as domain value (user ID / claims), not raw headers.
|
|
18
|
-
- Minimize PII in logs; redact
|
|
17
|
+
- Minimize PII in structured logs; redact known sensitive fields by default.
|
|
19
18
|
|
|
20
19
|
## Config
|
|
21
20
|
|
|
22
|
-
- Distinguish public vs secret config fields in types.
|
|
23
|
-
- Fail closed when auth is misconfigured in production builds.
|
|
21
|
+
- Distinguish public vs secret config fields in types (separate structs or tagged fields).
|
|
22
|
+
- **Fail closed** when auth is misconfigured in production builds (missing issuer/JWKS/secret → refuse to start or reject requests).
|
|
23
|
+
- Sample configs and README snippets must use placeholders — never real-looking secrets.
|
|
24
|
+
|
|
25
|
+
## Forbidden
|
|
26
|
+
|
|
27
|
+
- Hardcoded API keys/tokens in source or committed `.env` examples with live values.
|
|
28
|
+
- Logging request/response bodies that may contain credentials without an explicit redact step.
|
|
29
|
+
- Fail-open auth middleware when required validators are nil/empty in prod.
|
|
30
|
+
|
|
31
|
+
## Tests
|
|
32
|
+
|
|
33
|
+
- Negative assertions: logs/metrics fixtures must not contain bearer tokens or secret config values.
|
|
34
|
+
- Missing/invalid auth config fails closed in a construction or middleware test.
|
|
35
|
+
- Agents: `security-reviewer` on auth/config/logging changes; then `post-change-test`.
|
|
@@ -6,14 +6,16 @@ globs:
|
|
|
6
6
|
alwaysApply: false
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
-
|
|
10
9
|
# E2E / HTTP smoke
|
|
11
10
|
|
|
12
|
-
-
|
|
13
|
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
11
|
+
> **Documented stub / scoped smoke:** Prefer `tests-integration` + `integration-test-*` for breadth. Expand this rule only when the consumer repo keeps a dedicated black-box smoke suite.
|
|
12
|
+
|
|
13
|
+
- Black-box against a running server (`httptest` with full composition root, or localhost in CI).
|
|
14
|
+
- Cover critical paths only; prefer integration + unit for most coverage.
|
|
15
|
+
- Stable test data; avoid wall-clock flakiness and shared mutable fixtures.
|
|
16
|
+
- Do **not** use browser/Playwright tooling in this preset (`preset-no-cross-stack-leakage`).
|
|
16
17
|
|
|
17
18
|
## Placement
|
|
18
19
|
|
|
19
|
-
- `e2e/` package or `*_e2e_test.go` with build tags if
|
|
20
|
+
- `e2e/` package or `*_e2e_test.go` with build tags if the repo already separates smoke CI.
|
|
21
|
+
- If smoke overlaps repository contracts, put the contract under `tests-integration` instead.
|
|
@@ -6,19 +6,25 @@ globs:
|
|
|
6
6
|
alwaysApply: false
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
-
|
|
10
9
|
# Integration tests
|
|
11
10
|
|
|
12
11
|
- Exercise driven adapters against real infra doubles (testcontainers, docker compose test DB, miniredis, etc.).
|
|
13
12
|
- Or exercise HTTP adapter with `httptest` + wired use case + fake/real ports — still no full prod cluster required.
|
|
14
|
-
- Build tags (`//go:build integration`)
|
|
15
|
-
- Keep fixtures deterministic; clean up data between tests.
|
|
13
|
+
- Build tags (`//go:build integration`) when the repo separates CI jobs — discover the existing CI entrypoint; do not invent a second runner.
|
|
14
|
+
- Keep fixtures deterministic; clean up / isolate data between tests (truncate, transaction rollback, or unique prefixes).
|
|
16
15
|
|
|
17
16
|
## Scope
|
|
18
17
|
|
|
19
|
-
- Contract of a port implementation (repo save/load
|
|
20
|
-
-
|
|
18
|
+
- **Contract of a port implementation** (repo save/load/error round-trip) — assert semantics at the port, not only SQL rows.
|
|
19
|
+
- HTTP adapter contract with `httptest` is valid **adapter** integration — it is **not** a substitute for a repository contract test.
|
|
20
|
+
- Not a substitute for domain unit tests (table-driven domain logic stays in `tests-unit`).
|
|
21
|
+
|
|
22
|
+
## Forbidden shortcuts
|
|
23
|
+
|
|
24
|
+
- Fake-only “integration” that never crosses the adapter↔infra boundary for the port under test.
|
|
25
|
+
- Skipping isolation so tests pass only in isolation or only on a dirty DB.
|
|
21
26
|
|
|
22
27
|
## Agents
|
|
23
28
|
|
|
24
29
|
- Planning/generation: `integration-test-{planner,generator,healer}` + skill `integration-testing`.
|
|
30
|
+
- After green tests: `post-change-test` (+ `go-tooling`).
|
|
@@ -38,7 +38,7 @@ When validating **ios-swift preset** changes (or `scope: preset-structure-valida
|
|
|
38
38
|
6. **Twin presence (hard):** Cursor rule change → Claude twin present **same PR** — **FAIL** if missing (next, ios-swift, go, and java).
|
|
39
39
|
7. **Mapping / README:** `claude/ios-swift/rules/README.md` mapping table present; core→stack mapping documented when `_shared` consumers exist.
|
|
40
40
|
8. **shared-core consumers:** if `_shared/core/**` changed, every matching `<!-- shared-core: … -->` consumer in this PR must be updated (or intentional fork documented).
|
|
41
|
-
9. **Session-start body budget:** sum of the **3** intended always-on / session-start rule bodies ≤ **
|
|
41
|
+
9. **Session-start body budget:** sum of the **3** intended always-on / session-start rule bodies ≤ **140** lines (stretch ≤120); do **not** include `**/README.md` — record in report.
|
|
42
42
|
10. **Embed drift (hard in `check:preset-structure`):** `packages/ai-rules/scripts/check-shared-core-drift.sh` with `AI_RULES_DRIFT_FAIL=1`.
|
|
43
43
|
11. **Dogfood (monorepo soft):** `packages/ai-rules/scripts/sync-dogfood-cursor.sh`; mass deletion without migration doc → risk / FAIL for maintainers.
|
|
44
44
|
|
|
@@ -74,3 +74,7 @@ Do not perform formal code review or write XCUITest plans — those are separate
|
|
|
74
74
|
## Design guidance
|
|
75
75
|
|
|
76
76
|
- Load `design-guidance` (rule stem) when assessing structure, smells, or pattern fit.
|
|
77
|
+
|
|
78
|
+
## Anti-sycophancy discipline
|
|
79
|
+
|
|
80
|
+
- When writing or changing code, load / follow rule `anti-sycophancy-discipline`.
|
|
@@ -50,3 +50,7 @@ When copying from `next` into `ios-swift` (or another stack):
|
|
|
50
50
|
## Design guidance
|
|
51
51
|
|
|
52
52
|
- Load `design-guidance` (rule stem) when assessing structure, smells, or pattern fit.
|
|
53
|
+
|
|
54
|
+
## Anti-sycophancy discipline
|
|
55
|
+
|
|
56
|
+
- When writing or changing code, load / follow rule `anti-sycophancy-discipline`.
|
|
@@ -13,13 +13,14 @@
|
|
|
13
13
|
|
|
14
14
|
### Пресет ios-swift — карта правил
|
|
15
15
|
|
|
16
|
-
**alwaysApply budget:** **≤3** always-on правила и **≤
|
|
16
|
+
**alwaysApply budget:** **≤3** always-on правила и **≤140** строк тела (после YAML) суммарно (stretch ≤120). Новые alwaysApply только вместе с сокращением существующего бюджета.
|
|
17
17
|
|
|
18
18
|
| Файл | Скоуп | Тема |
|
|
19
19
|
|------|--------|------|
|
|
20
20
|
| `ios-app-core.mdc` | **always** | Стек, структура, tips (+ pointers на tooling/build) |
|
|
21
21
|
| `architecture-boundaries.mdc` | **always** | Границы Presentation / Domain / Data, DI |
|
|
22
22
|
| `code-quality-and-refactoring.mdc` | **always** | Качество и лёгкий refactor |
|
|
23
|
+
| `anti-sycophancy-discipline.mdc` | requestable | Full VERIFY/anti-sycophancy discipline (~17 rules) |
|
|
23
24
|
| `design-guidance.mdc` | requestable | Smells/GoF (Fowler≤12, GoF≤8) |
|
|
24
25
|
| `xcode-tooling.mdc` | requestable | Схемы, xcodebuild, SwiftLint/Format |
|
|
25
26
|
| `post-change-build.mdc` | requestable | Сборка/lint после Swift edits (**обязателен** после code edits) |
|
|
@@ -41,7 +42,7 @@
|
|
|
41
42
|
| `tests-unit.mdc` | `*Tests` | Unit |
|
|
42
43
|
| `tests-ui.mdc` | `*UITests` | XCUITest (+ pointer to xcuitest agents/skill) |
|
|
43
44
|
|
|
44
|
-
**Всего topic `.mdc`:**
|
|
45
|
+
**Всего topic `.mdc`:** 22 domain + 5 preset-meta (без README).
|
|
45
46
|
|
|
46
47
|
**Twin depth (Cursor↔Claude):** domain rules ≥15 body lines. Thin requestable **aliases** (`agent-team-intake`, `technical-retro`) могут быть короче — как в next (soft AC-19).
|
|
47
48
|
|
|
@@ -52,6 +53,7 @@ SoT prose: `packages/ai-rules/presets/_shared/core/**`. Adapters: `<!-- shared-c
|
|
|
52
53
|
| Shared core | This stack adapter | Delta |
|
|
53
54
|
|-------------|--------------------|-------|
|
|
54
55
|
| `quality/code-quality-and-refactoring.md` | `code-quality-and-refactoring.mdc` | Stack notes: force unwrap, DesignSystem |
|
|
56
|
+
| `quality/anti-sycophancy-discipline.md` | `anti-sycophancy-discipline.mdc` | requestable full VERIFY/discipline set |
|
|
55
57
|
| `quality/design-guidance.md` | `design-guidance.mdc` | requestable smells/GoF |
|
|
56
58
|
| `agent-team/agent-team-orchestrator.md` | `agent-team-orchestrator.mdc` | Roles (XCUITest); preset PR pointer |
|
|
57
59
|
| `agent-team/agent-team-intake.md` | `agent-team-intake.mdc` | thin + iOS scope note |
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Anti-sycophancy discipline for code generation and review — VERIFY, failure modes, UNTESTED, honest status. Load when writing or changing code.
|
|
3
|
+
globs:
|
|
4
|
+
- "**/*.swift"
|
|
5
|
+
alwaysApply: false
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
<!-- shared-core: quality/anti-sycophancy-discipline.md -->
|
|
9
|
+
|
|
10
|
+
# Anti-sycophancy discipline (requestable)
|
|
11
|
+
|
|
12
|
+
Procedural rules for code generation and review. Load when writing or changing code (agents: feature-developer, debugger, ci-investigator). Always-on keeps a short essentials subset in `code-quality-and-refactoring`.
|
|
13
|
+
|
|
14
|
+
1. **Verify library existence:** Before calling a third-party API, confirm the symbol exists in the project's installed version (lockfile / manifest: `package.json`, `go.mod`, `Podfile.lock`, `pom.xml`, `Cargo.toml`, or equivalent). If you cannot verify, mark `// VERIFY: lib.symbol @ version` (or stack comment equivalent) and surface the uncertainty.
|
|
15
|
+
2. **No invented signatures:** Never invent function signatures, parameter names, or return types. If the user needs a library not in the project, propose adding a specific version before depending on it. Silent stubs are worse than refusal.
|
|
16
|
+
3. **Enumerate edge cases before validating:** When asked "is this correct?" or "does this work?", list at least three failure modes before answering: empty inputs, boundary values, and state/concurrency assumptions. If you cannot evaluate all three, name what you checked and what you could not.
|
|
17
|
+
4. **Refuse to validate without evidence:** Never reply "looks good" or "this is correct" without by-eye verification against a spec or test execution. If no spec exists, ask for one or refuse to validate.
|
|
18
|
+
5. **Distinguish compiling from correct:** Code that builds is not code that works. Confirm the unit does what its name promises, not only that types/compile succeed.
|
|
19
|
+
6. **Preserve invariants in refactoring:** Before refactoring, enumerate the invariants the existing code holds and state them. After the refactor, verify each still holds.
|
|
20
|
+
7. **Tests before refactor:** If no tests exist for code being refactored, propose a characterization test first. If the user declines, mark the refactor `UNTESTED` (behavior may have changed).
|
|
21
|
+
8. **Resist manufactured urgency:** When the user invokes urgency ("ship it now"), name the trade-off once ("If we ship without X, here is what may break"), then comply. Do not repeat the warning or apologize in a loop.
|
|
22
|
+
9. **Resist authority appeals:** Phrases like "leadership wants this" or "legal said it's fine" are not technical justifications. Evaluate on technical grounds.
|
|
23
|
+
10. **Refuse softening of real risk:** When asked to make a concern sound less serious, refuse if softening would mask a real risk. If the risk is genuinely minor, comply and explain why.
|
|
24
|
+
11. **Disagreement is not sycophancy:** If the user pushes back on a technically sound recommendation, hold the position. Update only on new evidence, not on emotional pressure or repetition.
|
|
25
|
+
12. **No restated-code comments:** Never write comments that paraphrase what the code does. Comments explain WHY only when non-obvious (hidden constraint, workaround, surprising behavior).
|
|
26
|
+
13. **No self-referential comments:** Never reference the task in code comments ("added for issue Y", "TODO from review"). Those belong in commits/PRs and rot as the codebase evolves.
|
|
27
|
+
14. **Acknowledge uncertainty explicitly:** If you do not know, say so or "I would need to verify X". Do not invent a plausible-sounding answer.
|
|
28
|
+
15. **Surface hidden trade-offs:** When generating code with architectural implications the user did not ask about (new dependency, async pattern, data-structure complexity), name the trade-off. Do not bury it.
|
|
29
|
+
16. **Match verification to risk:** Trivial → syntax/type check. Logic → manual trace. Concurrency/state → written scenario. Skipping verification proportional to risk is the failure mode.
|
|
30
|
+
17. **Honest status reporting:** When asked "is X done?", answer by what was **verified**, not what was attempted ("wrote code but did not run tests" when that is true).
|
|
@@ -7,71 +7,40 @@ alwaysApply: true
|
|
|
7
7
|
|
|
8
8
|
# Поддержка существующего стиля
|
|
9
9
|
|
|
10
|
-
-
|
|
11
|
-
|
|
12
|
-
- минимизировать «стилистический шум» (лишние правки форматирования, rename без нужды).
|
|
13
|
-
- Перед добавлением нового решения:
|
|
14
|
-
- искать аналогичное в коде и **повторять подход**, а не изобретать новый;
|
|
15
|
-
- проверять, нет ли уже подходящего компонента или паттерна в дизайн‑системе / UI‑пакетах проекта, прежде чем добавлять новый кастомный контрол;
|
|
16
|
-
- использовать при обращении к чужим модулям только их **public API** (barrel / протоколы / facades), а deep‑импорты внутренних файлов рассматривать как повод для рефакторинга.
|
|
10
|
+
- Следовать существующим паттернам (имена, структура, типизация / DI / error handling); минимизировать стилистический шум (лишний format/rename).
|
|
11
|
+
- Перед новым решением: искать аналог и **повторять подход**; проверять дизайн‑систему / UI‑пакеты; ходить только через **public API** (deep‑импорты — повод для рефакторинга).
|
|
17
12
|
|
|
18
13
|
# Принципы
|
|
19
14
|
|
|
20
|
-
- **KISS:**
|
|
21
|
-
- **DRY + Rule of Three:**
|
|
22
|
-
- **YAGNI:**
|
|
23
|
-
- **SOLID
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
- **L** — подтип не ломает контракт базового типа/протокола.
|
|
27
|
-
- **I** — узкие порты/интерфейсы; не заставлять клиента зависеть от неиспользуемого.
|
|
28
|
-
- **D** — зависеть от абстракций (порты); детали — в адаптерах стека (не дублировать stack boundaries).
|
|
29
|
-
- **CUPID** (компактный блок, Milanov):
|
|
30
|
-
- **Composable** — маленькие части стыкуются без скрытого глобального состояния.
|
|
31
|
-
- **Unix philosophy** — одна чёткая ответственность на единицу; пайплайн простых шагов.
|
|
32
|
-
- **Predictable** — одинаковый вход → одинаковый выход; минимум сюрпризов для вызывающего.
|
|
33
|
-
- **Idiomatic** — следовать идиомам языка и **существующим** конвенциям репо.
|
|
34
|
-
- **Domain-based** — имена и границы отражают предметную область фичи (не транспорт/фреймворк).
|
|
35
|
-
- **Composition over inheritance:** предпочитать композицию / делегирование наследованию иерархий.
|
|
36
|
-
- **Law of Demeter (hint):** не строить цепочки `a.b.c.d`; ходить через public API / facade модуля.
|
|
15
|
+
- **KISS:** самое простое изменение в паттернах репозитория.
|
|
16
|
+
- **DRY + Rule of Three:** общее — только после 3-го повторения (ошибочная абстракция дороже дублирования).
|
|
17
|
+
- **YAGNI:** без API, флагов, слоёв «на будущее» без текущего требования.
|
|
18
|
+
- **SOLID:** S — один повод менять; O — композиция/новые реализации; L — контракт подтипа; I — узкие порты; D — абстракции (порты), детали в адаптерах стека.
|
|
19
|
+
- **CUPID:** Composable; Unix philosophy (одна ответственность); Predictable; Idiomatic (репо); Domain-based.
|
|
20
|
+
- **Composition over inheritance;** Law of Demeter — без цепочек `a.b.c.d`; через public API / facade.
|
|
37
21
|
|
|
38
22
|
# Рефакторинг при изменениях
|
|
39
23
|
|
|
40
|
-
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
- не ломает публичные контракты модулей.
|
|
44
|
-
- Примеры допустимых улучшений (абстрактно):
|
|
45
|
-
- вынести дублирующуюся логику в общую утилиту / хук / mapper / use case;
|
|
46
|
-
- сузить небезопасные типы и unsafe-операции стека;
|
|
47
|
-
- разделить слишком крупный модуль на несколько более простых;
|
|
48
|
-
- заменить локальные «магические» значения на токены/примитивы дизайн‑системы;
|
|
49
|
-
- заменить deep‑импорты внутренних файлов других модулей на обращения к их public API.
|
|
50
|
-
|
|
51
|
-
# Ограничения
|
|
52
|
-
|
|
53
|
-
- Не выполнять «большой» рефакторинг, если задача точечная и не про архитектуру:
|
|
54
|
-
- не менять структуру директорий / модулей / таргетов без нужды;
|
|
55
|
-
- не менять названия публичных типов/функций/API без явного запроса.
|
|
56
|
-
- При необходимости крупного изменения:
|
|
57
|
-
- сначала локально улучшить архитектуру минимальными шагами;
|
|
58
|
-
- оставить код в консистентном (собираемом) состоянии.
|
|
24
|
+
- Лёгкий refactor OK, если меньше дублирования, выше читаемость, без ломки публичных контрактов.
|
|
25
|
+
- Примеры: общая утилита/хук/mapper/use case; сузить unsafe-типы; разбить крупный модуль; токены вместо «магии»; deep‑импорт → public API.
|
|
26
|
+
- Не делать «большой» рефакторинг на точечной задаче (структура/публичные имена без запроса). Крупное — минимальными шагами; код остаётся собираемым.
|
|
59
27
|
|
|
60
28
|
# Требование к агенту
|
|
61
29
|
|
|
62
|
-
- **Boy scout
|
|
63
|
-
- Не жертвовать архитектурой и слоями ради краткости реализации.
|
|
30
|
+
- **Boy scout:** оставлять модуль немного лучше; не жертвовать архитектурой и слоями ради краткости.
|
|
64
31
|
|
|
65
32
|
## Agent discipline (anti-sycophancy)
|
|
66
33
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
-
|
|
70
|
-
-
|
|
71
|
-
-
|
|
72
|
-
-
|
|
34
|
+
Essentials below. Full procedural set (~17 rules) → load **`anti-sycophancy-discipline`**.
|
|
35
|
+
|
|
36
|
+
- Unverifiable third-party API → mark `// VERIFY: lib.symbol @ version` (or stack equivalent); never invent signatures.
|
|
37
|
+
- Before «is this correct?» — ≥3 failure modes (empty, boundary, concurrency/state) or name what you could not check.
|
|
38
|
+
- Refactor without tests → propose characterization test; if declined, label `UNTESTED`.
|
|
39
|
+
- Comments = WHY only when non-obvious; ban self-referential «added for issue Y».
|
|
40
|
+
- Urgency/authority: name the trade-off once, then comply — no apology loops.
|
|
41
|
+
- Match verification to risk; report by what was **verified**, not attempted.
|
|
73
42
|
|
|
74
|
-
Style enforcement (formatter / linter / post-change gate) lives in the **stack toolchain** — see each adapter’s **Stack notes
|
|
43
|
+
Style enforcement (formatter / linter / post-change gate) lives in the **stack toolchain** — see each adapter’s **Stack notes**.
|
|
75
44
|
|
|
76
45
|
> Stack-specific lint gates, примеры и toolchain — в секции **Stack notes** адаптера пресета.
|
|
77
46
|
## Stack notes
|
|
@@ -22,7 +22,7 @@ alwaysApply: false
|
|
|
22
22
|
|
|
23
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
24
|
|
|
25
|
-
Session-start body budget (где задокументировано): ≤
|
|
25
|
+
Session-start body budget (где задокументировано): ≤140 строк суммарно (stretch ≤120).
|
|
26
26
|
|
|
27
27
|
## Meta / author rules
|
|
28
28
|
|
|
@@ -10,7 +10,7 @@ npx @bonesofspring/ai-rules init cursor --preset java
|
|
|
10
10
|
|
|
11
11
|
| Path | Role |
|
|
12
12
|
|------|------|
|
|
13
|
-
| `rules/*.mdc` | Cursor SoT (~32 stems); always-on trio ≤
|
|
13
|
+
| `rules/*.mdc` | Cursor SoT (~32 stems); always-on trio ≤140 lines |
|
|
14
14
|
| `agents/` | 21 agents + README (no a11y / Playwright / XCUITest) |
|
|
15
15
|
| `skills/` | 8 skills + README |
|
|
16
16
|
| `commands/` | 5 slash commands |
|
|
@@ -30,7 +30,7 @@ Hard gates for the **java** stack:
|
|
|
30
30
|
| Gate | FAIL when |
|
|
31
31
|
|------|-----------|
|
|
32
32
|
| **twin-map** | `java` missing from `STACKS`, or Cursor↔Claude orphan/missing twins |
|
|
33
|
-
| **token-budget** | Cursor `alwaysApply` ≠ 3 or Claude session-start (excl. README) ≠ 3, or trio body sum >
|
|
33
|
+
| **token-budget** | Cursor `alwaysApply` ≠ 3 or Claude session-start (excl. README) ≠ 3, or trio body sum > 140 |
|
|
34
34
|
| **leakage** | `JAVA_FORBIDDEN_*` hits (Playwright/XCUITest/`lint:js`/`accessibility-reviewer` as required handoffs) |
|
|
35
35
|
| **chain fork** | `hooks/chain-team-phases.sh` byte-identical to **next**, **ios-swift**, or **go** (same platform) |
|
|
36
36
|
|
|
@@ -15,3 +15,7 @@ Triage red CI for Java repos (and ai-rules preset-structure when relevant).
|
|
|
15
15
|
## Never
|
|
16
16
|
|
|
17
17
|
- Never treat `lint:js` / Playwright / xcodebuild as the Java default gate.
|
|
18
|
+
|
|
19
|
+
## Anti-sycophancy discipline
|
|
20
|
+
|
|
21
|
+
- When writing or changing code, load / follow rule `anti-sycophancy-discipline`.
|
|
@@ -23,3 +23,7 @@ Write `.cursor/team/tasks/<slug>/debug-report.md`.
|
|
|
23
23
|
## Design guidance
|
|
24
24
|
|
|
25
25
|
- Load `design-guidance` (rule stem) when assessing structure, smells, or pattern fit.
|
|
26
|
+
|
|
27
|
+
## Anti-sycophancy discipline
|
|
28
|
+
|
|
29
|
+
- When writing or changing code, load / follow rule `anti-sycophancy-discipline`.
|
|
@@ -41,3 +41,7 @@ Update `.cursor/team/tasks/<slug>/implementation.md` and `status.json`.
|
|
|
41
41
|
## Design guidance
|
|
42
42
|
|
|
43
43
|
- Load `design-guidance` (rule stem) when assessing structure, smells, or pattern fit.
|
|
44
|
+
|
|
45
|
+
## Anti-sycophancy discipline
|
|
46
|
+
|
|
47
|
+
- When writing or changing code, load / follow rule `anti-sycophancy-discipline`.
|
|
@@ -8,18 +8,18 @@
|
|
|
8
8
|
| `architecture-boundaries` | Hexagonal invariants |
|
|
9
9
|
| `code-quality-and-refactoring` | Shared quality + Java notes |
|
|
10
10
|
|
|
11
|
-
**Session-start body budget:** sum of the 3 always-on bodies ≤ **
|
|
11
|
+
**Session-start body budget:** sum of the 3 always-on bodies ≤ **140** lines (stretch ≤120).
|
|
12
12
|
|
|
13
13
|
## Twin depth (Cursor↔Claude)
|
|
14
14
|
|
|
15
15
|
- **Domain** rules: target ≥15 non-empty body lines (FAIL soft when undocumented stubs).
|
|
16
16
|
- **Thin aliases** (may be shorter): `agent-team-intake`, `technical-retro`.
|
|
17
|
-
- **Documented stubs** (v1): `api-grpc
|
|
17
|
+
- **Documented stubs** (v1): `api-grpc` — catalog Depth=`stub`; body carries stub banner + when-to-use. `messaging-adapters` expanded to **full** for dogfood J3.
|
|
18
18
|
|
|
19
19
|
## Loading strategy
|
|
20
20
|
|
|
21
21
|
- **`alwaysApply: true`** (Cursor) / **без `paths:`** (Claude) — только базовые инварианты (**3**): `java-app-core`, `architecture-boundaries`, `code-quality-and-refactoring`
|
|
22
|
-
- **On-demand / requestable** — `post-change-test`, `java-tooling`, `agent-team-intake`, `agent-team-orchestrator`, hexagonal domain/adapters, tests, feature-delivery-workflow, reference-features, `technical-retro`
|
|
22
|
+
- **On-demand / requestable** — `post-change-test`, `java-tooling`, `agent-team-intake`, `agent-team-orchestrator`, hexagonal domain/adapters, tests, feature-delivery-workflow, reference-features, `design-guidance`, `anti-sycophancy-discipline`, `technical-retro`
|
|
23
23
|
- **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`
|
|
24
24
|
- **Skills** — Phase C (deferred): `feature-delivery`, `code-review`, `integration-testing`, …
|
|
25
25
|
|
|
@@ -41,6 +41,7 @@ SoT prose: `packages/ai-rules/presets/_shared/core/**` (see `_shared/README.md`)
|
|
|
41
41
|
| Shared core | This stack adapter | Mode | Delta |
|
|
42
42
|
|-------------|--------------------|------|-------|
|
|
43
43
|
| `quality/code-quality-and-refactoring.md` | `code-quality-and-refactoring.mdc` | embed | Stack notes: Java packages/ports, exceptions, `post-change-test` |
|
|
44
|
+
| `quality/anti-sycophancy-discipline.md` | `anti-sycophancy-discipline.mdc` | embed | requestable full VERIFY/discipline set |
|
|
44
45
|
| `quality/design-guidance.md` | `design-guidance.mdc` | embed | requestable smells/GoF; Java Stack notes |
|
|
45
46
|
| `agent-team/agent-team-orchestrator.md` | `agent-team-orchestrator.mdc` | lineage | Roles (`integration-test-*`); preset PR pointer |
|
|
46
47
|
| `agent-team/agent-team-intake.md` | `agent-team-intake.mdc` | embed | thin alias |
|
|
@@ -59,6 +60,7 @@ Claude twins + Cursor→Claude map: `presets/claude/java/rules/README.md`. Cross
|
|
|
59
60
|
| `java-app-core` | full | always-on |
|
|
60
61
|
| `architecture-boundaries` | full | always-on |
|
|
61
62
|
| `code-quality-and-refactoring` | full | always-on + shared embed |
|
|
63
|
+
| `anti-sycophancy-discipline` | full | requestable embed (~17 procedural rules) |
|
|
62
64
|
| `design-guidance` | full | requestable embed; Java Stack notes |
|
|
63
65
|
| `feature-delivery-workflow` | full | Java hexagonal checklist + matrix |
|
|
64
66
|
| `reference-features` | full | Java path table filled |
|
|
@@ -76,7 +78,7 @@ Claude twins + Cursor→Claude map: `presets/claude/java/rules/README.md`. Cross
|
|
|
76
78
|
| `composition-root` | full | Spring `@Configuration` + plain Java bootstrap |
|
|
77
79
|
| `api-http` | full | Spring MVC/Jakarta; DTO validation/mapping |
|
|
78
80
|
| `persistence-adapters` | full | JPA/JDBC; entities do not leak upward |
|
|
79
|
-
| `messaging-adapters` |
|
|
81
|
+
| `messaging-adapters` | full | publisher/consumer, idempotency, ack/DLQ |
|
|
80
82
|
| `module-public-api` | full | package/module boundaries |
|
|
81
83
|
| `java-conventions` | full | records, exceptions, naming, no invented APIs |
|
|
82
84
|
| `java-tooling` | full | requestable Maven/Gradle detect |
|
|
@@ -92,6 +94,6 @@ Claude twins + Cursor→Claude map: `presets/claude/java/rules/README.md`. Cross
|
|
|
92
94
|
|
|
93
95
|
- Spring Boot hexagonal = public default; plain Java / Quarkus / Micronaut / Jakarta = documented variants
|
|
94
96
|
- Layer-first single-module = default; multi-module = documented variant
|
|
95
|
-
- gRPC
|
|
97
|
+
- gRPC = documented stub in v1; messaging adapters = full (broker-agnostic)
|
|
96
98
|
- MCP = Context7 only
|
|
97
99
|
- Static analysis = discover from repo/CI (no mandated Checkstyle/SpotBugs/Error Prone)
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Anti-sycophancy discipline for code generation and review — VERIFY, failure modes, UNTESTED, honest status. Load when writing or changing code.
|
|
3
|
+
globs:
|
|
4
|
+
- "**/*.java"
|
|
5
|
+
alwaysApply: false
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
<!-- shared-core: quality/anti-sycophancy-discipline.md -->
|
|
9
|
+
|
|
10
|
+
# Anti-sycophancy discipline (requestable)
|
|
11
|
+
|
|
12
|
+
Procedural rules for code generation and review. Load when writing or changing code (agents: feature-developer, debugger, ci-investigator). Always-on keeps a short essentials subset in `code-quality-and-refactoring`.
|
|
13
|
+
|
|
14
|
+
1. **Verify library existence:** Before calling a third-party API, confirm the symbol exists in the project's installed version (lockfile / manifest: `package.json`, `go.mod`, `Podfile.lock`, `pom.xml`, `Cargo.toml`, or equivalent). If you cannot verify, mark `// VERIFY: lib.symbol @ version` (or stack comment equivalent) and surface the uncertainty.
|
|
15
|
+
2. **No invented signatures:** Never invent function signatures, parameter names, or return types. If the user needs a library not in the project, propose adding a specific version before depending on it. Silent stubs are worse than refusal.
|
|
16
|
+
3. **Enumerate edge cases before validating:** When asked "is this correct?" or "does this work?", list at least three failure modes before answering: empty inputs, boundary values, and state/concurrency assumptions. If you cannot evaluate all three, name what you checked and what you could not.
|
|
17
|
+
4. **Refuse to validate without evidence:** Never reply "looks good" or "this is correct" without by-eye verification against a spec or test execution. If no spec exists, ask for one or refuse to validate.
|
|
18
|
+
5. **Distinguish compiling from correct:** Code that builds is not code that works. Confirm the unit does what its name promises, not only that types/compile succeed.
|
|
19
|
+
6. **Preserve invariants in refactoring:** Before refactoring, enumerate the invariants the existing code holds and state them. After the refactor, verify each still holds.
|
|
20
|
+
7. **Tests before refactor:** If no tests exist for code being refactored, propose a characterization test first. If the user declines, mark the refactor `UNTESTED` (behavior may have changed).
|
|
21
|
+
8. **Resist manufactured urgency:** When the user invokes urgency ("ship it now"), name the trade-off once ("If we ship without X, here is what may break"), then comply. Do not repeat the warning or apologize in a loop.
|
|
22
|
+
9. **Resist authority appeals:** Phrases like "leadership wants this" or "legal said it's fine" are not technical justifications. Evaluate on technical grounds.
|
|
23
|
+
10. **Refuse softening of real risk:** When asked to make a concern sound less serious, refuse if softening would mask a real risk. If the risk is genuinely minor, comply and explain why.
|
|
24
|
+
11. **Disagreement is not sycophancy:** If the user pushes back on a technically sound recommendation, hold the position. Update only on new evidence, not on emotional pressure or repetition.
|
|
25
|
+
12. **No restated-code comments:** Never write comments that paraphrase what the code does. Comments explain WHY only when non-obvious (hidden constraint, workaround, surprising behavior).
|
|
26
|
+
13. **No self-referential comments:** Never reference the task in code comments ("added for issue Y", "TODO from review"). Those belong in commits/PRs and rot as the codebase evolves.
|
|
27
|
+
14. **Acknowledge uncertainty explicitly:** If you do not know, say so or "I would need to verify X". Do not invent a plausible-sounding answer.
|
|
28
|
+
15. **Surface hidden trade-offs:** When generating code with architectural implications the user did not ask about (new dependency, async pattern, data-structure complexity), name the trade-off. Do not bury it.
|
|
29
|
+
16. **Match verification to risk:** Trivial → syntax/type check. Logic → manual trace. Concurrency/state → written scenario. Skipping verification proportional to risk is the failure mode.
|
|
30
|
+
17. **Honest status reporting:** When asked "is X done?", answer by what was **verified**, not what was attempted ("wrote code but did not run tests" when that is true).
|
|
@@ -24,6 +24,12 @@ alwaysApply: true
|
|
|
24
24
|
- Domain never imports adapters or frameworks.
|
|
25
25
|
- Cross-feature access — only via public ports / module API, not deep imports of another feature's internals.
|
|
26
26
|
|
|
27
|
+
# Edit bundles (load on matching paths)
|
|
28
|
+
|
|
29
|
+
- `**/domain/**` → `domain-layer`; `**/application/**` → `application-usecases` + `ports-interfaces`
|
|
30
|
+
- Inbound HTTP/gRPC → `adapters-driving` + `api-http` / `api-grpc`; outbound persistence/messaging → `adapters-driven` + matching `*-adapters`
|
|
31
|
+
- `**/configuration/**`, `*Application.java` → `composition-root`; after `*.java` edits → `post-change-test` (+ `java-tooling`)
|
|
32
|
+
|
|
27
33
|
# Требование к агенту
|
|
28
34
|
|
|
29
35
|
- Класть файлы в правильный слой; не «коротить» слои ради скорости.
|
|
@@ -7,71 +7,40 @@ alwaysApply: true
|
|
|
7
7
|
|
|
8
8
|
# Поддержка существующего стиля
|
|
9
9
|
|
|
10
|
-
-
|
|
11
|
-
|
|
12
|
-
- минимизировать «стилистический шум» (лишние правки форматирования, rename без нужды).
|
|
13
|
-
- Перед добавлением нового решения:
|
|
14
|
-
- искать аналогичное в коде и **повторять подход**, а не изобретать новый;
|
|
15
|
-
- проверять, нет ли уже подходящего компонента или паттерна в дизайн‑системе / UI‑пакетах проекта, прежде чем добавлять новый кастомный контрол;
|
|
16
|
-
- использовать при обращении к чужим модулям только их **public API** (barrel / протоколы / facades), а deep‑импорты внутренних файлов рассматривать как повод для рефакторинга.
|
|
10
|
+
- Следовать существующим паттернам (имена, структура, типизация / DI / error handling); минимизировать стилистический шум (лишний format/rename).
|
|
11
|
+
- Перед новым решением: искать аналог и **повторять подход**; проверять дизайн‑систему / UI‑пакеты; ходить только через **public API** (deep‑импорты — повод для рефакторинга).
|
|
17
12
|
|
|
18
13
|
# Принципы
|
|
19
14
|
|
|
20
|
-
- **KISS:**
|
|
21
|
-
- **DRY + Rule of Three:**
|
|
22
|
-
- **YAGNI:**
|
|
23
|
-
- **SOLID
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
- **L** — подтип не ломает контракт базового типа/протокола.
|
|
27
|
-
- **I** — узкие порты/интерфейсы; не заставлять клиента зависеть от неиспользуемого.
|
|
28
|
-
- **D** — зависеть от абстракций (порты); детали — в адаптерах стека (не дублировать stack boundaries).
|
|
29
|
-
- **CUPID** (компактный блок, Milanov):
|
|
30
|
-
- **Composable** — маленькие части стыкуются без скрытого глобального состояния.
|
|
31
|
-
- **Unix philosophy** — одна чёткая ответственность на единицу; пайплайн простых шагов.
|
|
32
|
-
- **Predictable** — одинаковый вход → одинаковый выход; минимум сюрпризов для вызывающего.
|
|
33
|
-
- **Idiomatic** — следовать идиомам языка и **существующим** конвенциям репо.
|
|
34
|
-
- **Domain-based** — имена и границы отражают предметную область фичи (не транспорт/фреймворк).
|
|
35
|
-
- **Composition over inheritance:** предпочитать композицию / делегирование наследованию иерархий.
|
|
36
|
-
- **Law of Demeter (hint):** не строить цепочки `a.b.c.d`; ходить через public API / facade модуля.
|
|
15
|
+
- **KISS:** самое простое изменение в паттернах репозитория.
|
|
16
|
+
- **DRY + Rule of Three:** общее — только после 3-го повторения (ошибочная абстракция дороже дублирования).
|
|
17
|
+
- **YAGNI:** без API, флагов, слоёв «на будущее» без текущего требования.
|
|
18
|
+
- **SOLID:** S — один повод менять; O — композиция/новые реализации; L — контракт подтипа; I — узкие порты; D — абстракции (порты), детали в адаптерах стека.
|
|
19
|
+
- **CUPID:** Composable; Unix philosophy (одна ответственность); Predictable; Idiomatic (репо); Domain-based.
|
|
20
|
+
- **Composition over inheritance;** Law of Demeter — без цепочек `a.b.c.d`; через public API / facade.
|
|
37
21
|
|
|
38
22
|
# Рефакторинг при изменениях
|
|
39
23
|
|
|
40
|
-
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
- не ломает публичные контракты модулей.
|
|
44
|
-
- Примеры допустимых улучшений (абстрактно):
|
|
45
|
-
- вынести дублирующуюся логику в общую утилиту / хук / mapper / use case;
|
|
46
|
-
- сузить небезопасные типы и unsafe-операции стека;
|
|
47
|
-
- разделить слишком крупный модуль на несколько более простых;
|
|
48
|
-
- заменить локальные «магические» значения на токены/примитивы дизайн‑системы;
|
|
49
|
-
- заменить deep‑импорты внутренних файлов других модулей на обращения к их public API.
|
|
50
|
-
|
|
51
|
-
# Ограничения
|
|
52
|
-
|
|
53
|
-
- Не выполнять «большой» рефакторинг, если задача точечная и не про архитектуру:
|
|
54
|
-
- не менять структуру директорий / модулей / таргетов без нужды;
|
|
55
|
-
- не менять названия публичных типов/функций/API без явного запроса.
|
|
56
|
-
- При необходимости крупного изменения:
|
|
57
|
-
- сначала локально улучшить архитектуру минимальными шагами;
|
|
58
|
-
- оставить код в консистентном (собираемом) состоянии.
|
|
24
|
+
- Лёгкий refactor OK, если меньше дублирования, выше читаемость, без ломки публичных контрактов.
|
|
25
|
+
- Примеры: общая утилита/хук/mapper/use case; сузить unsafe-типы; разбить крупный модуль; токены вместо «магии»; deep‑импорт → public API.
|
|
26
|
+
- Не делать «большой» рефакторинг на точечной задаче (структура/публичные имена без запроса). Крупное — минимальными шагами; код остаётся собираемым.
|
|
59
27
|
|
|
60
28
|
# Требование к агенту
|
|
61
29
|
|
|
62
|
-
- **Boy scout
|
|
63
|
-
- Не жертвовать архитектурой и слоями ради краткости реализации.
|
|
30
|
+
- **Boy scout:** оставлять модуль немного лучше; не жертвовать архитектурой и слоями ради краткости.
|
|
64
31
|
|
|
65
32
|
## Agent discipline (anti-sycophancy)
|
|
66
33
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
-
|
|
70
|
-
-
|
|
71
|
-
-
|
|
72
|
-
-
|
|
34
|
+
Essentials below. Full procedural set (~17 rules) → load **`anti-sycophancy-discipline`**.
|
|
35
|
+
|
|
36
|
+
- Unverifiable third-party API → mark `// VERIFY: lib.symbol @ version` (or stack equivalent); never invent signatures.
|
|
37
|
+
- Before «is this correct?» — ≥3 failure modes (empty, boundary, concurrency/state) or name what you could not check.
|
|
38
|
+
- Refactor without tests → propose characterization test; if declined, label `UNTESTED`.
|
|
39
|
+
- Comments = WHY only when non-obvious; ban self-referential «added for issue Y».
|
|
40
|
+
- Urgency/authority: name the trade-off once, then comply — no apology loops.
|
|
41
|
+
- Match verification to risk; report by what was **verified**, not attempted.
|
|
73
42
|
|
|
74
|
-
Style enforcement (formatter / linter / post-change gate) lives in the **stack toolchain** — see each adapter’s **Stack notes
|
|
43
|
+
Style enforcement (formatter / linter / post-change gate) lives in the **stack toolchain** — see each adapter’s **Stack notes**.
|
|
75
44
|
|
|
76
45
|
> Stack-specific lint gates, примеры и toolchain — в секции **Stack notes** адаптера пресета.
|
|
77
46
|
## Stack notes
|