@bonesofspring/ai-rules 0.2.6 → 0.2.8
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 +65 -1
- package/README.md +13 -5
- package/bin/cli.js +30 -1
- package/package.json +3 -2
- package/presets/_shared/README.md +1 -1
- package/presets/_shared/core/agent-team/agent-team-intake.md +1 -1
- package/presets/_shared/core/agent-team/agent-team-orchestrator.md +1 -1
- package/presets/_shared/core/architecture/reference-features.template.md +12 -0
- package/presets/_shared/core/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/code-quality-and-refactoring.md +11 -0
- package/presets/_shared/core/review/code-review-mr.md +9 -0
- package/presets/claude/go/CLAUDE.md +5 -1
- package/presets/claude/go/README.md +5 -1
- package/presets/claude/go/REPO_AGENTS.md +48 -0
- package/presets/claude/go/agents/README.md +19 -2
- package/presets/claude/go/agents/build-verifier.md +6 -1
- package/presets/claude/go/agents/codebase-analyzer.md +28 -0
- package/presets/claude/go/agents/feature-developer.md +13 -0
- package/presets/claude/go/hooks/README.md +6 -0
- package/presets/claude/go/hooks/examples/README.md +18 -0
- package/presets/claude/go/hooks/examples/format-edited.example.sh +9 -0
- package/presets/claude/go/hooks/examples/secret-guard.example.sh +10 -0
- package/presets/claude/go/hooks/examples/test-on-save.example.sh +11 -0
- package/presets/claude/go/rules/api-and-data/api-http.md +10 -3
- package/presets/claude/go/rules/architecture/reference-features.md +4 -0
- package/presets/claude/go/rules/stack/go-conventions.md +30 -3
- package/presets/claude/go/rules/tooling-and-review/agent-team-intake.md +1 -1
- package/presets/claude/go/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
- package/presets/claude/go/rules/tooling-and-review/code-quality.md +12 -1
- package/presets/claude/go/rules/tooling-and-review/code-review.md +9 -0
- package/presets/claude/go/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/skills/README.md +2 -2
- package/presets/claude/go/skills/code-review/SKILL.md +11 -2
- package/presets/claude/go/skills/feature-delivery/SKILL.md +4 -0
- package/presets/claude/go/skills/technical-retro/SKILL.md +46 -2
- package/presets/claude/go/skills/write-adr/SKILL.md +41 -0
- package/presets/claude/go/team/conventions.md +21 -0
- package/presets/claude/go/team/fixtures/feature-full.json +5 -23
- package/presets/claude/ios-swift/CLAUDE.md +4 -1
- package/presets/claude/ios-swift/README.md +5 -1
- package/presets/claude/ios-swift/REPO_AGENTS.md +46 -0
- package/presets/claude/ios-swift/agents/README.md +3 -2
- package/presets/claude/ios-swift/agents/build-verifier.md +7 -2
- package/presets/claude/ios-swift/agents/codebase-analyzer.md +28 -0
- package/presets/claude/ios-swift/agents/feature-developer.md +13 -0
- package/presets/claude/ios-swift/hooks/README.md +6 -0
- package/presets/claude/ios-swift/hooks/examples/README.md +18 -0
- package/presets/claude/ios-swift/hooks/examples/format-edited.example.sh +13 -0
- package/presets/claude/ios-swift/hooks/examples/secret-guard.example.sh +10 -0
- package/presets/claude/ios-swift/hooks/examples/test-on-save.example.sh +8 -0
- package/presets/claude/ios-swift/rules/architecture/reference-features.md +4 -0
- package/presets/claude/ios-swift/rules/stack/ios-app-core.md +5 -28
- package/presets/claude/ios-swift/rules/stack/swift-conventions.md +12 -2
- package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-intake.md +1 -1
- package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
- package/presets/claude/ios-swift/rules/tooling-and-review/code-quality.md +12 -1
- package/presets/claude/ios-swift/rules/tooling-and-review/code-review.md +47 -0
- package/presets/claude/ios-swift/rules/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/ios-swift/rules/ui-and-accessibility/swiftui.md +8 -0
- package/presets/claude/ios-swift/skills/README.md +1 -0
- package/presets/claude/ios-swift/skills/code-review/SKILL.md +10 -2
- package/presets/claude/ios-swift/skills/feature-delivery/SKILL.md +4 -0
- package/presets/claude/ios-swift/skills/technical-retro/SKILL.md +46 -2
- package/presets/claude/ios-swift/skills/write-adr/SKILL.md +41 -0
- package/presets/claude/ios-swift/team/conventions.md +21 -0
- package/presets/claude/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 +17 -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 +25 -0
- package/presets/claude/java/agents/feature-developer.md +43 -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 +60 -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/code-quality.md +83 -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/CLAUDE.md +5 -1
- package/presets/claude/next/README.md +6 -1
- package/presets/claude/next/REPO_AGENTS.md +48 -0
- package/presets/claude/next/agents/README.md +7 -1
- package/presets/claude/next/agents/build-verifier.md +7 -2
- package/presets/claude/next/agents/codebase-analyzer.md +28 -0
- package/presets/claude/next/agents/feature-developer.md +13 -0
- package/presets/claude/next/agents/security-reviewer.md +4 -2
- package/presets/claude/next/hooks/README.md +6 -0
- package/presets/claude/next/hooks/examples/README.md +18 -0
- package/presets/claude/next/hooks/examples/format-edited.example.sh +11 -0
- package/presets/claude/next/hooks/examples/secret-guard.example.sh +10 -0
- package/presets/claude/next/hooks/examples/test-on-save.example.sh +8 -0
- package/presets/claude/next/rules/README.md +2 -1
- package/presets/claude/next/rules/api-and-data/api-services.md +22 -0
- package/presets/claude/next/rules/api-and-data/http-client.md +21 -0
- package/presets/claude/next/rules/api-and-data/store-rtk.md +20 -0
- package/presets/claude/next/rules/architecture/architecture-boundaries.md +28 -0
- package/presets/claude/next/rules/architecture/layer-barrel-exports.md +15 -0
- package/presets/claude/next/rules/architecture/public-imports.md +14 -0
- package/presets/claude/next/rules/architecture/reference-features.md +4 -0
- package/presets/claude/next/rules/stack/arrow-functions.md +13 -28
- package/presets/claude/next/rules/stack/next-app-router.md +13 -1
- package/presets/claude/next/rules/testing/tests-unit.md +13 -0
- package/presets/claude/next/rules/tooling-and-review/README.md +2 -1
- package/presets/claude/next/rules/tooling-and-review/agent-team-intake.md +1 -1
- package/presets/claude/next/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
- package/presets/claude/next/rules/tooling-and-review/code-quality.md +12 -2
- package/presets/claude/next/rules/tooling-and-review/code-review-mr.md +22 -0
- package/presets/claude/next/rules/tooling-and-review/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/rules/tooling-and-review/security-next.md +57 -0
- package/presets/claude/next/rules/ui-and-accessibility/react-ui.md +21 -0
- package/presets/claude/next/skills/README.md +2 -0
- package/presets/claude/next/skills/code-review/SKILL.md +10 -2
- package/presets/claude/next/skills/feature-delivery/SKILL.md +4 -0
- package/presets/claude/next/skills/react-performance/SKILL.md +44 -0
- package/presets/claude/next/skills/technical-retro/SKILL.md +19 -5
- package/presets/claude/next/skills/write-adr/SKILL.md +41 -0
- package/presets/claude/next/team/conventions.md +21 -0
- package/presets/cursor/go/AGENTS.md +6 -0
- package/presets/cursor/go/README.md +6 -5
- package/presets/cursor/go/REPO_AGENTS.md +48 -0
- package/presets/cursor/go/agents/README.md +23 -2
- package/presets/cursor/go/agents/build-verifier.md +6 -1
- package/presets/cursor/go/agents/codebase-analyzer.md +28 -0
- package/presets/cursor/go/agents/feature-developer.md +13 -0
- package/presets/cursor/go/commands/README.md +1 -1
- package/presets/cursor/go/hooks/README.md +4 -0
- package/presets/cursor/go/hooks/examples/README.md +18 -0
- package/presets/cursor/go/hooks/examples/format-edited.example.sh +9 -0
- package/presets/cursor/go/hooks/examples/secret-guard.example.sh +10 -0
- package/presets/cursor/go/hooks/examples/test-on-save.example.sh +11 -0
- package/presets/cursor/go/rules/README.md +2 -2
- package/presets/cursor/go/rules/agent-team-intake.mdc +1 -1
- package/presets/cursor/go/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/go/rules/api-http.mdc +10 -3
- package/presets/cursor/go/rules/code-quality-and-refactoring.mdc +12 -1
- package/presets/cursor/go/rules/code-review-mr.mdc +9 -0
- package/presets/cursor/go/rules/go-conventions.mdc +30 -3
- package/presets/cursor/go/rules/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/rules/reference-features.mdc +4 -0
- package/presets/cursor/go/skills/README.md +2 -2
- package/presets/cursor/go/skills/code-review/SKILL.md +10 -1
- package/presets/cursor/go/skills/feature-delivery/SKILL.md +4 -0
- package/presets/cursor/go/skills/technical-retro/SKILL.md +46 -2
- package/presets/cursor/go/skills/write-adr/SKILL.md +41 -0
- package/presets/cursor/go/team/conventions.md +21 -0
- package/presets/cursor/go/team/fixtures/feature-full.json +5 -23
- package/presets/cursor/ios-swift/AGENTS.md +5 -2
- package/presets/cursor/ios-swift/README.md +6 -5
- package/presets/cursor/ios-swift/REPO_AGENTS.md +46 -0
- package/presets/cursor/ios-swift/agents/README.md +3 -2
- package/presets/cursor/ios-swift/agents/build-verifier.md +7 -2
- package/presets/cursor/ios-swift/agents/codebase-analyzer.md +28 -0
- package/presets/cursor/ios-swift/agents/feature-developer.md +13 -0
- package/presets/cursor/ios-swift/commands/README.md +1 -1
- package/presets/cursor/ios-swift/hooks/README.md +4 -0
- package/presets/cursor/ios-swift/hooks/examples/README.md +18 -0
- package/presets/cursor/ios-swift/hooks/examples/format-edited.example.sh +13 -0
- package/presets/cursor/ios-swift/hooks/examples/secret-guard.example.sh +10 -0
- package/presets/cursor/ios-swift/hooks/examples/test-on-save.example.sh +8 -0
- package/presets/cursor/ios-swift/rules/agent-team-intake.mdc +1 -1
- package/presets/cursor/ios-swift/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/ios-swift/rules/code-quality-and-refactoring.mdc +12 -1
- package/presets/cursor/ios-swift/rules/code-review-mr.mdc +9 -0
- package/presets/cursor/ios-swift/rules/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/ios-swift/rules/reference-features.mdc +4 -0
- package/presets/cursor/ios-swift/rules/swift-conventions.mdc +12 -2
- package/presets/cursor/ios-swift/rules/swiftui-ui.mdc +8 -0
- package/presets/cursor/ios-swift/skills/README.md +1 -0
- package/presets/cursor/ios-swift/skills/code-review/SKILL.md +10 -2
- package/presets/cursor/ios-swift/skills/feature-delivery/SKILL.md +4 -0
- package/presets/cursor/ios-swift/skills/technical-retro/SKILL.md +46 -2
- package/presets/cursor/ios-swift/skills/write-adr/SKILL.md +41 -0
- package/presets/cursor/ios-swift/team/conventions.md +21 -0
- package/presets/cursor/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 +17 -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 +25 -0
- package/presets/cursor/java/agents/feature-developer.md +43 -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 +97 -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/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 +84 -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.md +5 -2
- package/presets/cursor/next/README.md +7 -6
- package/presets/cursor/next/REPO_AGENTS.md +48 -0
- package/presets/cursor/next/agents/README.md +7 -1
- package/presets/cursor/next/agents/build-verifier.md +7 -2
- package/presets/cursor/next/agents/codebase-analyzer.md +28 -0
- package/presets/cursor/next/agents/feature-developer.md +13 -0
- package/presets/cursor/next/agents/security-reviewer.md +4 -2
- package/presets/cursor/next/commands/README.md +1 -1
- package/presets/cursor/next/hooks/README.md +4 -0
- package/presets/cursor/next/hooks/examples/README.md +18 -0
- package/presets/cursor/next/hooks/examples/format-edited.example.sh +11 -0
- package/presets/cursor/next/hooks/examples/secret-guard.example.sh +10 -0
- package/presets/cursor/next/hooks/examples/test-on-save.example.sh +8 -0
- package/presets/cursor/next/rules/README.md +4 -3
- package/presets/cursor/next/rules/agent-team-intake.mdc +1 -1
- package/presets/cursor/next/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/next/rules/api-services.mdc +21 -0
- package/presets/cursor/next/rules/architecture-boundaries.mdc +27 -0
- package/presets/cursor/next/rules/arrow-functions.mdc +13 -28
- package/presets/cursor/next/rules/code-quality-and-refactoring.mdc +12 -2
- package/presets/cursor/next/rules/code-review-mr.mdc +11 -13
- package/presets/cursor/next/rules/http-client.mdc +21 -0
- package/presets/cursor/next/rules/layer-barrel-exports.mdc +15 -0
- package/presets/cursor/next/rules/next-app-router.mdc +13 -1
- package/presets/cursor/next/rules/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/public-imports.mdc +14 -0
- package/presets/cursor/next/rules/react-ui.mdc +20 -0
- package/presets/cursor/next/rules/reference-features.mdc +4 -0
- package/presets/cursor/next/rules/security-next.mdc +57 -0
- package/presets/cursor/next/rules/store-rtk.mdc +19 -0
- package/presets/cursor/next/rules/tests-unit.mdc +12 -0
- package/presets/cursor/next/skills/README.md +2 -0
- package/presets/cursor/next/skills/code-review/SKILL.md +10 -2
- package/presets/cursor/next/skills/feature-delivery/SKILL.md +4 -0
- package/presets/cursor/next/skills/react-performance/SKILL.md +44 -0
- package/presets/cursor/next/skills/technical-retro/SKILL.md +19 -5
- package/presets/cursor/next/skills/write-adr/SKILL.md +41 -0
- package/presets/cursor/next/team/conventions.md +21 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Optional cookbook: block committing likely secrets in staged diffs.
|
|
3
|
+
# NOT wired in default hooks.json — copy to hooks/ and register manually.
|
|
4
|
+
set -euo pipefail
|
|
5
|
+
PATTERN='(AKIA[0-9A-Z]{16}|-----BEGIN (RSA |OPENSSH )?PRIVATE KEY-----|api[_-]?key\s*[:=]\s*['\''\"][^'\''\"]{12,})'
|
|
6
|
+
if git diff --cached -U0 2>/dev/null | grep -Eiq "$PATTERN"; then
|
|
7
|
+
echo "secret-guard: possible secret in staged diff — review before commit" >&2
|
|
8
|
+
exit 1
|
|
9
|
+
fi
|
|
10
|
+
exit 0
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Optional: scoped Maven/Gradle test after Java edits.
|
|
3
|
+
# NOT in default hooks.json. Prefer wrappers when present.
|
|
4
|
+
set -euo pipefail
|
|
5
|
+
changed=$(git diff --name-only --diff-filter=ACMR HEAD 2>/dev/null | grep '\.java$' || true)
|
|
6
|
+
if [[ -z "${changed:-}" ]]; then
|
|
7
|
+
exit 0
|
|
8
|
+
fi
|
|
9
|
+
if [[ -x ./mvnw ]]; then
|
|
10
|
+
./mvnw -q test 2>/dev/null || true
|
|
11
|
+
elif [[ -x ./gradlew ]]; then
|
|
12
|
+
./gradlew -q test 2>/dev/null || true
|
|
13
|
+
elif [[ -f pom.xml ]]; then
|
|
14
|
+
mvn -q test 2>/dev/null || true
|
|
15
|
+
elif [[ -f build.gradle || -f build.gradle.kts ]]; then
|
|
16
|
+
gradle -q test 2>/dev/null || true
|
|
17
|
+
fi
|
|
18
|
+
exit 0
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Lightweight shell guard for Claude Code projects using this preset.
|
|
3
|
+
# Java: do NOT blanket-block mvn test / ./gradlew test / compiler/IDE inspections / configured static analysis / repo static analysis.
|
|
4
|
+
# Package-manager mismatch checks apply only when a JS lockfile/package.json exists.
|
|
5
|
+
|
|
6
|
+
set -euo pipefail
|
|
7
|
+
# JAVA_PRESET_GUARD: allow mvn/gradlew test; no Playwright/XCUITest assumptions
|
|
8
|
+
|
|
9
|
+
input=$(cat)
|
|
10
|
+
|
|
11
|
+
INPUT="$input" node <<'NODE'
|
|
12
|
+
const fs = require('fs');
|
|
13
|
+
|
|
14
|
+
const raw = process.env.INPUT || '';
|
|
15
|
+
let event;
|
|
16
|
+
try {
|
|
17
|
+
event = JSON.parse(raw);
|
|
18
|
+
} catch {
|
|
19
|
+
process.stdout.write('{ "permission": "allow" }');
|
|
20
|
+
process.exit(0);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const command = String(event.command || event.input?.command || '');
|
|
24
|
+
if (!command.trim()) {
|
|
25
|
+
process.stdout.write('{ "permission": "allow" }');
|
|
26
|
+
process.exit(0);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function out(permission, userMessage, agentMessage) {
|
|
30
|
+
process.stdout.write(JSON.stringify({
|
|
31
|
+
permission,
|
|
32
|
+
user_message: userMessage,
|
|
33
|
+
agent_message: agentMessage || userMessage,
|
|
34
|
+
}));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const dangerousGit = /\bgit\s+(reset\s+--hard|clean\s+-[^\n]*f|push\s+--force|push\s+-f|checkout\s+--\s+)/;
|
|
38
|
+
if (dangerousGit.test(command)) {
|
|
39
|
+
out(
|
|
40
|
+
'ask',
|
|
41
|
+
'This command looks destructive for git state. Review it before continuing.',
|
|
42
|
+
'A project hook flagged a destructive git command. Ask the user before running it.',
|
|
43
|
+
);
|
|
44
|
+
process.exit(0);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const managerByFile = [
|
|
48
|
+
['yarn.lock', 'yarn'],
|
|
49
|
+
['pnpm-lock.yaml', 'pnpm'],
|
|
50
|
+
['package-lock.json', 'npm'],
|
|
51
|
+
].find(([file]) => fs.existsSync(file));
|
|
52
|
+
|
|
53
|
+
let expected = managerByFile?.[1];
|
|
54
|
+
if (!expected && fs.existsSync('package.json')) {
|
|
55
|
+
try {
|
|
56
|
+
const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
|
|
57
|
+
const pm = typeof pkg.packageManager === 'string' ? pkg.packageManager : '';
|
|
58
|
+
expected = pm.split('@')[0] || undefined;
|
|
59
|
+
} catch {
|
|
60
|
+
// Ignore invalid package.json in the hook; the agent can diagnose it later.
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (!expected) {
|
|
65
|
+
process.stdout.write('{ "permission": "allow" }');
|
|
66
|
+
process.exit(0);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const used = command.match(/(^|[;&|]\s*)(npm|yarn|pnpm)\s+/)?.[2];
|
|
70
|
+
if (used && used !== expected) {
|
|
71
|
+
out(
|
|
72
|
+
'ask',
|
|
73
|
+
`This repository appears to use ${expected}, but the command uses ${used}. Confirm before continuing.`,
|
|
74
|
+
`Use ${expected} for package scripts and installs unless the user explicitly approves ${used}.`,
|
|
75
|
+
);
|
|
76
|
+
process.exit(0);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
process.stdout.write('{ "permission": "allow" }');
|
|
80
|
+
NODE
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# `.claude/rules` (preset java)
|
|
2
|
+
|
|
3
|
+
Claude topic `.md` files are **derived** from Cursor SoT `presets/cursor/java/rules/*.mdc`.
|
|
4
|
+
|
|
5
|
+
## SoT sync
|
|
6
|
+
|
|
7
|
+
| Principle | Detail |
|
|
8
|
+
|-----------|--------|
|
|
9
|
+
| **SoT** | `presets/cursor/java/rules/*.mdc` |
|
|
10
|
+
| **Derive** | Claude topic `.md` + `paths:` (drop `alwaysApply`) |
|
|
11
|
+
| **Checklist** | change Cursor → update Claude twin **same PR** (**FAIL** if missing — next, ios-swift, go, and java; see `preset-twin-sync` / build-verifier) |
|
|
12
|
+
|
|
13
|
+
## Loading budget
|
|
14
|
+
|
|
15
|
+
- **Session-start (no `paths:`):** exactly **3** — `java-app-core`, `boundaries`, `code-quality`
|
|
16
|
+
- All others — with `paths:`
|
|
17
|
+
- **Twin depth:** domain rules target ≥15 body lines; thin aliases: `agent-team-intake`, `technical-retro`; **documented stubs** (v1): `api-grpc`, `messaging-adapters` — see Cursor `presets/cursor/java/rules/README.md` Catalog (Depth column)
|
|
18
|
+
|
|
19
|
+
## Cursor → Claude mapping
|
|
20
|
+
|
|
21
|
+
| Cursor `.mdc` (SoT) | Claude topic |
|
|
22
|
+
|---------------------|--------------|
|
|
23
|
+
| `adapters-driven.mdc` | `api-and-data/adapters-driven.md` |
|
|
24
|
+
| `adapters-driving.mdc` | `api-and-data/adapters-driving.md` |
|
|
25
|
+
| `agent-team-intake.mdc` | `tooling-and-review/agent-team-intake.md` |
|
|
26
|
+
| `agent-team-orchestrator.mdc` | `tooling-and-review/agent-team-orchestrator.md` |
|
|
27
|
+
| `api-grpc.mdc` | `api-and-data/api-grpc.md` |
|
|
28
|
+
| `api-http.mdc` | `api-and-data/api-http.md` |
|
|
29
|
+
| `application-usecases.mdc` | `architecture/application-usecases.md` |
|
|
30
|
+
| `architecture-boundaries.mdc` | `architecture/boundaries.md` |
|
|
31
|
+
| `code-quality-and-refactoring.mdc` | `tooling-and-review/code-quality.md` |
|
|
32
|
+
| `design-guidance.mdc` | `tooling-and-review/design-guidance.md` |
|
|
33
|
+
| `code-review-mr.mdc` | `tooling-and-review/code-review.md` |
|
|
34
|
+
| `composition-root.mdc` | `architecture/composition-root.md` |
|
|
35
|
+
| `domain-layer.mdc` | `architecture/domain-layer.md` |
|
|
36
|
+
| `feature-delivery-workflow.mdc` | `architecture/feature-delivery.md` |
|
|
37
|
+
| `java-app-core.mdc` | `stack/java-app-core.md` |
|
|
38
|
+
| `java-conventions.mdc` | `stack/java-conventions.md` |
|
|
39
|
+
| `java-tooling.mdc` | `tooling-and-review/java-tooling.md` |
|
|
40
|
+
| `messaging-adapters.mdc` | `api-and-data/messaging-adapters.md` |
|
|
41
|
+
| `module-public-api.mdc` | `architecture/module-public-api.md` |
|
|
42
|
+
| `persistence-adapters.mdc` | `api-and-data/persistence-adapters.md` |
|
|
43
|
+
| `ports-interfaces.mdc` | `architecture/ports-interfaces.md` |
|
|
44
|
+
| `post-change-test.mdc` | `tooling-and-review/post-change-test.md` |
|
|
45
|
+
| `preset-layering.mdc` | `tooling-and-review/preset-layering.md` |
|
|
46
|
+
| `preset-no-cross-stack-leakage.mdc` | `tooling-and-review/preset-no-cross-stack-leakage.md` |
|
|
47
|
+
| `preset-pr-checklist.mdc` | `tooling-and-review/preset-pr-checklist.md` |
|
|
48
|
+
| `preset-token-budget.mdc` | `tooling-and-review/preset-token-budget.md` |
|
|
49
|
+
| `preset-twin-sync.mdc` | `tooling-and-review/preset-twin-sync.md` |
|
|
50
|
+
| `reference-features.mdc` | `architecture/reference-features.md` |
|
|
51
|
+
| `security-java.mdc` | `tooling-and-review/security-java.md` |
|
|
52
|
+
| `technical-retro.mdc` | `tooling-and-review/technical-retro.md` |
|
|
53
|
+
| `tests-e2e.mdc` | `testing/e2e.md` |
|
|
54
|
+
| `tests-integration.mdc` | `testing/integration.md` |
|
|
55
|
+
| `tests-unit.mdc` | `testing/unit.md` |
|
|
56
|
+
|
|
57
|
+
## Topics
|
|
58
|
+
|
|
59
|
+
`architecture/`, `stack/`, `api-and-data/`, `testing/`, `tooling-and-review/`.
|
|
60
|
+
`ui-and-accessibility/` — README stub only (N/A backend).
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# API and data
|
|
2
|
+
|
|
3
|
+
Driving/driven adapters. Index only.
|
|
4
|
+
|
|
5
|
+
| File | Cursor SoT |
|
|
6
|
+
|------|------------|
|
|
7
|
+
| [`adapters-driving.md`](./adapters-driving.md) | `adapters-driving.mdc` |
|
|
8
|
+
| [`adapters-driven.md`](./adapters-driven.md) | `adapters-driven.mdc` |
|
|
9
|
+
| [`api-http.md`](./api-http.md) | `api-http.mdc` |
|
|
10
|
+
| [`api-grpc.md`](./api-grpc.md) | `api-grpc.mdc` |
|
|
11
|
+
| [`persistence-adapters.md`](./persistence-adapters.md) | `persistence-adapters.mdc` |
|
|
12
|
+
| [`messaging-adapters.md`](./messaging-adapters.md) | `messaging-adapters.mdc` |
|
|
13
|
+
|
|
14
|
+
Full map: [`../README.md`](../README.md).
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Driven adapters (persistence, cache, messaging) for Java hexagonal services
|
|
3
|
+
paths:
|
|
4
|
+
- "**/adapters/outbound/**/*"
|
|
5
|
+
- "**/adapters/persistence/**/*"
|
|
6
|
+
- "**/adapters/cache/**/*"
|
|
7
|
+
- "**/adapters/messaging/**/*"
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Driven adapters
|
|
11
|
+
|
|
12
|
+
- Implement application **outbound ports**.
|
|
13
|
+
- Map storage/broker models → domain at the boundary; never return JPA entities or JDBC rows to application.
|
|
14
|
+
- Handle retries/timeouts/idempotency here when infrastructure-specific.
|
|
15
|
+
- Wrap driver/ORM exceptions with context; translate to domain/application errors when meaningful.
|
|
16
|
+
- Honor timeouts/cancellation from the application call when the client API supports them.
|
|
17
|
+
|
|
18
|
+
## Layout
|
|
19
|
+
|
|
20
|
+
Default: `adapters/outbound/persistence|messaging|external|cache/`. Flat `adapters/persistence/` etc. remains valid when already used.
|
|
21
|
+
|
|
22
|
+
## Persistence
|
|
23
|
+
|
|
24
|
+
- See `persistence-adapters.mdc` for JPA/JDBC/transactions.
|
|
25
|
+
- Keep SQL/JPQL/query builders inside the adapter package; application sees only port methods.
|
|
26
|
+
|
|
27
|
+
## Cache / messaging / external HTTP
|
|
28
|
+
|
|
29
|
+
- Cache keys and serialization are adapter concerns.
|
|
30
|
+
- Publishers implement port `publishX`; consumers that trigger use cases are **driving** adapters.
|
|
31
|
+
- Prefer idempotent publish/consume when brokers may redeliver (see stub `messaging-adapters`).
|
|
32
|
+
- Outbound HTTP clients: per-provider timeouts/pools — do not share one god-client for every vendor.
|
|
33
|
+
|
|
34
|
+
## Forbidden
|
|
35
|
+
|
|
36
|
+
- Calling other driven adapters bypassing application (hidden coupling).
|
|
37
|
+
- Leaking `Entity`, `ResultSet`, Redis/Jedis, or Kafka client types through port signatures.
|
|
38
|
+
- Embedding business invariants that belong in domain (e.g. discount rules only in SQL).
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Driving adapters (HTTP, gRPC, CLI) for Java hexagonal services
|
|
3
|
+
paths:
|
|
4
|
+
- "**/adapters/inbound/**/*"
|
|
5
|
+
- "**/adapters/http/**/*"
|
|
6
|
+
- "**/adapters/grpc/**/*"
|
|
7
|
+
- "**/*Controller*.java"
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Driving adapters
|
|
11
|
+
|
|
12
|
+
- Translate transport → application calls → transport response.
|
|
13
|
+
- Map request/response DTOs at the edge; do **not** pass framework types (`HttpServletRequest`, Spring Security internals) into use cases.
|
|
14
|
+
- AuthN/AuthZ and wire-format validation belong here (or filters/interceptors); domain validation stays in domain.
|
|
15
|
+
- Errors: map domain/application exceptions to status codes once (central `@ControllerAdvice` / exception mapper preferred).
|
|
16
|
+
- Keep controllers/handlers thin: decode → call use case → encode; no multi-step workflows or SQL in the adapter.
|
|
17
|
+
|
|
18
|
+
## Layout
|
|
19
|
+
|
|
20
|
+
Default (layer-first): `adapters/inbound/http/` (and `…/grpc/`, `…/cli/` as needed). Flat `adapters/http/` is an accepted variant when the repo already uses it.
|
|
21
|
+
|
|
22
|
+
## HTTP
|
|
23
|
+
|
|
24
|
+
- See `api-http.mdc`. Prefer thin Spring MVC / Jakarta controllers; routing in one place.
|
|
25
|
+
- Bind path/query/body into request DTOs (`@Valid` / Bean Validation at the edge) before calling application.
|
|
26
|
+
- Framework choice (Spring MVC, JAX-RS, Quarkus REST) is optional — match the repo.
|
|
27
|
+
|
|
28
|
+
## gRPC / CLI / messaging consumers
|
|
29
|
+
|
|
30
|
+
- Same mapping rules; see stub `api-grpc.mdc` for protobuf notes; messaging consumers that trigger use cases are driving adapters (`messaging-adapters` stub).
|
|
31
|
+
- CLI `main` / CommandLineRunner may call composition root or inbound ports — **no** SQL in `main`.
|
|
32
|
+
- Propagate cancellation/timeouts from the transport into use-case calls when the stack supports it.
|
|
33
|
+
|
|
34
|
+
## Forbidden
|
|
35
|
+
|
|
36
|
+
- SQL, JPQL, or business invariants inside controllers.
|
|
37
|
+
- Importing persistence packages from HTTP handlers (wire via application ports).
|
|
38
|
+
- Swallowing exceptions without mapping to a transport status / structured log field.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Thin gRPC/protobuf extension notes for Java hexagonal services (HTTP-first v1)
|
|
3
|
+
paths:
|
|
4
|
+
- "**/*.proto"
|
|
5
|
+
- "**/adapters/inbound/grpc/**/*"
|
|
6
|
+
- "**/adapters/grpc/**/*"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# gRPC adapters (documented stub)
|
|
10
|
+
|
|
11
|
+
> **Stub (v1):** HTTP is the preset SoT (`api-http`). This rule is a light placeholder — do not pretend full protobuf/streaming depth. **When to use:** editing `*.proto` or `adapters/**/grpc/**` in a repo that already (or newly) adopts gRPC.
|
|
12
|
+
|
|
13
|
+
HTTP remains the **v1 SoT**. gRPC is an optional driving adapter with the same hexagonal rules.
|
|
14
|
+
|
|
15
|
+
## Requirements when adding gRPC
|
|
16
|
+
|
|
17
|
+
1. Keep protobuf messages in the adapter (or `api/proto`); map to domain/application at the edge.
|
|
18
|
+
2. Implement the same inbound ports / use cases as HTTP — do not fork business logic.
|
|
19
|
+
3. Map gRPC status codes from domain/application errors (parity with HTTP mapper).
|
|
20
|
+
4. Generate code via repo-standard `buf` / `protoc` / protobuf-maven / Gradle protobuf plugins — do not hand-edit generated `*.java` stubs unless the repo requires it.
|
|
21
|
+
|
|
22
|
+
## Non-goals (v1)
|
|
23
|
+
|
|
24
|
+
- Full protobuf style guide and streaming patterns — expand this rule when the consumer repo adopts gRPC widely.
|
|
25
|
+
- Mandating gRPC over HTTP.
|
|
26
|
+
|
|
27
|
+
## Ports
|
|
28
|
+
|
|
29
|
+
- Prefer shared application use cases; gRPC service class is a driving adapter only.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: HTTP API adapter conventions for Java hexagonal services
|
|
3
|
+
paths:
|
|
4
|
+
- "**/adapters/inbound/http/**/*"
|
|
5
|
+
- "**/adapters/http/**/*"
|
|
6
|
+
- "**/*Controller*.java"
|
|
7
|
+
- "**/*handler*.java"
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# HTTP API adapters
|
|
11
|
+
|
|
12
|
+
- Controllers/handlers are **thin**: parse input, call one inbound port / use case, map status + body.
|
|
13
|
+
- Use a consistent error envelope; map **domain exceptions** centrally (`@ControllerAdvice` / `ExceptionMapper`) — do not leak transport types into use cases.
|
|
14
|
+
- Version routes if the repo already versions (`/v1/...`).
|
|
15
|
+
- Spring MVC / Jakarta at the edge by default; plain Java may use JDK `HttpServer` or another framework — same mapping rules.
|
|
16
|
+
- DTO validation: Bean Validation (`@Valid`, constraints) on request DTOs at the adapter; do not put `@NotNull` on domain entities “for HTTP”.
|
|
17
|
+
- Map DTO ↔ domain/application at the edge (dedicated mapper or small private methods).
|
|
18
|
+
|
|
19
|
+
## Resilience
|
|
20
|
+
|
|
21
|
+
- Side-effect endpoints (charge, create, enqueue): accept/propagate an **idempotency key** when the domain already uses one; document if intentionally omitted.
|
|
22
|
+
- Outbound HTTP to third parties: prefer **per-provider clients** (separate timeouts/pools) — bulkhead isolation.
|
|
23
|
+
- Provider/ACL adapters return typed results or errors — never raw `Map<String, Object>` / untyped JSON into the domain.
|
|
24
|
+
- Soft file-size hint: split when a controller grows past ~400 LOC.
|
|
25
|
+
|
|
26
|
+
## Testing
|
|
27
|
+
|
|
28
|
+
- Prefer `MockMvc` / WebTestClient / JAX-RS test client against the controller with a mocked use case (unit of adapter).
|
|
29
|
+
- Integration: Spring slice or full context + Testcontainers behind driven ports when needed.
|
|
30
|
+
|
|
31
|
+
## Forbidden
|
|
32
|
+
|
|
33
|
+
- Business rules or SQL/JPQL in controllers.
|
|
34
|
+
- Ignoring request timeouts / async cancel when the framework exposes them.
|
|
35
|
+
- Raising transport-only errors from use cases (keep HTTP mapping at the adapter edge).
|
|
36
|
+
- Returning JPA entities directly as JSON response bodies.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Messaging driven/driving adapters for Java hexagonal services (stub)
|
|
3
|
+
paths:
|
|
4
|
+
- "**/adapters/outbound/messaging/**/*"
|
|
5
|
+
- "**/adapters/inbound/messaging/**/*"
|
|
6
|
+
- "**/adapters/messaging/**/*"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Messaging adapters (documented stub)
|
|
10
|
+
|
|
11
|
+
> **Stub (v1):** Light guidance only — not a full Kafka/Rabbit/JMS cookbook. **When to use:** editing `adapters/**/messaging/**` or adding broker publishers/consumers. Prefer expanding this rule when the consumer repo standardizes on a broker.
|
|
12
|
+
|
|
13
|
+
- **Publisher** (driven): implements outbound port; serializes domain events / integration events.
|
|
14
|
+
- **Consumer** (driving): deserializes → calls use case / inbound port; ack/nack policy here.
|
|
15
|
+
- Idempotency keys and retry/DLQ are adapter concerns; document at-least-once assumptions.
|
|
16
|
+
- Do not put broker client types (`KafkaTemplate`, JMS sessions, etc.) in domain or application signatures.
|
|
17
|
+
|
|
18
|
+
## Event shapes
|
|
19
|
+
|
|
20
|
+
- Prefer explicit event types in application or a small `events` package used by ports — map to wire format in the adapter.
|
|
21
|
+
|
|
22
|
+
## Tests
|
|
23
|
+
|
|
24
|
+
- Unit-test mapping with fakes; integration against embedded/broker Testcontainers when the repo has them.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Persistence driven adapters (JPA/JDBC/repos) for Java hexagonal services
|
|
3
|
+
paths:
|
|
4
|
+
- "**/adapters/outbound/persistence/**/*"
|
|
5
|
+
- "**/adapters/persistence/**/*"
|
|
6
|
+
- "**/*Repository*.java"
|
|
7
|
+
- "**/*repository*.java"
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Persistence adapters
|
|
11
|
+
|
|
12
|
+
- Implement outbound repository ports from application.
|
|
13
|
+
- Use parameterized queries / JPA Criteria / Spring Data methods — **never** string-concatenated SQL with untrusted input.
|
|
14
|
+
- Map rows / JPA entities → **domain** inside the adapter; entities stay private to the adapter package when possible.
|
|
15
|
+
- Transactions: use cases own the boundary (`@Transactional` on application services, or a `UnitOfWork` port). Adapters must not start ad-hoc transactions that hide business atomicity.
|
|
16
|
+
- Migrations live with infra (`db/migration`, Flyway/Liquibase dirs) — **not** in domain.
|
|
17
|
+
|
|
18
|
+
## Mapping
|
|
19
|
+
|
|
20
|
+
- JPA `@Entity` / JDBC row mappers are adapter-local; do not pass them through port signatures or up into application/domain.
|
|
21
|
+
- Nullability and DB defaults convert to domain values explicitly (no silent nulls into invariants).
|
|
22
|
+
- Spring Data repositories may be used **inside** the adapter as helpers; the application still depends on the port interface, not on `JpaRepository`.
|
|
23
|
+
|
|
24
|
+
## Forbidden
|
|
25
|
+
|
|
26
|
+
- Importing persistence from domain, or leaking `EntityManager` / `@Entity` / `JdbcTemplate` through port APIs.
|
|
27
|
+
- Building SQL/JPQL strings in use cases.
|
|
28
|
+
- Returning JPA entities from REST controllers “because lazy loading”.
|
|
29
|
+
|
|
30
|
+
## Tests
|
|
31
|
+
|
|
32
|
+
- Integration tests with Testcontainers / test DB preferred for repos; unit-test mappers with fixtures.
|
|
33
|
+
- Spring `@DataJpaTest` / JDBC slices only when needed — prefer testing through the port implementation.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Architecture
|
|
2
|
+
|
|
3
|
+
Hexagonal boundaries and delivery. Index only.
|
|
4
|
+
|
|
5
|
+
| File | Cursor SoT |
|
|
6
|
+
|------|------------|
|
|
7
|
+
| [`boundaries.md`](./boundaries.md) | `architecture-boundaries.mdc` |
|
|
8
|
+
| [`feature-delivery.md`](./feature-delivery.md) | `feature-delivery-workflow.mdc` |
|
|
9
|
+
| [`reference-features.md`](./reference-features.md) | `reference-features.mdc` |
|
|
10
|
+
| [`domain-layer.md`](./domain-layer.md) | `domain-layer.mdc` |
|
|
11
|
+
| [`application-usecases.md`](./application-usecases.md) | `application-usecases.mdc` |
|
|
12
|
+
| [`ports-interfaces.md`](./ports-interfaces.md) | `ports-interfaces.mdc` |
|
|
13
|
+
| [`composition-root.md`](./composition-root.md) | `composition-root.mdc` |
|
|
14
|
+
| [`module-public-api.md`](./module-public-api.md) | `module-public-api.mdc` |
|
|
15
|
+
|
|
16
|
+
Full map: [`../README.md`](../README.md).
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Application use cases and orchestration in Java hexagonal services
|
|
3
|
+
paths:
|
|
4
|
+
- "application/**/*"
|
|
5
|
+
- "**/application/**/*"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Application / use cases
|
|
9
|
+
|
|
10
|
+
- One use case ≈ one application service method (command/query).
|
|
11
|
+
- Depend on **outbound ports** (interfaces), not concrete repos, JPA, or HTTP clients.
|
|
12
|
+
- Orchestrate domain; transaction boundaries via ports (`UnitOfWork` / `@Transactional` **on the application service** when the repo uses Spring) — still **no SQL/JPQL** here.
|
|
13
|
+
- Keep signatures in domain / application types — never `HttpServletRequest`, `EntityManager`, or controller DTOs.
|
|
14
|
+
- Spring `@Service` on use cases is optional wiring sugar; domain remains Spring-free. Plain Java: plain classes constructed in composition root.
|
|
15
|
+
|
|
16
|
+
## Forbidden
|
|
17
|
+
|
|
18
|
+
- Importing `adapters.*`, JDBC drivers, Spring Web, JPA entity classes.
|
|
19
|
+
- Embedding `DataSource`, Redis/Kafka clients, or controller types in use-case fields.
|
|
20
|
+
- Business rules that belong on domain entities/VOs (keep use cases thin orchestrators).
|
|
21
|
+
|
|
22
|
+
## Structure
|
|
23
|
+
|
|
24
|
+
- Prefer `…/application/<Feature>Service.java` (or `…/<usecase>/`) with ports colocated (`…/application/ports/` or `*Port.java` beside the service).
|
|
25
|
+
- Inbound port = interface the driving adapter calls (optional when a concrete use-case class is the only API).
|
|
26
|
+
- Package layout may be layer-first (`application/`) or feature-first (`<feature>/application/`) — same dependency direction.
|
|
27
|
+
|
|
28
|
+
## Tests
|
|
29
|
+
|
|
30
|
+
- Unit-test with fakes/mocks of outbound ports; assert domain outcomes and port interactions — **no** real DB.
|
|
31
|
+
- Mockito is optional when the repo already uses it; prefer simple fakes for narrow ports.
|
|
32
|
+
- JUnit 5; AssertJ when present.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Hexagonal layer boundaries for Java backends (domain, application, ports, adapters)
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
# Границы слоёв (hexagonal)
|
|
7
|
+
|
|
8
|
+
- **Domain** (`**/domain`):
|
|
9
|
+
- Может: entities, value objects, domain services, domain errors; JDK / same BC domain.
|
|
10
|
+
- Не должен: Spring/Jakarta web, JPA/JDBC, brokers, HTTP DTOs, transport serialization annotations.
|
|
11
|
+
- **Application** (`**/application`):
|
|
12
|
+
- Может: use cases; **define ports** (inbound/outbound interfaces) with domain types in signatures.
|
|
13
|
+
- Не должен: concrete adapters, SQL/JPQL, controller/framework types as domain input.
|
|
14
|
+
- **Ports**: interfaces only — no adapter implementations in port packages.
|
|
15
|
+
- **Driving adapters** (`adapters/inbound/**`): map DTO ↔ application/domain at the edge; no business rules/SQL in controllers.
|
|
16
|
+
- **Driven adapters** (`adapters/outbound/**`): implement outbound ports; map rows/messages → domain; do not leak persistence models upward.
|
|
17
|
+
- **Composition** (`configuration/`, `*Application.java`): wires the graph; no business logic.
|
|
18
|
+
|
|
19
|
+
# Зависимости
|
|
20
|
+
|
|
21
|
+
- Направление: **adapters → application → domain**.
|
|
22
|
+
- Driven adapters implement outbound ports defined by application.
|
|
23
|
+
- Domain never imports adapters or frameworks.
|
|
24
|
+
- Cross-feature access — only via public ports / module API, not deep imports of another feature's internals.
|
|
25
|
+
|
|
26
|
+
# Требование к агенту
|
|
27
|
+
|
|
28
|
+
- Класть файлы в правильный слой; не «коротить» слои ради скорости.
|
|
29
|
+
- DI / wiring только в composition / configuration.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Composition root and DI wiring for Java hexagonal services
|
|
3
|
+
paths:
|
|
4
|
+
- "**/configuration/**"
|
|
5
|
+
- "**/*Application.java"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Composition root
|
|
9
|
+
|
|
10
|
+
- Construct adapters, use cases, and servers in `configuration/` and/or `*Application.java`.
|
|
11
|
+
- **Spring Boot default:** `@SpringBootApplication` + `@Configuration` / `@Bean` (or component scan limited to adapters + application). Wire ports → implementations explicitly when scan ambiguity exists.
|
|
12
|
+
- **Plain Java:** explicit bootstrap / factory in `main` — same graph, no component scan.
|
|
13
|
+
- Quarkus / Micronaut / Jakarta: CDI/`@ApplicationScoped` equivalents — still **no business logic** here.
|
|
14
|
+
- Load config once; fail fast on missing required settings (Spring `Environment` / typed `@ConfigurationProperties`, or plain config objects).
|
|
15
|
+
- Lifecycle: graceful shutdown via Spring lifecycle beans / JVM shutdown hooks matching the repo.
|
|
16
|
+
|
|
17
|
+
## Allowed here
|
|
18
|
+
|
|
19
|
+
- Import all layers for **wiring only**.
|
|
20
|
+
- Process-wide loggers, metrics, health indicators, ObjectMapper beans.
|
|
21
|
+
|
|
22
|
+
## Forbidden
|
|
23
|
+
|
|
24
|
+
- Business rules, SQL/JPQL, HTTP routing tables with domain logic.
|
|
25
|
+
- Global mutable singletons for repos without clear init (prefer constructor injection / explicit beans).
|
|
26
|
+
- Putting domain types under Spring stereotype annotations unless the repo already does — prefer adapters + application as Spring components.
|
|
27
|
+
|
|
28
|
+
## Tests
|
|
29
|
+
|
|
30
|
+
- Optional smoke that the context loads (`@SpringBootTest` / slice, or construction test for plain Java).
|
|
31
|
+
- Heavy logic stays in unit/integration tests — composition-root tests only prove the graph builds.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Domain layer invariants for Java hexagonal services
|
|
3
|
+
paths:
|
|
4
|
+
- "domain/**/*"
|
|
5
|
+
- "**/domain/**/*"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Domain layer
|
|
9
|
+
|
|
10
|
+
- Pure business types and rules; **no I/O**, no Spring, no JPA, no HTTP.
|
|
11
|
+
- Prefer small value objects with validation factories (`of` / `parse` / package-private constructors) that throw typed **domain** exceptions.
|
|
12
|
+
- Domain errors are typed (`RuntimeException` subtypes or a small sealed hierarchy); map to HTTP/gRPC statuses **only** in adapters.
|
|
13
|
+
- Domain services orchestrate entities/VOs without calling outbound ports (ports live in **application**).
|
|
14
|
+
- Keep invariants close to the type that owns them; avoid anemic bags of fields with all logic in use cases.
|
|
15
|
+
- Prefer `record` / immutable types when the repo already uses them; do not invent a new VO style mid-module.
|
|
16
|
+
|
|
17
|
+
## Forbidden imports
|
|
18
|
+
|
|
19
|
+
- Spring (`org.springframework.*`), Jakarta Servlet / JAX-RS resource types, Spring MVC / WebFlux.
|
|
20
|
+
- JPA (`jakarta.persistence.*`, `EntityManager`), Spring Data repositories, JDBC templates as domain deps.
|
|
21
|
+
- Redis/Kafka/HTTP clients, Jackson `@Json*` / OpenAPI annotations that mirror wire contracts.
|
|
22
|
+
- Framework request-scope / security-context plumbing as a substitute for domain deadlines (prefer explicit types).
|
|
23
|
+
|
|
24
|
+
## Allowed
|
|
25
|
+
|
|
26
|
+
- JDK: `java.time`, collections, `Optional` sparingly, custom exceptions, pure utilities.
|
|
27
|
+
- Cross-aggregate references by **ID**, not by loading other aggregates via ports.
|
|
28
|
+
- Deadline/time primitives only when the domain API genuinely needs them (prefer application to pass values).
|
|
29
|
+
|
|
30
|
+
## Plain-Java / alternate frameworks
|
|
31
|
+
|
|
32
|
+
Same rules: domain stays framework-free whether the edge is Spring Boot, Quarkus, Micronaut, or plain JDK.
|
|
33
|
+
|
|
34
|
+
## Tests
|
|
35
|
+
|
|
36
|
+
- JUnit 5 unit tests (parameterized when covering many cases); **no** DB, `MockMvc`, Testcontainers, or Spring contexts.
|
|
37
|
+
- Cover invalid factory inputs and invariant violations explicitly.
|
|
38
|
+
- Prefer AssertJ when the repo already depends on it.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: End-to-end delivery checklist for Java hexagonal features
|
|
3
|
+
paths:
|
|
4
|
+
- .cursor/team/**/*
|
|
5
|
+
- .claude/team/**/*
|
|
6
|
+
- "**/*.java"
|
|
7
|
+
- src/main/java/**/*
|
|
8
|
+
- src/test/java/**/*
|
|
9
|
+
- "**/configuration/**"
|
|
10
|
+
---
|
|
11
|
+
<!-- shared-core: architecture/feature-delivery-workflow.md -->
|
|
12
|
+
|
|
13
|
+
# Feature delivery (Java hexagonal)
|
|
14
|
+
|
|
15
|
+
Order of work:
|
|
16
|
+
|
|
17
|
+
1. **Domain** — entities/VOs/errors (`domain-layer`).
|
|
18
|
+
2. **Application + ports** — use case + outbound interfaces (`application-usecases`, `ports-interfaces`).
|
|
19
|
+
3. **Driven adapters** — persistence/cache/messaging implementing ports (`adapters-driven`, `persistence-adapters`).
|
|
20
|
+
4. **Driving adapters** — HTTP/gRPC/CLI mapping DTOs (`adapters-driving`, `api-http`; stubs for gRPC/messaging).
|
|
21
|
+
5. **Composition root** — wire in `configuration/` / `*Application.java` (`composition-root`).
|
|
22
|
+
6. **Tests** — unit (domain/app) → integration (adapters) → optional e2e smoke.
|
|
23
|
+
7. **Gate** — `post-change-test` (+ `java-tooling`).
|
|
24
|
+
|
|
25
|
+
```mermaid
|
|
26
|
+
flowchart LR
|
|
27
|
+
D[Domain] --> A[Application+Ports]
|
|
28
|
+
A --> Drv[Driven adapters]
|
|
29
|
+
Drv --> A
|
|
30
|
+
HTTP[Driving HTTP] --> A
|
|
31
|
+
CR[Composition root] --> HTTP
|
|
32
|
+
CR --> A
|
|
33
|
+
CR --> Drv
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Matrix
|
|
37
|
+
|
|
38
|
+
| Path | Rules |
|
|
39
|
+
|------|-------|
|
|
40
|
+
| `**/domain/**` | `domain-layer`, `architecture-boundaries` |
|
|
41
|
+
| `**/application/**` | `application-usecases`, `ports-interfaces` |
|
|
42
|
+
| `**/adapters/inbound/**`, `**/adapters/http/**` | `adapters-driving`, `api-http` / `api-grpc` |
|
|
43
|
+
| `**/adapters/outbound/**`, `**/adapters/persistence/**` | `adapters-driven`, `persistence-adapters` / `messaging-adapters` |
|
|
44
|
+
| `**/configuration/**`, `**/*Application.java` | `composition-root` |
|
|
45
|
+
| After `*.java` edits | `post-change-test` (+ `java-tooling`) |
|
|
46
|
+
|
|
47
|
+
## Anti-patterns
|
|
48
|
+
|
|
49
|
+
- Framework types in domain; SQL/JPQL in use cases; DI inside controllers; skipping port interfaces “for speed”; returning JPA entities as HTTP bodies.
|
|
50
|
+
- **Ubiquitous language:** Domain names/boundaries reflect the feature domain — do not mix transport/framework terms into domain without need.
|
|
51
|
+
- Load `design-guidance` (rule stem) when assessing structure, smells, or pattern fit.
|
|
52
|
+
- Spring Boot is the default edge; plain Java / Quarkus / Micronaut keep the same layer order with different wiring.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Public module API and package boundaries for Java services
|
|
3
|
+
paths:
|
|
4
|
+
- "**/api/**/*.java"
|
|
5
|
+
- "**/module-info.java"
|
|
6
|
+
- pom.xml
|
|
7
|
+
- "**/build.gradle*"
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Module public API
|
|
11
|
+
|
|
12
|
+
- Published types under a module's public packages are a compatibility surface — change carefully; prefer additive APIs.
|
|
13
|
+
- Service-private code stays in implementation packages — do not treat every package as public API.
|
|
14
|
+
- Prefer package-private by default; expose only what other modules/features need.
|
|
15
|
+
- Do not deep-import another module's internal packages; depend on its published API / facade only.
|
|
16
|
+
- Document breaking Java API changes in CHANGELOG when the repo publishes libraries.
|
|
17
|
+
|
|
18
|
+
## Single-module default / multi-module variant
|
|
19
|
+
|
|
20
|
+
- **Default:** one deployable module with layer-first packages under `src/main/java/<base>/`.
|
|
21
|
+
- **Multi-module (Maven/Gradle):** each module exposes a narrow public API; application ports may live in an `application-api` module; adapters depend inward. Do not invent multi-module scaffolding unless the repo already uses it.
|
|
22
|
+
|
|
23
|
+
## pom.xml / build.gradle
|
|
24
|
+
|
|
25
|
+
- Module coordinates and JDK version are SoT for toolchain.
|
|
26
|
+
- Prefer minimal direct deps; pin via BOM / lockfile the repo already uses (`pom.xml`, `build.gradle(.kts)`).
|
|
27
|
+
|
|
28
|
+
## Cross-feature
|
|
29
|
+
|
|
30
|
+
- Inside one module, features communicate via application ports or small public facades — not by importing sibling feature adapter packages.
|
|
31
|
+
- JPMS `module-info.java` (when present): export only public packages; keep adapters non-exported when possible.
|