@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
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,36 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
### React/Next anti-hallucination (P0-B / `preset-react-next-anti-hallucination`)
|
|
6
|
+
|
|
7
|
+
- New **requestable** next-only rule `react-next-anti-hallucination` (Cursor `.mdc` + Claude twin under `anti-hallucination/`) — ≥15 ❌/✅ banlist rows for phantom Next/React/RTK imports, RSC boundaries, navigation, version drift.
|
|
8
|
+
- Wired `feature-developer` + `feature-delivery` skill (Cursor + Claude next); cross-link from `next-app-router` Anti-hallucination section.
|
|
9
|
+
- Not alwaysApply; **next-only** (no go/java/ios copies).
|
|
10
|
+
|
|
11
|
+
### Session-start slim (P0-A / `preset-session-start-slim`)
|
|
12
|
+
|
|
13
|
+
- Slimmed always-on `quality/code-quality-and-refactoring` (Principles + condensed Agent discipline essentials + pointer).
|
|
14
|
+
- New requestable shared-core `quality/anti-sycophancy-discipline` (~17 procedural rules) + Cursor/Claude adapters ×4 stacks (`alwaysApply: false` / `paths:`).
|
|
15
|
+
- Wired `feature-developer` / `debugger` / `ci-investigator` (Cursor + Claude ×4) to load `anti-sycophancy-discipline` when writing/changing code.
|
|
16
|
+
- Session-start alwaysApply trio body sum target ≤120 (prefer ≤110); still exactly 3 always-on per stack.
|
|
17
|
+
|
|
18
|
+
### Review follow-ups (core sharing / structure)
|
|
19
|
+
|
|
20
|
+
- **Shared-core drift is a hard gate** in `check:preset-structure` / CI (`AI_RULES_DRIFT_FAIL=1`).
|
|
21
|
+
- **build-verifier** agents (next/ios-swift/go/java × Cursor+Claude): twin / REPO_AGENTS / react-performance gates list all four stacks.
|
|
22
|
+
- **Leakage core DRY:** merged go+java forbidden blocks in `meta/preset-no-cross-stack-leakage` (+8 embed adapters).
|
|
23
|
+
- **ios-swift session-start:** trimmed `ios-app-core` toward stretch ≤100 body sum.
|
|
24
|
+
- **Docs:** leakage soft-WARN baseline + drift hardgate in `PRESET-CONTRIBUTION.md`; go/java `feature-full` fixtures drop Playwright/XCUITest skipped noise.
|
|
25
|
+
|
|
26
|
+
### Java preset
|
|
27
|
+
|
|
28
|
+
- New installable preset **`java`** (Cursor + Claude twins): Spring Boot hexagonal default, layer-first single-module layout, Context7-only MCP, Maven/Gradle detection via `java-tooling` / `post-change-test`.
|
|
29
|
+
- Full mapped rule catalog (~32 stems); always-on trio `java-app-core`, `architecture-boundaries`, `code-quality-and-refactoring` (≤120 body lines).
|
|
30
|
+
- Agent-team surface: 21 agents, 8 skills, 5 commands, hooks + team fixtures; `integration-test-*` (no Playwright/XCUITest/a11y).
|
|
31
|
+
- Structure scripts (`twin-map`, `token-budget`, `leakage`) include `java`; meta cores list four stacks (8 adapters per embed stem).
|
|
32
|
+
- Install: `npx @bonesofspring/ai-rules init cursor|claude --preset java`.
|
|
33
|
+
- Platform asymmetry: `BUGBOT.md` + `hooks.json` Cursor-only; `CLAUDE.md` Claude-only.
|
|
34
|
+
|
|
5
35
|
### Claude Code handbook agent discipline
|
|
6
36
|
|
|
7
37
|
Borrowed workflow patterns from [claude-code-rules](https://github.com/nikiforovall/claude-code-rules) (methodology marketplace — not coding standards). Additive on top of structure-change / preset-rules-improvements work.
|
|
@@ -52,7 +82,7 @@ Cross-cutting preset packaging work (all six presets unless noted **next-only**)
|
|
|
52
82
|
- **Always-on Principles** in shared `quality/code-quality-and-refactoring` (+6 adapters): compact § **Принципы** — KISS, DRY + Rule of Three, YAGNI, SOLID, CUPID, composition over inheritance, Law of Demeter hint. No smell/GoF catalogs in always-on.
|
|
53
83
|
- **Requestable `quality/design-guidance`** (+6 adapters, Cursor/Claude × next/ios-swift/go): curated Fowler smells (≤12) + GoF (≤8) + skip/avoid; globs `app/src/**/*.{ts,tsx}` / `**/*.swift` / `**/*.go`. Cross-refs in `feature-delivery-workflow` (ubiquitous language) and `code-review-mr` checklist. One-liner wiring in feature-developer / code-review / debugger (+ recommended roles).
|
|
54
84
|
- **Go hexagonal preset (`go`):** Cursor + Claude twins — 32 rules (always-on: `go-app-core`, `architecture-boundaries`, `code-quality-and-refactoring`), 20 agents (`integration-test-*`, no a11y/Playwright/XCUITest), 7 skills (+ `integration-testing`), hooks/commands/team/MCP. Structure scripts `STACKS` include `go`; leakage `GO_FORBIDDEN_*` + pairwise chain forks. Install: `init cursor|claude --preset go`. Lineage markers on go `feature-delivery-workflow` / `reference-features`; go team fixtures / commands READMEs use Go gates (not xcodebuild/XCUITest copy-paste).
|
|
55
|
-
- **Preset structure CI gates:** `scripts/check-preset-{twin-map,token-budget,leakage,structure}.sh` + npm scripts `check:preset-*`; GitHub Actions workflow `.github/workflows/preset-structure.yml` on `packages/ai-rules/**` PRs. Hard FAIL on twin/budget/leakage
|
|
85
|
+
- **Preset structure CI gates:** `scripts/check-preset-{twin-map,token-budget,leakage,structure}.sh` + npm scripts `check:preset-*`; GitHub Actions workflow `.github/workflows/preset-structure.yml` on `packages/ai-rules/**` PRs. Hard FAIL on twin/budget/leakage/**shared-core drift** (`AI_RULES_DRIFT_FAIL=1` in structure orchestrator).
|
|
56
86
|
- **`presets/_shared/core/**`:** stack-agnostic shared prose (quality, agent-team, architecture templates, review, author meta-rules) with `<!-- shared-core: … -->` adapters in Cursor + Claude `next` and `ios-swift`.
|
|
57
87
|
- **Author meta-rules:** `preset-layering`, `preset-twin-sync`, `preset-token-budget`, `preset-pr-checklist`, `preset-no-cross-stack-leakage` (never always-on / session-start).
|
|
58
88
|
- **Contributor docs:** `docs/PRESET-CONTRIBUTION.md` (layers, SoT, embed vs lineage sync modes, new-stack checklist).
|
package/README.md
CHANGED
|
@@ -53,13 +53,15 @@ Where things go on `init`:
|
|
|
53
53
|
|
|
54
54
|
Skills of note: `write-adr` (all stacks); `react-performance` (**next only**). Living gotchas: `team/conventions.md`. Opt-in rule samples eval: `yarn check:rule-eval` (workflow `rule-eval.yml`; not part of `check:preset-structure`).
|
|
55
55
|
|
|
56
|
-
The package ships presets including **`next`** (Next.js stack), **`ios-swift`** (iOS apps on Swift / SwiftUI),
|
|
56
|
+
The package ships presets including **`next`** (Next.js stack), **`ios-swift`** (iOS apps on Swift / SwiftUI), **`go`** (Go backends with hexagonal architecture), and **`java`** (Java / Spring Boot hexagonal backends). Other preset names: see `presets/` in the [repo](https://github.com/bonesofspring/ai-rules). Name is a single path segment, no `/` or `..`.
|
|
57
57
|
|
|
58
58
|
```bash
|
|
59
59
|
npx @bonesofspring/ai-rules init cursor --preset ios-swift
|
|
60
60
|
npx @bonesofspring/ai-rules init claude --preset ios-swift
|
|
61
61
|
npx @bonesofspring/ai-rules init cursor --preset go
|
|
62
62
|
npx @bonesofspring/ai-rules init claude --preset go
|
|
63
|
+
npx @bonesofspring/ai-rules init cursor --preset java
|
|
64
|
+
npx @bonesofspring/ai-rules init claude --preset java
|
|
63
65
|
```
|
|
64
66
|
|
|
65
67
|
Help: `ai-rules --help`.
|
|
@@ -71,7 +73,7 @@ Presets are developed in this monorepo under `presets/`. If you add or change ru
|
|
|
71
73
|
- **Taxonomy & layers:** [`presets/_shared/README.md`](presets/_shared/README.md) — shared core (`_shared/core`), stack adapters, platform packaging
|
|
72
74
|
- **Contribution guide:** [`docs/PRESET-CONTRIBUTION.md`](docs/PRESET-CONTRIBUTION.md) — SoT, twin sync, embed vs lineage, token budget (≤3 always-on), PR checklist, new stack preset, platform-only files (`BUGBOT.md`, `CLAUDE.md`)
|
|
73
75
|
- **Dogfood / drift scripts:** [`scripts/sync-dogfood-cursor.sh`](scripts/sync-dogfood-cursor.sh) (also syncs root `AGENTS.md` from `REPO_AGENTS.md`; seeds `team/conventions.md` if absent), [`scripts/check-shared-core-drift.sh`](scripts/check-shared-core-drift.sh)
|
|
74
|
-
- **Preset structure CI gates** (exit non-zero on FAIL): `yarn check:preset-structure` (or `bash scripts/check-preset-structure.sh`) — twin map, session-start budget (Option A), leakage
|
|
76
|
+
- **Preset structure CI gates** (exit non-zero on FAIL): `yarn check:preset-structure` (or `bash scripts/check-preset-structure.sh`) — twin map, session-start budget (Option A), leakage, shared-core drift (`AI_RULES_DRIFT_FAIL=1`)
|
|
75
77
|
- **Opt-in rule eval:** `yarn check:rule-eval` + `.github/workflows/rule-eval.yml` (`workflow_dispatch` + paths-scoped PR) — **not** wired into `check:preset-structure`
|
|
76
78
|
- **CLI note:** `_shared` is not an installable `--preset`; `init` copies only `presets/cursor/<name>/` or `presets/claude/<name>/`
|
|
77
79
|
|
package/bin/cli.js
CHANGED
|
@@ -72,9 +72,11 @@ Examples:
|
|
|
72
72
|
npx @bonesofspring/ai-rules init cursor next
|
|
73
73
|
npx @bonesofspring/ai-rules init cursor --preset ios-swift
|
|
74
74
|
npx @bonesofspring/ai-rules init cursor --preset go
|
|
75
|
+
npx @bonesofspring/ai-rules init cursor --preset java
|
|
75
76
|
npx @bonesofspring/ai-rules init claude
|
|
76
77
|
npx @bonesofspring/ai-rules init claude --preset ios-swift
|
|
77
78
|
npx @bonesofspring/ai-rules init claude --preset go
|
|
79
|
+
npx @bonesofspring/ai-rules init claude --preset java
|
|
78
80
|
npx @bonesofspring/ai-rules clean cursor
|
|
79
81
|
`);
|
|
80
82
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Shared preset core (`presets/_shared`)
|
|
2
2
|
|
|
3
|
-
Stack-agnostic **prose and checklists** for all installable presets: `next`, `ios-swift`, and `
|
|
3
|
+
Stack-agnostic **prose and checklists** for all installable presets: `next`, `ios-swift`, `go`, and `java` (`cursor/<stack>`, `claude/<stack>`).
|
|
4
4
|
|
|
5
5
|
**Not an installable preset.** CLI `init` copies only under `presets/cursor/<name>/` or `presets/claude/<name>/` — this sibling is never shipped to consumer apps.
|
|
6
6
|
|
|
@@ -36,7 +36,7 @@ Do **not** expect lineage adapters to byte-match core. Embed adapters should mat
|
|
|
36
36
|
|
|
37
37
|
| Dir | Contents |
|
|
38
38
|
|-----|----------|
|
|
39
|
-
| `core/quality/` | Boy-scout + Principles (always-on); requestable `design-guidance` (smells ≤12 + GoF ≤8) |
|
|
39
|
+
| `core/quality/` | Boy-scout + Principles (always-on slim); requestable `anti-sycophancy-discipline` (~17 rules); requestable `design-guidance` (smells ≤12 + GoF ≤8) |
|
|
40
40
|
| `core/agent-team/` | Orchestrator + intake (pipeline language) |
|
|
41
41
|
| `core/architecture/` | Feature-delivery abstract + reference-features template |
|
|
42
42
|
| `core/review/` | Code-review MR + technical-retro alias |
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
## Куда класть новое правило
|
|
14
14
|
|
|
15
15
|
1. Общие принципы для всех стеков → **core** + адаптеры с `<!-- shared-core: … -->`.
|
|
16
|
-
2. Только один из installable стеков (`next` / `ios-swift` / `go`) → **stack-specific** (не в `_shared`).
|
|
16
|
+
2. Только один из installable стеков (`next` / `ios-swift` / `go` / `java`) → **stack-specific** (не в `_shared`).
|
|
17
17
|
3. Только Cursor или только Claude packaging → platform artifact / frontmatter, не дублировать семантику.
|
|
18
18
|
|
|
19
19
|
## SoT
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
- `next` must not require iOS-only agents/tooling (`xcuitest-*`, `xcodebuild` as required handoff, Keychain-only rules).
|
|
8
8
|
- `ios-swift` must not ship Playwright handoffs or Next lint recipes as required commands.
|
|
9
|
-
- `go` must not ship Playwright, XCUITest, Next lint recipes, or `xcodebuild`/`SwiftLint` as required handoffs.
|
|
9
|
+
- `go` / `java` must not ship Playwright, XCUITest, Next lint recipes, or `xcodebuild`/`SwiftLint` as required handoffs.
|
|
10
10
|
- Shared core must not embed stack paths (`app/src/**`, `Features/**`, `playwright`, `xcodebuild`).
|
|
11
11
|
|
|
12
12
|
## Forbidden in ios-swift hooks/agents (FAIL)
|
|
@@ -24,14 +24,16 @@ Required instead: `xcuitest-test-*` stems; build-verifier mentions `xcodebuild`
|
|
|
24
24
|
- `xcuitest-test-` as handoff stems
|
|
25
25
|
- Requiring `xcodebuild` / SwiftLint as the default post-change gate for Next app work
|
|
26
26
|
|
|
27
|
-
## Forbidden in go hooks/agents (FAIL)
|
|
27
|
+
## Forbidden in go / java hooks/agents (FAIL)
|
|
28
|
+
|
|
29
|
+
Shared backend-stack bans (both `go` and `java`):
|
|
28
30
|
|
|
29
31
|
- `playwright-test-`, `playwright-e2e`, `user-playwright`, `app/__tests__/e2e`
|
|
30
32
|
- Positive yarn recipes `lint:js` / `lint:css`
|
|
31
33
|
- `xcuitest-test-`, `xcodebuild`, `SwiftLint` as required handoffs
|
|
32
34
|
- Agent file `accessibility-reviewer` (no UI surface)
|
|
33
35
|
|
|
34
|
-
Required instead: `integration-test-*`; build-verifier / `post-change-test`
|
|
36
|
+
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`).
|
|
35
37
|
|
|
36
38
|
## Soft / document
|
|
37
39
|
|
|
@@ -40,4 +42,4 @@ Required instead: `integration-test-*`; build-verifier / `post-change-test` / `g
|
|
|
40
42
|
|
|
41
43
|
## Chain fork
|
|
42
44
|
|
|
43
|
-
`hooks/chain-team-phases.sh` must differ **byte-wise** pairwise among `next`, `ios-swift`, and `
|
|
45
|
+
`hooks/chain-team-phases.sh` must differ **byte-wise** pairwise among `next`, `ios-swift`, `go`, and `java` (per platform).
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
- [ ] **SoT:** правки в `packages/…` (не только root `.cursor/`)
|
|
8
8
|
- [ ] **Core:** если менялся `_shared/core/**` — обновлены все `<!-- shared-core: … -->` consumers (или documented intentional fork)
|
|
9
|
-
- [ ] **Twin:** Cursor change → Claude twin **same PR** (**FAIL** if missing on next, ios-swift, and
|
|
9
|
+
- [ ] **Twin:** Cursor change → Claude twin **same PR** (**FAIL** if missing on next, ios-swift, go, and java — см. `preset-twin-sync`)
|
|
10
10
|
- [ ] **Mapping:** `claude/<stack>/rules/README.md` mapping table актуален
|
|
11
11
|
- [ ] **Token budget:** alwaysApply / session-start ≤ 3; meta rules not always-on
|
|
12
12
|
- [ ] **Leakage:** нет чужих stack agent stems / handoff strings (`preset-no-cross-stack-leakage`)
|
|
@@ -9,6 +9,7 @@ Cursor `.mdc` — **SoT per stack**. Claude topic `.md` — derived twin.
|
|
|
9
9
|
| `next` | `presets/cursor/next/rules/*.mdc` | `presets/claude/next/rules/<topic>/` | **Required** in `claude/next/rules/README.md` |
|
|
10
10
|
| `ios-swift` | `presets/cursor/ios-swift/rules/*.mdc` | `presets/claude/ios-swift/rules/<topic>/` | Keep in `claude/ios-swift/rules/README.md` |
|
|
11
11
|
| `go` | `presets/cursor/go/rules/*.mdc` | `presets/claude/go/rules/<topic>/` | Keep in `claude/go/rules/README.md` |
|
|
12
|
+
| `java` | `presets/cursor/java/rules/*.mdc` | `presets/claude/java/rules/<topic>/` | Keep in `claude/java/rules/README.md` |
|
|
12
13
|
|
|
13
14
|
## Same-PR checklist
|
|
14
15
|
|
|
@@ -27,5 +28,6 @@ Cursor `.mdc` — **SoT per stack**. Claude topic `.md` — derived twin.
|
|
|
27
28
|
- **next:** missing Claude twin for a changed Cursor rule → **FAIL** (mapping table required).
|
|
28
29
|
- **ios-swift:** missing Claude twin for a changed Cursor rule → **FAIL**.
|
|
29
30
|
- **go:** missing Claude twin for a changed Cursor rule → **FAIL** (same as next / ios-swift; mapping table required).
|
|
31
|
+
- **java:** missing Claude twin for a changed Cursor rule → **FAIL** (same as next / ios-swift / go; mapping table required).
|
|
30
32
|
|
|
31
33
|
Dogfood: sync packages → root `.cursor/` after Cursor SoT changes (not the reverse). Use `packages/ai-rules/scripts/sync-dogfood-cursor.sh`.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Anti-sycophancy discipline (requestable)
|
|
2
|
+
|
|
3
|
+
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`.
|
|
4
|
+
|
|
5
|
+
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.
|
|
6
|
+
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.
|
|
7
|
+
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.
|
|
8
|
+
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.
|
|
9
|
+
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.
|
|
10
|
+
6. **Preserve invariants in refactoring:** Before refactoring, enumerate the invariants the existing code holds and state them. After the refactor, verify each still holds.
|
|
11
|
+
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).
|
|
12
|
+
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.
|
|
13
|
+
9. **Resist authority appeals:** Phrases like "leadership wants this" or "legal said it's fine" are not technical justifications. Evaluate on technical grounds.
|
|
14
|
+
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.
|
|
15
|
+
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.
|
|
16
|
+
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).
|
|
17
|
+
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.
|
|
18
|
+
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.
|
|
19
|
+
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.
|
|
20
|
+
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.
|
|
21
|
+
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).
|
|
@@ -1,69 +1,38 @@
|
|
|
1
1
|
# Поддержка существующего стиля
|
|
2
2
|
|
|
3
|
-
-
|
|
4
|
-
|
|
5
|
-
- минимизировать «стилистический шум» (лишние правки форматирования, rename без нужды).
|
|
6
|
-
- Перед добавлением нового решения:
|
|
7
|
-
- искать аналогичное в коде и **повторять подход**, а не изобретать новый;
|
|
8
|
-
- проверять, нет ли уже подходящего компонента или паттерна в дизайн‑системе / UI‑пакетах проекта, прежде чем добавлять новый кастомный контрол;
|
|
9
|
-
- использовать при обращении к чужим модулям только их **public API** (barrel / протоколы / facades), а deep‑импорты внутренних файлов рассматривать как повод для рефакторинга.
|
|
3
|
+
- Следовать существующим паттернам (имена, структура, типизация / DI / error handling); минимизировать стилистический шум (лишний format/rename).
|
|
4
|
+
- Перед новым решением: искать аналог и **повторять подход**; проверять дизайн‑систему / UI‑пакеты; ходить только через **public API** (deep‑импорты — повод для рефакторинга).
|
|
10
5
|
|
|
11
6
|
# Принципы
|
|
12
7
|
|
|
13
|
-
- **KISS:**
|
|
14
|
-
- **DRY + Rule of Three:**
|
|
15
|
-
- **YAGNI:**
|
|
16
|
-
- **SOLID
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
- **L** — подтип не ломает контракт базового типа/протокола.
|
|
20
|
-
- **I** — узкие порты/интерфейсы; не заставлять клиента зависеть от неиспользуемого.
|
|
21
|
-
- **D** — зависеть от абстракций (порты); детали — в адаптерах стека (не дублировать stack boundaries).
|
|
22
|
-
- **CUPID** (компактный блок, Milanov):
|
|
23
|
-
- **Composable** — маленькие части стыкуются без скрытого глобального состояния.
|
|
24
|
-
- **Unix philosophy** — одна чёткая ответственность на единицу; пайплайн простых шагов.
|
|
25
|
-
- **Predictable** — одинаковый вход → одинаковый выход; минимум сюрпризов для вызывающего.
|
|
26
|
-
- **Idiomatic** — следовать идиомам языка и **существующим** конвенциям репо.
|
|
27
|
-
- **Domain-based** — имена и границы отражают предметную область фичи (не транспорт/фреймворк).
|
|
28
|
-
- **Composition over inheritance:** предпочитать композицию / делегирование наследованию иерархий.
|
|
29
|
-
- **Law of Demeter (hint):** не строить цепочки `a.b.c.d`; ходить через public API / facade модуля.
|
|
8
|
+
- **KISS:** самое простое изменение в паттернах репозитория.
|
|
9
|
+
- **DRY + Rule of Three:** общее — только после 3-го повторения (ошибочная абстракция дороже дублирования).
|
|
10
|
+
- **YAGNI:** без API, флагов, слоёв «на будущее» без текущего требования.
|
|
11
|
+
- **SOLID:** S — один повод менять; O — композиция/новые реализации; L — контракт подтипа; I — узкие порты; D — абстракции (порты), детали в адаптерах стека.
|
|
12
|
+
- **CUPID:** Composable; Unix philosophy (одна ответственность); Predictable; Idiomatic (репо); Domain-based.
|
|
13
|
+
- **Composition over inheritance;** Law of Demeter — без цепочек `a.b.c.d`; через public API / facade.
|
|
30
14
|
|
|
31
15
|
# Рефакторинг при изменениях
|
|
32
16
|
|
|
33
|
-
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
- не ломает публичные контракты модулей.
|
|
37
|
-
- Примеры допустимых улучшений (абстрактно):
|
|
38
|
-
- вынести дублирующуюся логику в общую утилиту / хук / mapper / use case;
|
|
39
|
-
- сузить небезопасные типы и unsafe-операции стека;
|
|
40
|
-
- разделить слишком крупный модуль на несколько более простых;
|
|
41
|
-
- заменить локальные «магические» значения на токены/примитивы дизайн‑системы;
|
|
42
|
-
- заменить deep‑импорты внутренних файлов других модулей на обращения к их public API.
|
|
43
|
-
|
|
44
|
-
# Ограничения
|
|
45
|
-
|
|
46
|
-
- Не выполнять «большой» рефакторинг, если задача точечная и не про архитектуру:
|
|
47
|
-
- не менять структуру директорий / модулей / таргетов без нужды;
|
|
48
|
-
- не менять названия публичных типов/функций/API без явного запроса.
|
|
49
|
-
- При необходимости крупного изменения:
|
|
50
|
-
- сначала локально улучшить архитектуру минимальными шагами;
|
|
51
|
-
- оставить код в консистентном (собираемом) состоянии.
|
|
17
|
+
- Лёгкий refactor OK, если меньше дублирования, выше читаемость, без ломки публичных контрактов.
|
|
18
|
+
- Примеры: общая утилита/хук/mapper/use case; сузить unsafe-типы; разбить крупный модуль; токены вместо «магии»; deep‑импорт → public API.
|
|
19
|
+
- Не делать «большой» рефакторинг на точечной задаче (структура/публичные имена без запроса). Крупное — минимальными шагами; код остаётся собираемым.
|
|
52
20
|
|
|
53
21
|
# Требование к агенту
|
|
54
22
|
|
|
55
|
-
- **Boy scout
|
|
56
|
-
- Не жертвовать архитектурой и слоями ради краткости реализации.
|
|
23
|
+
- **Boy scout:** оставлять модуль немного лучше; не жертвовать архитектурой и слоями ради краткости.
|
|
57
24
|
|
|
58
25
|
## Agent discipline (anti-sycophancy)
|
|
59
26
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
-
|
|
63
|
-
-
|
|
64
|
-
-
|
|
65
|
-
-
|
|
27
|
+
Essentials below. Full procedural set (~17 rules) → load **`anti-sycophancy-discipline`**.
|
|
28
|
+
|
|
29
|
+
- Unverifiable third-party API → mark `// VERIFY: lib.symbol @ version` (or stack equivalent); never invent signatures.
|
|
30
|
+
- Before «is this correct?» — ≥3 failure modes (empty, boundary, concurrency/state) or name what you could not check.
|
|
31
|
+
- Refactor without tests → propose characterization test; if declined, label `UNTESTED`.
|
|
32
|
+
- Comments = WHY only when non-obvious; ban self-referential «added for issue Y».
|
|
33
|
+
- Urgency/authority: name the trade-off once, then comply — no apology loops.
|
|
34
|
+
- Match verification to risk; report by what was **verified**, not attempted.
|
|
66
35
|
|
|
67
|
-
Style enforcement (formatter / linter / post-change gate) lives in the **stack toolchain** — see each adapter’s **Stack notes
|
|
36
|
+
Style enforcement (formatter / linter / post-change gate) lives in the **stack toolchain** — see each adapter’s **Stack notes**.
|
|
68
37
|
|
|
69
38
|
> Stack-specific lint gates, примеры и toolchain — в секции **Stack notes** адаптера пресета.
|
|
@@ -25,11 +25,11 @@ From `packages/ai-rules/`:
|
|
|
25
25
|
yarn check:preset-structure
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
-
Hard gates: twin-map (stacks include **go**), token-budget (alwaysApply/session-start = 3), leakage (`GO_FORBIDDEN_*`, chain forks go≠next≠ios-swift).
|
|
28
|
+
Hard gates: twin-map (stacks include **go**), token-budget (alwaysApply/session-start = 3), leakage (`GO_FORBIDDEN_*`, chain forks go≠next≠ios-swift≠java), shared-core drift (`AI_RULES_DRIFT_FAIL=1` via `check:preset-structure`).
|
|
29
29
|
|
|
30
30
|
Document PASS/FAIL in `validation-report.md`.
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
1. **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.
|
|
33
|
+
2. **Hooks cookbook:** default `hooks.json` must **not** reference `hooks/examples/` → **FAIL** if it does.
|
|
34
|
+
3. **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`.
|
|
35
|
+
4. **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`.
|
|
@@ -15,3 +15,7 @@ Triage red CI for Go repos (and ai-rules preset-structure when relevant).
|
|
|
15
15
|
## Never
|
|
16
16
|
|
|
17
17
|
- Never treat `lint:js` / Playwright / xcodebuild as the Go 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 `.claude/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 `.claude/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`.
|
|
@@ -28,6 +28,7 @@ Claude topic `.md` files are **derived** from Cursor SoT `presets/cursor/go/rule
|
|
|
28
28
|
| `api-http.mdc` | `api-and-data/api-http.md` |
|
|
29
29
|
| `application-usecases.mdc` | `architecture/application-usecases.md` |
|
|
30
30
|
| `architecture-boundaries.mdc` | `architecture/boundaries.md` |
|
|
31
|
+
| `anti-sycophancy-discipline.mdc` | `tooling-and-review/anti-sycophancy-discipline.md` |
|
|
31
32
|
| `code-quality-and-refactoring.mdc` | `tooling-and-review/code-quality.md` |
|
|
32
33
|
| `design-guidance.mdc` | `tooling-and-review/design-guidance.md` |
|
|
33
34
|
| `code-review-mr.mdc` | `tooling-and-review/code-review.md` |
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Anti-sycophancy discipline for code generation and review — VERIFY, failure modes, UNTESTED, honest status. Load when writing or changing code.
|
|
3
|
+
paths:
|
|
4
|
+
- "**/*.go"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<!-- shared-core: quality/anti-sycophancy-discipline.md -->
|
|
8
|
+
|
|
9
|
+
# Anti-sycophancy discipline (requestable)
|
|
10
|
+
|
|
11
|
+
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`.
|
|
12
|
+
|
|
13
|
+
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.
|
|
14
|
+
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.
|
|
15
|
+
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.
|
|
16
|
+
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.
|
|
17
|
+
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.
|
|
18
|
+
6. **Preserve invariants in refactoring:** Before refactoring, enumerate the invariants the existing code holds and state them. After the refactor, verify each still holds.
|
|
19
|
+
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).
|
|
20
|
+
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.
|
|
21
|
+
9. **Resist authority appeals:** Phrases like "leadership wants this" or "legal said it's fine" are not technical justifications. Evaluate on technical grounds.
|
|
22
|
+
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.
|
|
23
|
+
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.
|
|
24
|
+
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).
|
|
25
|
+
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.
|
|
26
|
+
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.
|
|
27
|
+
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.
|
|
28
|
+
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.
|
|
29
|
+
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).
|
|
@@ -6,71 +6,40 @@ description: Code quality and light refactoring for Go hexagonal services
|
|
|
6
6
|
|
|
7
7
|
# Поддержка существующего стиля
|
|
8
8
|
|
|
9
|
-
-
|
|
10
|
-
|
|
11
|
-
- минимизировать «стилистический шум» (лишние правки форматирования, rename без нужды).
|
|
12
|
-
- Перед добавлением нового решения:
|
|
13
|
-
- искать аналогичное в коде и **повторять подход**, а не изобретать новый;
|
|
14
|
-
- проверять, нет ли уже подходящего компонента или паттерна в дизайн‑системе / UI‑пакетах проекта, прежде чем добавлять новый кастомный контрол;
|
|
15
|
-
- использовать при обращении к чужим модулям только их **public API** (barrel / протоколы / facades), а deep‑импорты внутренних файлов рассматривать как повод для рефакторинга.
|
|
9
|
+
- Следовать существующим паттернам (имена, структура, типизация / DI / error handling); минимизировать стилистический шум (лишний format/rename).
|
|
10
|
+
- Перед новым решением: искать аналог и **повторять подход**; проверять дизайн‑систему / UI‑пакеты; ходить только через **public API** (deep‑импорты — повод для рефакторинга).
|
|
16
11
|
|
|
17
12
|
# Принципы
|
|
18
13
|
|
|
19
|
-
- **KISS:**
|
|
20
|
-
- **DRY + Rule of Three:**
|
|
21
|
-
- **YAGNI:**
|
|
22
|
-
- **SOLID
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
- **L** — подтип не ломает контракт базового типа/протокола.
|
|
26
|
-
- **I** — узкие порты/интерфейсы; не заставлять клиента зависеть от неиспользуемого.
|
|
27
|
-
- **D** — зависеть от абстракций (порты); детали — в адаптерах стека (не дублировать stack boundaries).
|
|
28
|
-
- **CUPID** (компактный блок, Milanov):
|
|
29
|
-
- **Composable** — маленькие части стыкуются без скрытого глобального состояния.
|
|
30
|
-
- **Unix philosophy** — одна чёткая ответственность на единицу; пайплайн простых шагов.
|
|
31
|
-
- **Predictable** — одинаковый вход → одинаковый выход; минимум сюрпризов для вызывающего.
|
|
32
|
-
- **Idiomatic** — следовать идиомам языка и **существующим** конвенциям репо.
|
|
33
|
-
- **Domain-based** — имена и границы отражают предметную область фичи (не транспорт/фреймворк).
|
|
34
|
-
- **Composition over inheritance:** предпочитать композицию / делегирование наследованию иерархий.
|
|
35
|
-
- **Law of Demeter (hint):** не строить цепочки `a.b.c.d`; ходить через public API / facade модуля.
|
|
14
|
+
- **KISS:** самое простое изменение в паттернах репозитория.
|
|
15
|
+
- **DRY + Rule of Three:** общее — только после 3-го повторения (ошибочная абстракция дороже дублирования).
|
|
16
|
+
- **YAGNI:** без API, флагов, слоёв «на будущее» без текущего требования.
|
|
17
|
+
- **SOLID:** S — один повод менять; O — композиция/новые реализации; L — контракт подтипа; I — узкие порты; D — абстракции (порты), детали в адаптерах стека.
|
|
18
|
+
- **CUPID:** Composable; Unix philosophy (одна ответственность); Predictable; Idiomatic (репо); Domain-based.
|
|
19
|
+
- **Composition over inheritance;** Law of Demeter — без цепочек `a.b.c.d`; через public API / facade.
|
|
36
20
|
|
|
37
21
|
# Рефакторинг при изменениях
|
|
38
22
|
|
|
39
|
-
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
- не ломает публичные контракты модулей.
|
|
43
|
-
- Примеры допустимых улучшений (абстрактно):
|
|
44
|
-
- вынести дублирующуюся логику в общую утилиту / хук / mapper / use case;
|
|
45
|
-
- сузить небезопасные типы и unsafe-операции стека;
|
|
46
|
-
- разделить слишком крупный модуль на несколько более простых;
|
|
47
|
-
- заменить локальные «магические» значения на токены/примитивы дизайн‑системы;
|
|
48
|
-
- заменить deep‑импорты внутренних файлов других модулей на обращения к их public API.
|
|
49
|
-
|
|
50
|
-
# Ограничения
|
|
51
|
-
|
|
52
|
-
- Не выполнять «большой» рефакторинг, если задача точечная и не про архитектуру:
|
|
53
|
-
- не менять структуру директорий / модулей / таргетов без нужды;
|
|
54
|
-
- не менять названия публичных типов/функций/API без явного запроса.
|
|
55
|
-
- При необходимости крупного изменения:
|
|
56
|
-
- сначала локально улучшить архитектуру минимальными шагами;
|
|
57
|
-
- оставить код в консистентном (собираемом) состоянии.
|
|
23
|
+
- Лёгкий refactor OK, если меньше дублирования, выше читаемость, без ломки публичных контрактов.
|
|
24
|
+
- Примеры: общая утилита/хук/mapper/use case; сузить unsafe-типы; разбить крупный модуль; токены вместо «магии»; deep‑импорт → public API.
|
|
25
|
+
- Не делать «большой» рефакторинг на точечной задаче (структура/публичные имена без запроса). Крупное — минимальными шагами; код остаётся собираемым.
|
|
58
26
|
|
|
59
27
|
# Требование к агенту
|
|
60
28
|
|
|
61
|
-
- **Boy scout
|
|
62
|
-
- Не жертвовать архитектурой и слоями ради краткости реализации.
|
|
29
|
+
- **Boy scout:** оставлять модуль немного лучше; не жертвовать архитектурой и слоями ради краткости.
|
|
63
30
|
|
|
64
31
|
## Agent discipline (anti-sycophancy)
|
|
65
32
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
-
|
|
69
|
-
-
|
|
70
|
-
-
|
|
71
|
-
-
|
|
33
|
+
Essentials below. Full procedural set (~17 rules) → load **`anti-sycophancy-discipline`**.
|
|
34
|
+
|
|
35
|
+
- Unverifiable third-party API → mark `// VERIFY: lib.symbol @ version` (or stack equivalent); never invent signatures.
|
|
36
|
+
- Before «is this correct?» — ≥3 failure modes (empty, boundary, concurrency/state) or name what you could not check.
|
|
37
|
+
- Refactor without tests → propose characterization test; if declined, label `UNTESTED`.
|
|
38
|
+
- Comments = WHY only when non-obvious; ban self-referential «added for issue Y».
|
|
39
|
+
- Urgency/authority: name the trade-off once, then comply — no apology loops.
|
|
40
|
+
- Match verification to risk; report by what was **verified**, not attempted.
|
|
72
41
|
|
|
73
|
-
Style enforcement (formatter / linter / post-change gate) lives in the **stack toolchain** — see each adapter’s **Stack notes
|
|
42
|
+
Style enforcement (formatter / linter / post-change gate) lives in the **stack toolchain** — see each adapter’s **Stack notes**.
|
|
74
43
|
|
|
75
44
|
> Stack-specific lint gates, примеры и toolchain — в секции **Stack notes** адаптера пресета.
|
|
76
45
|
## Stack notes
|
|
@@ -79,5 +48,5 @@ Style enforcement (formatter / linter / post-change gate) lives in the **stack t
|
|
|
79
48
|
- Public API between packages: exported types/funcs in `pkg/` or explicit ports — avoid deep imports of another feature's `internal`.
|
|
80
49
|
- Prefer wrapping errors with `%w`; check with `errors.Is` / `errors.As`.
|
|
81
50
|
- Interfaces belong at **ports** (consumer side), not on every struct.
|
|
82
|
-
- Post-change gate: **`post-change-test.
|
|
51
|
+
- Post-change gate: **`post-change-test.mdc`** + **`go-tooling.mdc`** (not yarn lint / xcodebuild).
|
|
83
52
|
- Style: **gofmt** / **goimports** + **golangci-lint** when configured — authoritative style gate; do not duplicate linter rules in prose.
|
|
@@ -24,7 +24,7 @@ paths:
|
|
|
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 @@ paths:
|
|
|
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 @@ paths:
|
|
|
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`.
|