@bonesofspring/ai-rules 0.2.7 → 0.2.9
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 +31 -1
- package/README.md +4 -2
- package/bin/cli.js +2 -0
- package/package.json +1 -1
- package/presets/_shared/README.md +2 -2
- package/presets/_shared/core/meta/preset-layering.md +1 -1
- package/presets/_shared/core/meta/preset-no-cross-stack-leakage.md +6 -4
- package/presets/_shared/core/meta/preset-pr-checklist.md +1 -1
- package/presets/_shared/core/meta/preset-twin-sync.md +2 -0
- 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/build-verifier.md +5 -5
- 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/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-layering.md +1 -1
- package/presets/claude/go/rules/tooling-and-review/preset-no-cross-stack-leakage.md +6 -8
- package/presets/claude/go/rules/tooling-and-review/preset-pr-checklist.md +1 -1
- package/presets/claude/go/rules/tooling-and-review/preset-twin-sync.md +2 -0
- package/presets/claude/go/team/fixtures/feature-full.json +5 -23
- package/presets/claude/ios-swift/agents/build-verifier.md +6 -7
- 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 +2 -0
- package/presets/claude/ios-swift/rules/stack/ios-app-core.md +5 -28
- 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-layering.md +1 -1
- package/presets/claude/ios-swift/rules/tooling-and-review/preset-no-cross-stack-leakage.md +6 -4
- package/presets/claude/ios-swift/rules/tooling-and-review/preset-pr-checklist.md +1 -1
- package/presets/claude/ios-swift/rules/tooling-and-review/preset-twin-sync.md +2 -0
- package/presets/claude/java/CLAUDE.md +29 -0
- package/presets/claude/java/MCP.md +13 -0
- package/presets/claude/java/README.md +26 -0
- package/presets/claude/java/REPO_AGENTS.md +45 -0
- package/presets/claude/java/agents/README.md +32 -0
- package/presets/claude/java/agents/api-contract-reviewer.md +23 -0
- package/presets/claude/java/agents/build-verifier.md +45 -0
- package/presets/claude/java/agents/ci-investigator.md +21 -0
- package/presets/claude/java/agents/code-reviewer.md +40 -0
- package/presets/claude/java/agents/codebase-analyzer.md +28 -0
- package/presets/claude/java/agents/debugger.md +29 -0
- package/presets/claude/java/agents/feature-developer.md +47 -0
- package/presets/claude/java/agents/integration-test-generator.md +22 -0
- package/presets/claude/java/agents/integration-test-healer.md +22 -0
- package/presets/claude/java/agents/integration-test-planner.md +22 -0
- package/presets/claude/java/agents/migration-specialist.md +31 -0
- package/presets/claude/java/agents/performance-auditor.md +22 -0
- package/presets/claude/java/agents/qa-tester.md +24 -0
- package/presets/claude/java/agents/security-reviewer.md +20 -0
- package/presets/claude/java/agents/solution-architect.md +28 -0
- package/presets/claude/java/agents/task-analyst.md +25 -0
- package/presets/claude/java/agents/task-router.md +69 -0
- package/presets/claude/java/agents/tech-writer.md +15 -0
- package/presets/claude/java/agents/unit-test-generator.md +21 -0
- package/presets/claude/java/agents/unit-test-healer.md +13 -0
- package/presets/claude/java/agents/unit-test-planner.md +26 -0
- package/presets/claude/java/commands/README.md +13 -0
- package/presets/claude/java/commands/feature-continue.md +51 -0
- package/presets/claude/java/commands/feature-start.md +30 -0
- package/presets/claude/java/commands/task-continue.md +49 -0
- package/presets/claude/java/commands/task.md +49 -0
- package/presets/claude/java/commands/technical-retro.md +58 -0
- package/presets/claude/java/hooks/README.md +16 -0
- package/presets/claude/java/hooks/chain-team-phases.sh +381 -0
- package/presets/claude/java/hooks/examples/README.md +18 -0
- package/presets/claude/java/hooks/examples/format-edited.example.sh +11 -0
- package/presets/claude/java/hooks/examples/secret-guard.example.sh +10 -0
- package/presets/claude/java/hooks/examples/test-on-save.example.sh +18 -0
- package/presets/claude/java/hooks/guard-shell-command.sh +80 -0
- package/presets/claude/java/mcp.json +11 -0
- package/presets/claude/java/rules/README.md +61 -0
- package/presets/claude/java/rules/api-and-data/README.md +14 -0
- package/presets/claude/java/rules/api-and-data/adapters-driven.md +38 -0
- package/presets/claude/java/rules/api-and-data/adapters-driving.md +38 -0
- package/presets/claude/java/rules/api-and-data/api-grpc.md +29 -0
- package/presets/claude/java/rules/api-and-data/api-http.md +36 -0
- package/presets/claude/java/rules/api-and-data/messaging-adapters.md +24 -0
- package/presets/claude/java/rules/api-and-data/persistence-adapters.md +33 -0
- package/presets/claude/java/rules/architecture/README.md +16 -0
- package/presets/claude/java/rules/architecture/application-usecases.md +32 -0
- package/presets/claude/java/rules/architecture/boundaries.md +29 -0
- package/presets/claude/java/rules/architecture/composition-root.md +31 -0
- package/presets/claude/java/rules/architecture/domain-layer.md +38 -0
- package/presets/claude/java/rules/architecture/feature-delivery.md +52 -0
- package/presets/claude/java/rules/architecture/module-public-api.md +31 -0
- package/presets/claude/java/rules/architecture/ports-interfaces.md +34 -0
- package/presets/claude/java/rules/architecture/reference-features.md +34 -0
- package/presets/claude/java/rules/stack/README.md +10 -0
- package/presets/claude/java/rules/stack/java-app-core.md +32 -0
- package/presets/claude/java/rules/stack/java-conventions.md +52 -0
- package/presets/claude/java/rules/testing/README.md +11 -0
- package/presets/claude/java/rules/testing/e2e.md +22 -0
- package/presets/claude/java/rules/testing/integration.md +27 -0
- package/presets/claude/java/rules/testing/unit.md +33 -0
- package/presets/claude/java/rules/tooling-and-review/README.md +21 -0
- package/presets/claude/java/rules/tooling-and-review/agent-team-intake.md +26 -0
- package/presets/claude/java/rules/tooling-and-review/agent-team-orchestrator.md +179 -0
- 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 +52 -0
- package/presets/claude/java/rules/tooling-and-review/code-review.md +59 -0
- package/presets/claude/java/rules/tooling-and-review/design-guidance.md +110 -0
- package/presets/claude/java/rules/tooling-and-review/java-tooling.md +36 -0
- package/presets/claude/java/rules/tooling-and-review/post-change-test.md +32 -0
- package/presets/claude/java/rules/tooling-and-review/preset-layering.md +36 -0
- package/presets/claude/java/rules/tooling-and-review/preset-no-cross-stack-leakage.md +56 -0
- package/presets/claude/java/rules/tooling-and-review/preset-pr-checklist.md +39 -0
- package/presets/claude/java/rules/tooling-and-review/preset-token-budget.md +41 -0
- package/presets/claude/java/rules/tooling-and-review/preset-twin-sync.md +44 -0
- package/presets/claude/java/rules/tooling-and-review/security-java.md +29 -0
- package/presets/claude/java/rules/tooling-and-review/technical-retro.md +20 -0
- package/presets/claude/java/rules/ui-and-accessibility/README.md +5 -0
- package/presets/claude/java/skills/README.md +5 -0
- package/presets/claude/java/skills/ci-investigation/SKILL.md +11 -0
- package/presets/claude/java/skills/code-review/SKILL.md +25 -0
- package/presets/claude/java/skills/debug-investigation/SKILL.md +15 -0
- package/presets/claude/java/skills/feature-delivery/SKILL.md +30 -0
- package/presets/claude/java/skills/integration-testing/SKILL.md +15 -0
- package/presets/claude/java/skills/technical-retro/SKILL.md +54 -0
- package/presets/claude/java/skills/unit-testing/SKILL.md +14 -0
- package/presets/claude/java/skills/write-adr/SKILL.md +41 -0
- package/presets/claude/java/team/README.md +27 -0
- package/presets/claude/java/team/conventions.md +21 -0
- package/presets/claude/java/team/fixtures/bugfix-standard.json +37 -0
- package/presets/claude/java/team/fixtures/feature-full.json +25 -0
- package/presets/claude/java/team/fixtures/feature-light.json +17 -0
- package/presets/claude/next/agents/build-verifier.md +4 -4
- 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-layering.md +1 -1
- package/presets/claude/next/rules/tooling-and-review/preset-no-cross-stack-leakage.md +6 -4
- package/presets/claude/next/rules/tooling-and-review/preset-pr-checklist.md +1 -1
- package/presets/claude/next/rules/tooling-and-review/preset-twin-sync.md +2 -0
- package/presets/claude/next/skills/feature-delivery/SKILL.md +4 -0
- package/presets/cursor/go/agents/build-verifier.md +5 -5
- 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 +3 -1
- package/presets/cursor/go/rules/anti-sycophancy-discipline.mdc +30 -0
- package/presets/cursor/go/rules/code-quality-and-refactoring.mdc +21 -52
- package/presets/cursor/go/rules/preset-layering.mdc +1 -1
- package/presets/cursor/go/rules/preset-no-cross-stack-leakage.mdc +6 -8
- package/presets/cursor/go/rules/preset-pr-checklist.mdc +1 -1
- package/presets/cursor/go/rules/preset-twin-sync.mdc +2 -0
- package/presets/cursor/go/team/fixtures/feature-full.json +5 -23
- package/presets/cursor/ios-swift/agents/build-verifier.md +6 -7
- 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 +3 -1
- 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/ios-app-core.mdc +5 -28
- package/presets/cursor/ios-swift/rules/preset-layering.mdc +1 -1
- package/presets/cursor/ios-swift/rules/preset-no-cross-stack-leakage.mdc +6 -4
- package/presets/cursor/ios-swift/rules/preset-pr-checklist.mdc +1 -1
- package/presets/cursor/ios-swift/rules/preset-twin-sync.mdc +2 -0
- package/presets/cursor/java/AGENTS.md +37 -0
- package/presets/cursor/java/BUGBOT.md +11 -0
- package/presets/cursor/java/MCP.md +15 -0
- package/presets/cursor/java/README.md +26 -0
- package/presets/cursor/java/REPO_AGENTS.md +45 -0
- package/presets/cursor/java/agents/README.md +36 -0
- package/presets/cursor/java/agents/api-contract-reviewer.md +23 -0
- package/presets/cursor/java/agents/build-verifier.md +45 -0
- package/presets/cursor/java/agents/ci-investigator.md +21 -0
- package/presets/cursor/java/agents/code-reviewer.md +40 -0
- package/presets/cursor/java/agents/codebase-analyzer.md +28 -0
- package/presets/cursor/java/agents/debugger.md +29 -0
- package/presets/cursor/java/agents/feature-developer.md +47 -0
- package/presets/cursor/java/agents/integration-test-generator.md +22 -0
- package/presets/cursor/java/agents/integration-test-healer.md +22 -0
- package/presets/cursor/java/agents/integration-test-planner.md +22 -0
- package/presets/cursor/java/agents/migration-specialist.md +31 -0
- package/presets/cursor/java/agents/performance-auditor.md +22 -0
- package/presets/cursor/java/agents/qa-tester.md +24 -0
- package/presets/cursor/java/agents/security-reviewer.md +20 -0
- package/presets/cursor/java/agents/solution-architect.md +28 -0
- package/presets/cursor/java/agents/task-analyst.md +25 -0
- package/presets/cursor/java/agents/task-router.md +69 -0
- package/presets/cursor/java/agents/tech-writer.md +15 -0
- package/presets/cursor/java/agents/unit-test-generator.md +21 -0
- package/presets/cursor/java/agents/unit-test-healer.md +13 -0
- package/presets/cursor/java/agents/unit-test-planner.md +26 -0
- package/presets/cursor/java/commands/README.md +54 -0
- package/presets/cursor/java/commands/feature-continue.md +19 -0
- package/presets/cursor/java/commands/feature-start.md +33 -0
- package/presets/cursor/java/commands/task-continue.md +49 -0
- package/presets/cursor/java/commands/task.md +49 -0
- package/presets/cursor/java/commands/technical-retro.md +81 -0
- package/presets/cursor/java/hooks/README.md +12 -0
- package/presets/cursor/java/hooks/chain-team-phases.sh +381 -0
- package/presets/cursor/java/hooks/examples/README.md +18 -0
- package/presets/cursor/java/hooks/examples/format-edited.example.sh +11 -0
- package/presets/cursor/java/hooks/examples/secret-guard.example.sh +10 -0
- package/presets/cursor/java/hooks/examples/test-on-save.example.sh +18 -0
- package/presets/cursor/java/hooks/guard-shell-command.sh +80 -0
- package/presets/cursor/java/hooks.json +17 -0
- package/presets/cursor/java/mcp.json +11 -0
- package/presets/cursor/java/rules/README.md +99 -0
- package/presets/cursor/java/rules/adapters-driven.mdc +40 -0
- package/presets/cursor/java/rules/adapters-driving.mdc +40 -0
- package/presets/cursor/java/rules/agent-team-intake.mdc +20 -0
- package/presets/cursor/java/rules/agent-team-orchestrator.mdc +173 -0
- package/presets/cursor/java/rules/anti-sycophancy-discipline.mdc +30 -0
- package/presets/cursor/java/rules/api-grpc.mdc +31 -0
- package/presets/cursor/java/rules/api-http.mdc +38 -0
- package/presets/cursor/java/rules/application-usecases.mdc +34 -0
- package/presets/cursor/java/rules/architecture-boundaries.mdc +30 -0
- package/presets/cursor/java/rules/code-quality-and-refactoring.mdc +53 -0
- package/presets/cursor/java/rules/code-review-mr.mdc +54 -0
- package/presets/cursor/java/rules/composition-root.mdc +33 -0
- package/presets/cursor/java/rules/design-guidance.mdc +112 -0
- package/presets/cursor/java/rules/domain-layer.mdc +40 -0
- package/presets/cursor/java/rules/feature-delivery-workflow.mdc +47 -0
- package/presets/cursor/java/rules/java-app-core.mdc +33 -0
- package/presets/cursor/java/rules/java-conventions.mdc +54 -0
- package/presets/cursor/java/rules/java-tooling.mdc +34 -0
- package/presets/cursor/java/rules/messaging-adapters.mdc +26 -0
- package/presets/cursor/java/rules/module-public-api.mdc +33 -0
- package/presets/cursor/java/rules/persistence-adapters.mdc +35 -0
- package/presets/cursor/java/rules/ports-interfaces.mdc +36 -0
- package/presets/cursor/java/rules/post-change-test.mdc +30 -0
- package/presets/cursor/java/rules/preset-layering.mdc +36 -0
- package/presets/cursor/java/rules/preset-no-cross-stack-leakage.mdc +56 -0
- package/presets/cursor/java/rules/preset-pr-checklist.mdc +39 -0
- package/presets/cursor/java/rules/preset-token-budget.mdc +41 -0
- package/presets/cursor/java/rules/preset-twin-sync.mdc +44 -0
- package/presets/cursor/java/rules/reference-features.mdc +36 -0
- package/presets/cursor/java/rules/security-java.mdc +31 -0
- package/presets/cursor/java/rules/technical-retro.mdc +14 -0
- package/presets/cursor/java/rules/tests-e2e.mdc +24 -0
- package/presets/cursor/java/rules/tests-integration.mdc +29 -0
- package/presets/cursor/java/rules/tests-unit.mdc +35 -0
- package/presets/cursor/java/skills/README.md +5 -0
- package/presets/cursor/java/skills/ci-investigation/SKILL.md +11 -0
- package/presets/cursor/java/skills/code-review/SKILL.md +25 -0
- package/presets/cursor/java/skills/debug-investigation/SKILL.md +15 -0
- package/presets/cursor/java/skills/feature-delivery/SKILL.md +30 -0
- package/presets/cursor/java/skills/integration-testing/SKILL.md +15 -0
- package/presets/cursor/java/skills/technical-retro/SKILL.md +54 -0
- package/presets/cursor/java/skills/unit-testing/SKILL.md +14 -0
- package/presets/cursor/java/skills/write-adr/SKILL.md +41 -0
- package/presets/cursor/java/team/README.md +31 -0
- package/presets/cursor/java/team/conventions.md +21 -0
- package/presets/cursor/java/team/fixtures/bugfix-standard.json +37 -0
- package/presets/cursor/java/team/fixtures/feature-full.json +25 -0
- package/presets/cursor/java/team/fixtures/feature-light.json +17 -0
- package/presets/cursor/next/agents/build-verifier.md +4 -4
- 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-layering.mdc +1 -1
- package/presets/cursor/next/rules/preset-no-cross-stack-leakage.mdc +6 -4
- package/presets/cursor/next/rules/preset-pr-checklist.mdc +1 -1
- package/presets/cursor/next/rules/preset-twin-sync.mdc +2 -0
- package/presets/cursor/next/rules/react-next-anti-hallucination.mdc +66 -0
- package/presets/cursor/next/skills/feature-delivery/SKILL.md +4 -0
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
## Loading strategy
|
|
20
20
|
|
|
21
21
|
- **`alwaysApply: true`** (Cursor) / **без `paths:`** (Claude) — только базовые инварианты (**3**): `go-app-core`, `architecture-boundaries`, `code-quality-and-refactoring`
|
|
22
|
-
- **On-demand / requestable** — `post-change-test`, `go-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`, `go-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** — длинные процедуры (`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: Go errors/`%w`, ports, `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 |
|
|
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/go/rules/README.md`. Cross-s
|
|
|
59
60
|
| `go-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 |
|
|
63
65
|
| `feature-delivery-workflow` | full | lineage |
|
|
64
66
|
| `reference-features` | full | lineage |
|
|
@@ -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
|
+
- "**/*.go"
|
|
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
|
|
@@ -24,7 +24,7 @@ alwaysApply: false
|
|
|
24
24
|
## Куда класть новое правило
|
|
25
25
|
|
|
26
26
|
1. Общие принципы для всех стеков → **core** + адаптеры с `<!-- shared-core: … -->`.
|
|
27
|
-
2. Только один из installable стеков (`next` / `ios-swift` / `go`) → **stack-specific** (не в `_shared`).
|
|
27
|
+
2. Только один из installable стеков (`next` / `ios-swift` / `go` / `java`) → **stack-specific** (не в `_shared`).
|
|
28
28
|
3. Только Cursor или только Claude packaging → platform artifact / frontmatter, не дублировать семантику.
|
|
29
29
|
|
|
30
30
|
## SoT
|
|
@@ -17,7 +17,7 @@ alwaysApply: false
|
|
|
17
17
|
|
|
18
18
|
- `next` must not require iOS-only agents/tooling (`xcuitest-*`, `xcodebuild` as required handoff, Keychain-only rules).
|
|
19
19
|
- `ios-swift` must not ship Playwright handoffs or Next lint recipes as required commands.
|
|
20
|
-
- `go` must not ship Playwright, XCUITest, Next lint recipes, or `xcodebuild`/`SwiftLint` as required handoffs.
|
|
20
|
+
- `go` / `java` must not ship Playwright, XCUITest, Next lint recipes, or `xcodebuild`/`SwiftLint` as required handoffs.
|
|
21
21
|
- Shared core must not embed stack paths (`app/src/**`, `Features/**`, `playwright`, `xcodebuild`).
|
|
22
22
|
|
|
23
23
|
## Forbidden in ios-swift hooks/agents (FAIL)
|
|
@@ -35,14 +35,16 @@ Required instead: `xcuitest-test-*` stems; build-verifier mentions `xcodebuild`
|
|
|
35
35
|
- `xcuitest-test-` as handoff stems
|
|
36
36
|
- Requiring `xcodebuild` / SwiftLint as the default post-change gate for Next app work
|
|
37
37
|
|
|
38
|
-
## Forbidden in go hooks/agents (FAIL)
|
|
38
|
+
## Forbidden in go / java hooks/agents (FAIL)
|
|
39
|
+
|
|
40
|
+
Shared backend-stack bans (both `go` and `java`):
|
|
39
41
|
|
|
40
42
|
- `playwright-test-`, `playwright-e2e`, `user-playwright`, `app/__tests__/e2e`
|
|
41
43
|
- Positive yarn recipes `lint:js` / `lint:css`
|
|
42
44
|
- `xcuitest-test-`, `xcodebuild`, `SwiftLint` as required handoffs
|
|
43
45
|
- Agent file `accessibility-reviewer` (no UI surface)
|
|
44
46
|
|
|
45
|
-
Required instead: `integration-test-*`; build-verifier / `post-change-test`
|
|
47
|
+
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`).
|
|
46
48
|
|
|
47
49
|
## Soft / document
|
|
48
50
|
|
|
@@ -51,8 +53,4 @@ Required instead: `integration-test-*`; build-verifier / `post-change-test` / `g
|
|
|
51
53
|
|
|
52
54
|
## Chain fork
|
|
53
55
|
|
|
54
|
-
`hooks/chain-team-phases.sh` must differ **byte-wise** pairwise among `next`, `ios-swift`, and `
|
|
55
|
-
|
|
56
|
-
## Stack notes
|
|
57
|
-
|
|
58
|
-
Forbidden positive handoffs on this stack are listed in core § go. Prefer `integration-test-*` and `post-change-test`.
|
|
56
|
+
`hooks/chain-team-phases.sh` must differ **byte-wise** pairwise among `next`, `ios-swift`, `go`, and `java` (per platform).
|
|
@@ -17,7 +17,7 @@ alwaysApply: false
|
|
|
17
17
|
|
|
18
18
|
- [ ] **SoT:** правки в `packages/…` (не только root `.cursor/`)
|
|
19
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, and
|
|
20
|
+
- [ ] **Twin:** Cursor change → Claude twin **same PR** (**FAIL** if missing on next, ios-swift, go, and java — см. `preset-twin-sync`)
|
|
21
21
|
- [ ] **Mapping:** `claude/<stack>/rules/README.md` mapping table актуален
|
|
22
22
|
- [ ] **Token budget:** alwaysApply / session-start ≤ 3; meta rules not always-on
|
|
23
23
|
- [ ] **Leakage:** нет чужих stack agent stems / handoff strings (`preset-no-cross-stack-leakage`)
|
|
@@ -20,6 +20,7 @@ Cursor `.mdc` — **SoT per stack**. Claude topic `.md` — derived twin.
|
|
|
20
20
|
| `next` | `presets/cursor/next/rules/*.mdc` | `presets/claude/next/rules/<topic>/` | **Required** in `claude/next/rules/README.md` |
|
|
21
21
|
| `ios-swift` | `presets/cursor/ios-swift/rules/*.mdc` | `presets/claude/ios-swift/rules/<topic>/` | Keep in `claude/ios-swift/rules/README.md` |
|
|
22
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` |
|
|
23
24
|
|
|
24
25
|
## Same-PR checklist
|
|
25
26
|
|
|
@@ -38,5 +39,6 @@ Cursor `.mdc` — **SoT per stack**. Claude topic `.md` — derived twin.
|
|
|
38
39
|
- **next:** missing Claude twin for a changed Cursor rule → **FAIL** (mapping table required).
|
|
39
40
|
- **ios-swift:** missing Claude twin for a changed Cursor rule → **FAIL**.
|
|
40
41
|
- **go:** missing Claude twin for a changed Cursor rule → **FAIL** (same as next / ios-swift; mapping table required).
|
|
42
|
+
- **java:** missing Claude twin for a changed Cursor rule → **FAIL** (same as next / ios-swift / go; mapping table required).
|
|
41
43
|
|
|
42
44
|
Dogfood: sync packages → root `.cursor/` after Cursor SoT changes (not the reverse). Use `packages/ai-rules/scripts/sync-dogfood-cursor.sh`.
|
|
@@ -10,34 +10,16 @@
|
|
|
10
10
|
{ "agent": "build-verifier", "label": "go test / go vet / golangci-lint", "model": "cheap" },
|
|
11
11
|
{ "agent": "security-reviewer", "label": "Security review", "model": "strong" },
|
|
12
12
|
{ "agent": "code-reviewer", "label": "Code review", "model": "cheap" },
|
|
13
|
-
{ "agent": "qa-tester", "label": "Integration tests", "scope": "e2e-only" }
|
|
13
|
+
{ "agent": "qa-tester", "label": "Integration tests", "scope": "e2e-only" },
|
|
14
|
+
{ "agent": "integration-test-planner", "label": "Plan integration coverage" },
|
|
15
|
+
{ "agent": "integration-test-generator", "label": "Generate integration tests" }
|
|
14
16
|
],
|
|
15
17
|
"humanGates": ["after:task-analyst"],
|
|
16
18
|
"autoChain": true,
|
|
17
19
|
"skipped": [
|
|
18
20
|
{
|
|
19
|
-
"agent": "
|
|
20
|
-
"reason": "Go backend
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
"agent": "playwright-test-generator",
|
|
24
|
-
"reason": "Go backend uses integration-test-*"
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
"agent": "playwright-test-healer",
|
|
28
|
-
"reason": "Go backend uses integration-test-*"
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
"agent": "xcuitest-test-planner",
|
|
32
|
-
"reason": "Go backend uses integration-test-* — not XCUITest"
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
"agent": "xcuitest-test-generator",
|
|
36
|
-
"reason": "Go backend uses integration-test-*"
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
"agent": "xcuitest-test-healer",
|
|
40
|
-
"reason": "Go backend uses integration-test-*"
|
|
21
|
+
"agent": "accessibility-reviewer",
|
|
22
|
+
"reason": "Go backend has no UI surface"
|
|
41
23
|
}
|
|
42
24
|
]
|
|
43
25
|
}
|
|
@@ -35,11 +35,11 @@ When validating **ios-swift preset** changes (or `scope: preset-structure-valida
|
|
|
35
35
|
3. **Forbidden handoff strings** in ios-swift `chain-team-phases.sh` (Cursor + Claude): `playwright-test-`, `playwright-agents`, `playwright-e2e`, `user-playwright`, `app/__tests__/e2e`, and positive yarn lint recipes (`lint:js` / `lint:css` as commands to run — negation prose alone is not enough; prefer zero occurrences). See `preset-no-cross-stack-leakage.mdc`.
|
|
36
36
|
4. **Required handoff stems:** `AGENT_HANDOFF` must include `xcuitest-test-planner` (or generator/healer) and `build-verifier` text must mention `xcodebuild` or `post-change-build` / `xcode-tooling`.
|
|
37
37
|
5. **Roster:** 21 agent stems; no `playwright-test-*` files under ios-swift `agents/`.
|
|
38
|
-
6. **Twin presence (hard):** Cursor rule change → Claude twin present **same PR** — **FAIL** if missing (next, ios-swift, and
|
|
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
41
|
9. **Session-start body budget:** sum of the **3** intended always-on / session-start rule bodies ≤ **120** lines (stretch ≤100); do **not** include `**/README.md` — record in report.
|
|
42
|
-
10. **Embed drift (
|
|
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
|
|
|
45
45
|
### Soft rules (do not FAIL alone)
|
|
@@ -47,11 +47,10 @@ When validating **ios-swift preset** changes (or `scope: preset-structure-valida
|
|
|
47
47
|
- **Thin aliases:** `agent-team-intake`, `technical-retro` may be <15 body lines. Enforce ≥15 on **domain** rules (navigation, persistence, security, modules, networking, UI).
|
|
48
48
|
- Embed vs lineage modes: `docs/PRESET-CONTRIBUTION.md`, `_shared/README.md`.
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
12. **Rule eval (WARN):** `scripts/check-rule-eval.mjs` / `yarn check:rule-eval` should exist for maintainers; smoke optional. Hard fail only when the opt-in eval job runs — not part of default `check:preset-structure`.
|
|
50
|
+
12. **Root AGENTS template:** each installable preset (`cursor|claude` × `next|ios-swift|go|java`) must ship `REPO_AGENTS.md` when validating preset packaging → **FAIL** if missing.
|
|
51
|
+
13. **Hooks cookbook:** default `hooks.json` must **not** reference `hooks/examples/` → **FAIL** if it does.
|
|
52
|
+
14. **No react-performance on ios/go/java:** skill directory / required handoff must be absent under ios-swift, go, and java → **FAIL** (leakage). Prefer `check:preset-leakage`.
|
|
53
|
+
15. **Rule eval (WARN):** `scripts/check-rule-eval.mjs` / `yarn check:rule-eval` should exist for maintainers; smoke optional. Hard fail only when the opt-in eval job runs — not part of default `check:preset-structure`.
|
|
55
54
|
|
|
56
55
|
## Output
|
|
57
56
|
|
|
@@ -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`.
|
|
@@ -20,6 +20,7 @@
|
|
|
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
|
|
@@ -5,40 +5,17 @@ alwaysApply: true
|
|
|
5
5
|
|
|
6
6
|
# Стек и окружение
|
|
7
7
|
|
|
8
|
-
Версии Swift, iOS
|
|
9
|
-
|
|
10
|
-
- **Язык / платформа:** Swift, iOS (min — из таргета).
|
|
11
|
-
- **UI:** SwiftUI — приоритет для нового кода; UIKit — где уже принято в репо.
|
|
12
|
-
- **Сборка:** Xcode; SPM и/или CocoaPods — как в репозитории.
|
|
13
|
-
- **Concurrency:** `async`/`await`, `Task`, `Actor`; UI — `@MainActor`.
|
|
14
|
-
- **Тесты:** XCTest или Swift Testing; UI — XCUITest.
|
|
15
|
-
- **Сеть:** `URLSession` или клиент репо; DTO через `Codable`.
|
|
16
|
-
- **Дизайн-система:** токены/примитивы из `DesignSystem/` (или аналога); без «магических» значений.
|
|
17
|
-
- **Наблюдаемость:** только если уже в проекте — централизованно.
|
|
8
|
+
Версии — **из Xcode / Package.swift / конфигов репо**. Рамка: Swift, iOS; SwiftUI приоритет (UIKit где принято); Xcode + SPM/CocoaPods как в репо; `async`/`await`, `@MainActor`; XCTest/Swift Testing + XCUITest; сеть — `URLSession`/`Codable`; UI — токены `DesignSystem/`; наблюдаемость — только если уже в проекте.
|
|
18
9
|
|
|
19
10
|
# Структура проекта
|
|
20
11
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
- `App/` — `@main`, composition root, DI, навигация верхнего уровня.
|
|
24
|
-
- `Features/<FeatureName>/` — `Presentation/` (Views, ViewModels), `Domain/` (entities, use cases, протоколы), `Data/` (repos, API, DTO, mappers).
|
|
25
|
-
- `Core/` — общие утилиты, extensions, базовые ошибки.
|
|
26
|
-
- `DesignSystem/` — UI-примитивы без бизнес-логики.
|
|
27
|
-
- `Tests/` / `*Tests/` — unit и UI по конвенции Xcode.
|
|
28
|
-
|
|
29
|
-
Новые файлы — в том же слое/модуле, что и аналогичная функциональность.
|
|
30
|
-
|
|
31
|
-
Границы зависимостей и DI — **`architecture-boundaries.mdc`**.
|
|
12
|
+
Feature-first или слои сверху (как в репо): `App/` (composition root), `Features/<Name>/` (Presentation / Domain / Data), `Core/`, `DesignSystem/`, `Tests/`. Новые файлы — рядом с аналогами. Границы/DI — **`architecture-boundaries.mdc`**.
|
|
32
13
|
|
|
33
14
|
# Swift и качество
|
|
34
15
|
|
|
35
|
-
|
|
36
|
-
- Избегать `!` / `try!` в production; `guard` / `if let` / typed errors.
|
|
37
|
-
- Копировать существующие паттерны фичи/слоя.
|
|
16
|
+
API Design Guidelines + SwiftLint/SwiftFormat репо; без `!`/`try!` в production; `guard` / typed errors; паттерны соседних файлов.
|
|
38
17
|
|
|
39
18
|
# Работа агента
|
|
40
19
|
|
|
41
|
-
-
|
|
42
|
-
-
|
|
43
|
-
- Доставка фичи — `feature-delivery-workflow.mdc`; после правок Swift — **вызвать** `post-change-build.mdc` (requestable).
|
|
44
|
-
- Toolchain перед сборкой — `xcode-tooling.mdc` (requestable).
|
|
20
|
+
- Слой → паттерн соседей; без `URLSession` во View и DTO во ViewModel (`architecture-boundaries.mdc`).
|
|
21
|
+
- Фичи: `feature-delivery-workflow.mdc`; после Swift — **вызвать** `post-change-build.mdc`; toolchain — `xcode-tooling.mdc`.
|
|
@@ -24,7 +24,7 @@ alwaysApply: false
|
|
|
24
24
|
## Куда класть новое правило
|
|
25
25
|
|
|
26
26
|
1. Общие принципы для всех стеков → **core** + адаптеры с `<!-- shared-core: … -->`.
|
|
27
|
-
2. Только один из installable стеков (`next` / `ios-swift` / `go`) → **stack-specific** (не в `_shared`).
|
|
27
|
+
2. Только один из installable стеков (`next` / `ios-swift` / `go` / `java`) → **stack-specific** (не в `_shared`).
|
|
28
28
|
3. Только Cursor или только Claude packaging → platform artifact / frontmatter, не дублировать семантику.
|
|
29
29
|
|
|
30
30
|
## SoT
|
|
@@ -17,7 +17,7 @@ alwaysApply: false
|
|
|
17
17
|
|
|
18
18
|
- `next` must not require iOS-only agents/tooling (`xcuitest-*`, `xcodebuild` as required handoff, Keychain-only rules).
|
|
19
19
|
- `ios-swift` must not ship Playwright handoffs or Next lint recipes as required commands.
|
|
20
|
-
- `go` must not ship Playwright, XCUITest, Next lint recipes, or `xcodebuild`/`SwiftLint` as required handoffs.
|
|
20
|
+
- `go` / `java` must not ship Playwright, XCUITest, Next lint recipes, or `xcodebuild`/`SwiftLint` as required handoffs.
|
|
21
21
|
- Shared core must not embed stack paths (`app/src/**`, `Features/**`, `playwright`, `xcodebuild`).
|
|
22
22
|
|
|
23
23
|
## Forbidden in ios-swift hooks/agents (FAIL)
|
|
@@ -35,14 +35,16 @@ Required instead: `xcuitest-test-*` stems; build-verifier mentions `xcodebuild`
|
|
|
35
35
|
- `xcuitest-test-` as handoff stems
|
|
36
36
|
- Requiring `xcodebuild` / SwiftLint as the default post-change gate for Next app work
|
|
37
37
|
|
|
38
|
-
## Forbidden in go hooks/agents (FAIL)
|
|
38
|
+
## Forbidden in go / java hooks/agents (FAIL)
|
|
39
|
+
|
|
40
|
+
Shared backend-stack bans (both `go` and `java`):
|
|
39
41
|
|
|
40
42
|
- `playwright-test-`, `playwright-e2e`, `user-playwright`, `app/__tests__/e2e`
|
|
41
43
|
- Positive yarn recipes `lint:js` / `lint:css`
|
|
42
44
|
- `xcuitest-test-`, `xcodebuild`, `SwiftLint` as required handoffs
|
|
43
45
|
- Agent file `accessibility-reviewer` (no UI surface)
|
|
44
46
|
|
|
45
|
-
Required instead: `integration-test-*`; build-verifier / `post-change-test`
|
|
47
|
+
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`).
|
|
46
48
|
|
|
47
49
|
## Soft / document
|
|
48
50
|
|
|
@@ -51,4 +53,4 @@ Required instead: `integration-test-*`; build-verifier / `post-change-test` / `g
|
|
|
51
53
|
|
|
52
54
|
## Chain fork
|
|
53
55
|
|
|
54
|
-
`hooks/chain-team-phases.sh` must differ **byte-wise** pairwise among `next`, `ios-swift`, and `
|
|
56
|
+
`hooks/chain-team-phases.sh` must differ **byte-wise** pairwise among `next`, `ios-swift`, `go`, and `java` (per platform).
|