@bonesofspring/ai-rules 0.2.5 → 0.2.6
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 +22 -5
- package/README.md +13 -1
- package/bin/cli.js +2 -0
- package/package.json +8 -1
- package/presets/_shared/README.md +47 -0
- package/presets/_shared/core/agent-team/agent-team-intake.md +9 -0
- package/presets/_shared/core/agent-team/agent-team-orchestrator.md +142 -0
- package/presets/_shared/core/architecture/feature-delivery-workflow.md +46 -0
- package/presets/_shared/core/architecture/reference-features.template.md +31 -0
- package/presets/_shared/core/meta/preset-layering.md +25 -0
- package/presets/_shared/core/meta/preset-no-cross-stack-leakage.md +43 -0
- package/presets/_shared/core/meta/preset-pr-checklist.md +28 -0
- package/presets/_shared/core/meta/preset-token-budget.md +30 -0
- package/presets/_shared/core/meta/preset-twin-sync.md +31 -0
- package/presets/_shared/core/quality/code-quality-and-refactoring.md +58 -0
- package/presets/_shared/core/quality/design-guidance.md +97 -0
- package/presets/_shared/core/review/code-review-mr.md +29 -0
- package/presets/_shared/core/review/technical-retro.md +7 -0
- package/presets/claude/go/CLAUDE.md +10 -0
- package/presets/claude/go/MCP.md +16 -0
- package/presets/claude/go/README.md +34 -0
- package/presets/claude/go/agents/README.md +15 -0
- package/presets/claude/go/agents/api-contract-reviewer.md +23 -0
- package/presets/claude/go/agents/build-verifier.md +30 -0
- package/presets/claude/go/agents/ci-investigator.md +17 -0
- package/presets/claude/go/agents/code-reviewer.md +40 -0
- package/presets/claude/go/agents/debugger.md +25 -0
- package/presets/claude/go/agents/feature-developer.md +30 -0
- package/presets/claude/go/agents/integration-test-generator.md +22 -0
- package/presets/claude/go/agents/integration-test-healer.md +22 -0
- package/presets/claude/go/agents/integration-test-planner.md +22 -0
- package/presets/claude/go/agents/migration-specialist.md +31 -0
- package/presets/claude/go/agents/performance-auditor.md +22 -0
- package/presets/claude/go/agents/qa-tester.md +24 -0
- package/presets/claude/go/agents/security-reviewer.md +20 -0
- package/presets/claude/go/agents/solution-architect.md +28 -0
- package/presets/claude/go/agents/task-analyst.md +25 -0
- package/presets/claude/go/agents/task-router.md +69 -0
- package/presets/claude/go/agents/tech-writer.md +15 -0
- package/presets/claude/go/agents/unit-test-generator.md +21 -0
- package/presets/claude/go/agents/unit-test-healer.md +13 -0
- package/presets/claude/go/agents/unit-test-planner.md +26 -0
- package/presets/claude/go/commands/README.md +13 -0
- package/presets/claude/go/commands/feature-continue.md +51 -0
- package/presets/claude/go/commands/feature-start.md +30 -0
- package/presets/claude/go/commands/task-continue.md +49 -0
- package/presets/claude/go/commands/task.md +49 -0
- package/presets/claude/go/commands/technical-retro.md +58 -0
- package/presets/claude/go/hooks/README.md +10 -0
- package/presets/claude/go/hooks/chain-team-phases.sh +381 -0
- package/presets/claude/go/hooks/guard-shell-command.sh +79 -0
- package/presets/claude/go/mcp.json +12 -0
- package/presets/claude/go/rules/README.md +60 -0
- package/presets/claude/go/rules/api-and-data/README.md +14 -0
- package/presets/claude/go/rules/api-and-data/adapters-driven.md +34 -0
- package/presets/claude/go/rules/api-and-data/adapters-driving.md +35 -0
- package/presets/claude/go/rules/api-and-data/api-grpc.md +27 -0
- package/presets/claude/go/rules/api-and-data/api-http.md +26 -0
- package/presets/claude/go/rules/api-and-data/messaging-adapters.md +21 -0
- package/presets/claude/go/rules/api-and-data/persistence-adapters.md +28 -0
- package/presets/claude/go/rules/architecture/README.md +16 -0
- package/presets/claude/go/rules/architecture/application-usecases.md +29 -0
- package/presets/claude/go/rules/architecture/boundaries.md +29 -0
- package/presets/claude/go/rules/architecture/composition-root.md +28 -0
- package/presets/claude/go/rules/architecture/domain-layer.md +32 -0
- package/presets/claude/go/rules/architecture/feature-delivery.md +51 -0
- package/presets/claude/go/rules/architecture/module-public-api.md +23 -0
- package/presets/claude/go/rules/architecture/ports-interfaces.md +34 -0
- package/presets/claude/go/rules/architecture/reference-features.md +30 -0
- package/presets/claude/go/rules/stack/README.md +10 -0
- package/presets/claude/go/rules/stack/go-app-core.md +31 -0
- package/presets/claude/go/rules/stack/go-conventions.md +24 -0
- package/presets/claude/go/rules/testing/README.md +11 -0
- package/presets/claude/go/rules/testing/e2e.md +18 -0
- package/presets/claude/go/rules/testing/integration.md +23 -0
- package/presets/claude/go/rules/testing/unit.md +24 -0
- package/presets/claude/go/rules/tooling-and-review/README.md +21 -0
- package/presets/claude/go/rules/tooling-and-review/agent-team-intake.md +25 -0
- package/presets/claude/go/rules/tooling-and-review/agent-team-orchestrator.md +161 -0
- package/presets/claude/go/rules/tooling-and-review/code-quality.md +72 -0
- package/presets/claude/go/rules/tooling-and-review/code-review.md +48 -0
- package/presets/claude/go/rules/tooling-and-review/design-guidance.md +110 -0
- package/presets/claude/go/rules/tooling-and-review/go-tooling.md +38 -0
- package/presets/claude/go/rules/tooling-and-review/post-change-test.md +32 -0
- package/presets/claude/go/rules/tooling-and-review/preset-layering.md +36 -0
- package/presets/claude/go/rules/tooling-and-review/preset-no-cross-stack-leakage.md +58 -0
- package/presets/claude/go/rules/tooling-and-review/preset-pr-checklist.md +39 -0
- package/presets/claude/go/rules/tooling-and-review/preset-token-budget.md +41 -0
- package/presets/claude/go/rules/tooling-and-review/preset-twin-sync.md +42 -0
- package/presets/claude/go/rules/tooling-and-review/security-go.md +22 -0
- package/presets/claude/go/rules/tooling-and-review/technical-retro.md +19 -0
- package/presets/claude/go/rules/ui-and-accessibility/README.md +3 -0
- package/presets/claude/go/skills/README.md +5 -0
- package/presets/claude/go/skills/ci-investigation/SKILL.md +11 -0
- package/presets/claude/go/skills/code-review/SKILL.md +16 -0
- package/presets/claude/go/skills/debug-investigation/SKILL.md +15 -0
- package/presets/claude/go/skills/feature-delivery/SKILL.md +26 -0
- package/presets/claude/go/skills/integration-testing/SKILL.md +15 -0
- package/presets/claude/go/skills/technical-retro/SKILL.md +10 -0
- package/presets/claude/go/skills/unit-testing/SKILL.md +14 -0
- package/presets/claude/go/team/README.md +27 -0
- package/presets/claude/go/team/fixtures/bugfix-standard.json +37 -0
- package/presets/claude/go/team/fixtures/feature-full.json +43 -0
- package/presets/claude/go/team/fixtures/feature-light.json +17 -0
- package/presets/claude/ios-swift/README.md +7 -0
- package/presets/claude/ios-swift/agents/build-verifier.md +17 -8
- package/presets/claude/ios-swift/agents/code-reviewer.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/agents/migration-specialist.md +4 -0
- package/presets/claude/ios-swift/agents/performance-auditor.md +4 -0
- package/presets/claude/ios-swift/agents/qa-tester.md +4 -0
- package/presets/claude/ios-swift/agents/solution-architect.md +4 -0
- package/presets/claude/ios-swift/agents/task-analyst.md +4 -0
- package/presets/claude/ios-swift/agents/unit-test-generator.md +4 -0
- package/presets/claude/ios-swift/agents/unit-test-healer.md +4 -0
- package/presets/claude/ios-swift/agents/unit-test-planner.md +4 -0
- package/presets/claude/ios-swift/rules/README.md +24 -2
- package/presets/claude/ios-swift/rules/architecture/feature-delivery.md +5 -0
- package/presets/claude/ios-swift/rules/architecture/reference-features.md +5 -0
- package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-intake.md +2 -2
- package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-orchestrator.md +7 -0
- package/presets/claude/ios-swift/rules/tooling-and-review/code-quality.md +53 -20
- package/presets/claude/ios-swift/rules/tooling-and-review/code-review.md +29 -35
- package/presets/claude/ios-swift/rules/tooling-and-review/design-guidance.md +110 -0
- package/presets/claude/ios-swift/rules/tooling-and-review/preset-layering.md +36 -0
- package/presets/claude/ios-swift/rules/tooling-and-review/preset-no-cross-stack-leakage.md +54 -0
- package/presets/claude/ios-swift/rules/tooling-and-review/preset-pr-checklist.md +39 -0
- package/presets/claude/ios-swift/rules/tooling-and-review/preset-token-budget.md +41 -0
- package/presets/claude/ios-swift/rules/tooling-and-review/preset-twin-sync.md +42 -0
- package/presets/claude/ios-swift/rules/tooling-and-review/technical-retro.md +5 -3
- package/presets/claude/ios-swift/skills/code-review/SKILL.md +4 -0
- package/presets/claude/ios-swift/skills/debug-investigation/SKILL.md +4 -0
- package/presets/claude/ios-swift/skills/feature-delivery/SKILL.md +4 -0
- package/presets/claude/next/README.md +9 -1
- package/presets/claude/next/agents/build-verifier.md +24 -0
- package/presets/claude/next/agents/code-reviewer.md +4 -0
- package/presets/claude/next/agents/debugger.md +4 -0
- package/presets/claude/next/agents/feature-developer.md +4 -0
- package/presets/claude/next/agents/migration-specialist.md +4 -0
- package/presets/claude/next/agents/performance-auditor.md +4 -0
- package/presets/claude/next/agents/qa-tester.md +4 -0
- package/presets/claude/next/agents/solution-architect.md +4 -0
- package/presets/claude/next/agents/task-analyst.md +4 -0
- package/presets/claude/next/agents/unit-test-generator.md +4 -0
- package/presets/claude/next/agents/unit-test-healer.md +4 -0
- package/presets/claude/next/agents/unit-test-planner.md +4 -0
- package/presets/claude/next/rules/README.md +74 -21
- package/presets/claude/next/rules/architecture/feature-delivery-workflow.md +5 -0
- package/presets/claude/next/rules/architecture/reference-features.md +5 -0
- package/presets/claude/next/rules/tooling-and-review/agent-team-intake.md +2 -0
- package/presets/claude/next/rules/tooling-and-review/agent-team-orchestrator.md +7 -0
- package/presets/claude/next/rules/tooling-and-review/code-quality.md +48 -20
- package/presets/claude/next/rules/tooling-and-review/code-review-mr.md +17 -8
- package/presets/claude/next/rules/tooling-and-review/design-guidance.md +110 -0
- package/presets/claude/next/rules/tooling-and-review/preset-layering.md +36 -0
- package/presets/claude/next/rules/tooling-and-review/preset-no-cross-stack-leakage.md +54 -0
- package/presets/claude/next/rules/tooling-and-review/preset-pr-checklist.md +39 -0
- package/presets/claude/next/rules/tooling-and-review/preset-token-budget.md +41 -0
- package/presets/claude/next/rules/tooling-and-review/preset-twin-sync.md +42 -0
- package/presets/claude/next/rules/tooling-and-review/technical-retro.md +16 -0
- package/presets/claude/next/skills/code-review/SKILL.md +4 -0
- package/presets/claude/next/skills/debug-investigation/SKILL.md +4 -0
- package/presets/claude/next/skills/feature-delivery/SKILL.md +4 -0
- package/presets/cursor/go/AGENTS.md +24 -0
- package/presets/cursor/go/BUGBOT.md +9 -0
- package/presets/cursor/go/MCP.md +16 -0
- package/presets/cursor/go/README.md +38 -0
- package/presets/cursor/go/agents/README.md +15 -0
- package/presets/cursor/go/agents/api-contract-reviewer.md +23 -0
- package/presets/cursor/go/agents/build-verifier.md +30 -0
- package/presets/cursor/go/agents/ci-investigator.md +17 -0
- package/presets/cursor/go/agents/code-reviewer.md +40 -0
- package/presets/cursor/go/agents/debugger.md +25 -0
- package/presets/cursor/go/agents/feature-developer.md +30 -0
- package/presets/cursor/go/agents/integration-test-generator.md +22 -0
- package/presets/cursor/go/agents/integration-test-healer.md +22 -0
- package/presets/cursor/go/agents/integration-test-planner.md +22 -0
- package/presets/cursor/go/agents/migration-specialist.md +31 -0
- package/presets/cursor/go/agents/performance-auditor.md +22 -0
- package/presets/cursor/go/agents/qa-tester.md +24 -0
- package/presets/cursor/go/agents/security-reviewer.md +20 -0
- package/presets/cursor/go/agents/solution-architect.md +28 -0
- package/presets/cursor/go/agents/task-analyst.md +25 -0
- package/presets/cursor/go/agents/task-router.md +69 -0
- package/presets/cursor/go/agents/tech-writer.md +15 -0
- package/presets/cursor/go/agents/unit-test-generator.md +21 -0
- package/presets/cursor/go/agents/unit-test-healer.md +13 -0
- package/presets/cursor/go/agents/unit-test-planner.md +26 -0
- package/presets/cursor/go/commands/README.md +54 -0
- package/presets/cursor/go/commands/feature-continue.md +19 -0
- package/presets/cursor/go/commands/feature-start.md +33 -0
- package/presets/cursor/go/commands/task-continue.md +49 -0
- package/presets/cursor/go/commands/task.md +49 -0
- package/presets/cursor/go/commands/technical-retro.md +81 -0
- package/presets/cursor/go/hooks/README.md +8 -0
- package/presets/cursor/go/hooks/chain-team-phases.sh +381 -0
- package/presets/cursor/go/hooks/guard-shell-command.sh +79 -0
- package/presets/cursor/go/hooks.json +17 -0
- package/presets/cursor/go/mcp.json +11 -0
- package/presets/cursor/go/rules/README.md +89 -0
- package/presets/cursor/go/rules/adapters-driven.mdc +35 -0
- package/presets/cursor/go/rules/adapters-driving.mdc +36 -0
- package/presets/cursor/go/rules/agent-team-intake.mdc +20 -0
- package/presets/cursor/go/rules/agent-team-orchestrator.mdc +156 -0
- package/presets/cursor/go/rules/api-grpc.mdc +28 -0
- package/presets/cursor/go/rules/api-http.mdc +27 -0
- package/presets/cursor/go/rules/application-usecases.mdc +30 -0
- package/presets/cursor/go/rules/architecture-boundaries.mdc +30 -0
- package/presets/cursor/go/rules/code-quality-and-refactoring.mdc +73 -0
- package/presets/cursor/go/rules/code-review-mr.mdc +43 -0
- package/presets/cursor/go/rules/composition-root.mdc +29 -0
- package/presets/cursor/go/rules/design-guidance.mdc +111 -0
- package/presets/cursor/go/rules/domain-layer.mdc +33 -0
- package/presets/cursor/go/rules/feature-delivery-workflow.mdc +46 -0
- package/presets/cursor/go/rules/go-app-core.mdc +32 -0
- package/presets/cursor/go/rules/go-conventions.mdc +25 -0
- package/presets/cursor/go/rules/go-tooling.mdc +33 -0
- package/presets/cursor/go/rules/messaging-adapters.mdc +22 -0
- package/presets/cursor/go/rules/module-public-api.mdc +24 -0
- package/presets/cursor/go/rules/persistence-adapters.mdc +29 -0
- package/presets/cursor/go/rules/ports-interfaces.mdc +35 -0
- package/presets/cursor/go/rules/post-change-test.mdc +27 -0
- package/presets/cursor/go/rules/preset-layering.mdc +36 -0
- package/presets/cursor/go/rules/preset-no-cross-stack-leakage.mdc +58 -0
- package/presets/cursor/go/rules/preset-pr-checklist.mdc +39 -0
- package/presets/cursor/go/rules/preset-token-budget.mdc +41 -0
- package/presets/cursor/go/rules/preset-twin-sync.mdc +42 -0
- package/presets/cursor/go/rules/reference-features.mdc +31 -0
- package/presets/cursor/go/rules/security-go.mdc +23 -0
- package/presets/cursor/go/rules/technical-retro.mdc +14 -0
- package/presets/cursor/go/rules/tests-e2e.mdc +19 -0
- package/presets/cursor/go/rules/tests-integration.mdc +24 -0
- package/presets/cursor/go/rules/tests-unit.mdc +25 -0
- package/presets/cursor/go/skills/README.md +5 -0
- package/presets/cursor/go/skills/ci-investigation/SKILL.md +11 -0
- package/presets/cursor/go/skills/code-review/SKILL.md +16 -0
- package/presets/cursor/go/skills/debug-investigation/SKILL.md +15 -0
- package/presets/cursor/go/skills/feature-delivery/SKILL.md +26 -0
- package/presets/cursor/go/skills/integration-testing/SKILL.md +15 -0
- package/presets/cursor/go/skills/technical-retro/SKILL.md +10 -0
- package/presets/cursor/go/skills/unit-testing/SKILL.md +14 -0
- package/presets/cursor/go/team/README.md +31 -0
- package/presets/cursor/go/team/fixtures/bugfix-standard.json +37 -0
- package/presets/cursor/go/team/fixtures/feature-full.json +43 -0
- package/presets/cursor/go/team/fixtures/feature-light.json +17 -0
- package/presets/cursor/ios-swift/README.md +7 -0
- package/presets/cursor/ios-swift/agents/build-verifier.md +17 -8
- package/presets/cursor/ios-swift/agents/code-reviewer.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/agents/migration-specialist.md +4 -0
- package/presets/cursor/ios-swift/agents/performance-auditor.md +4 -0
- package/presets/cursor/ios-swift/agents/qa-tester.md +4 -0
- package/presets/cursor/ios-swift/agents/solution-architect.md +4 -0
- package/presets/cursor/ios-swift/agents/task-analyst.md +4 -0
- package/presets/cursor/ios-swift/agents/unit-test-generator.md +4 -0
- package/presets/cursor/ios-swift/agents/unit-test-healer.md +4 -0
- package/presets/cursor/ios-swift/agents/unit-test-planner.md +4 -0
- package/presets/cursor/ios-swift/rules/README.md +23 -2
- package/presets/cursor/ios-swift/rules/agent-team-intake.mdc +2 -2
- package/presets/cursor/ios-swift/rules/agent-team-orchestrator.mdc +8 -2
- package/presets/cursor/ios-swift/rules/code-quality-and-refactoring.mdc +53 -20
- package/presets/cursor/ios-swift/rules/code-review-mr.mdc +32 -0
- package/presets/cursor/ios-swift/rules/design-guidance.mdc +111 -0
- package/presets/cursor/ios-swift/rules/feature-delivery-workflow.mdc +6 -0
- package/presets/cursor/ios-swift/rules/preset-layering.mdc +36 -0
- package/presets/cursor/ios-swift/rules/preset-no-cross-stack-leakage.mdc +54 -0
- package/presets/cursor/ios-swift/rules/preset-pr-checklist.mdc +39 -0
- package/presets/cursor/ios-swift/rules/preset-token-budget.mdc +41 -0
- package/presets/cursor/ios-swift/rules/preset-twin-sync.mdc +42 -0
- package/presets/cursor/ios-swift/rules/reference-features.mdc +6 -0
- package/presets/cursor/ios-swift/rules/technical-retro.mdc +4 -2
- package/presets/cursor/ios-swift/skills/code-review/SKILL.md +4 -0
- package/presets/cursor/ios-swift/skills/debug-investigation/SKILL.md +4 -0
- package/presets/cursor/ios-swift/skills/feature-delivery/SKILL.md +4 -0
- package/presets/cursor/next/README.md +46 -0
- package/presets/cursor/next/agents/build-verifier.md +24 -0
- package/presets/cursor/next/agents/code-reviewer.md +4 -0
- package/presets/cursor/next/agents/debugger.md +4 -0
- package/presets/cursor/next/agents/feature-developer.md +4 -0
- package/presets/cursor/next/agents/migration-specialist.md +4 -0
- package/presets/cursor/next/agents/performance-auditor.md +4 -0
- package/presets/cursor/next/agents/qa-tester.md +4 -0
- package/presets/cursor/next/agents/solution-architect.md +4 -0
- package/presets/cursor/next/agents/task-analyst.md +4 -0
- package/presets/cursor/next/agents/unit-test-generator.md +4 -0
- package/presets/cursor/next/agents/unit-test-healer.md +4 -0
- package/presets/cursor/next/agents/unit-test-planner.md +4 -0
- package/presets/cursor/next/commands/README.md +1 -1
- package/presets/cursor/next/rules/README.md +21 -1
- package/presets/cursor/next/rules/agent-team-intake.mdc +2 -0
- package/presets/cursor/next/rules/agent-team-orchestrator.mdc +8 -2
- package/presets/cursor/next/rules/code-quality-and-refactoring.mdc +45 -18
- package/presets/cursor/next/rules/code-review-mr.mdc +32 -0
- package/presets/cursor/next/rules/design-guidance.mdc +111 -0
- package/presets/cursor/next/rules/feature-delivery-workflow.mdc +6 -0
- package/presets/cursor/next/rules/preset-layering.mdc +36 -0
- package/presets/cursor/next/rules/preset-no-cross-stack-leakage.mdc +54 -0
- package/presets/cursor/next/rules/preset-pr-checklist.mdc +39 -0
- package/presets/cursor/next/rules/preset-token-budget.mdc +41 -0
- package/presets/cursor/next/rules/preset-twin-sync.mdc +42 -0
- package/presets/cursor/next/rules/reference-features.mdc +6 -0
- package/presets/cursor/next/rules/technical-retro.mdc +5 -3
- package/presets/cursor/next/skills/code-review/SKILL.md +4 -0
- package/presets/cursor/next/skills/debug-investigation/SKILL.md +4 -0
- package/presets/cursor/next/skills/feature-delivery/SKILL.md +4 -0
|
@@ -66,3 +66,7 @@ Update `status.json`:
|
|
|
66
66
|
For standalone `perf-audit` intent, suggest `/technical-retro` or a follow-up `/task` to implement fixes.
|
|
67
67
|
|
|
68
68
|
Do not modify production code.
|
|
69
|
+
|
|
70
|
+
## Design guidance
|
|
71
|
+
|
|
72
|
+
- Load `design-guidance` (rule stem) when assessing structure, smells, or pattern fit.
|
|
@@ -68,3 +68,7 @@ Update `status.json`:
|
|
|
68
68
|
For `spike` intent with human gate after architect: set `"state": "awaiting_approval"` if design needs user sign-off.
|
|
69
69
|
|
|
70
70
|
Handoff: summary of design decisions and recommended next steps for developer.
|
|
71
|
+
|
|
72
|
+
## Design guidance
|
|
73
|
+
|
|
74
|
+
- Load `design-guidance` (rule stem) when assessing structure, smells, or pattern fit.
|
|
@@ -109,3 +109,7 @@ When DoR is reached and artifacts are saved:
|
|
|
109
109
|
3. **Stop** and ask the user to review artifacts. Tell them to run `/task-continue <slug>` after approval or reply with corrections.
|
|
110
110
|
|
|
111
111
|
Do not invoke the developer or any implementation subagent.
|
|
112
|
+
|
|
113
|
+
## Design guidance (optional)
|
|
114
|
+
|
|
115
|
+
- Optional: Load `design-guidance` (rule stem) when assessing structure, smells, or pattern fit — only when decomposing refactor/architecture tasks (not default).
|
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
# `.claude/rules` (preset next)
|
|
2
2
|
|
|
3
|
-
В Claude Code все `.md` под `rules/` **обнаруживаются рекурсивно**.
|
|
3
|
+
В Claude Code все `.md` под `rules/` **обнаруживаются рекурсивно**. Тела **derived** из Cursor SoT; индексы — не второй SoT.
|
|
4
|
+
|
|
5
|
+
## SoT sync
|
|
6
|
+
|
|
7
|
+
| Principle | Detail |
|
|
8
|
+
|-----------|--------|
|
|
9
|
+
| **SoT** | `presets/cursor/next/rules/*.mdc` — edit here first |
|
|
10
|
+
| **Derive** | Claude topic `.md` = body + `paths:` (from Cursor `globs:` / requestable triggers) |
|
|
11
|
+
| **Drop** | Cursor-only keys (`alwaysApply`); keep short `description` |
|
|
12
|
+
| **Checklist** | change Cursor → update Claude twin **same PR** (**FAIL** if missing — next, ios-swift, and go; see `preset-twin-sync` / build-verifier) |
|
|
13
|
+
| **Shared core** | `presets/_shared/core/**` — see `<!-- shared-core: … -->` markers; taxonomy in `_shared/README.md` |
|
|
4
14
|
|
|
5
15
|
## Loading strategy
|
|
6
16
|
|
|
7
17
|
- **Session start (no `paths:`):** ровно **3** — `next-app-core`, `package-manager`, `code-quality`
|
|
8
|
-
- **On-demand (`paths:` or via commands):** `post-change-lint` (**обязателен после правок кода**), `agent-team-intake`, `agent-team-orchestrator`, `code-review-mr`, architecture, imports, UI, tests, feature-delivery-workflow, reference-features, next-app-router, react-a11y-coding
|
|
18
|
+
- **On-demand (`paths:` or via commands):** `post-change-lint` (**обязателен после правок кода**), `agent-team-intake`, `agent-team-orchestrator`, `code-review-mr`, architecture, imports, UI, tests, feature-delivery-workflow, `design-guidance`, reference-features, next-app-router, react-a11y-coding, `technical-retro`, **preset-*** meta (paths on `packages/ai-rules/presets/**`)
|
|
9
19
|
- **Skills:** long workflows (`feature-delivery`, `code-review`, …)
|
|
10
20
|
|
|
11
21
|
### UI edit bundle (consolidated paths)
|
|
@@ -21,27 +31,70 @@
|
|
|
21
31
|
|
|
22
32
|
**Не грузятся на типичный UI edit:** `architecture/architecture-boundaries.md` (api/store/types/lib), `architecture/layer-barrel-exports.md` (только `index.ts`), `stack/navigation-router.md` (только `app/src/app/**`). Стили колокации — в `react-ui.md` (не отдельный stub).
|
|
23
33
|
|
|
24
|
-
##
|
|
34
|
+
## Cursor → Claude mapping
|
|
25
35
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
-
|
|
36
|
+
| Cursor `.mdc` (SoT) | Claude topic |
|
|
37
|
+
|---------------------|--------------|
|
|
38
|
+
| `next-app-core.mdc` | `stack/next-app-core.md` |
|
|
39
|
+
| `package-manager.mdc` | `tooling-and-review/package-manager.md` |
|
|
40
|
+
| `code-quality-and-refactoring.mdc` | `tooling-and-review/code-quality.md` |
|
|
41
|
+
| `design-guidance.mdc` | `tooling-and-review/design-guidance.md` |
|
|
42
|
+
| `next-app-router.mdc` | `stack/next-app-router.md` |
|
|
43
|
+
| `arrow-functions.mdc` | `stack/arrow-functions.md` |
|
|
44
|
+
| `types-jsdoc.mdc` | `stack/types-jsdoc.md` |
|
|
45
|
+
| `no-type-assertion-as-import-export.mdc` | `stack/no-type-assertion.md` |
|
|
46
|
+
| `navigation-router-stack.mdc` | `stack/navigation-router.md` |
|
|
47
|
+
| `navigation-router-ui.mdc` | `stack/navigation-router-ui.md` |
|
|
48
|
+
| `architecture-boundaries.mdc` | `architecture/architecture-boundaries.md` |
|
|
49
|
+
| `architecture-boundaries-ui.mdc` | `architecture/architecture-boundaries-ui.md` |
|
|
50
|
+
| `feature-delivery-workflow.mdc` | `architecture/feature-delivery-workflow.md` |
|
|
51
|
+
| `reference-features.mdc` | `architecture/reference-features.md` |
|
|
52
|
+
| `public-imports.mdc` | `architecture/public-imports.md` |
|
|
53
|
+
| `layer-barrel-exports.mdc` | `architecture/layer-barrel-exports.md` |
|
|
54
|
+
| `api-services.mdc` | `api-and-data/api-services.md` |
|
|
55
|
+
| `http-client.mdc` | `api-and-data/http-client.md` |
|
|
56
|
+
| `store-rtk.mdc` | `api-and-data/store-rtk.md` |
|
|
57
|
+
| `react-ui.mdc` | `ui-and-accessibility/react-ui.md` |
|
|
58
|
+
| `react-a11y-coding.mdc` | `ui-and-accessibility/react-a11y-coding.md` |
|
|
59
|
+
| `no-props-spread.mdc` | `ui-and-accessibility/no-props-spread.md` |
|
|
60
|
+
| `css-property-order-stylelint.mdc` | `ui-and-accessibility/css-property-order.md` |
|
|
61
|
+
| `tests-unit.mdc` | `testing/tests-unit.md` |
|
|
62
|
+
| `tests-e2e-structure.mdc` | `testing/tests-e2e-structure.md` |
|
|
63
|
+
| `playwright-agents.mdc` | `testing/playwright-agents.md` |
|
|
64
|
+
| `post-change-lint.mdc` | `tooling-and-review/post-change-lint.md` |
|
|
65
|
+
| `code-review-mr.mdc` | `tooling-and-review/code-review-mr.md` |
|
|
66
|
+
| `agent-team-intake.mdc` | `tooling-and-review/agent-team-intake.md` |
|
|
67
|
+
| `agent-team-orchestrator.mdc` | `tooling-and-review/agent-team-orchestrator.md` |
|
|
68
|
+
| `technical-retro.mdc` | `tooling-and-review/technical-retro.md` |
|
|
69
|
+
| `preset-layering.mdc` | `tooling-and-review/preset-layering.md` |
|
|
70
|
+
| `preset-twin-sync.mdc` | `tooling-and-review/preset-twin-sync.md` |
|
|
71
|
+
| `preset-token-budget.mdc` | `tooling-and-review/preset-token-budget.md` |
|
|
72
|
+
| `preset-pr-checklist.mdc` | `tooling-and-review/preset-pr-checklist.md` |
|
|
73
|
+
| `preset-no-cross-stack-leakage.mdc` | `tooling-and-review/preset-no-cross-stack-leakage.md` |
|
|
29
74
|
|
|
30
|
-
##
|
|
75
|
+
## Core → stack mapping
|
|
31
76
|
|
|
32
|
-
|
|
|
33
|
-
|
|
34
|
-
| `
|
|
35
|
-
| `
|
|
36
|
-
| `
|
|
37
|
-
| `
|
|
38
|
-
| `architecture/
|
|
39
|
-
| `architecture/
|
|
40
|
-
| `
|
|
41
|
-
| `
|
|
42
|
-
| `
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
77
|
+
| Shared core | Cursor adapter | Notes |
|
|
78
|
+
|-------------|----------------|-------|
|
|
79
|
+
| `quality/code-quality-and-refactoring.md` | `code-quality-and-refactoring.mdc` / `code-quality.md` | + Stack notes (ESLint/CSS) |
|
|
80
|
+
| `quality/design-guidance.md` | `design-guidance.mdc` / `design-guidance.md` | requestable smells/GoF |
|
|
81
|
+
| `agent-team/agent-team-orchestrator.md` | `agent-team-orchestrator.mdc` | Roles in Stack notes |
|
|
82
|
+
| `agent-team/agent-team-intake.md` | `agent-team-intake.mdc` | thin alias |
|
|
83
|
+
| `architecture/feature-delivery-workflow.md` | `feature-delivery-workflow.mdc` | Next layer checklist in Stack notes |
|
|
84
|
+
| `architecture/reference-features.template.md` | `reference-features.mdc` | path table in Stack notes |
|
|
85
|
+
| `review/code-review-mr.md` | `code-review-mr.mdc` | Next checklist refs |
|
|
86
|
+
| `review/technical-retro.md` | `technical-retro.mdc` | thin alias |
|
|
87
|
+
| `meta/preset-*.md` | `preset-*.mdc` | author globs only |
|
|
88
|
+
|
|
89
|
+
## Folders
|
|
90
|
+
|
|
91
|
+
| Папка | О чём |
|
|
92
|
+
|-------|--------|
|
|
93
|
+
| `stack/` | Next core, router, conventions |
|
|
94
|
+
| `architecture/` | Границы, feature-delivery, reference-features, imports |
|
|
95
|
+
| `api-and-data/` | HTTP, services, store |
|
|
96
|
+
| `testing/` | Unit, e2e, Playwright |
|
|
97
|
+
| `ui-and-accessibility/` | React UI, a11y, props |
|
|
98
|
+
| `tooling-and-review/` | Quality, review, lint, agent-team, retro, **preset meta** |
|
|
46
99
|
|
|
47
100
|
**Коллизии:** импорт типов и API — **`architecture/public-imports.md`**.
|
|
@@ -6,6 +6,9 @@ paths:
|
|
|
6
6
|
- app/src/types/**/*
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
+
<!-- shared-core: architecture/feature-delivery-workflow.md -->
|
|
10
|
+
|
|
11
|
+
|
|
9
12
|
# Доставка фичи (сквозной порядок)
|
|
10
13
|
|
|
11
14
|
Типичная фича с данными с backend и общим состоянием. Детали слоёв — `architecture/architecture-boundaries.md`, `stack/next-app-core.md`.
|
|
@@ -64,6 +67,8 @@ flowchart LR
|
|
|
64
67
|
- HTTP-клиент из компонента/thunk в обход сервиса.
|
|
65
68
|
- Deep-import `@/api/services/**` из UI/store.
|
|
66
69
|
- `{...props}` — `ui-and-accessibility/no-props-spread.md`.
|
|
70
|
+
- **Ubiquitous language:** имена Domain/типов отражают предметную область фичи — не смешивать транспорт/фреймворк-термины в домен без нужды.
|
|
71
|
+
- Load `design-guidance` (rule stem) when assessing structure, smells, or pattern fit.
|
|
67
72
|
|
|
68
73
|
## Матрица: зона → правила
|
|
69
74
|
|
|
@@ -6,10 +6,15 @@ paths:
|
|
|
6
6
|
- app/src/types/**/*
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
+
<!-- shared-core: architecture/reference-features.template.md -->
|
|
10
|
+
|
|
11
|
+
|
|
9
12
|
# Эталонные фичи (reference features)
|
|
10
13
|
|
|
11
14
|
Перед реализацией найди фичу того же типа и **повтори её структуру**, не изобретая новую организацию файлов.
|
|
12
15
|
|
|
16
|
+
Taxonomy / shared core: [`presets/_shared/README.md`](../../../../_shared/README.md) · [Preset contribution guide](../../../../docs/PRESET-CONTRIBUTION.md).
|
|
17
|
+
|
|
13
18
|
## Таблица эталонов
|
|
14
19
|
|
|
15
20
|
Замени **TBD** на реальные пути после договорённости в команде (или при `ai-rules init` в целевом репо):
|
|
@@ -4,6 +4,8 @@ paths:
|
|
|
4
4
|
- .claude/team/**/*
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
+
<!-- shared-core: agent-team/agent-team-intake.md -->
|
|
8
|
+
|
|
7
9
|
# Agent team intake
|
|
8
10
|
|
|
9
11
|
When the user message looks like a **work request** (implement, add, fix, refactor, review MR, write tests, spike) — not a question about how code works:
|
|
@@ -5,6 +5,9 @@ paths:
|
|
|
5
5
|
- .claude/agents/**/*
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
+
<!-- shared-core: agent-team/agent-team-orchestrator.md -->
|
|
9
|
+
|
|
10
|
+
|
|
8
11
|
# Agent team orchestrator
|
|
9
12
|
|
|
10
13
|
Parent agent = **manager**. Router plans; specialists execute. Artifacts: `.claude/team/tasks/<slug>/`.
|
|
@@ -153,3 +156,7 @@ Borderline work requests — см. **`tooling-and-review/agent-team-intake.md`**
|
|
|
153
156
|
## Auto-detection (optional)
|
|
154
157
|
|
|
155
158
|
When user describes a **non-trivial task** (not a question), suggest `/task <message>` or run router if they agree.
|
|
159
|
+
|
|
160
|
+
## Preset authoring
|
|
161
|
+
|
|
162
|
+
When editing `packages/ai-rules/presets/**`, follow **`tooling-and-review/preset-pr-checklist.md`** (+ twin-sync / layering / token-budget / leakage).
|
|
@@ -1,42 +1,70 @@
|
|
|
1
|
-
|
|
1
|
+
---
|
|
2
|
+
description: Поддержка и улучшение качества кода и архитектуры
|
|
3
|
+
---
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
<!-- shared-core: quality/code-quality-and-refactoring.md -->
|
|
6
|
+
|
|
7
|
+
# Поддержка существующего стиля
|
|
4
8
|
|
|
5
9
|
- Новые изменения должны:
|
|
6
|
-
- следовать существующим паттернам (имена, структура, типизация);
|
|
10
|
+
- следовать существующим паттернам (имена, структура, типизация / DI / error handling стека);
|
|
7
11
|
- минимизировать «стилистический шум» (лишние правки форматирования, rename без нужды).
|
|
8
12
|
- Перед добавлением нового решения:
|
|
9
13
|
- искать аналогичное в коде и **повторять подход**, а не изобретать новый;
|
|
10
|
-
- проверять, нет ли уже подходящего компонента или паттерна в
|
|
11
|
-
- использовать при обращении к чужим модулям только их **public API** (
|
|
14
|
+
- проверять, нет ли уже подходящего компонента или паттерна в дизайн‑системе / UI‑пакетах проекта, прежде чем добавлять новый кастомный контрол;
|
|
15
|
+
- использовать при обращении к чужим модулям только их **public API** (barrel / протоколы / facades), а deep‑импорты внутренних файлов рассматривать как повод для рефакторинга.
|
|
16
|
+
|
|
17
|
+
# Принципы
|
|
12
18
|
|
|
13
|
-
|
|
19
|
+
- **KISS:** выбирать самое простое изменение, которое совпадает с паттернами репозитория; не изобретать новый стиль «с нуля».
|
|
20
|
+
- **DRY + Rule of Three:** устранять дублирование логики; выносить общее **только после 3-го** повторения — ошибочная абстракция дороже дублирования.
|
|
21
|
+
- **YAGNI:** не добавлять API, флаги, слои и обобщения «на будущее» без текущего требования.
|
|
22
|
+
- **SOLID** (agent-actionable, не эссе):
|
|
23
|
+
- **S** — один модуль / один повод менять; дробить god-файлы в рамках лёгкого refactor.
|
|
24
|
+
- **O** — расширять через композицию/новые реализации, не раздувая существующие ветки «на всякий случай».
|
|
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 модуля.
|
|
36
|
+
|
|
37
|
+
# Рефакторинг при изменениях
|
|
14
38
|
|
|
15
39
|
- Разрешён лёгкий refactor, если он:
|
|
16
40
|
- уменьшает дублирование;
|
|
17
41
|
- повышает читаемость;
|
|
18
42
|
- не ломает публичные контракты модулей.
|
|
19
|
-
- Примеры допустимых
|
|
20
|
-
- вынести дублирующуюся логику в
|
|
21
|
-
-
|
|
22
|
-
- разделить слишком крупный
|
|
23
|
-
- заменить локальные «магические»
|
|
43
|
+
- Примеры допустимых улучшений (абстрактно):
|
|
44
|
+
- вынести дублирующуюся логику в общую утилиту / хук / mapper / use case;
|
|
45
|
+
- сузить небезопасные типы и unsafe-операции стека;
|
|
46
|
+
- разделить слишком крупный модуль на несколько более простых;
|
|
47
|
+
- заменить локальные «магические» значения на токены/примитивы дизайн‑системы;
|
|
24
48
|
- заменить deep‑импорты внутренних файлов других модулей на обращения к их public API.
|
|
25
49
|
|
|
26
|
-
|
|
50
|
+
# Ограничения
|
|
27
51
|
|
|
28
52
|
- Не выполнять «большой» рефакторинг, если задача точечная и не про архитектуру:
|
|
29
|
-
- не менять структуру
|
|
30
|
-
- не менять названия публичных
|
|
53
|
+
- не менять структуру директорий / модулей / таргетов без нужды;
|
|
54
|
+
- не менять названия публичных типов/функций/API без явного запроса.
|
|
31
55
|
- При необходимости крупного изменения:
|
|
32
56
|
- сначала локально улучшить архитектуру минимальными шагами;
|
|
33
|
-
- оставить код в консистентном состоянии.
|
|
34
|
-
|
|
35
|
-
## Линтеры
|
|
57
|
+
- оставить код в консистентном (собираемом) состоянии.
|
|
36
58
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
## Требование к агенту
|
|
59
|
+
# Требование к агенту
|
|
40
60
|
|
|
41
61
|
- **Boy scout rule:** оставлять модуль немного лучше, чем до изменения (простые, безопасные улучшения).
|
|
42
62
|
- Не жертвовать архитектурой и слоями ради краткости реализации.
|
|
63
|
+
|
|
64
|
+
> Stack-specific lint gates, примеры и toolchain — в секции **Stack notes** адаптера пресета.
|
|
65
|
+
|
|
66
|
+
## Stack notes
|
|
67
|
+
|
|
68
|
+
- Public API: index/barrel‑файлы (`architecture/public-imports.md`, `architecture/layer-barrel-exports.md`).
|
|
69
|
+
- Примеры: общий хук/утилита; `any`/`unknown`; разделение компонента; CSS‑токены.
|
|
70
|
+
- Lint/stylelint — только **`tooling-and-review/post-change-lint.md`**; ESLint: `app/eslint.config.mjs`. `eslint-disable` — точечно с комментарием «зачем».
|
|
@@ -6,25 +6,34 @@ paths:
|
|
|
6
6
|
- .claude/team/**/review.md
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
+
<!-- shared-core: review/code-review-mr.md -->
|
|
10
|
+
|
|
9
11
|
# Code review merge requests
|
|
10
12
|
|
|
11
13
|
On-demand rule for review flows. **Procedure and output format:** skill `code-review`.
|
|
12
14
|
|
|
13
|
-
## Checklist references
|
|
14
|
-
|
|
15
|
-
- Architecture layers: `architecture/architecture-boundaries.md`, `stack/next-app-core.md`; network: `api-and-data/http-client.md`
|
|
16
|
-
- Imports: `architecture/public-imports.md`, `architecture/layer-barrel-exports.md`
|
|
17
|
-
- UI: `ui-and-accessibility/react-ui.md`
|
|
18
|
-
- Tests: `testing/tests-unit.md`, `testing/playwright-agents.md`, `testing/tests-e2e-structure.md`
|
|
19
|
-
- Lint gate before final report: `tooling-and-review/post-change-lint.md`
|
|
20
|
-
|
|
21
15
|
## When to load
|
|
22
16
|
|
|
23
17
|
- User asks for review/MR/diff
|
|
24
18
|
- Pipeline step `code-reviewer`
|
|
19
|
+
- Platform automated review (e.g. BUGBOT) when present
|
|
20
|
+
|
|
21
|
+
## Checklist references (abstract)
|
|
22
|
+
|
|
23
|
+
- Architecture layers and stack core rules
|
|
24
|
+
- Public imports / module boundaries
|
|
25
|
+
- UI conventions of the stack
|
|
26
|
+
- Unit and e2e/UI test conventions
|
|
27
|
+
- Post-change lint/build gate before final report
|
|
28
|
+
- Design smells **in MR diff scope** — load `design-guidance`; не разворачивать полный каталог Fowler вне диффа
|
|
29
|
+
- Pattern name (GoF) — только если репозиторий уже использует эту форму или match минимален
|
|
30
|
+
- Principles (KISS / DRY+Ro3 / YAGNI / SOLID / CUPID) — через always-on `code-quality-and-refactoring`, не дублировать эссе в review
|
|
31
|
+
|
|
32
|
+
Concrete rule stems — in **Stack notes**.
|
|
25
33
|
|
|
26
34
|
## Constraints
|
|
27
35
|
|
|
28
36
|
- Focus on MR diff, not the whole repo.
|
|
29
37
|
- Use local `git diff` — do not invent hosting metadata.
|
|
30
38
|
- Boy scout rule: suggest fixes feasible within the MR scope.
|
|
39
|
+
- No «большие рефакторинги» without an explicit request (`code-quality-and-refactoring`).
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Design smells (Fowler) and curated GoF patterns for agents. Load when assessing structure, smells, or pattern fit.
|
|
3
|
+
paths:
|
|
4
|
+
- app/src/**/*.{ts,tsx}
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<!-- shared-core: quality/design-guidance.md -->
|
|
8
|
+
|
|
9
|
+
# Design guidance (smells & patterns)
|
|
10
|
+
|
|
11
|
+
Словарь **code smells** (Fowler) и **design patterns** (GoF) для агентов при implement / review / debug.
|
|
12
|
+
|
|
13
|
+
Применять только в scope задачи или MR. Лёгкий refactor — да; «большой» rewrite без явного запроса — нет.
|
|
14
|
+
|
|
15
|
+
Называть паттерн **только если** репозиторий уже так делает или это минимальный match. Иначе — extract/split/move без ярлыка GoF.
|
|
16
|
+
|
|
17
|
+
Не заменяет always-on Principles в `code-quality-and-refactoring` (KISS, DRY + Rule of Three, YAGNI, SOLID, CUPID, composition, Demeter).
|
|
18
|
+
|
|
19
|
+
## When to load
|
|
20
|
+
|
|
21
|
+
- **Feature delivery / implement** — оценка структуры модулей, границ и дублирования.
|
|
22
|
+
- **Code review** — smells и pattern fit **в диффе MR**, не по всему репо.
|
|
23
|
+
- **Debug** — root-cause похож на wrong abstraction, Feature Envy, Message Chains, Shotgun Surgery.
|
|
24
|
+
- **Light refactor only** — улучшения в рамках boy-scout / MR scope; не расширять задачу ради каталога.
|
|
25
|
+
|
|
26
|
+
Агенты и skills подгружают stem по one-liner wiring — не копировать этот каталог в промпт агента.
|
|
27
|
+
|
|
28
|
+
## How to use (agent rules of thumb)
|
|
29
|
+
|
|
30
|
+
1. Сначала сверить с Principles (always-on): проще ли решение, нет ли ранней абстракции, соблюдён ли public API.
|
|
31
|
+
2. Затем отметить smells **в изменённых файлах** задачи/MR; предложить fix только если он укладывается в light refactor.
|
|
32
|
+
3. Паттерн GoF — опциональный ярлык после того, как структура уже ясна; не начинать дизайн с выбора паттерна.
|
|
33
|
+
4. Если smell и паттерн конфликтуют с границами слоёв стека — побеждают stack boundaries и existing repo patterns.
|
|
34
|
+
5. Не требовать переименования «под GoF», если поведение уже корректно и читаемо.
|
|
35
|
+
|
|
36
|
+
## Code smells (Fowler, curated ≤12)
|
|
37
|
+
|
|
38
|
+
Таблица: smell → detect hint → fix hint (одна линия каждый). Без механических меню рефакторинга.
|
|
39
|
+
|
|
40
|
+
| # | Smell | Detect | Fix hint |
|
|
41
|
+
|---|-------|--------|----------|
|
|
42
|
+
| 1 | Duplicate Code | одинаковая логика в ≥2 местах | dedupe после Rule of Three |
|
|
43
|
+
| 2 | Long Method / Long Module | единица делает слишком много | extract в рамках scope; без big rewrite |
|
|
44
|
+
| 3 | Feature Envy | метод чаще трогает чужие данные, чем свои | сдвинуть логику к данным / public API |
|
|
45
|
+
| 4 | Data Clumps | одни и те же группы аргументов кочуют вместе | сгруппировать в type / value object |
|
|
46
|
+
| 5 | Primitive Obsession | сырые string/int вместо доменных понятий | typed ids / value objects при нужде домена |
|
|
47
|
+
| 6 | Speculative Generality | неиспользуемые хуки, флаги, абстракции «на будущее» | удалить (YAGNI) |
|
|
48
|
+
| 7 | Message Chains | цепочки `a.b.c.d` | Demeter; facade / public API модуля |
|
|
49
|
+
| 8 | Middle Man | класс почти только прокидывает вызовы | убрать pass-through **или** оставить как boundary |
|
|
50
|
+
| 9 | Divergent Change | один модуль меняется по разным причинам | split по поводам изменения |
|
|
51
|
+
| 10 | Shotgun Surgery | одно смысловое изменение разъезжается по многим файлам | consolidate ответственность |
|
|
52
|
+
| 11 | Inappropriate Intimacy | доступ к чужим internals / private деталям | только public API / ports / facades |
|
|
53
|
+
| 12 | Refused Bequest / Parallel Inheritance | подтип игнорирует базу; зеркальные иерархии классов | composition; не плодить параллельные деревья |
|
|
54
|
+
|
|
55
|
+
**Skip Fowler (не в core):** Lazy Class, Incomplete Library Class, Comments-as-smell dogma, полный каталог 70+, пошаговые recipe-меню.
|
|
56
|
+
|
|
57
|
+
Приоритет при конфликте smells: Inappropriate Intimacy и Message Chains (границы модулей) > Duplicate Code (после Rule of Three) > Long Method внутри уже правильного модуля.
|
|
58
|
+
|
|
59
|
+
## Design patterns (GoF, curated ≤8)
|
|
60
|
+
|
|
61
|
+
Suggest only when repo already uses the shape or the match is minimal. Prefer extract-function over naming Strategy ради ярлыка.
|
|
62
|
+
|
|
63
|
+
Паттерны ниже — **разрешённый минимум** для агентов; остальной GoF по умолчанию в Skip.
|
|
64
|
+
|
|
65
|
+
| Pattern | When to suggest | Anti-trigger |
|
|
66
|
+
|---------|-----------------|--------------|
|
|
67
|
+
| Strategy | взаимозаменяемые алгоритмы уже (или явно скоро) выбираются политикой | один алгоритм без ветвления политики |
|
|
68
|
+
| Adapter | обернуть внешний / чужой API под локальный port | лишняя обёртка вокруг своего же API |
|
|
69
|
+
| Facade | упростить multi-step subsystem за public API | facade превращается в god-object |
|
|
70
|
+
| Factory Method | полиморфное создание уже принято в стиле репо | factory на каждый тривиальный `new` |
|
|
71
|
+
| Decorator | аддитивное поведение без взрыва subclass-иерархий | decorator «для слоёв» без реальной нужды |
|
|
72
|
+
| Observer | events / subscriptions уже есть в архитектуре | самодельный pub/sub без прецедента в репо |
|
|
73
|
+
| Template Method | общий algorithm skeleton + вариативные hooks | наследование ради пары отличающихся строк |
|
|
74
|
+
| Composite | дерево однородных узлов (UI/domain), как уже в репо | Composite на плоский список без иерархии |
|
|
75
|
+
|
|
76
|
+
Если сомневаешься между двумя паттернами — выбери более простой extract/compose без имени; ярлык можно добавить на review, если репо уже так говорит.
|
|
77
|
+
|
|
78
|
+
## Skip / avoid by default
|
|
79
|
+
|
|
80
|
+
| Catalog | Skip |
|
|
81
|
+
|---------|------|
|
|
82
|
+
| GoF | Singleton, Abstract Factory, Flyweight, Memento, Interpreter, Visitor, Bridge, Prototype |
|
|
83
|
+
| GoF (conditional) | Command, Chain of Responsibility, State — упоминать **только если** репо уже использует |
|
|
84
|
+
| Fowler | всё сверх 12 smells выше |
|
|
85
|
+
| DDD | Aggregates, bounded-context maps, event sourcing, CQRS — **не в core** |
|
|
86
|
+
| DDD (pointer) | ubiquitous language anti-pattern — расширять в `feature-delivery-workflow`, не здесь |
|
|
87
|
+
| GRASP | список Larman как отдельные правила — skip (перекрывается SOLID/CUPID) |
|
|
88
|
+
| Clean Code dogma | жёсткие caps на строки функции / «ровно один assert» — skip |
|
|
89
|
+
|
|
90
|
+
Не вводить второй stem (`refactoring-smells` / `design-patterns-for-agents`) — один каталог: `design-guidance`.
|
|
91
|
+
|
|
92
|
+
## Out of scope for this stem
|
|
93
|
+
|
|
94
|
+
- Полный GoF (23) и полный Fowler catalog.
|
|
95
|
+
- Stack-specific рецепты (пути модулей, lint-команды) — только в **Stack notes** адаптера.
|
|
96
|
+
- Security, a11y, perf — отдельные review-правила; здесь только структурные smells/patterns.
|
|
97
|
+
- Четвёртое always-on правило — запрещено; этот stem только requestable / agent-load.
|
|
98
|
+
|
|
99
|
+
## Cross-refs
|
|
100
|
+
|
|
101
|
+
- Always-on Principles: `code-quality-and-refactoring`.
|
|
102
|
+
- DIP / ports vs adapters: stack `architecture-boundaries` (детали стека — в Stack notes адаптеров).
|
|
103
|
+
- Ubiquitous language: `feature-delivery-workflow` (lineage).
|
|
104
|
+
- MR checklist (smells in scope; pattern name only if repo uses it): `code-review-mr`.
|
|
105
|
+
- Token / twin policy for authors: `preset-token-budget`, `preset-twin-sync` (meta, not consumer always-on).
|
|
106
|
+
|
|
107
|
+
## Stack notes
|
|
108
|
+
|
|
109
|
+
- Prefer hooks/mappers over HOC or new pattern names when the repo already extracts that way.
|
|
110
|
+
- Suggest Strategy/Adapter only when ports or policy branching already exist in `app/src/**`.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Preset authoring: Core → Stack → Platform layering. Use when editing packages/ai-rules/presets/**.
|
|
3
|
+
paths:
|
|
4
|
+
- packages/ai-rules/presets/**/*
|
|
5
|
+
- .claude/**/*
|
|
6
|
+
- .cursor/rules/**/*
|
|
7
|
+
- .cursor/team/tasks/**/*
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
<!-- shared-core: meta/preset-layering.md -->
|
|
11
|
+
|
|
12
|
+
# Preset layering
|
|
13
|
+
|
|
14
|
+
Правила для **авторов пресетов** (`packages/ai-rules/presets/**`). Не always-on в consumer apps.
|
|
15
|
+
|
|
16
|
+
## Слои
|
|
17
|
+
|
|
18
|
+
| Слой | Где | Что класть |
|
|
19
|
+
|------|-----|------------|
|
|
20
|
+
| **Core** | `presets/_shared/core/**` | Stack-agnostic prose + checklists; без frontmatter; без путей `app/**`, `Features/**`, Playwright, xcodebuild |
|
|
21
|
+
| **Stack** | `presets/{cursor\|claude}/<stack>/` | Domain/tooling, always-on trio стека, stack examples в **Stack notes** |
|
|
22
|
+
| **Platform** | Cursor `.mdc` / Claude `.md` | Frontmatter (`alwaysApply`/`globs` vs `paths:`), platform-only (`BUGBOT.md`, `CLAUDE.md`) |
|
|
23
|
+
|
|
24
|
+
## Куда класть новое правило
|
|
25
|
+
|
|
26
|
+
1. Общие принципы для всех стеков → **core** + адаптеры с `<!-- shared-core: … -->`.
|
|
27
|
+
2. Только один из installable стеков (`next` / `ios-swift` / `go`) → **stack-specific** (не в `_shared`).
|
|
28
|
+
3. Только Cursor или только Claude packaging → platform artifact / frontmatter, не дублировать семантику.
|
|
29
|
+
|
|
30
|
+
## SoT
|
|
31
|
+
|
|
32
|
+
- Packages path — SoT; root `.cursor/` — dogfood sync.
|
|
33
|
+
- Per stack: **Cursor** `presets/cursor/<stack>/` → Claude twin same PR.
|
|
34
|
+
- `_shared` **не** `--preset` и не копируется CLI `init`.
|
|
35
|
+
|
|
36
|
+
См. также: `preset-twin-sync`, `preset-token-budget`, `preset-pr-checklist`, `preset-no-cross-stack-leakage`.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Preset authoring: forbid cross-stack agent/path leakage in hooks and agents.
|
|
3
|
+
paths:
|
|
4
|
+
- packages/ai-rules/presets/**/*
|
|
5
|
+
- .claude/**/*
|
|
6
|
+
- .cursor/rules/**/*
|
|
7
|
+
- .cursor/team/tasks/**/*
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
<!-- shared-core: meta/preset-no-cross-stack-leakage.md -->
|
|
11
|
+
|
|
12
|
+
# Preset no cross-stack leakage
|
|
13
|
+
|
|
14
|
+
Запрет протекания stack-specific имён, путей и handoff stems между пресетами.
|
|
15
|
+
|
|
16
|
+
## Principles
|
|
17
|
+
|
|
18
|
+
- `next` must not require iOS-only agents/tooling (`xcuitest-*`, `xcodebuild` as required handoff, Keychain-only rules).
|
|
19
|
+
- `ios-swift` must not ship Playwright handoffs or Next lint recipes as required commands.
|
|
20
|
+
- `go` must not ship Playwright, XCUITest, Next lint recipes, or `xcodebuild`/`SwiftLint` as required handoffs.
|
|
21
|
+
- Shared core must not embed stack paths (`app/src/**`, `Features/**`, `playwright`, `xcodebuild`).
|
|
22
|
+
|
|
23
|
+
## Forbidden in ios-swift hooks/agents (FAIL)
|
|
24
|
+
|
|
25
|
+
In ios-swift `chain-team-phases.sh` / agent handoffs (Cursor + Claude):
|
|
26
|
+
|
|
27
|
+
- `playwright-test-`, `playwright-agents`, `playwright-e2e`, `user-playwright`
|
|
28
|
+
- `app/__tests__/e2e` as a required path
|
|
29
|
+
- Positive yarn recipes `lint:js` / `lint:css` as commands to run (negation prose alone is weak — prefer zero occurrences)
|
|
30
|
+
|
|
31
|
+
Required instead: `xcuitest-test-*` stems; build-verifier mentions `xcodebuild` or `post-change-build` / `xcode-tooling`.
|
|
32
|
+
|
|
33
|
+
## Forbidden in next hooks/agents (FAIL when present as required)
|
|
34
|
+
|
|
35
|
+
- `xcuitest-test-` as handoff stems
|
|
36
|
+
- Requiring `xcodebuild` / SwiftLint as the default post-change gate for Next app work
|
|
37
|
+
|
|
38
|
+
## Forbidden in go hooks/agents (FAIL)
|
|
39
|
+
|
|
40
|
+
- `playwright-test-`, `playwright-e2e`, `user-playwright`, `app/__tests__/e2e`
|
|
41
|
+
- Positive yarn recipes `lint:js` / `lint:css`
|
|
42
|
+
- `xcuitest-test-`, `xcodebuild`, `SwiftLint` as required handoffs
|
|
43
|
+
- Agent file `accessibility-reviewer` (no UI surface)
|
|
44
|
+
|
|
45
|
+
Required instead: `integration-test-*`; build-verifier / `post-change-test` / `go-tooling` (`go test`, `go vet`).
|
|
46
|
+
|
|
47
|
+
## Soft / document
|
|
48
|
+
|
|
49
|
+
- Mentioning the other stack in **docs** comparing presets is OK.
|
|
50
|
+
- `build-verifier` may reference other stacks when validating **preset packaging** (`scope: preset-structure-validation`).
|
|
51
|
+
|
|
52
|
+
## Chain fork
|
|
53
|
+
|
|
54
|
+
`hooks/chain-team-phases.sh` must differ **byte-wise** pairwise among `next`, `ios-swift`, and `go` (per platform).
|