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,133 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: TypeScript Conventions and Standards
|
|
3
|
-
stack: typescript
|
|
4
|
-
version: "1.0"
|
|
5
|
-
focus: [typescript]
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# TypeScript Conventions and Standards
|
|
9
|
-
|
|
10
|
-
## Principle
|
|
11
|
-
|
|
12
|
-
Enable strict mode, use TypeScript's type system expressively (utility types, generics, discriminated unions), organize code with barrel exports and path aliases, and treat types as documentation. Prefer `interface` for object shapes and `type` for unions, intersections, and mapped types.
|
|
13
|
-
|
|
14
|
-
## Rationale
|
|
15
|
-
|
|
16
|
-
TypeScript's value comes from its type system catching errors at compile time. Strict mode (`"strict": true`) enables all strictness flags, preventing common bugs like implicit `any`, unchecked nulls, and incorrect `this` binding. Utility types (`Partial`, `Pick`, `Omit`, `Record`) reduce boilerplate. Generics enable reusable, type-safe abstractions. Barrel exports and path aliases create clean public APIs and eliminate deep relative import paths.
|
|
17
|
-
|
|
18
|
-
## Pattern Examples
|
|
19
|
-
|
|
20
|
-
### Pattern 1: Strict Mode and Utility Types
|
|
21
|
-
|
|
22
|
-
```typescript
|
|
23
|
-
// tsconfig.json — strict mode enabled
|
|
24
|
-
// { "compilerOptions": { "strict": true, "noUncheckedIndexedAccess": true } }
|
|
25
|
-
|
|
26
|
-
// Utility types reduce duplication
|
|
27
|
-
interface User {
|
|
28
|
-
id: string;
|
|
29
|
-
email: string;
|
|
30
|
-
name: string;
|
|
31
|
-
role: 'admin' | 'member' | 'viewer';
|
|
32
|
-
createdAt: Date;
|
|
33
|
-
updatedAt: Date;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// Derive types from the source of truth
|
|
37
|
-
type CreateUserInput = Omit<User, 'id' | 'createdAt' | 'updatedAt'>;
|
|
38
|
-
type UpdateUserInput = Partial<Pick<User, 'name' | 'role'>>;
|
|
39
|
-
type UserSummary = Pick<User, 'id' | 'name' | 'email'>;
|
|
40
|
-
|
|
41
|
-
// Record for typed dictionaries
|
|
42
|
-
type PermissionMap = Record<User['role'], string[]>;
|
|
43
|
-
|
|
44
|
-
const permissions: PermissionMap = {
|
|
45
|
-
admin: ['read', 'write', 'delete', 'manage'],
|
|
46
|
-
member: ['read', 'write'],
|
|
47
|
-
viewer: ['read'],
|
|
48
|
-
};
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
### Pattern 2: Generics and Discriminated Unions
|
|
52
|
-
|
|
53
|
-
```typescript
|
|
54
|
-
// Generic Result type for explicit error handling
|
|
55
|
-
type Result<T, E = Error> =
|
|
56
|
-
| { success: true; data: T }
|
|
57
|
-
| { success: false; error: E };
|
|
58
|
-
|
|
59
|
-
function ok<T>(data: T): Result<T> {
|
|
60
|
-
return { success: true, data };
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function fail<E>(error: E): Result<never, E> {
|
|
64
|
-
return { success: false, error };
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// Usage — compiler forces handling both cases
|
|
68
|
-
async function fetchUser(id: string): Promise<Result<User, string>> {
|
|
69
|
-
try {
|
|
70
|
-
const user = await db.users.findUnique({ where: { id } });
|
|
71
|
-
if (!user) return fail(`User ${id} not found`);
|
|
72
|
-
return ok(user);
|
|
73
|
-
} catch (e) {
|
|
74
|
-
return fail('Database error');
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
const result = await fetchUser('123');
|
|
79
|
-
if (result.success) {
|
|
80
|
-
console.log(result.data.name); // TypeScript knows data exists
|
|
81
|
-
} else {
|
|
82
|
-
console.error(result.error); // TypeScript knows error exists
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// Discriminated union for state machines
|
|
86
|
-
type AsyncState<T> =
|
|
87
|
-
| { status: 'idle' }
|
|
88
|
-
| { status: 'loading' }
|
|
89
|
-
| { status: 'success'; data: T }
|
|
90
|
-
| { status: 'error'; error: Error };
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
### Pattern 3: Barrel Exports and Path Aliases
|
|
94
|
-
|
|
95
|
-
```typescript
|
|
96
|
-
// src/features/users/index.ts — barrel export
|
|
97
|
-
export { UserService } from './user.service';
|
|
98
|
-
export { UserRepository } from './user.repository';
|
|
99
|
-
export type { User, CreateUserInput, UpdateUserInput } from './user.types';
|
|
100
|
-
// Do NOT export internal helpers or implementation details
|
|
101
|
-
|
|
102
|
-
// tsconfig.json paths
|
|
103
|
-
// {
|
|
104
|
-
// "compilerOptions": {
|
|
105
|
-
// "baseUrl": ".",
|
|
106
|
-
// "paths": {
|
|
107
|
-
// "@/features/*": ["src/features/*"],
|
|
108
|
-
// "@/shared/*": ["src/shared/*"],
|
|
109
|
-
// "@/config": ["src/config/index.ts"]
|
|
110
|
-
// }
|
|
111
|
-
// }
|
|
112
|
-
// }
|
|
113
|
-
|
|
114
|
-
// Clean imports from consumers
|
|
115
|
-
import { UserService } from '@/features/users';
|
|
116
|
-
import { Logger } from '@/shared/logging';
|
|
117
|
-
import { config } from '@/config';
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
## Anti-Patterns
|
|
121
|
-
|
|
122
|
-
- **`any` escape hatch**: Using `any` to silence type errors defeats TypeScript's purpose. Use `unknown` for truly unknown types, then narrow with type guards.
|
|
123
|
-
- **Type assertions (`as`)**: `response as User` skips type checking. Use type guards or validation (Zod, io-ts) for runtime safety.
|
|
124
|
-
- **Enums for simple unions**: `enum Role { Admin, Member }` is heavier than `type Role = 'admin' | 'member'`. Prefer string literal unions.
|
|
125
|
-
- **Deep relative imports**: `import { X } from '../../../shared/utils/helpers'`. Use path aliases (`@/shared/utils`).
|
|
126
|
-
- **No strict mode**: Running without `"strict": true` allows implicit `any` and unchecked nulls throughout the codebase.
|
|
127
|
-
|
|
128
|
-
## Integration Points
|
|
129
|
-
|
|
130
|
-
- **React**: Typed props, hooks, and context use these conventions; see `react-patterns.md`.
|
|
131
|
-
- **Next.js**: Route handlers, page props, and metadata types; see `nextjs-patterns.md`.
|
|
132
|
-
- **Express**: Typed middleware and request extensions; see `express-patterns.md`.
|
|
133
|
-
- **ESLint**: Use `@typescript-eslint/parser` and `@typescript-eslint/eslint-plugin` for TypeScript-aware linting.
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
name,code,command,description,agent
|
|
2
|
-
"typescript-dev","agent-dev-typescript","gaia-agent-dev-typescript","TypeScript/React/Next.js/Express developer","Cleo"
|
|
3
|
-
"angular-dev","agent-dev-angular","gaia-agent-dev-angular","Angular/RxJS/NgRx developer","Lena"
|
|
4
|
-
"flutter-dev","agent-dev-flutter","gaia-agent-dev-flutter","Flutter/Dart cross-platform developer","Freya"
|
|
5
|
-
"java-dev","agent-dev-java","gaia-agent-dev-java","Spring Boot/JPA/microservices developer","Hugo"
|
|
6
|
-
"python-dev","agent-dev-python","gaia-agent-dev-python","Django/FastAPI/data pipeline developer","Ravi"
|
|
7
|
-
"mobile-dev","agent-dev-mobile","gaia-agent-dev-mobile","React Native/Swift/Kotlin developer","Talia"
|
|
8
|
-
"dev-story","dev-story","gaia-dev-story","Implement a user story (use with any dev agent)","dev-*"
|
|
9
|
-
"code-review","code-review","gaia-code-review","Perform code review (use with any dev agent)","dev-*"
|
|
10
|
-
"quick-dev","quick-dev","gaia-quick-dev","Implement a quick spec (use with any dev agent)","dev-*"
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
skills:
|
|
2
|
-
- file: git-workflow.md
|
|
3
|
-
sections:
|
|
4
|
-
- { id: branching, line_range: [14, 46], description: "Branch naming, trunk-based dev, release branches" }
|
|
5
|
-
- { id: commits, line_range: [47, 90], description: "Conventional commit format, types, scopes" }
|
|
6
|
-
- { id: pull-requests, line_range: [91, 126], description: "PR template, review checklist, merge strategies" }
|
|
7
|
-
- { id: conflict-resolution, line_range: [127, 157], description: "Merge vs rebase, conflict markers, resolution" }
|
|
8
|
-
|
|
9
|
-
- file: api-design.md
|
|
10
|
-
sections:
|
|
11
|
-
- { id: rest-conventions, line_range: [14, 63], description: "REST naming, HTTP methods, status codes" }
|
|
12
|
-
- { id: graphql, line_range: [64, 104], description: "GraphQL schema design, queries, mutations" }
|
|
13
|
-
- { id: openapi, line_range: [105, 156], description: "OpenAPI specification, documentation" }
|
|
14
|
-
- { id: versioning, line_range: [157, 194], description: "API versioning strategies" }
|
|
15
|
-
- { id: error-standards, line_range: [195, 229], description: "RFC 7807 error responses" }
|
|
16
|
-
|
|
17
|
-
- file: database-design.md
|
|
18
|
-
sections:
|
|
19
|
-
- { id: schema-design, line_range: [14, 51], description: "Naming conventions, normalization" }
|
|
20
|
-
- { id: migrations, line_range: [52, 99], description: "Forward-only migration strategies" }
|
|
21
|
-
- { id: indexing, line_range: [100, 131], description: "Index optimization, covering indexes" }
|
|
22
|
-
- { id: orm-patterns, line_range: [132, 172], description: "N+1 prevention, ORM best practices" }
|
|
23
|
-
|
|
24
|
-
- file: docker-workflow.md
|
|
25
|
-
sections:
|
|
26
|
-
- { id: multi-stage-builds, line_range: [14, 93], description: "Multi-stage Dockerfile patterns" }
|
|
27
|
-
- { id: compose, line_range: [94, 157], description: "Docker Compose for development" }
|
|
28
|
-
- { id: security-scanning, line_range: [158, 222], description: "Image scanning, secrets handling" }
|
|
29
|
-
|
|
30
|
-
- file: testing-patterns.md
|
|
31
|
-
sections:
|
|
32
|
-
- { id: tdd-cycle, line_range: [14, 51], description: "Red-green-refactor cycle" }
|
|
33
|
-
- { id: unit-testing, line_range: [52, 102], description: "Unit test structure (AAA), test pyramid" }
|
|
34
|
-
- { id: integration-testing, line_range: [103, 170], description: "Integration test patterns" }
|
|
35
|
-
- { id: test-doubles, line_range: [171, 232], description: "Mock, stub, spy, fake strategies" }
|
|
36
|
-
|
|
37
|
-
- file: code-review-standards.md
|
|
38
|
-
sections:
|
|
39
|
-
- { id: review-checklist, line_range: [14, 59], description: "Universal code review checklist" }
|
|
40
|
-
- { id: solid-principles, line_range: [60, 132], description: "SOLID violation detection" }
|
|
41
|
-
- { id: complexity-metrics, line_range: [133, 226], description: "Cyclomatic and cognitive complexity" }
|
|
42
|
-
|
|
43
|
-
- file: documentation-standards.md
|
|
44
|
-
sections:
|
|
45
|
-
- { id: readme-template, line_range: [14, 81], description: "README structure and sections" }
|
|
46
|
-
- { id: adr-format, line_range: [82, 144], description: "Architecture Decision Record template" }
|
|
47
|
-
- { id: inline-comments, line_range: [145, 196], description: "When and how to comment code" }
|
|
48
|
-
- { id: api-docs, line_range: [197, 256], description: "API documentation conventions" }
|
|
49
|
-
|
|
50
|
-
- file: security-basics.md
|
|
51
|
-
sections:
|
|
52
|
-
- { id: owasp-top-10, line_range: [14, 68], description: "OWASP Top 10 prevention patterns" }
|
|
53
|
-
- { id: input-validation, line_range: [69, 118], description: "Validation at system boundaries" }
|
|
54
|
-
- { id: secrets-management, line_range: [119, 166], description: "Environment-based secrets" }
|
|
55
|
-
- { id: cors-csrf, line_range: [167, 230], description: "CORS and CSRF configuration, protection" }
|
|
@@ -1,229 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: api-design
|
|
3
|
-
version: '1.0'
|
|
4
|
-
applicable_agents: [typescript-dev, angular-dev, flutter-dev, java-dev, python-dev, mobile-dev]
|
|
5
|
-
test_scenarios:
|
|
6
|
-
- scenario: REST endpoint naming
|
|
7
|
-
expected: Resource names are plural nouns, lowercase, hyphenated
|
|
8
|
-
- scenario: Error response format
|
|
9
|
-
expected: Response follows RFC 7807 problem details structure
|
|
10
|
-
- scenario: API versioning
|
|
11
|
-
expected: Version strategy is documented and consistently applied
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
<!-- SECTION: rest-conventions -->
|
|
15
|
-
## REST Conventions
|
|
16
|
-
|
|
17
|
-
### Resource Naming
|
|
18
|
-
- Use plural nouns: `/users`, `/orders`, `/products`
|
|
19
|
-
- Use lowercase with hyphens: `/order-items`, `/user-profiles`
|
|
20
|
-
- Nest for relationships: `/users/{id}/orders`
|
|
21
|
-
- Max 3 levels of nesting; beyond that, use query params or separate resources
|
|
22
|
-
- No verbs in URLs (use HTTP methods instead)
|
|
23
|
-
|
|
24
|
-
### HTTP Methods
|
|
25
|
-
| Method | Use | Idempotent | Safe |
|
|
26
|
-
|--------|-----|------------|------|
|
|
27
|
-
| GET | Retrieve resource(s) | Yes | Yes |
|
|
28
|
-
| POST | Create resource | No | No |
|
|
29
|
-
| PUT | Full update/replace | Yes | No |
|
|
30
|
-
| PATCH | Partial update | No | No |
|
|
31
|
-
| DELETE | Remove resource | Yes | No |
|
|
32
|
-
|
|
33
|
-
### Status Codes
|
|
34
|
-
| Code | Meaning | Use When |
|
|
35
|
-
|------|---------|----------|
|
|
36
|
-
| 200 | OK | Successful GET, PUT, PATCH |
|
|
37
|
-
| 201 | Created | Successful POST creating resource |
|
|
38
|
-
| 204 | No Content | Successful DELETE |
|
|
39
|
-
| 400 | Bad Request | Invalid input/validation failure |
|
|
40
|
-
| 401 | Unauthorized | Missing or invalid authentication |
|
|
41
|
-
| 403 | Forbidden | Authenticated but not authorized |
|
|
42
|
-
| 404 | Not Found | Resource does not exist |
|
|
43
|
-
| 409 | Conflict | Duplicate resource or state conflict |
|
|
44
|
-
| 422 | Unprocessable | Valid syntax but semantic error |
|
|
45
|
-
| 429 | Too Many Requests | Rate limit exceeded |
|
|
46
|
-
| 500 | Server Error | Unexpected server failure |
|
|
47
|
-
|
|
48
|
-
### Pagination
|
|
49
|
-
```json
|
|
50
|
-
{
|
|
51
|
-
"data": [...],
|
|
52
|
-
"pagination": {
|
|
53
|
-
"page": 1,
|
|
54
|
-
"per_page": 20,
|
|
55
|
-
"total": 150,
|
|
56
|
-
"total_pages": 8
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
```
|
|
60
|
-
- Use `?page=1&per_page=20` for offset pagination
|
|
61
|
-
- Use `?cursor=abc123&limit=20` for cursor pagination (preferred for large datasets)
|
|
62
|
-
- Always include pagination metadata in response
|
|
63
|
-
|
|
64
|
-
<!-- SECTION: graphql -->
|
|
65
|
-
## GraphQL Design
|
|
66
|
-
|
|
67
|
-
### Schema Design
|
|
68
|
-
- Use descriptive type names: `User`, `OrderItem`, `PaymentMethod`
|
|
69
|
-
- Prefer input types for mutations: `input CreateUserInput { ... }`
|
|
70
|
-
- Use enums for fixed value sets: `enum OrderStatus { PENDING, SHIPPED, DELIVERED }`
|
|
71
|
-
- Add descriptions to all types and fields
|
|
72
|
-
|
|
73
|
-
### Query and Mutation Patterns
|
|
74
|
-
```graphql
|
|
75
|
-
type Query {
|
|
76
|
-
user(id: ID!): User
|
|
77
|
-
users(filter: UserFilter, pagination: PaginationInput): UserConnection!
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
type Mutation {
|
|
81
|
-
createUser(input: CreateUserInput!): CreateUserPayload!
|
|
82
|
-
updateUser(id: ID!, input: UpdateUserInput!): UpdateUserPayload!
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
type CreateUserPayload {
|
|
86
|
-
user: User
|
|
87
|
-
errors: [UserError!]!
|
|
88
|
-
}
|
|
89
|
-
```
|
|
90
|
-
- Return payload types from mutations (not raw entities)
|
|
91
|
-
- Include an `errors` field in payloads for domain-level errors
|
|
92
|
-
- Use Relay-style connections for paginated lists
|
|
93
|
-
|
|
94
|
-
### Resolvers
|
|
95
|
-
- Keep resolvers thin -- delegate to service layer
|
|
96
|
-
- Use DataLoader for batching to prevent N+1 queries
|
|
97
|
-
- Return typed errors, not generic messages
|
|
98
|
-
|
|
99
|
-
### Subscriptions
|
|
100
|
-
- Use for real-time updates only (chat, notifications, live data)
|
|
101
|
-
- Prefer polling for infrequently changing data
|
|
102
|
-
- Always implement authentication on subscription connections
|
|
103
|
-
- Handle connection lifecycle (connect, disconnect, reconnect)
|
|
104
|
-
|
|
105
|
-
<!-- SECTION: openapi -->
|
|
106
|
-
## OpenAPI Specification
|
|
107
|
-
|
|
108
|
-
### Spec Structure
|
|
109
|
-
```yaml
|
|
110
|
-
openapi: 3.0.3
|
|
111
|
-
info:
|
|
112
|
-
title: API Name
|
|
113
|
-
version: 1.0.0
|
|
114
|
-
description: Brief API description
|
|
115
|
-
paths:
|
|
116
|
-
/resources:
|
|
117
|
-
get:
|
|
118
|
-
summary: List resources
|
|
119
|
-
operationId: listResources
|
|
120
|
-
tags: [resources]
|
|
121
|
-
parameters:
|
|
122
|
-
- name: page
|
|
123
|
-
in: query
|
|
124
|
-
schema:
|
|
125
|
-
type: integer
|
|
126
|
-
default: 1
|
|
127
|
-
responses:
|
|
128
|
-
'200':
|
|
129
|
-
description: Successful response
|
|
130
|
-
content:
|
|
131
|
-
application/json:
|
|
132
|
-
schema:
|
|
133
|
-
$ref: '#/components/schemas/ResourceList'
|
|
134
|
-
'401':
|
|
135
|
-
$ref: '#/components/responses/Unauthorized'
|
|
136
|
-
components:
|
|
137
|
-
schemas: {}
|
|
138
|
-
securitySchemes:
|
|
139
|
-
bearerAuth:
|
|
140
|
-
type: http
|
|
141
|
-
scheme: bearer
|
|
142
|
-
bearerFormat: JWT
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
### Best Practices
|
|
146
|
-
- Every endpoint needs `operationId`, `summary`, `tags`
|
|
147
|
-
- Use `$ref` for shared schemas -- never inline complex types
|
|
148
|
-
- Document all possible response codes per endpoint
|
|
149
|
-
- Include request/response examples for non-trivial endpoints
|
|
150
|
-
|
|
151
|
-
### Code Generation
|
|
152
|
-
- Generate server stubs from spec (spec-first development)
|
|
153
|
-
- Generate client SDKs for frontend consumers
|
|
154
|
-
- Validate requests/responses against spec in tests
|
|
155
|
-
- Keep spec in sync with implementation via CI checks
|
|
156
|
-
|
|
157
|
-
<!-- SECTION: versioning -->
|
|
158
|
-
## API Versioning
|
|
159
|
-
|
|
160
|
-
### URL Versioning (Recommended)
|
|
161
|
-
```
|
|
162
|
-
/api/v1/users
|
|
163
|
-
/api/v2/users
|
|
164
|
-
```
|
|
165
|
-
- Simple, explicit, visible in logs and documentation
|
|
166
|
-
- Easy to route at load balancer level
|
|
167
|
-
|
|
168
|
-
### Header Versioning (Alternative)
|
|
169
|
-
```
|
|
170
|
-
Accept: application/vnd.api+json;version=2
|
|
171
|
-
```
|
|
172
|
-
- Cleaner URLs but harder to test in browser
|
|
173
|
-
- Requires custom middleware to parse
|
|
174
|
-
|
|
175
|
-
### Breaking vs Non-Breaking Changes
|
|
176
|
-
A change is **breaking** if it:
|
|
177
|
-
- Removes or renames a field
|
|
178
|
-
- Changes a field's type
|
|
179
|
-
- Adds a required field to a request body
|
|
180
|
-
- Changes authentication mechanism
|
|
181
|
-
- Changes error response format
|
|
182
|
-
|
|
183
|
-
A change is **non-breaking** if it:
|
|
184
|
-
- Adds an optional field to request or response
|
|
185
|
-
- Adds a new endpoint
|
|
186
|
-
- Adds a new optional query parameter
|
|
187
|
-
|
|
188
|
-
### Deprecation Policy
|
|
189
|
-
1. Announce deprecation with timeline (minimum 6 months)
|
|
190
|
-
2. Add `Sunset` header: `Sunset: Sat, 01 Jan 2027 00:00:00 GMT`
|
|
191
|
-
3. Add `Deprecation` header: `Deprecation: true`
|
|
192
|
-
4. Log usage of deprecated endpoints for migration tracking
|
|
193
|
-
5. Remove only after sunset date passes
|
|
194
|
-
|
|
195
|
-
<!-- SECTION: error-standards -->
|
|
196
|
-
## Error Standards (RFC 7807)
|
|
197
|
-
|
|
198
|
-
### Problem Details Structure
|
|
199
|
-
```json
|
|
200
|
-
{
|
|
201
|
-
"type": "https://api.example.com/errors/validation-error",
|
|
202
|
-
"title": "Validation Error",
|
|
203
|
-
"status": 422,
|
|
204
|
-
"detail": "The 'email' field must be a valid email address.",
|
|
205
|
-
"instance": "/users/registration",
|
|
206
|
-
"trace_id": "req-abc-123-def",
|
|
207
|
-
"errors": [
|
|
208
|
-
{
|
|
209
|
-
"field": "email",
|
|
210
|
-
"message": "Must be a valid email address",
|
|
211
|
-
"code": "INVALID_FORMAT"
|
|
212
|
-
}
|
|
213
|
-
]
|
|
214
|
-
}
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
### Error Codes
|
|
218
|
-
- Use machine-readable error codes: `INVALID_FORMAT`, `NOT_FOUND`, `RATE_LIMITED`
|
|
219
|
-
- Document all error codes in API reference
|
|
220
|
-
- Keep codes stable across API versions
|
|
221
|
-
- Group by category: `AUTH_*`, `VALIDATION_*`, `RESOURCE_*`
|
|
222
|
-
|
|
223
|
-
### Error Handling Rules
|
|
224
|
-
- Never expose stack traces in production
|
|
225
|
-
- Log full error details server-side with correlation ID
|
|
226
|
-
- Return consistent error format across all endpoints
|
|
227
|
-
- Include `trace_id` for debugging and support requests
|
|
228
|
-
- Localize `detail` field using `Accept-Language` header when needed
|
|
229
|
-
- Error codes remain stable across locales
|
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: code-review-standards
|
|
3
|
-
version: '1.0'
|
|
4
|
-
applicable_agents: [typescript-dev, angular-dev, flutter-dev, java-dev, python-dev, mobile-dev]
|
|
5
|
-
test_scenarios:
|
|
6
|
-
- scenario: Review checklist application
|
|
7
|
-
expected: All checklist items are evaluated and blocking issues are flagged
|
|
8
|
-
- scenario: SOLID violation detection
|
|
9
|
-
expected: Reviewer identifies specific SOLID principle violations with remediation suggestions
|
|
10
|
-
- scenario: Complexity assessment
|
|
11
|
-
expected: Functions exceeding complexity thresholds are flagged with refactoring recommendations
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
<!-- SECTION: review-checklist -->
|
|
15
|
-
## Review Checklist
|
|
16
|
-
|
|
17
|
-
### Correctness
|
|
18
|
-
- [ ] Code does what the PR description claims
|
|
19
|
-
- [ ] Edge cases are handled (null, empty, boundary values)
|
|
20
|
-
- [ ] Error paths are handled gracefully (no swallowed exceptions)
|
|
21
|
-
- [ ] No off-by-one errors in loops or slicing
|
|
22
|
-
- [ ] Concurrent access is safe (if applicable)
|
|
23
|
-
|
|
24
|
-
### Security
|
|
25
|
-
- [ ] No secrets, credentials, or API keys in code
|
|
26
|
-
- [ ] User input is validated and sanitized
|
|
27
|
-
- [ ] SQL queries use parameterized statements
|
|
28
|
-
- [ ] Authentication and authorization are enforced
|
|
29
|
-
- [ ] Sensitive data is not logged
|
|
30
|
-
|
|
31
|
-
### Performance
|
|
32
|
-
- [ ] No N+1 query patterns
|
|
33
|
-
- [ ] No unnecessary re-renders in UI components
|
|
34
|
-
- [ ] Large collections use pagination
|
|
35
|
-
- [ ] Expensive operations are cached or deferred
|
|
36
|
-
- [ ] Database queries have appropriate indexes
|
|
37
|
-
|
|
38
|
-
### Maintainability
|
|
39
|
-
- [ ] Functions and methods are under 30 lines
|
|
40
|
-
- [ ] Classes have a single responsibility
|
|
41
|
-
- [ ] Variable and function names are descriptive
|
|
42
|
-
- [ ] No commented-out code
|
|
43
|
-
- [ ] No magic numbers (use named constants)
|
|
44
|
-
- [ ] DRY: no copy-pasted logic blocks
|
|
45
|
-
|
|
46
|
-
### Testing
|
|
47
|
-
- [ ] New code has corresponding tests
|
|
48
|
-
- [ ] Tests cover happy path and error cases
|
|
49
|
-
- [ ] Tests are independent and repeatable
|
|
50
|
-
- [ ] No test code in production builds
|
|
51
|
-
- [ ] Mocks are reset between tests
|
|
52
|
-
|
|
53
|
-
### Review Etiquette
|
|
54
|
-
- Comment on the code, not the person
|
|
55
|
-
- Suggest, do not demand: "Consider using X because..."
|
|
56
|
-
- Distinguish blocking issues from suggestions
|
|
57
|
-
- Approve with minor comments when appropriate
|
|
58
|
-
- Respond to reviews within one business day
|
|
59
|
-
|
|
60
|
-
<!-- SECTION: solid-principles -->
|
|
61
|
-
## SOLID Principles
|
|
62
|
-
|
|
63
|
-
### Single Responsibility (SRP)
|
|
64
|
-
A class should have only one reason to change.
|
|
65
|
-
|
|
66
|
-
**Violation signal**: Class has methods for unrelated concerns.
|
|
67
|
-
```typescript
|
|
68
|
-
// BAD: UserService handles auth, email, and data access
|
|
69
|
-
class UserService {
|
|
70
|
-
authenticate(credentials) { ... }
|
|
71
|
-
sendWelcomeEmail(user) { ... }
|
|
72
|
-
saveToDatabase(user) { ... }
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// GOOD: Separated responsibilities
|
|
76
|
-
class AuthService { authenticate(credentials) { ... } }
|
|
77
|
-
class EmailService { sendWelcome(user) { ... } }
|
|
78
|
-
class UserRepository { save(user) { ... } }
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
### Open/Closed (OCP)
|
|
82
|
-
Open for extension, closed for modification.
|
|
83
|
-
|
|
84
|
-
**Violation signal**: Adding a feature requires modifying existing switch/if chains.
|
|
85
|
-
```typescript
|
|
86
|
-
// BAD: Must modify function for each new type
|
|
87
|
-
function calculateArea(shape) {
|
|
88
|
-
if (shape.type === 'circle') return Math.PI * shape.radius ** 2;
|
|
89
|
-
if (shape.type === 'rect') return shape.width * shape.height;
|
|
90
|
-
// Must add more conditions for new shapes
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// GOOD: Extend via polymorphism
|
|
94
|
-
interface Shape { area(): number; }
|
|
95
|
-
class Circle implements Shape { area() { return Math.PI * this.radius ** 2; } }
|
|
96
|
-
class Rectangle implements Shape { area() { return this.width * this.height; } }
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
### Liskov Substitution (LSP)
|
|
100
|
-
Subtypes must be substitutable for their base types.
|
|
101
|
-
|
|
102
|
-
**Violation signal**: Subclass overrides a method to throw or do nothing.
|
|
103
|
-
|
|
104
|
-
### Interface Segregation (ISP)
|
|
105
|
-
No client should depend on methods it does not use.
|
|
106
|
-
|
|
107
|
-
**Violation signal**: Interface has many methods and implementations leave some as no-ops.
|
|
108
|
-
|
|
109
|
-
### Dependency Inversion (DIP)
|
|
110
|
-
Depend on abstractions, not concretions.
|
|
111
|
-
|
|
112
|
-
**Violation signal**: Classes instantiate their own dependencies with `new`.
|
|
113
|
-
```typescript
|
|
114
|
-
// BAD: Tightly coupled to concrete class
|
|
115
|
-
class OrderService {
|
|
116
|
-
private repo = new PostgresOrderRepository();
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
// GOOD: Depend on abstraction, inject at construction
|
|
120
|
-
class OrderService {
|
|
121
|
-
constructor(private repo: OrderRepository) {}
|
|
122
|
-
}
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
### Review Flags
|
|
126
|
-
When reviewing, flag SOLID violations with a prefix tag:
|
|
127
|
-
```
|
|
128
|
-
[SRP] This class handles both X and Y -- consider splitting.
|
|
129
|
-
[OCP] Adding new types requires modifying this switch -- consider strategy pattern.
|
|
130
|
-
[DIP] Direct dependency on concrete class -- inject via interface.
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
<!-- SECTION: complexity-metrics -->
|
|
134
|
-
## Complexity Metrics
|
|
135
|
-
|
|
136
|
-
### Cyclomatic Complexity
|
|
137
|
-
Measures the number of independent paths through a function.
|
|
138
|
-
|
|
139
|
-
**Calculation**: Count decision points + 1
|
|
140
|
-
- Each `if`, `else if`, `case`, `while`, `for`, `&&`, `||`, `catch` adds 1
|
|
141
|
-
|
|
142
|
-
| Score | Risk Level | Action |
|
|
143
|
-
|-------|------------|--------|
|
|
144
|
-
| 1-5 | Low | Acceptable |
|
|
145
|
-
| 6-10 | Moderate | Review for simplification |
|
|
146
|
-
| 11-20 | High | Refactor required |
|
|
147
|
-
| 21+ | Critical | Must be broken apart |
|
|
148
|
-
|
|
149
|
-
### Cognitive Complexity
|
|
150
|
-
Measures how hard code is to understand (more nuanced than cyclomatic).
|
|
151
|
-
|
|
152
|
-
Increases with:
|
|
153
|
-
- Nesting depth (penalty compounds with each level)
|
|
154
|
-
- Breaks in linear flow (else, catch, continue, break)
|
|
155
|
-
- Recursion
|
|
156
|
-
|
|
157
|
-
```typescript
|
|
158
|
-
// Cognitive complexity: 7 (nested conditions compound)
|
|
159
|
-
function getLabel(user, order) { // +0
|
|
160
|
-
if (user.isAdmin) { // +1
|
|
161
|
-
if (order.isPriority) { // +2 (nesting)
|
|
162
|
-
return 'admin-priority';
|
|
163
|
-
} else { // +1
|
|
164
|
-
return 'admin-standard';
|
|
165
|
-
}
|
|
166
|
-
} else if (user.isVip) { // +1
|
|
167
|
-
return 'vip';
|
|
168
|
-
} else { // +1
|
|
169
|
-
if (order.total > 100) { // +2 (nesting)
|
|
170
|
-
return 'high-value';
|
|
171
|
-
}
|
|
172
|
-
return 'standard';
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
### Refactoring High-Complexity Code
|
|
178
|
-
**Extract method**: Pull branches into well-named functions.
|
|
179
|
-
```typescript
|
|
180
|
-
// Before: one long function with nested conditions
|
|
181
|
-
function processOrder(order) {
|
|
182
|
-
// 40 lines with nested if/else
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
// After: decomposed into focused functions
|
|
186
|
-
function processOrder(order) {
|
|
187
|
-
const pricing = calculatePricing(order);
|
|
188
|
-
const shipping = determineShipping(order);
|
|
189
|
-
return finalizeOrder(order, pricing, shipping);
|
|
190
|
-
}
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
**Replace conditionals with polymorphism**: When branching on type, use strategy pattern.
|
|
194
|
-
|
|
195
|
-
**Use early returns**: Flatten nested conditions with guard clauses.
|
|
196
|
-
```typescript
|
|
197
|
-
// Before: deeply nested
|
|
198
|
-
function validate(input) {
|
|
199
|
-
if (input) {
|
|
200
|
-
if (input.name) {
|
|
201
|
-
if (input.name.length > 0) {
|
|
202
|
-
return true;
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
return false;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
// After: guard clauses
|
|
210
|
-
function validate(input) {
|
|
211
|
-
if (!input) return false;
|
|
212
|
-
if (!input.name) return false;
|
|
213
|
-
if (input.name.length === 0) return false;
|
|
214
|
-
return true;
|
|
215
|
-
}
|
|
216
|
-
```
|
|
217
|
-
|
|
218
|
-
### Thresholds for Code Review
|
|
219
|
-
| Metric | Threshold | Action |
|
|
220
|
-
|--------|-----------|--------|
|
|
221
|
-
| Function length | > 30 lines | Suggest extraction |
|
|
222
|
-
| Cyclomatic complexity | > 10 | Require refactoring |
|
|
223
|
-
| Cognitive complexity | > 15 | Require refactoring |
|
|
224
|
-
| Parameter count | > 4 | Suggest object parameter |
|
|
225
|
-
| Nesting depth | > 3 levels | Require flattening |
|
|
226
|
-
| Class methods | > 10 public | Suggest decomposition |
|