gaia-framework 1.57.0 → 1.57.2
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/README.md +1 -1
- package/bin/gaia-framework.js +27 -19
- package/gaia-install.sh +1 -1
- package/package.json +15 -11
- package/.claude/commands/gaia-a11y-testing.md +0 -17
- package/.claude/commands/gaia-action-items.md +0 -23
- package/.claude/commands/gaia-add-feature.md +0 -17
- package/.claude/commands/gaia-add-stories.md +0 -17
- package/.claude/commands/gaia-advanced-elicitation.md +0 -17
- package/.claude/commands/gaia-adversarial.md +0 -15
- package/.claude/commands/gaia-agent-analyst.md +0 -14
- package/.claude/commands/gaia-agent-architect.md +0 -14
- package/.claude/commands/gaia-agent-brainstorming.md +0 -14
- package/.claude/commands/gaia-agent-data-engineer.md +0 -14
- package/.claude/commands/gaia-agent-design-thinking.md +0 -14
- package/.claude/commands/gaia-agent-dev-angular.md +0 -14
- package/.claude/commands/gaia-agent-dev-flutter.md +0 -14
- package/.claude/commands/gaia-agent-dev-go.md +0 -14
- package/.claude/commands/gaia-agent-dev-java.md +0 -14
- package/.claude/commands/gaia-agent-dev-mobile.md +0 -14
- package/.claude/commands/gaia-agent-dev-python.md +0 -14
- package/.claude/commands/gaia-agent-dev-typescript.md +0 -14
- package/.claude/commands/gaia-agent-devops.md +0 -14
- package/.claude/commands/gaia-agent-innovation.md +0 -14
- package/.claude/commands/gaia-agent-performance.md +0 -14
- package/.claude/commands/gaia-agent-pm.md +0 -14
- package/.claude/commands/gaia-agent-presentation.md +0 -14
- package/.claude/commands/gaia-agent-problem-solver.md +0 -14
- package/.claude/commands/gaia-agent-qa.md +0 -14
- package/.claude/commands/gaia-agent-security.md +0 -14
- package/.claude/commands/gaia-agent-sm.md +0 -14
- package/.claude/commands/gaia-agent-storyteller.md +0 -14
- package/.claude/commands/gaia-agent-tech-writer.md +0 -14
- package/.claude/commands/gaia-agent-test-architect.md +0 -14
- package/.claude/commands/gaia-agent-ux-designer.md +0 -14
- package/.claude/commands/gaia-agent-validator.md +0 -14
- package/.claude/commands/gaia-atdd.md +0 -17
- package/.claude/commands/gaia-brainstorm.md +0 -17
- package/.claude/commands/gaia-brainstorming.md +0 -17
- package/.claude/commands/gaia-brownfield.md +0 -17
- package/.claude/commands/gaia-build-configs.md +0 -22
- package/.claude/commands/gaia-change-request.md +0 -11
- package/.claude/commands/gaia-changelog.md +0 -16
- package/.claude/commands/gaia-check-dod.md +0 -17
- package/.claude/commands/gaia-check-review-gate.md +0 -17
- package/.claude/commands/gaia-ci-setup.md +0 -17
- package/.claude/commands/gaia-code-review.md +0 -17
- package/.claude/commands/gaia-correct-course.md +0 -17
- package/.claude/commands/gaia-create-arch.md +0 -17
- package/.claude/commands/gaia-create-epics.md +0 -17
- package/.claude/commands/gaia-create-prd.md +0 -17
- package/.claude/commands/gaia-create-story.md +0 -23
- package/.claude/commands/gaia-create-ux.md +0 -17
- package/.claude/commands/gaia-creative-sprint.md +0 -17
- package/.claude/commands/gaia-deploy-checklist.md +0 -17
- package/.claude/commands/gaia-design-thinking.md +0 -17
- package/.claude/commands/gaia-dev-story.md +0 -23
- package/.claude/commands/gaia-document-project.md +0 -17
- package/.claude/commands/gaia-domain-research.md +0 -17
- package/.claude/commands/gaia-edge-cases.md +0 -15
- package/.claude/commands/gaia-edit-arch.md +0 -17
- package/.claude/commands/gaia-edit-prd.md +0 -17
- package/.claude/commands/gaia-edit-test-plan.md +0 -17
- package/.claude/commands/gaia-editorial-prose.md +0 -15
- package/.claude/commands/gaia-editorial-structure.md +0 -15
- package/.claude/commands/gaia-epic-status.md +0 -17
- package/.claude/commands/gaia-fix-story.md +0 -17
- package/.claude/commands/gaia-help.md +0 -15
- package/.claude/commands/gaia-index-docs.md +0 -15
- package/.claude/commands/gaia-infra-design.md +0 -17
- package/.claude/commands/gaia-innovation.md +0 -17
- package/.claude/commands/gaia-market-research.md +0 -17
- package/.claude/commands/gaia-memory-hygiene.md +0 -17
- package/.claude/commands/gaia-merge-docs.md +0 -16
- package/.claude/commands/gaia-mobile-testing.md +0 -17
- package/.claude/commands/gaia-nfr.md +0 -17
- package/.claude/commands/gaia-party.md +0 -17
- package/.claude/commands/gaia-perf-testing.md +0 -17
- package/.claude/commands/gaia-performance-review.md +0 -17
- package/.claude/commands/gaia-pitch-deck.md +0 -17
- package/.claude/commands/gaia-post-deploy.md +0 -17
- package/.claude/commands/gaia-problem-solving.md +0 -17
- package/.claude/commands/gaia-product-brief.md +0 -17
- package/.claude/commands/gaia-project-context.md +0 -17
- package/.claude/commands/gaia-qa-tests.md +0 -17
- package/.claude/commands/gaia-quick-dev.md +0 -17
- package/.claude/commands/gaia-quick-spec.md +0 -17
- package/.claude/commands/gaia-readiness-check.md +0 -17
- package/.claude/commands/gaia-refresh-ground-truth.md +0 -17
- package/.claude/commands/gaia-release-plan.md +0 -17
- package/.claude/commands/gaia-resume.md +0 -25
- package/.claude/commands/gaia-retro.md +0 -20
- package/.claude/commands/gaia-review-a11y.md +0 -16
- package/.claude/commands/gaia-review-api.md +0 -16
- package/.claude/commands/gaia-review-deps.md +0 -16
- package/.claude/commands/gaia-review-perf.md +0 -16
- package/.claude/commands/gaia-review-security.md +0 -16
- package/.claude/commands/gaia-rollback-plan.md +0 -17
- package/.claude/commands/gaia-run-all-reviews.md +0 -17
- package/.claude/commands/gaia-security-review.md +0 -17
- package/.claude/commands/gaia-shard-doc.md +0 -15
- package/.claude/commands/gaia-slide-deck.md +0 -17
- package/.claude/commands/gaia-sprint-plan.md +0 -17
- package/.claude/commands/gaia-sprint-status.md +0 -17
- package/.claude/commands/gaia-storytelling.md +0 -17
- package/.claude/commands/gaia-summarize.md +0 -16
- package/.claude/commands/gaia-teach-testing.md +0 -17
- package/.claude/commands/gaia-tech-debt-review.md +0 -20
- package/.claude/commands/gaia-tech-research.md +0 -17
- package/.claude/commands/gaia-test-automate.md +0 -17
- package/.claude/commands/gaia-test-design.md +0 -17
- package/.claude/commands/gaia-test-framework.md +0 -17
- package/.claude/commands/gaia-test-review.md +0 -17
- package/.claude/commands/gaia-threat-model.md +0 -17
- package/.claude/commands/gaia-trace.md +0 -17
- package/.claude/commands/gaia-triage-findings.md +0 -20
- package/.claude/commands/gaia-val-validate-plan.md +0 -17
- package/.claude/commands/gaia-val-validate.md +0 -17
- package/.claude/commands/gaia-validate-framework.md +0 -17
- package/.claude/commands/gaia-validate-prd.md +0 -17
- package/.claude/commands/gaia-validate-story.md +0 -22
- package/.claude/commands/gaia.md +0 -32
- package/CLAUDE.md +0 -165
- package/_gaia/_config/agent-manifest.csv +0 -29
- package/_gaia/_config/agents/CUSTOMIZATION-README.md +0 -117
- package/_gaia/_config/files-manifest.csv +0 -30
- package/_gaia/_config/gaia-help.csv +0 -82
- package/_gaia/_config/global.yaml +0 -45
- package/_gaia/_config/lifecycle-sequence.yaml +0 -593
- package/_gaia/_config/manifest.yaml +0 -24
- package/_gaia/_config/skill-manifest.csv +0 -12
- package/_gaia/_config/task-manifest.csv +0 -17
- package/_gaia/_config/workflow-manifest.csv +0 -73
- package/_gaia/_memory/tier2-results/.gitkeep +0 -0
- package/_gaia/_memory/tier2-results/checkpoint-resume-2026-03-24.yaml +0 -6
- package/_gaia/_memory/tier2-results/engine-scenarios-2026-03-22.yaml +0 -14
- package/_gaia/core/.resolved/.gitkeep +0 -0
- package/_gaia/core/agents/orchestrator.md +0 -303
- package/_gaia/core/config.yaml +0 -8
- package/_gaia/core/engine/error-recovery.xml +0 -28
- package/_gaia/core/engine/protocols/discover-inputs.xml +0 -31
- package/_gaia/core/engine/protocols/handoff.xml +0 -21
- package/_gaia/core/engine/protocols/preflight-check.xml +0 -31
- package/_gaia/core/engine/task-runner.xml +0 -63
- package/_gaia/core/engine/workflow.xml +0 -225
- package/_gaia/core/module-help.csv +0 -21
- package/_gaia/core/protocols/agent-specification-protocol.md +0 -103
- package/_gaia/core/protocols/review-gate-check.xml +0 -29
- package/_gaia/core/protocols/sprint-status-write-safety.xml +0 -35
- package/_gaia/core/protocols/status-sync.xml +0 -49
- package/_gaia/core/tasks/editorial-review-prose.xml +0 -42
- package/_gaia/core/tasks/editorial-review-structure.xml +0 -43
- package/_gaia/core/tasks/generate-changelog.xml +0 -35
- package/_gaia/core/tasks/help.md +0 -45
- package/_gaia/core/tasks/index-docs.xml +0 -46
- package/_gaia/core/tasks/merge-docs.xml +0 -34
- package/_gaia/core/tasks/review-accessibility.xml +0 -47
- package/_gaia/core/tasks/review-adversarial.xml +0 -55
- package/_gaia/core/tasks/review-api-design.xml +0 -38
- package/_gaia/core/tasks/review-dependency-audit.xml +0 -38
- package/_gaia/core/tasks/review-edge-case-hunter.xml +0 -52
- package/_gaia/core/tasks/review-performance.xml +0 -49
- package/_gaia/core/tasks/review-security.xml +0 -37
- package/_gaia/core/tasks/shard-doc.xml +0 -49
- package/_gaia/core/tasks/summarize-doc.xml +0 -33
- package/_gaia/core/tasks/validate-framework.xml +0 -66
- package/_gaia/core/workflows/brainstorming/steps/step-01-session-setup.md +0 -7
- package/_gaia/core/workflows/brainstorming/steps/step-02-technique-selection.md +0 -20
- package/_gaia/core/workflows/brainstorming/steps/step-03-technique-execution.md +0 -11
- package/_gaia/core/workflows/brainstorming/steps/step-04-idea-organization.md +0 -14
- package/_gaia/core/workflows/brainstorming/template.md +0 -38
- package/_gaia/core/workflows/brainstorming/workflow.yaml +0 -26
- package/_gaia/core/workflows/party-mode/steps/step-01-agent-loading.md +0 -11
- package/_gaia/core/workflows/party-mode/steps/step-02-discussion-orchestration.md +0 -16
- package/_gaia/core/workflows/party-mode/steps/step-03-graceful-exit.md +0 -10
- package/_gaia/core/workflows/party-mode/workflow.yaml +0 -23
- package/_gaia/creative/.resolved/.gitkeep +0 -0
- package/_gaia/creative/agents/brainstorming-coach.md +0 -93
- package/_gaia/creative/agents/design-thinking-coach.md +0 -91
- package/_gaia/creative/agents/innovation-strategist.md +0 -89
- package/_gaia/creative/agents/presentation-designer.md +0 -99
- package/_gaia/creative/agents/problem-solver.md +0 -90
- package/_gaia/creative/agents/storyteller.md +0 -90
- package/_gaia/creative/config.yaml +0 -8
- package/_gaia/creative/data/design-methods.csv +0 -28
- package/_gaia/creative/data/innovation-frameworks.csv +0 -15
- package/_gaia/creative/data/solving-methods.csv +0 -14
- package/_gaia/creative/data/story-types.csv +0 -12
- package/_gaia/creative/module-help.csv +0 -8
- package/_gaia/creative/teams/creative-squad.yaml +0 -10
- package/_gaia/creative/workflows/creative-sprint/checklist.md +0 -10
- package/_gaia/creative/workflows/creative-sprint/instructions.xml +0 -40
- package/_gaia/creative/workflows/creative-sprint/workflow.yaml +0 -11
- package/_gaia/creative/workflows/design-thinking/checklist.md +0 -25
- package/_gaia/creative/workflows/design-thinking/instructions.xml +0 -38
- package/_gaia/creative/workflows/design-thinking/workflow.yaml +0 -13
- package/_gaia/creative/workflows/innovation-strategy/checklist.md +0 -26
- package/_gaia/creative/workflows/innovation-strategy/instructions.xml +0 -34
- package/_gaia/creative/workflows/innovation-strategy/workflow.yaml +0 -13
- package/_gaia/creative/workflows/pitch-deck/checklist.md +0 -22
- package/_gaia/creative/workflows/pitch-deck/instructions.xml +0 -49
- package/_gaia/creative/workflows/pitch-deck/workflow.yaml +0 -15
- package/_gaia/creative/workflows/problem-solving/checklist.md +0 -26
- package/_gaia/creative/workflows/problem-solving/instructions.xml +0 -39
- package/_gaia/creative/workflows/problem-solving/workflow.yaml +0 -13
- package/_gaia/creative/workflows/slide-deck/checklist.md +0 -21
- package/_gaia/creative/workflows/slide-deck/instructions.xml +0 -39
- package/_gaia/creative/workflows/slide-deck/workflow.yaml +0 -15
- package/_gaia/creative/workflows/storytelling/checklist.md +0 -26
- package/_gaia/creative/workflows/storytelling/instructions.xml +0 -38
- package/_gaia/creative/workflows/storytelling/workflow.yaml +0 -13
- package/_gaia/dev/agents/_base-dev.md +0 -180
- package/_gaia/dev/agents/angular-dev.md +0 -70
- package/_gaia/dev/agents/flutter-dev.md +0 -70
- package/_gaia/dev/agents/go-dev.md +0 -72
- package/_gaia/dev/agents/java-dev.md +0 -70
- package/_gaia/dev/agents/mobile-dev.md +0 -70
- package/_gaia/dev/agents/python-dev.md +0 -70
- package/_gaia/dev/agents/typescript-dev.md +0 -70
- package/_gaia/dev/config.yaml +0 -11
- package/_gaia/dev/knowledge/_index.csv +0 -25
- package/_gaia/dev/knowledge/angular/angular-conventions.md +0 -119
- package/_gaia/dev/knowledge/angular/angular-patterns.md +0 -126
- package/_gaia/dev/knowledge/angular/ngrx-state.md +0 -124
- package/_gaia/dev/knowledge/angular/rxjs-patterns.md +0 -119
- package/_gaia/dev/knowledge/flutter/dart-conventions.md +0 -143
- package/_gaia/dev/knowledge/flutter/platform-channels.md +0 -144
- package/_gaia/dev/knowledge/flutter/state-management.md +0 -144
- package/_gaia/dev/knowledge/flutter/widget-patterns.md +0 -134
- package/_gaia/dev/knowledge/go/gin-fiber-patterns.md +0 -40
- package/_gaia/dev/knowledge/go/go-conventions.md +0 -54
- package/_gaia/dev/knowledge/go/go-stdlib-patterns.md +0 -39
- package/_gaia/dev/knowledge/go/go-testing-patterns.md +0 -39
- package/_gaia/dev/knowledge/java/jpa-patterns.md +0 -136
- package/_gaia/dev/knowledge/java/maven-gradle.md +0 -189
- package/_gaia/dev/knowledge/java/microservices.md +0 -159
- package/_gaia/dev/knowledge/java/spring-boot-patterns.md +0 -160
- package/_gaia/dev/knowledge/mobile/kotlin-patterns.md +0 -193
- package/_gaia/dev/knowledge/mobile/mobile-testing.md +0 -186
- package/_gaia/dev/knowledge/mobile/react-native-patterns.md +0 -162
- package/_gaia/dev/knowledge/mobile/swift-patterns.md +0 -190
- package/_gaia/dev/knowledge/python/data-pipelines.md +0 -169
- package/_gaia/dev/knowledge/python/django-patterns.md +0 -145
- package/_gaia/dev/knowledge/python/fastapi-patterns.md +0 -164
- package/_gaia/dev/knowledge/python/python-conventions.md +0 -170
- package/_gaia/dev/knowledge/typescript/express-patterns.md +0 -188
- package/_gaia/dev/knowledge/typescript/nextjs-patterns.md +0 -166
- package/_gaia/dev/knowledge/typescript/react-patterns.md +0 -176
- package/_gaia/dev/knowledge/typescript/ts-conventions.md +0 -133
- package/_gaia/dev/module-help.csv +0 -10
- package/_gaia/dev/skills/_skill-index.yaml +0 -55
- package/_gaia/dev/skills/api-design.md +0 -229
- package/_gaia/dev/skills/code-review-standards.md +0 -226
- package/_gaia/dev/skills/database-design.md +0 -172
- package/_gaia/dev/skills/docker-workflow.md +0 -222
- package/_gaia/dev/skills/documentation-standards.md +0 -256
- package/_gaia/dev/skills/git-workflow.md +0 -157
- package/_gaia/dev/skills/security-basics.md +0 -230
- package/_gaia/dev/skills/testing-patterns.md +0 -232
- package/_gaia/lifecycle/.resolved/.gitkeep +0 -0
- package/_gaia/lifecycle/agents/analyst.md +0 -104
- package/_gaia/lifecycle/agents/architect.md +0 -109
- package/_gaia/lifecycle/agents/data-engineer.md +0 -99
- package/_gaia/lifecycle/agents/devops.md +0 -110
- package/_gaia/lifecycle/agents/performance.md +0 -92
- package/_gaia/lifecycle/agents/pm.md +0 -112
- package/_gaia/lifecycle/agents/qa.md +0 -89
- package/_gaia/lifecycle/agents/security.md +0 -108
- package/_gaia/lifecycle/agents/sm.md +0 -119
- package/_gaia/lifecycle/agents/tech-writer.md +0 -94
- package/_gaia/lifecycle/agents/ux-designer.md +0 -94
- package/_gaia/lifecycle/agents/validator.md +0 -189
- package/_gaia/lifecycle/config.yaml +0 -14
- package/_gaia/lifecycle/module-help.csv +0 -39
- package/_gaia/lifecycle/skills/ground-truth-management.md +0 -252
- package/_gaia/lifecycle/skills/memory-management.md +0 -322
- package/_gaia/lifecycle/skills/validation-patterns.md +0 -230
- package/_gaia/lifecycle/teams/team-data-intensive.yaml +0 -12
- package/_gaia/lifecycle/teams/team-enterprise.yaml +0 -16
- package/_gaia/lifecycle/teams/team-full.yaml +0 -13
- package/_gaia/lifecycle/teams/team-implementation.yaml +0 -8
- package/_gaia/lifecycle/teams/team-planning.yaml +0 -9
- package/_gaia/lifecycle/teams/team-quick-ship.yaml +0 -6
- package/_gaia/lifecycle/teams/team-security-focused.yaml +0 -13
- package/_gaia/lifecycle/templates/api-documentation-template.md +0 -112
- package/_gaia/lifecycle/templates/architecture-template.md +0 -65
- package/_gaia/lifecycle/templates/brownfield-architecture-template.md +0 -198
- package/_gaia/lifecycle/templates/brownfield-assessment-template.md +0 -78
- package/_gaia/lifecycle/templates/brownfield-onboarding-template.md +0 -160
- package/_gaia/lifecycle/templates/dependency-map-template.md +0 -73
- package/_gaia/lifecycle/templates/deployment-template.md +0 -52
- package/_gaia/lifecycle/templates/epic-status-template.md +0 -64
- package/_gaia/lifecycle/templates/event-catalog-template.md +0 -78
- package/_gaia/lifecycle/templates/nfr-assessment-template.md +0 -96
- package/_gaia/lifecycle/templates/prd-template.md +0 -83
- package/_gaia/lifecycle/templates/product-brief-template.md +0 -48
- package/_gaia/lifecycle/templates/review-template.md +0 -47
- package/_gaia/lifecycle/templates/sprint-plan-template.md +0 -45
- package/_gaia/lifecycle/templates/story-template.md +0 -118
- package/_gaia/lifecycle/templates/tech-debt-dashboard-template.md +0 -71
- package/_gaia/lifecycle/templates/test-plan-template.md +0 -56
- package/_gaia/lifecycle/templates/ux-design-assessment-template.md +0 -122
- package/_gaia/lifecycle/workflows/1-analysis/advanced-elicitation/instructions.xml +0 -44
- package/_gaia/lifecycle/workflows/1-analysis/advanced-elicitation/methods.csv +0 -9
- package/_gaia/lifecycle/workflows/1-analysis/advanced-elicitation/workflow.yaml +0 -33
- package/_gaia/lifecycle/workflows/1-analysis/brainstorm-project/checklist.md +0 -24
- package/_gaia/lifecycle/workflows/1-analysis/brainstorm-project/instructions.xml +0 -39
- package/_gaia/lifecycle/workflows/1-analysis/brainstorm-project/workflow.yaml +0 -19
- package/_gaia/lifecycle/workflows/1-analysis/create-product-brief/checklist.md +0 -27
- package/_gaia/lifecycle/workflows/1-analysis/create-product-brief/instructions.xml +0 -57
- package/_gaia/lifecycle/workflows/1-analysis/create-product-brief/workflow.yaml +0 -38
- package/_gaia/lifecycle/workflows/1-analysis/domain-research/checklist.md +0 -22
- package/_gaia/lifecycle/workflows/1-analysis/domain-research/instructions.xml +0 -34
- package/_gaia/lifecycle/workflows/1-analysis/domain-research/workflow.yaml +0 -15
- package/_gaia/lifecycle/workflows/1-analysis/market-research/checklist.md +0 -28
- package/_gaia/lifecycle/workflows/1-analysis/market-research/instructions.xml +0 -42
- package/_gaia/lifecycle/workflows/1-analysis/market-research/workflow.yaml +0 -15
- package/_gaia/lifecycle/workflows/1-analysis/technical-research/checklist.md +0 -22
- package/_gaia/lifecycle/workflows/1-analysis/technical-research/instructions.xml +0 -34
- package/_gaia/lifecycle/workflows/1-analysis/technical-research/workflow.yaml +0 -15
- package/_gaia/lifecycle/workflows/2-planning/create-prd/checklist.md +0 -36
- package/_gaia/lifecycle/workflows/2-planning/create-prd/instructions.xml +0 -80
- package/_gaia/lifecycle/workflows/2-planning/create-prd/workflow.yaml +0 -23
- package/_gaia/lifecycle/workflows/2-planning/create-ux-design/checklist.md +0 -26
- package/_gaia/lifecycle/workflows/2-planning/create-ux-design/instructions.xml +0 -49
- package/_gaia/lifecycle/workflows/2-planning/create-ux-design/workflow.yaml +0 -23
- package/_gaia/lifecycle/workflows/2-planning/edit-prd/checklist.md +0 -17
- package/_gaia/lifecycle/workflows/2-planning/edit-prd/instructions.xml +0 -50
- package/_gaia/lifecycle/workflows/2-planning/edit-prd/workflow.yaml +0 -22
- package/_gaia/lifecycle/workflows/2-planning/validate-prd/checklist.md +0 -12
- package/_gaia/lifecycle/workflows/2-planning/validate-prd/instructions.xml +0 -52
- package/_gaia/lifecycle/workflows/2-planning/validate-prd/workflow.yaml +0 -19
- package/_gaia/lifecycle/workflows/3-solutioning/create-architecture/checklist.md +0 -32
- package/_gaia/lifecycle/workflows/3-solutioning/create-architecture/instructions.xml +0 -100
- package/_gaia/lifecycle/workflows/3-solutioning/create-architecture/workflow.yaml +0 -41
- package/_gaia/lifecycle/workflows/3-solutioning/create-epics-stories/checklist.md +0 -30
- package/_gaia/lifecycle/workflows/3-solutioning/create-epics-stories/instructions.xml +0 -86
- package/_gaia/lifecycle/workflows/3-solutioning/create-epics-stories/workflow.yaml +0 -34
- package/_gaia/lifecycle/workflows/3-solutioning/edit-architecture/checklist.md +0 -24
- package/_gaia/lifecycle/workflows/3-solutioning/edit-architecture/instructions.xml +0 -91
- package/_gaia/lifecycle/workflows/3-solutioning/edit-architecture/workflow.yaml +0 -32
- package/_gaia/lifecycle/workflows/3-solutioning/implementation-readiness/checklist.md +0 -66
- package/_gaia/lifecycle/workflows/3-solutioning/implementation-readiness/instructions.xml +0 -160
- package/_gaia/lifecycle/workflows/3-solutioning/implementation-readiness/workflow.yaml +0 -48
- package/_gaia/lifecycle/workflows/3-solutioning/infrastructure-design/checklist.md +0 -24
- package/_gaia/lifecycle/workflows/3-solutioning/infrastructure-design/instructions.xml +0 -44
- package/_gaia/lifecycle/workflows/3-solutioning/infrastructure-design/workflow.yaml +0 -23
- package/_gaia/lifecycle/workflows/3-solutioning/security-threat-model/checklist.md +0 -24
- package/_gaia/lifecycle/workflows/3-solutioning/security-threat-model/instructions.xml +0 -55
- package/_gaia/lifecycle/workflows/3-solutioning/security-threat-model/workflow.yaml +0 -23
- package/_gaia/lifecycle/workflows/4-implementation/action-items/instructions.xml +0 -131
- package/_gaia/lifecycle/workflows/4-implementation/action-items/workflow.yaml +0 -19
- package/_gaia/lifecycle/workflows/4-implementation/add-stories/checklist.md +0 -27
- package/_gaia/lifecycle/workflows/4-implementation/add-stories/instructions.xml +0 -100
- package/_gaia/lifecycle/workflows/4-implementation/add-stories/workflow.yaml +0 -35
- package/_gaia/lifecycle/workflows/4-implementation/change-request/checklist.md +0 -25
- package/_gaia/lifecycle/workflows/4-implementation/change-request/instructions.xml +0 -123
- package/_gaia/lifecycle/workflows/4-implementation/change-request/workflow.yaml +0 -38
- package/_gaia/lifecycle/workflows/4-implementation/check-dod/checklist.md +0 -18
- package/_gaia/lifecycle/workflows/4-implementation/check-dod/instructions.xml +0 -54
- package/_gaia/lifecycle/workflows/4-implementation/check-dod/workflow.yaml +0 -19
- package/_gaia/lifecycle/workflows/4-implementation/check-review-gate/checklist.md +0 -18
- package/_gaia/lifecycle/workflows/4-implementation/check-review-gate/instructions.xml +0 -53
- package/_gaia/lifecycle/workflows/4-implementation/check-review-gate/workflow.yaml +0 -19
- package/_gaia/lifecycle/workflows/4-implementation/code-review/checklist.md +0 -18
- package/_gaia/lifecycle/workflows/4-implementation/code-review/instructions.xml +0 -50
- package/_gaia/lifecycle/workflows/4-implementation/code-review/workflow.yaml +0 -24
- package/_gaia/lifecycle/workflows/4-implementation/correct-course/checklist.md +0 -21
- package/_gaia/lifecycle/workflows/4-implementation/correct-course/instructions.xml +0 -63
- package/_gaia/lifecycle/workflows/4-implementation/correct-course/workflow.yaml +0 -25
- package/_gaia/lifecycle/workflows/4-implementation/create-story/checklist.md +0 -38
- package/_gaia/lifecycle/workflows/4-implementation/create-story/instructions.xml +0 -194
- package/_gaia/lifecycle/workflows/4-implementation/create-story/workflow.yaml +0 -26
- package/_gaia/lifecycle/workflows/4-implementation/dev-story/checklist.md +0 -26
- package/_gaia/lifecycle/workflows/4-implementation/dev-story/instructions.xml +0 -268
- package/_gaia/lifecycle/workflows/4-implementation/dev-story/workflow.yaml +0 -51
- package/_gaia/lifecycle/workflows/4-implementation/epic-status/checklist.md +0 -25
- package/_gaia/lifecycle/workflows/4-implementation/epic-status/instructions.xml +0 -62
- package/_gaia/lifecycle/workflows/4-implementation/epic-status/workflow.yaml +0 -24
- package/_gaia/lifecycle/workflows/4-implementation/fix-story/checklist.md +0 -12
- package/_gaia/lifecycle/workflows/4-implementation/fix-story/instructions.xml +0 -67
- package/_gaia/lifecycle/workflows/4-implementation/fix-story/workflow.yaml +0 -17
- package/_gaia/lifecycle/workflows/4-implementation/qa-generate-tests/checklist.md +0 -19
- package/_gaia/lifecycle/workflows/4-implementation/qa-generate-tests/instructions.xml +0 -52
- package/_gaia/lifecycle/workflows/4-implementation/qa-generate-tests/workflow.yaml +0 -20
- package/_gaia/lifecycle/workflows/4-implementation/retrospective/checklist.md +0 -15
- package/_gaia/lifecycle/workflows/4-implementation/retrospective/instructions.xml +0 -164
- package/_gaia/lifecycle/workflows/4-implementation/retrospective/workflow.yaml +0 -30
- package/_gaia/lifecycle/workflows/4-implementation/run-all-reviews/checklist.md +0 -14
- package/_gaia/lifecycle/workflows/4-implementation/run-all-reviews/instructions.xml +0 -78
- package/_gaia/lifecycle/workflows/4-implementation/run-all-reviews/workflow.yaml +0 -16
- package/_gaia/lifecycle/workflows/4-implementation/security-review/checklist.md +0 -29
- package/_gaia/lifecycle/workflows/4-implementation/security-review/instructions.xml +0 -80
- package/_gaia/lifecycle/workflows/4-implementation/security-review/workflow.yaml +0 -27
- package/_gaia/lifecycle/workflows/4-implementation/sprint-planning/checklist.md +0 -29
- package/_gaia/lifecycle/workflows/4-implementation/sprint-planning/instructions.xml +0 -140
- package/_gaia/lifecycle/workflows/4-implementation/sprint-planning/workflow.yaml +0 -33
- package/_gaia/lifecycle/workflows/4-implementation/sprint-status/checklist.md +0 -18
- package/_gaia/lifecycle/workflows/4-implementation/sprint-status/instructions.xml +0 -36
- package/_gaia/lifecycle/workflows/4-implementation/sprint-status/workflow.yaml +0 -19
- package/_gaia/lifecycle/workflows/4-implementation/tech-debt-review/checklist.md +0 -30
- package/_gaia/lifecycle/workflows/4-implementation/tech-debt-review/instructions.xml +0 -147
- package/_gaia/lifecycle/workflows/4-implementation/tech-debt-review/workflow.yaml +0 -24
- package/_gaia/lifecycle/workflows/4-implementation/triage-findings/checklist.md +0 -17
- package/_gaia/lifecycle/workflows/4-implementation/triage-findings/instructions.xml +0 -124
- package/_gaia/lifecycle/workflows/4-implementation/triage-findings/workflow.yaml +0 -15
- package/_gaia/lifecycle/workflows/4-implementation/val-refresh-ground-truth/checklist.md +0 -48
- package/_gaia/lifecycle/workflows/4-implementation/val-refresh-ground-truth/instructions.xml +0 -125
- package/_gaia/lifecycle/workflows/4-implementation/val-refresh-ground-truth/workflow.yaml +0 -31
- package/_gaia/lifecycle/workflows/4-implementation/val-validate-artifact/checklist.md +0 -54
- package/_gaia/lifecycle/workflows/4-implementation/val-validate-artifact/instructions.xml +0 -147
- package/_gaia/lifecycle/workflows/4-implementation/val-validate-artifact/test-structure.sh +0 -116
- package/_gaia/lifecycle/workflows/4-implementation/val-validate-artifact/workflow.yaml +0 -29
- package/_gaia/lifecycle/workflows/4-implementation/val-validate-plan/checklist.md +0 -34
- package/_gaia/lifecycle/workflows/4-implementation/val-validate-plan/instructions.xml +0 -162
- package/_gaia/lifecycle/workflows/4-implementation/val-validate-plan/workflow.yaml +0 -39
- package/_gaia/lifecycle/workflows/4-implementation/validate-story/checklist.md +0 -23
- package/_gaia/lifecycle/workflows/4-implementation/validate-story/instructions.xml +0 -146
- package/_gaia/lifecycle/workflows/4-implementation/validate-story/workflow.yaml +0 -25
- package/_gaia/lifecycle/workflows/5-deployment/deployment-checklist/checklist.md +0 -29
- package/_gaia/lifecycle/workflows/5-deployment/deployment-checklist/instructions.xml +0 -59
- package/_gaia/lifecycle/workflows/5-deployment/deployment-checklist/workflow.yaml +0 -39
- package/_gaia/lifecycle/workflows/5-deployment/post-deploy-verify/checklist.md +0 -19
- package/_gaia/lifecycle/workflows/5-deployment/post-deploy-verify/instructions.xml +0 -33
- package/_gaia/lifecycle/workflows/5-deployment/post-deploy-verify/workflow.yaml +0 -15
- package/_gaia/lifecycle/workflows/5-deployment/release-plan/checklist.md +0 -20
- package/_gaia/lifecycle/workflows/5-deployment/release-plan/instructions.xml +0 -33
- package/_gaia/lifecycle/workflows/5-deployment/release-plan/workflow.yaml +0 -19
- package/_gaia/lifecycle/workflows/5-deployment/rollback-plan/checklist.md +0 -20
- package/_gaia/lifecycle/workflows/5-deployment/rollback-plan/instructions.xml +0 -33
- package/_gaia/lifecycle/workflows/5-deployment/rollback-plan/workflow.yaml +0 -15
- package/_gaia/lifecycle/workflows/anytime/brownfield-onboarding/checklist.md +0 -52
- package/_gaia/lifecycle/workflows/anytime/brownfield-onboarding/instructions.xml +0 -122
- package/_gaia/lifecycle/workflows/anytime/brownfield-onboarding/test-step7.sh +0 -149
- package/_gaia/lifecycle/workflows/anytime/brownfield-onboarding/workflow.yaml +0 -33
- package/_gaia/lifecycle/workflows/anytime/document-project/checklist.md +0 -11
- package/_gaia/lifecycle/workflows/anytime/document-project/instructions.xml +0 -26
- package/_gaia/lifecycle/workflows/anytime/document-project/workflow.yaml +0 -15
- package/_gaia/lifecycle/workflows/anytime/generate-project-context/checklist.md +0 -11
- package/_gaia/lifecycle/workflows/anytime/generate-project-context/instructions.xml +0 -22
- package/_gaia/lifecycle/workflows/anytime/generate-project-context/workflow.yaml +0 -15
- package/_gaia/lifecycle/workflows/anytime/memory-hygiene/checklist.md +0 -24
- package/_gaia/lifecycle/workflows/anytime/memory-hygiene/instructions.xml +0 -108
- package/_gaia/lifecycle/workflows/anytime/memory-hygiene/workflow.yaml +0 -15
- package/_gaia/lifecycle/workflows/anytime/performance-review/checklist.md +0 -25
- package/_gaia/lifecycle/workflows/anytime/performance-review/instructions.xml +0 -62
- package/_gaia/lifecycle/workflows/anytime/performance-review/workflow.yaml +0 -15
- package/_gaia/lifecycle/workflows/cross-phase/add-feature/checklist.md +0 -30
- package/_gaia/lifecycle/workflows/cross-phase/add-feature/instructions.xml +0 -85
- package/_gaia/lifecycle/workflows/cross-phase/add-feature/workflow.yaml +0 -37
- package/_gaia/lifecycle/workflows/quick-flow/quick-dev/checklist.md +0 -11
- package/_gaia/lifecycle/workflows/quick-flow/quick-dev/instructions.xml +0 -26
- package/_gaia/lifecycle/workflows/quick-flow/quick-dev/workflow.yaml +0 -19
- package/_gaia/lifecycle/workflows/quick-flow/quick-spec/checklist.md +0 -13
- package/_gaia/lifecycle/workflows/quick-flow/quick-spec/instructions.xml +0 -27
- package/_gaia/lifecycle/workflows/quick-flow/quick-spec/workflow.yaml +0 -15
- package/_gaia/testing/.resolved/.gitkeep +0 -0
- package/_gaia/testing/agents/test-architect.md +0 -131
- package/_gaia/testing/config.yaml +0 -8
- package/_gaia/testing/knowledge/_index.csv +0 -22
- package/_gaia/testing/knowledge/accessibility/axe-core-patterns.md +0 -177
- package/_gaia/testing/knowledge/accessibility/wcag-checks.md +0 -191
- package/_gaia/testing/knowledge/core/deterministic-testing.md +0 -167
- package/_gaia/testing/knowledge/core/fixture-architecture.md +0 -131
- package/_gaia/testing/knowledge/core/test-isolation.md +0 -142
- package/_gaia/testing/knowledge/core/test-pyramid.md +0 -129
- package/_gaia/testing/knowledge/extended/api-testing-patterns.md +0 -196
- package/_gaia/testing/knowledge/extended/data-factories.md +0 -158
- package/_gaia/testing/knowledge/extended/risk-governance.md +0 -119
- package/_gaia/testing/knowledge/extended/selector-resilience.md +0 -109
- package/_gaia/testing/knowledge/mobile-testing/appium-patterns.md +0 -164
- package/_gaia/testing/knowledge/mobile-testing/react-native-testing.md +0 -193
- package/_gaia/testing/knowledge/mobile-testing/responsive-testing.md +0 -177
- package/_gaia/testing/knowledge/performance/k6-patterns.md +0 -200
- package/_gaia/testing/knowledge/performance/lighthouse-ci.md +0 -158
- package/_gaia/testing/knowledge/specialized/contract-testing.md +0 -173
- package/_gaia/testing/knowledge/specialized/test-healing.md +0 -129
- package/_gaia/testing/knowledge/specialized/visual-testing.md +0 -129
- package/_gaia/testing/knowledge/unit-testing/jest-vitest-patterns.md +0 -193
- package/_gaia/testing/knowledge/unit-testing/junit5-patterns.md +0 -200
- package/_gaia/testing/knowledge/unit-testing/pytest-patterns.md +0 -185
- package/_gaia/testing/module-help.csv +0 -13
- package/_gaia/testing/workflows/accessibility-testing/checklist.md +0 -12
- package/_gaia/testing/workflows/accessibility-testing/instructions.xml +0 -41
- package/_gaia/testing/workflows/accessibility-testing/workflow.yaml +0 -13
- package/_gaia/testing/workflows/atdd/checklist.md +0 -6
- package/_gaia/testing/workflows/atdd/instructions.xml +0 -36
- package/_gaia/testing/workflows/atdd/workflow.yaml +0 -22
- package/_gaia/testing/workflows/ci-setup/checklist.md +0 -9
- package/_gaia/testing/workflows/ci-setup/instructions.xml +0 -43
- package/_gaia/testing/workflows/ci-setup/workflow.yaml +0 -11
- package/_gaia/testing/workflows/edit-test-plan/checklist.md +0 -20
- package/_gaia/testing/workflows/edit-test-plan/instructions.xml +0 -65
- package/_gaia/testing/workflows/edit-test-plan/workflow.yaml +0 -35
- package/_gaia/testing/workflows/mobile-testing/checklist.md +0 -13
- package/_gaia/testing/workflows/mobile-testing/instructions.xml +0 -41
- package/_gaia/testing/workflows/mobile-testing/workflow.yaml +0 -11
- package/_gaia/testing/workflows/nfr-assessment/checklist.md +0 -7
- package/_gaia/testing/workflows/nfr-assessment/instructions.xml +0 -26
- package/_gaia/testing/workflows/nfr-assessment/workflow.yaml +0 -11
- package/_gaia/testing/workflows/performance-testing/checklist.md +0 -11
- package/_gaia/testing/workflows/performance-testing/instructions.xml +0 -41
- package/_gaia/testing/workflows/performance-testing/workflow.yaml +0 -11
- package/_gaia/testing/workflows/teach-me-testing/checklist.md +0 -6
- package/_gaia/testing/workflows/teach-me-testing/instructions.xml +0 -28
- package/_gaia/testing/workflows/teach-me-testing/workflow.yaml +0 -12
- package/_gaia/testing/workflows/test-automation/checklist.md +0 -6
- package/_gaia/testing/workflows/test-automation/instructions.xml +0 -49
- package/_gaia/testing/workflows/test-automation/workflow.yaml +0 -11
- package/_gaia/testing/workflows/test-design/checklist.md +0 -9
- package/_gaia/testing/workflows/test-design/instructions.xml +0 -47
- package/_gaia/testing/workflows/test-design/workflow.yaml +0 -11
- package/_gaia/testing/workflows/test-framework/checklist.md +0 -8
- package/_gaia/testing/workflows/test-framework/instructions.xml +0 -25
- package/_gaia/testing/workflows/test-framework/workflow.yaml +0 -11
- package/_gaia/testing/workflows/test-review/checklist.md +0 -9
- package/_gaia/testing/workflows/test-review/instructions.xml +0 -51
- package/_gaia/testing/workflows/test-review/workflow.yaml +0 -11
- package/_gaia/testing/workflows/traceability/checklist.md +0 -6
- package/_gaia/testing/workflows/traceability/instructions.xml +0 -49
- package/_gaia/testing/workflows/traceability/workflow.yaml +0 -21
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: Spring Boot Patterns
|
|
3
|
-
stack: java
|
|
4
|
-
version: "1.0"
|
|
5
|
-
focus: [spring-boot]
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# Spring Boot Patterns
|
|
9
|
-
|
|
10
|
-
## Principle
|
|
11
|
-
|
|
12
|
-
Leverage Spring Boot's auto-configuration and convention-over-configuration philosophy. Use constructor injection for mandatory dependencies, profiles for environment-specific configuration, and Actuator for production observability. Structure applications in layers (controller, service, repository) with clear dependency direction.
|
|
13
|
-
|
|
14
|
-
## Rationale
|
|
15
|
-
|
|
16
|
-
Spring Boot eliminates boilerplate by auto-configuring beans based on classpath contents. Constructor injection makes dependencies explicit and immutable, and enables testing without the Spring container. Profiles allow the same codebase to run against different environments without code changes. Actuator provides production-ready health checks, metrics, and management endpoints with zero custom code.
|
|
17
|
-
|
|
18
|
-
## Pattern Examples
|
|
19
|
-
|
|
20
|
-
### Pattern 1: Layered Architecture with Constructor Injection
|
|
21
|
-
|
|
22
|
-
```java
|
|
23
|
-
// Controller — thin, delegates to service
|
|
24
|
-
@RestController
|
|
25
|
-
@RequestMapping("/api/v1/users")
|
|
26
|
-
@RequiredArgsConstructor // Lombok generates constructor
|
|
27
|
-
public class UserController {
|
|
28
|
-
|
|
29
|
-
private final UserService userService;
|
|
30
|
-
|
|
31
|
-
@GetMapping
|
|
32
|
-
public ResponseEntity<List<UserDto>> getAll(
|
|
33
|
-
@RequestParam(defaultValue = "0") int page,
|
|
34
|
-
@RequestParam(defaultValue = "20") int size) {
|
|
35
|
-
var users = userService.findAll(PageRequest.of(page, size));
|
|
36
|
-
return ResponseEntity.ok(users.getContent());
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
@PostMapping
|
|
40
|
-
public ResponseEntity<UserDto> create(@Valid @RequestBody CreateUserRequest request) {
|
|
41
|
-
var user = userService.create(request);
|
|
42
|
-
var uri = URI.create("/api/v1/users/" + user.id());
|
|
43
|
-
return ResponseEntity.created(uri).body(user);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// Service — business logic
|
|
48
|
-
@Service
|
|
49
|
-
@RequiredArgsConstructor
|
|
50
|
-
@Transactional(readOnly = true)
|
|
51
|
-
public class UserService {
|
|
52
|
-
|
|
53
|
-
private final UserRepository userRepository;
|
|
54
|
-
private final UserMapper userMapper;
|
|
55
|
-
|
|
56
|
-
public Page<UserDto> findAll(Pageable pageable) {
|
|
57
|
-
return userRepository.findAll(pageable).map(userMapper::toDto);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
@Transactional
|
|
61
|
-
public UserDto create(CreateUserRequest request) {
|
|
62
|
-
var entity = userMapper.toEntity(request);
|
|
63
|
-
var saved = userRepository.save(entity);
|
|
64
|
-
return userMapper.toDto(saved);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
### Pattern 2: Profile-Based Configuration
|
|
70
|
-
|
|
71
|
-
```yaml
|
|
72
|
-
# application.yml — common settings
|
|
73
|
-
spring:
|
|
74
|
-
application:
|
|
75
|
-
name: user-service
|
|
76
|
-
jpa:
|
|
77
|
-
open-in-view: false
|
|
78
|
-
|
|
79
|
-
---
|
|
80
|
-
# application-dev.yml
|
|
81
|
-
spring:
|
|
82
|
-
config:
|
|
83
|
-
activate:
|
|
84
|
-
on-profile: dev
|
|
85
|
-
datasource:
|
|
86
|
-
url: jdbc:h2:mem:devdb
|
|
87
|
-
jpa:
|
|
88
|
-
show-sql: true
|
|
89
|
-
|
|
90
|
-
---
|
|
91
|
-
# application-prod.yml
|
|
92
|
-
spring:
|
|
93
|
-
config:
|
|
94
|
-
activate:
|
|
95
|
-
on-profile: prod
|
|
96
|
-
datasource:
|
|
97
|
-
url: jdbc:postgresql://${DB_HOST}:5432/users
|
|
98
|
-
jpa:
|
|
99
|
-
show-sql: false
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
```java
|
|
103
|
-
// Profile-conditional bean
|
|
104
|
-
@Configuration
|
|
105
|
-
public class CacheConfig {
|
|
106
|
-
|
|
107
|
-
@Bean
|
|
108
|
-
@Profile("prod")
|
|
109
|
-
public CacheManager redisCacheManager(RedisConnectionFactory factory) {
|
|
110
|
-
return RedisCacheManager.builder(factory).build();
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
@Bean
|
|
114
|
-
@Profile("!prod")
|
|
115
|
-
public CacheManager simpleCacheManager() {
|
|
116
|
-
return new ConcurrentMapCacheManager("users");
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
### Pattern 3: Actuator and Custom Health Indicator
|
|
122
|
-
|
|
123
|
-
```java
|
|
124
|
-
@Component
|
|
125
|
-
@RequiredArgsConstructor
|
|
126
|
-
public class DatabaseHealthIndicator implements HealthIndicator {
|
|
127
|
-
|
|
128
|
-
private final DataSource dataSource;
|
|
129
|
-
|
|
130
|
-
@Override
|
|
131
|
-
public Health health() {
|
|
132
|
-
try (var conn = dataSource.getConnection()) {
|
|
133
|
-
if (conn.isValid(2)) {
|
|
134
|
-
return Health.up()
|
|
135
|
-
.withDetail("database", "reachable")
|
|
136
|
-
.build();
|
|
137
|
-
}
|
|
138
|
-
} catch (SQLException e) {
|
|
139
|
-
return Health.down()
|
|
140
|
-
.withDetail("error", e.getMessage())
|
|
141
|
-
.build();
|
|
142
|
-
}
|
|
143
|
-
return Health.down().build();
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
## Anti-Patterns
|
|
149
|
-
|
|
150
|
-
- **Field injection with `@Autowired`**: Hides dependencies, prevents immutability, and complicates testing. Use constructor injection.
|
|
151
|
-
- **Business logic in controllers**: Controllers should validate input and delegate. Logic belongs in the service layer.
|
|
152
|
-
- **`spring.jpa.open-in-view=true` (default)**: Keeps DB sessions open during view rendering, causing lazy-loading surprises and connection pool exhaustion. Set to `false`.
|
|
153
|
-
- **Catching all exceptions in each controller method**: Use `@ControllerAdvice` with `@ExceptionHandler` for centralized error handling.
|
|
154
|
-
|
|
155
|
-
## Integration Points
|
|
156
|
-
|
|
157
|
-
- **JPA**: Repository layer uses Spring Data JPA; see `jpa-patterns.md` for entity mapping and query optimization.
|
|
158
|
-
- **Microservices**: Spring Boot apps are the unit of deployment; see `microservices.md` for service decomposition.
|
|
159
|
-
- **Build Tools**: Spring Boot plugin integrates with Maven/Gradle; see `maven-gradle.md`.
|
|
160
|
-
- **Testing**: Use `@SpringBootTest` for integration tests, plain JUnit for service unit tests.
|
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: Kotlin Android Patterns
|
|
3
|
-
stack: mobile
|
|
4
|
-
version: "1.0"
|
|
5
|
-
focus: [kotlin]
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# Kotlin Android Patterns
|
|
9
|
-
|
|
10
|
-
## Principle
|
|
11
|
-
|
|
12
|
-
Use Kotlin coroutines (Flow, StateFlow) for reactive data streams, Jetpack Compose for declarative UI, Hilt for dependency injection, and sealed classes for modeling finite state. Structure Android apps with MVVM architecture where ViewModels expose UI state as StateFlow and Compose observes it.
|
|
13
|
-
|
|
14
|
-
## Rationale
|
|
15
|
-
|
|
16
|
-
Coroutines provide structured concurrency that respects lifecycle boundaries, preventing common memory leaks and crashes from orphaned async work. `StateFlow` is a hot stream that always holds a current value, making it ideal for UI state. Jetpack Compose replaces XML layouts with a reactive, composable UI framework similar to SwiftUI and Flutter. Hilt simplifies Dagger-based DI with Android-specific lifecycle-aware scoping.
|
|
17
|
-
|
|
18
|
-
## Pattern Examples
|
|
19
|
-
|
|
20
|
-
### Pattern 1: ViewModel with StateFlow
|
|
21
|
-
|
|
22
|
-
```kotlin
|
|
23
|
-
// UI State — sealed interface for exhaustive when()
|
|
24
|
-
sealed interface UserListState {
|
|
25
|
-
data object Loading : UserListState
|
|
26
|
-
data class Success(val users: List<User>) : UserListState
|
|
27
|
-
data class Error(val message: String) : UserListState
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
@HiltViewModel
|
|
31
|
-
class UserListViewModel @Inject constructor(
|
|
32
|
-
private val userRepository: UserRepository,
|
|
33
|
-
) : ViewModel() {
|
|
34
|
-
|
|
35
|
-
private val _state = MutableStateFlow<UserListState>(UserListState.Loading)
|
|
36
|
-
val state: StateFlow<UserListState> = _state.asStateFlow()
|
|
37
|
-
|
|
38
|
-
init {
|
|
39
|
-
loadUsers()
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
fun loadUsers() {
|
|
43
|
-
viewModelScope.launch {
|
|
44
|
-
_state.value = UserListState.Loading
|
|
45
|
-
userRepository.getUsers()
|
|
46
|
-
.catch { e ->
|
|
47
|
-
_state.value = UserListState.Error(
|
|
48
|
-
e.message ?: "Unknown error"
|
|
49
|
-
)
|
|
50
|
-
}
|
|
51
|
-
.collect { users ->
|
|
52
|
-
_state.value = UserListState.Success(users)
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
### Pattern 2: Jetpack Compose UI
|
|
60
|
-
|
|
61
|
-
```kotlin
|
|
62
|
-
@Composable
|
|
63
|
-
fun UserListScreen(
|
|
64
|
-
viewModel: UserListViewModel = hiltViewModel(),
|
|
65
|
-
) {
|
|
66
|
-
val state by viewModel.state.collectAsStateWithLifecycle()
|
|
67
|
-
|
|
68
|
-
Scaffold(
|
|
69
|
-
topBar = {
|
|
70
|
-
TopAppBar(title = { Text("Users") })
|
|
71
|
-
},
|
|
72
|
-
) { padding ->
|
|
73
|
-
when (val s = state) {
|
|
74
|
-
is UserListState.Loading -> {
|
|
75
|
-
Box(
|
|
76
|
-
modifier = Modifier.fillMaxSize().padding(padding),
|
|
77
|
-
contentAlignment = Alignment.Center,
|
|
78
|
-
) {
|
|
79
|
-
CircularProgressIndicator()
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
is UserListState.Success -> {
|
|
83
|
-
LazyColumn(
|
|
84
|
-
contentPadding = padding,
|
|
85
|
-
verticalArrangement = Arrangement.spacedBy(8.dp),
|
|
86
|
-
) {
|
|
87
|
-
items(
|
|
88
|
-
items = s.users,
|
|
89
|
-
key = { it.id },
|
|
90
|
-
) { user ->
|
|
91
|
-
UserCard(user = user)
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
is UserListState.Error -> {
|
|
96
|
-
ErrorView(
|
|
97
|
-
message = s.message,
|
|
98
|
-
onRetry = viewModel::loadUsers,
|
|
99
|
-
modifier = Modifier.padding(padding),
|
|
100
|
-
)
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
@Composable
|
|
107
|
-
fun UserCard(user: User, modifier: Modifier = Modifier) {
|
|
108
|
-
Card(
|
|
109
|
-
modifier = modifier.fillMaxWidth().padding(horizontal = 16.dp),
|
|
110
|
-
) {
|
|
111
|
-
Row(
|
|
112
|
-
modifier = Modifier.padding(16.dp),
|
|
113
|
-
verticalAlignment = Alignment.CenterVertically,
|
|
114
|
-
) {
|
|
115
|
-
AsyncImage(
|
|
116
|
-
model = user.avatarUrl,
|
|
117
|
-
contentDescription = null,
|
|
118
|
-
modifier = Modifier.size(48.dp).clip(CircleShape),
|
|
119
|
-
)
|
|
120
|
-
Spacer(modifier = Modifier.width(12.dp))
|
|
121
|
-
Column {
|
|
122
|
-
Text(user.name, style = MaterialTheme.typography.titleMedium)
|
|
123
|
-
Text(user.email, style = MaterialTheme.typography.bodySmall)
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
### Pattern 3: Hilt Dependency Injection
|
|
131
|
-
|
|
132
|
-
```kotlin
|
|
133
|
-
// Module providing dependencies
|
|
134
|
-
@Module
|
|
135
|
-
@InstallIn(SingletonComponent::class)
|
|
136
|
-
object NetworkModule {
|
|
137
|
-
|
|
138
|
-
@Provides
|
|
139
|
-
@Singleton
|
|
140
|
-
fun provideOkHttpClient(): OkHttpClient {
|
|
141
|
-
return OkHttpClient.Builder()
|
|
142
|
-
.addInterceptor(AuthInterceptor())
|
|
143
|
-
.connectTimeout(30, TimeUnit.SECONDS)
|
|
144
|
-
.build()
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
@Provides
|
|
148
|
-
@Singleton
|
|
149
|
-
fun provideRetrofit(client: OkHttpClient): Retrofit {
|
|
150
|
-
return Retrofit.Builder()
|
|
151
|
-
.baseUrl(BuildConfig.API_BASE_URL)
|
|
152
|
-
.client(client)
|
|
153
|
-
.addConverterFactory(MoshiConverterFactory.create())
|
|
154
|
-
.build()
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
@Provides
|
|
158
|
-
@Singleton
|
|
159
|
-
fun provideUserApi(retrofit: Retrofit): UserApi {
|
|
160
|
-
return retrofit.create(UserApi::class.java)
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
// Repository with injected dependencies
|
|
165
|
-
@Singleton
|
|
166
|
-
class UserRepository @Inject constructor(
|
|
167
|
-
private val userApi: UserApi,
|
|
168
|
-
private val userDao: UserDao,
|
|
169
|
-
) {
|
|
170
|
-
fun getUsers(): Flow<List<User>> = flow {
|
|
171
|
-
// Emit cached data first
|
|
172
|
-
emit(userDao.getAll())
|
|
173
|
-
// Then fetch fresh data
|
|
174
|
-
val remote = userApi.getUsers()
|
|
175
|
-
userDao.insertAll(remote)
|
|
176
|
-
emit(remote)
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
## Anti-Patterns
|
|
182
|
-
|
|
183
|
-
- **Collecting flows without lifecycle awareness**: Using `collect` directly in a coroutine scope without `repeatOnLifecycle` or `collectAsStateWithLifecycle` causes updates to be processed when the UI is not visible.
|
|
184
|
-
- **Mutable state exposed from ViewModel**: Exposing `MutableStateFlow` instead of `StateFlow` allows views to mutate state directly.
|
|
185
|
-
- **Recomposition-heavy Compose**: Passing unstable types to composables causes unnecessary recomposition. Use immutable data classes and `@Stable` annotation.
|
|
186
|
-
- **Manual DI wiring**: Building dependency graphs by hand instead of using Hilt. Hilt handles scoping and lifecycle automatically.
|
|
187
|
-
|
|
188
|
-
## Integration Points
|
|
189
|
-
|
|
190
|
-
- **React Native**: Kotlin native modules bridge to React Native via TurboModules; see `react-native-patterns.md`.
|
|
191
|
-
- **Mobile Testing**: JUnit, Compose testing, and Espresso; see `mobile-testing.md`.
|
|
192
|
-
- **Swift**: Cross-platform design considerations; see `swift-patterns.md`.
|
|
193
|
-
- **Coroutines**: `Flow` integrates with Room, Retrofit, and Compose seamlessly.
|
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: Mobile Testing Strategies
|
|
3
|
-
stack: mobile
|
|
4
|
-
version: "1.0"
|
|
5
|
-
focus: [mobile-testing]
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# Mobile Testing Strategies
|
|
9
|
-
|
|
10
|
-
## Principle
|
|
11
|
-
|
|
12
|
-
Test mobile apps at three levels: unit tests for business logic, component/widget tests for UI rendering, and end-to-end tests for critical user flows. Use platform-specific tools (XCTest, Espresso, Detox) for E2E, and cross-platform tools (Jest, flutter_test) for unit and component layers. Include screenshot testing to catch visual regressions across devices and OS versions.
|
|
13
|
-
|
|
14
|
-
## Rationale
|
|
15
|
-
|
|
16
|
-
Mobile apps run on diverse hardware (screen sizes, OS versions, chipsets) and are distributed as immutable binaries that cannot be hotfixed. This makes pre-release testing critical. Unit tests verify logic without simulators/emulators and run in seconds. Component tests verify UI rendering and interaction in isolation. E2E tests validate real user flows but are slower and flakier, so they should cover only critical paths. Screenshot testing catches subtle visual regressions that functional tests miss.
|
|
17
|
-
|
|
18
|
-
## Pattern Examples
|
|
19
|
-
|
|
20
|
-
### Pattern 1: React Native Testing with Detox
|
|
21
|
-
|
|
22
|
-
```typescript
|
|
23
|
-
// e2e/login.test.ts — Detox E2E test
|
|
24
|
-
describe('Login Flow', () => {
|
|
25
|
-
beforeAll(async () => {
|
|
26
|
-
await device.launchApp({ newInstance: true });
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
beforeEach(async () => {
|
|
30
|
-
await device.reloadReactNative();
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it('should log in with valid credentials', async () => {
|
|
34
|
-
await element(by.id('email-input')).typeText('user@example.com');
|
|
35
|
-
await element(by.id('password-input')).typeText('password123');
|
|
36
|
-
await element(by.id('login-button')).tap();
|
|
37
|
-
|
|
38
|
-
// Wait for navigation to complete
|
|
39
|
-
await waitFor(element(by.id('home-screen')))
|
|
40
|
-
.toBeVisible()
|
|
41
|
-
.withTimeout(5000);
|
|
42
|
-
|
|
43
|
-
await expect(element(by.text('Welcome back'))).toBeVisible();
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
it('should show error for invalid credentials', async () => {
|
|
47
|
-
await element(by.id('email-input')).typeText('wrong@example.com');
|
|
48
|
-
await element(by.id('password-input')).typeText('wrong');
|
|
49
|
-
await element(by.id('login-button')).tap();
|
|
50
|
-
|
|
51
|
-
await waitFor(element(by.id('error-message')))
|
|
52
|
-
.toBeVisible()
|
|
53
|
-
.withTimeout(3000);
|
|
54
|
-
|
|
55
|
-
await expect(element(by.text('Invalid credentials'))).toBeVisible();
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
// Component test with React Native Testing Library
|
|
60
|
-
import { render, fireEvent, waitFor } from '@testing-library/react-native';
|
|
61
|
-
|
|
62
|
-
test('LoginForm calls onSubmit with email and password', async () => {
|
|
63
|
-
const onSubmit = jest.fn();
|
|
64
|
-
const { getByTestId } = render(<LoginForm onSubmit={onSubmit} />);
|
|
65
|
-
|
|
66
|
-
fireEvent.changeText(getByTestId('email-input'), 'user@example.com');
|
|
67
|
-
fireEvent.changeText(getByTestId('password-input'), 'password123');
|
|
68
|
-
fireEvent.press(getByTestId('login-button'));
|
|
69
|
-
|
|
70
|
-
await waitFor(() => {
|
|
71
|
-
expect(onSubmit).toHaveBeenCalledWith({
|
|
72
|
-
email: 'user@example.com',
|
|
73
|
-
password: 'password123',
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
### Pattern 2: iOS Testing with XCTest
|
|
80
|
-
|
|
81
|
-
```swift
|
|
82
|
-
// Unit test — pure logic, no UI
|
|
83
|
-
class UserServiceTests: XCTestCase {
|
|
84
|
-
var sut: UserService!
|
|
85
|
-
var mockRepository: MockUserRepository!
|
|
86
|
-
|
|
87
|
-
override func setUp() {
|
|
88
|
-
super.setUp()
|
|
89
|
-
mockRepository = MockUserRepository()
|
|
90
|
-
sut = UserService(repository: mockRepository)
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
func testFetchUsersReturnsUsers() async throws {
|
|
94
|
-
mockRepository.stubbedUsers = [
|
|
95
|
-
User(id: "1", name: "Alice", email: "alice@test.com"),
|
|
96
|
-
]
|
|
97
|
-
|
|
98
|
-
let users = try await sut.fetchAll()
|
|
99
|
-
|
|
100
|
-
XCTAssertEqual(users.count, 1)
|
|
101
|
-
XCTAssertEqual(users.first?.name, "Alice")
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
// UI test with XCUITest
|
|
106
|
-
class LoginUITests: XCTestCase {
|
|
107
|
-
let app = XCUIApplication()
|
|
108
|
-
|
|
109
|
-
override func setUp() {
|
|
110
|
-
super.setUp()
|
|
111
|
-
continueAfterFailure = false
|
|
112
|
-
app.launchArguments = ["--uitesting"]
|
|
113
|
-
app.launch()
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
func testSuccessfulLogin() {
|
|
117
|
-
let emailField = app.textFields["email-field"]
|
|
118
|
-
let passwordField = app.secureTextFields["password-field"]
|
|
119
|
-
let loginButton = app.buttons["login-button"]
|
|
120
|
-
|
|
121
|
-
emailField.tap()
|
|
122
|
-
emailField.typeText("user@example.com")
|
|
123
|
-
passwordField.tap()
|
|
124
|
-
passwordField.typeText("password123")
|
|
125
|
-
loginButton.tap()
|
|
126
|
-
|
|
127
|
-
let homeScreen = app.staticTexts["Welcome back"]
|
|
128
|
-
XCTAssertTrue(homeScreen.waitForExistence(timeout: 5))
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
### Pattern 3: Screenshot Testing
|
|
134
|
-
|
|
135
|
-
```kotlin
|
|
136
|
-
// Android — Compose screenshot test (Roborazzi)
|
|
137
|
-
@RunWith(ParameterizedRobolectricTestRunner::class)
|
|
138
|
-
class UserCardScreenshotTest(
|
|
139
|
-
private val config: ScreenConfig,
|
|
140
|
-
) {
|
|
141
|
-
@get:Rule
|
|
142
|
-
val composeTestRule = createComposeRule()
|
|
143
|
-
|
|
144
|
-
@Test
|
|
145
|
-
fun userCard_default() {
|
|
146
|
-
composeTestRule.setContent {
|
|
147
|
-
AppTheme {
|
|
148
|
-
UserCard(
|
|
149
|
-
user = User(
|
|
150
|
-
name = "Alice Johnson",
|
|
151
|
-
email = "alice@example.com",
|
|
152
|
-
avatarUrl = null,
|
|
153
|
-
),
|
|
154
|
-
)
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
composeTestRule.onRoot()
|
|
158
|
-
.captureRoboImage("screenshots/user_card_${config.name}.png")
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
companion object {
|
|
162
|
-
@JvmStatic
|
|
163
|
-
@ParameterizedRobolectricTestRunner.Parameters(name = "{0}")
|
|
164
|
-
fun configs() = listOf(
|
|
165
|
-
ScreenConfig("phone", 360, 640, 2f),
|
|
166
|
-
ScreenConfig("tablet", 800, 1280, 2f),
|
|
167
|
-
ScreenConfig("phone_large_font", 360, 640, 2f, fontScale = 1.5f),
|
|
168
|
-
)
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
## Anti-Patterns
|
|
174
|
-
|
|
175
|
-
- **E2E tests for everything**: E2E tests are slow and flaky. Use them only for critical user flows (login, checkout, onboarding). Test business logic with unit tests.
|
|
176
|
-
- **No testIDs on interactive elements**: Without accessibility IDs (`testID` in RN, `accessibilityIdentifier` in iOS), E2E tests rely on fragile text matchers.
|
|
177
|
-
- **Testing implementation details**: Testing internal state or private methods couples tests to implementation. Test behavior and outputs.
|
|
178
|
-
- **Skipping device matrix testing**: Testing only on one device/OS version misses platform-specific rendering bugs.
|
|
179
|
-
- **No screenshot baseline management**: Screenshot tests without proper baseline storage and diff tooling generate false positives.
|
|
180
|
-
|
|
181
|
-
## Integration Points
|
|
182
|
-
|
|
183
|
-
- **React Native**: Detox and RNTL for cross-platform testing; see `react-native-patterns.md`.
|
|
184
|
-
- **Swift**: XCTest and XCUITest for iOS; see `swift-patterns.md`.
|
|
185
|
-
- **Kotlin**: JUnit, Compose Test, and Espresso for Android; see `kotlin-patterns.md`.
|
|
186
|
-
- **CI/CD**: Run unit/component tests on every PR; E2E tests nightly or on release branches.
|
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: React Native Application Patterns
|
|
3
|
-
stack: mobile
|
|
4
|
-
version: "1.0"
|
|
5
|
-
focus: [react-native]
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# React Native Application Patterns
|
|
9
|
-
|
|
10
|
-
## Principle
|
|
11
|
-
|
|
12
|
-
Build cross-platform mobile apps with React Native using platform-aware component composition, optimized list rendering with `FlatList`, and React Navigation for type-safe navigation. Use the Hermes engine for improved startup performance and the new architecture (Fabric, TurboModules) for better native interop.
|
|
13
|
-
|
|
14
|
-
## Rationale
|
|
15
|
-
|
|
16
|
-
React Native bridges JavaScript and native platforms, so performance-sensitive code must account for the bridge overhead. `FlatList` virtualizes long lists, rendering only visible items. React Navigation provides a native-feeling navigation experience with proper gesture handling. Hermes (default since RN 0.70) pre-compiles JavaScript to bytecode, reducing TTI by 30-50%. The new architecture eliminates the async bridge bottleneck with synchronous native calls.
|
|
17
|
-
|
|
18
|
-
## Pattern Examples
|
|
19
|
-
|
|
20
|
-
### Pattern 1: Optimized FlatList with Memoized Items
|
|
21
|
-
|
|
22
|
-
```typescript
|
|
23
|
-
interface Message {
|
|
24
|
-
id: string;
|
|
25
|
-
text: string;
|
|
26
|
-
sender: string;
|
|
27
|
-
timestamp: number;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const MessageItem = memo(function MessageItem({
|
|
31
|
-
item,
|
|
32
|
-
onPress,
|
|
33
|
-
}: {
|
|
34
|
-
item: Message;
|
|
35
|
-
onPress: (id: string) => void;
|
|
36
|
-
}) {
|
|
37
|
-
const handlePress = useCallback(() => onPress(item.id), [item.id, onPress]);
|
|
38
|
-
|
|
39
|
-
return (
|
|
40
|
-
<Pressable onPress={handlePress} style={styles.messageItem}>
|
|
41
|
-
<Text style={styles.sender}>{item.sender}</Text>
|
|
42
|
-
<Text style={styles.text}>{item.text}</Text>
|
|
43
|
-
</Pressable>
|
|
44
|
-
);
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
function MessageList({ messages }: { messages: Message[] }) {
|
|
48
|
-
const handlePress = useCallback((id: string) => {
|
|
49
|
-
// Handle message press
|
|
50
|
-
}, []);
|
|
51
|
-
|
|
52
|
-
const renderItem = useCallback(
|
|
53
|
-
({ item }: { item: Message }) => (
|
|
54
|
-
<MessageItem item={item} onPress={handlePress} />
|
|
55
|
-
),
|
|
56
|
-
[handlePress]
|
|
57
|
-
);
|
|
58
|
-
|
|
59
|
-
const keyExtractor = useCallback((item: Message) => item.id, []);
|
|
60
|
-
|
|
61
|
-
return (
|
|
62
|
-
<FlatList
|
|
63
|
-
data={messages}
|
|
64
|
-
renderItem={renderItem}
|
|
65
|
-
keyExtractor={keyExtractor}
|
|
66
|
-
initialNumToRender={15}
|
|
67
|
-
maxToRenderPerBatch={10}
|
|
68
|
-
windowSize={5}
|
|
69
|
-
removeClippedSubviews
|
|
70
|
-
getItemLayout={(_, index) => ({
|
|
71
|
-
length: ITEM_HEIGHT,
|
|
72
|
-
offset: ITEM_HEIGHT * index,
|
|
73
|
-
index,
|
|
74
|
-
})}
|
|
75
|
-
/>
|
|
76
|
-
);
|
|
77
|
-
}
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
### Pattern 2: Type-Safe React Navigation
|
|
81
|
-
|
|
82
|
-
```typescript
|
|
83
|
-
import { NavigationContainer } from '@react-navigation/native';
|
|
84
|
-
import { createNativeStackNavigator } from '@react-navigation/native-stack';
|
|
85
|
-
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
|
|
86
|
-
|
|
87
|
-
// Define all route params in one place
|
|
88
|
-
type RootStackParamList = {
|
|
89
|
-
Auth: undefined;
|
|
90
|
-
Main: undefined;
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
type MainTabParamList = {
|
|
94
|
-
Home: undefined;
|
|
95
|
-
Profile: { userId: string };
|
|
96
|
-
Settings: undefined;
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
type HomeStackParamList = {
|
|
100
|
-
Feed: undefined;
|
|
101
|
-
PostDetail: { postId: string };
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
const RootStack = createNativeStackNavigator<RootStackParamList>();
|
|
105
|
-
const MainTab = createBottomTabNavigator<MainTabParamList>();
|
|
106
|
-
const HomeStack = createNativeStackNavigator<HomeStackParamList>();
|
|
107
|
-
|
|
108
|
-
// Type-safe navigation in components
|
|
109
|
-
import { NativeStackScreenProps } from '@react-navigation/native-stack';
|
|
110
|
-
|
|
111
|
-
type PostDetailProps = NativeStackScreenProps<HomeStackParamList, 'PostDetail'>;
|
|
112
|
-
|
|
113
|
-
function PostDetailScreen({ route, navigation }: PostDetailProps) {
|
|
114
|
-
const { postId } = route.params; // TypeScript knows postId is string
|
|
115
|
-
// navigation.navigate('Feed') works; navigate('Invalid') is a type error
|
|
116
|
-
return <PostView postId={postId} />;
|
|
117
|
-
}
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
### Pattern 3: Platform-Specific Code
|
|
121
|
-
|
|
122
|
-
```typescript
|
|
123
|
-
import { Platform, StyleSheet } from 'react-native';
|
|
124
|
-
|
|
125
|
-
// Platform-specific styling
|
|
126
|
-
const styles = StyleSheet.create({
|
|
127
|
-
shadow: Platform.select({
|
|
128
|
-
ios: {
|
|
129
|
-
shadowColor: '#000',
|
|
130
|
-
shadowOffset: { width: 0, height: 2 },
|
|
131
|
-
shadowOpacity: 0.1,
|
|
132
|
-
shadowRadius: 4,
|
|
133
|
-
},
|
|
134
|
-
android: {
|
|
135
|
-
elevation: 4,
|
|
136
|
-
},
|
|
137
|
-
default: {},
|
|
138
|
-
})!,
|
|
139
|
-
container: {
|
|
140
|
-
paddingTop: Platform.OS === 'ios' ? 44 : 0,
|
|
141
|
-
},
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
// Platform-specific files (RN resolves automatically)
|
|
145
|
-
// DatePicker.ios.tsx — uses native iOS date picker
|
|
146
|
-
// DatePicker.android.tsx — uses Android material date picker
|
|
147
|
-
// DatePicker.tsx — fallback / web
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
## Anti-Patterns
|
|
151
|
-
|
|
152
|
-
- **ScrollView for long lists**: `ScrollView` renders all children at once. Use `FlatList` or `SectionList` for lists with more than ~20 items.
|
|
153
|
-
- **Inline styles and functions in render**: Creating new objects and functions on every render defeats `memo`. Extract to `StyleSheet.create` and `useCallback`.
|
|
154
|
-
- **Ignoring Hermes**: Not enabling Hermes (or using an old RN version without it) wastes 30-50% startup performance.
|
|
155
|
-
- **Untyped navigation**: Using `navigation.navigate('Screen')` without type definitions. Type your param lists for compile-time safety.
|
|
156
|
-
|
|
157
|
-
## Integration Points
|
|
158
|
-
|
|
159
|
-
- **Swift/Kotlin**: Native modules bridge platform APIs; see `swift-patterns.md` and `kotlin-patterns.md`.
|
|
160
|
-
- **Testing**: See `mobile-testing.md` for Detox E2E and component testing strategies.
|
|
161
|
-
- **React Patterns**: Core React hooks and component patterns apply; see `react-patterns.md` (typescript stack).
|
|
162
|
-
- **State Management**: Use Zustand, Redux Toolkit, or React Query for state; principles from `react-patterns.md` apply.
|