oh-my-agent-commandcode 0.0.0-stage → 20.38.4
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 +35 -2
- package/filter-test-output.sh +52 -0
- package/mods/oma.ts +347 -0
- package/package.json +30 -4
- package/skills/_shared/conditional/experiment-ledger.md +28 -0
- package/skills/_shared/conditional/exploration-loop.md +22 -0
- package/skills/_shared/conditional/quality-score.md +33 -0
- package/skills/_shared/core/anti-ai-prose.md +191 -0
- package/skills/_shared/core/api-contracts/README.md +28 -0
- package/skills/_shared/core/api-contracts/template.md +90 -0
- package/skills/_shared/core/clarification-protocol.md +23 -0
- package/skills/_shared/core/code-intelligence.md +46 -0
- package/skills/_shared/core/collaboration-policy.md +28 -0
- package/skills/_shared/core/common-checklist.md +28 -0
- package/skills/_shared/core/context-budget.md +22 -0
- package/skills/_shared/core/context-loading.md +34 -0
- package/skills/_shared/core/difficulty-guide.md +26 -0
- package/skills/_shared/core/execution-policy.md +31 -0
- package/skills/_shared/core/lessons-learned.md +33 -0
- package/skills/_shared/core/prompt-structure.md +18 -0
- package/skills/_shared/core/quality-principles.md +11 -0
- package/skills/_shared/core/session-metrics.md +35 -0
- package/skills/_shared/core/skill-routing.md +39 -0
- package/skills/_shared/core/test-approach.md +54 -0
- package/skills/_shared/core/vendor-detection.md +52 -0
- package/skills/_shared/runtime/memory-protocol.md +118 -0
- package/skills/_shared/runtime/result-contract.md +64 -0
- package/skills/_shared/ui-interaction-quality.md +133 -0
- package/skills/oma-academic-writing/SKILL.md +181 -0
- package/skills/oma-academic-writing/resources/abstract-guide.md +51 -0
- package/skills/oma-academic-writing/resources/academic-verb-tiers.md +42 -0
- package/skills/oma-academic-writing/resources/anti-ai-checklist.md +52 -0
- package/skills/oma-academic-writing/resources/hedging-guide.md +132 -0
- package/skills/oma-academic-writing/resources/sentence-structure-reference.md +151 -0
- package/skills/oma-architecture/SKILL.md +203 -0
- package/skills/oma-architecture/resources/api-evolution.md +41 -0
- package/skills/oma-architecture/resources/checklist.md +42 -0
- package/skills/oma-architecture/resources/execution-protocol.md +115 -0
- package/skills/oma-architecture/resources/methodology-selection.md +92 -0
- package/skills/oma-architecture/resources/migration-patterns.md +28 -0
- package/skills/oma-architecture/resources/output-templates.md +111 -0
- package/skills/oma-architecture/resources/stakeholder-synthesis.md +80 -0
- package/skills/oma-backend/SKILL.md +202 -0
- package/skills/oma-backend/resources/checklist.md +45 -0
- package/skills/oma-backend/resources/error-playbook.md +97 -0
- package/skills/oma-backend/resources/execution-protocol.md +39 -0
- package/skills/oma-backend/resources/orm-reference.md +61 -0
- package/skills/oma-backend/variants/node/api-template.ts +315 -0
- package/skills/oma-backend/variants/node/snippets.md +475 -0
- package/skills/oma-backend/variants/node/stack.yaml +21 -0
- package/skills/oma-backend/variants/node/tech-stack.md +33 -0
- package/skills/oma-backend/variants/python/api-template.py +378 -0
- package/skills/oma-backend/variants/python/snippets.md +199 -0
- package/skills/oma-backend/variants/python/stack.yaml +18 -0
- package/skills/oma-backend/variants/python/tech-stack.md +45 -0
- package/skills/oma-backend/variants/rust/api-template.rs +635 -0
- package/skills/oma-backend/variants/rust/snippets.md +471 -0
- package/skills/oma-backend/variants/rust/stack.yaml +20 -0
- package/skills/oma-backend/variants/rust/tech-stack.md +36 -0
- package/skills/oma-backend/variants/stack.schema.json +73 -0
- package/skills/oma-brainstorm/SKILL.md +166 -0
- package/skills/oma-brainstorm/resources/triz-lite.md +117 -0
- package/skills/oma-coordination/SKILL.md +171 -0
- package/skills/oma-db/SKILL.md +201 -0
- package/skills/oma-db/resources/anti-patterns.md +177 -0
- package/skills/oma-db/resources/checklist.md +67 -0
- package/skills/oma-db/resources/document-templates.md +107 -0
- package/skills/oma-db/resources/error-playbook.md +50 -0
- package/skills/oma-db/resources/examples.md +170 -0
- package/skills/oma-db/resources/execution-protocol.md +127 -0
- package/skills/oma-db/resources/iso-controls.md +98 -0
- package/skills/oma-db/resources/migration-playbook.md +93 -0
- package/skills/oma-db/resources/query-tuning.md +57 -0
- package/skills/oma-db/resources/vector-db.md +159 -0
- package/skills/oma-debug/SKILL.md +146 -0
- package/skills/oma-debug/resources/bug-report-template.md +327 -0
- package/skills/oma-debug/resources/checklist.md +31 -0
- package/skills/oma-debug/resources/common-patterns.md +734 -0
- package/skills/oma-debug/resources/debugging-checklist.md +364 -0
- package/skills/oma-debug/resources/error-playbook.md +94 -0
- package/skills/oma-debug/resources/execution-protocol.md +40 -0
- package/skills/oma-design/SKILL.md +135 -0
- package/skills/oma-design/resources/asset-strategy.md +34 -0
- package/skills/oma-design/resources/checklist.md +63 -0
- package/skills/oma-design/resources/data-grid.md +48 -0
- package/skills/oma-design/resources/design-md-spec.md +107 -0
- package/skills/oma-design/resources/design-tokens.md +53 -0
- package/skills/oma-design/resources/error-playbook.md +18 -0
- package/skills/oma-design/resources/execution-protocol.md +95 -0
- package/skills/oma-design/resources/external-design-skills.md +130 -0
- package/skills/oma-design/resources/getdesign-fetcher.md +104 -0
- package/skills/oma-design/resources/product-interface-review.md +59 -0
- package/skills/oma-design/resources/redesign-protocol.md +52 -0
- package/skills/oma-design/resources/stitch-integration.md +244 -0
- package/skills/oma-dev-workflow/SKILL.md +375 -0
- package/skills/oma-dev-workflow/resources/affected-checks.py +58 -0
- package/skills/oma-dev-workflow/resources/api-workflows.md +58 -0
- package/skills/oma-dev-workflow/resources/database-patterns.md +107 -0
- package/skills/oma-dev-workflow/resources/i18n-patterns.md +63 -0
- package/skills/oma-dev-workflow/resources/release-coordination.md +240 -0
- package/skills/oma-dev-workflow/resources/tooling-profiles.md +217 -0
- package/skills/oma-dev-workflow/resources/troubleshooting.md +78 -0
- package/skills/oma-dev-workflow/resources/validation-pipeline.md +246 -0
- package/skills/oma-docs/SKILL.md +77 -0
- package/skills/oma-docs/resources/commands.md +76 -0
- package/skills/oma-explanation/SKILL.md +212 -0
- package/skills/oma-explanation/resources/document-structure.md +115 -0
- package/skills/oma-explanation/resources/draft-format.md +199 -0
- package/skills/oma-explanation/resources/html-contract.md +102 -0
- package/skills/oma-frontend/SKILL.md +227 -0
- package/skills/oma-frontend/resources/angular-rules.md +110 -0
- package/skills/oma-frontend/resources/checklist.md +76 -0
- package/skills/oma-frontend/resources/error-playbook.md +125 -0
- package/skills/oma-frontend/resources/execution-protocol.md +46 -0
- package/skills/oma-frontend/resources/snippets.md +354 -0
- package/skills/oma-frontend/resources/specialized-visual-implementation.md +193 -0
- package/skills/oma-frontend/resources/tailwind-rules.md +83 -0
- package/skills/oma-frontend/resources/tech-stack.md +156 -0
- package/skills/oma-hwp/SKILL.md +166 -0
- package/skills/oma-hwp/config/hwp-config.yaml +35 -0
- package/skills/oma-hwp/resources/balanced-tables.ts +39 -0
- package/skills/oma-hwp/resources/execution-protocol.md +145 -0
- package/skills/oma-hwp/resources/flatten-tables.ts +101 -0
- package/skills/oma-hwp/resources/package.json +13 -0
- package/skills/oma-hwp/resources/troubleshooting.md +70 -0
- package/skills/oma-hwp/resources/tsconfig.json +10 -0
- package/skills/oma-hwp/resources/turndown-plugin-gfm.d.ts +9 -0
- package/skills/oma-image/SKILL.md +142 -0
- package/skills/oma-image/config/image-config.yaml +70 -0
- package/skills/oma-image/resources/checklist.md +18 -0
- package/skills/oma-image/resources/execution-protocol.md +117 -0
- package/skills/oma-image/resources/invocation.md +105 -0
- package/skills/oma-image/resources/prompt-tips.md +71 -0
- package/skills/oma-image/resources/vendor-matrix.md +90 -0
- package/skills/oma-market/SKILL.md +142 -0
- package/skills/oma-market/resources/checklist.md +12 -0
- package/skills/oma-market/resources/error-playbook.md +12 -0
- package/skills/oma-market/resources/execution-protocol.md +60 -0
- package/skills/oma-market/resources/frameworks/pestel.md +101 -0
- package/skills/oma-market/resources/frameworks/porters-5f.md +90 -0
- package/skills/oma-market/resources/frameworks/swot.md +61 -0
- package/skills/oma-market/resources/intent-rules.md +35 -0
- package/skills/oma-market/resources/output-laws.md +53 -0
- package/skills/oma-mobile/SKILL.md +168 -0
- package/skills/oma-mobile/resources/checklist.md +77 -0
- package/skills/oma-mobile/resources/error-playbook.md +198 -0
- package/skills/oma-mobile/resources/execution-protocol.md +47 -0
- package/skills/oma-mobile/resources/screen-template.dart +331 -0
- package/skills/oma-mobile/resources/screen-template.swift +239 -0
- package/skills/oma-mobile/resources/screen-template.tsx +179 -0
- package/skills/oma-mobile/resources/tech-stack.md +69 -0
- package/skills/oma-mobile/variants/README.md +45 -0
- package/skills/oma-mobile/variants/flutter/api-template.dart +461 -0
- package/skills/oma-mobile/variants/flutter/snippets.md +1353 -0
- package/skills/oma-mobile/variants/flutter/stack.yaml +21 -0
- package/skills/oma-mobile/variants/flutter/tech-stack.md +201 -0
- package/skills/oma-mobile/variants/kotlin-android/api-template.kt +182 -0
- package/skills/oma-mobile/variants/kotlin-android/snippets.md +871 -0
- package/skills/oma-mobile/variants/kotlin-android/stack.yaml +32 -0
- package/skills/oma-mobile/variants/kotlin-android/tech-stack.md +159 -0
- package/skills/oma-mobile/variants/react-native/api-template.ts +531 -0
- package/skills/oma-mobile/variants/react-native/snippets.md +1014 -0
- package/skills/oma-mobile/variants/react-native/stack.yaml +22 -0
- package/skills/oma-mobile/variants/react-native/tech-stack.md +192 -0
- package/skills/oma-mobile/variants/stack.schema.json +68 -0
- package/skills/oma-mobile/variants/swift-ios/api-template.swift +165 -0
- package/skills/oma-mobile/variants/swift-ios/snippets.md +1028 -0
- package/skills/oma-mobile/variants/swift-ios/stack.yaml +25 -0
- package/skills/oma-mobile/variants/swift-ios/tech-stack.md +174 -0
- package/skills/oma-observability/SKILL.md +225 -0
- package/skills/oma-observability/resources/anti-patterns.md +555 -0
- package/skills/oma-observability/resources/boundaries/cross-application.md +348 -0
- package/skills/oma-observability/resources/boundaries/multi-tenant.md +290 -0
- package/skills/oma-observability/resources/boundaries/release.md +372 -0
- package/skills/oma-observability/resources/boundaries/slo.md +225 -0
- package/skills/oma-observability/resources/checklist.md +123 -0
- package/skills/oma-observability/resources/examples.md +448 -0
- package/skills/oma-observability/resources/execution-protocol.md +166 -0
- package/skills/oma-observability/resources/incident-forensics.md +348 -0
- package/skills/oma-observability/resources/intent-rules.md +307 -0
- package/skills/oma-observability/resources/layers/L3-network.md +281 -0
- package/skills/oma-observability/resources/layers/L4-transport.md +299 -0
- package/skills/oma-observability/resources/layers/L7-application/crash-analytics.md +359 -0
- package/skills/oma-observability/resources/layers/L7-application/mobile-rum.md +278 -0
- package/skills/oma-observability/resources/layers/L7-application/waf.md +246 -0
- package/skills/oma-observability/resources/layers/L7-application/web-rum.md +350 -0
- package/skills/oma-observability/resources/layers/mesh.md +368 -0
- package/skills/oma-observability/resources/matrix.md +177 -0
- package/skills/oma-observability/resources/meta-observability.md +605 -0
- package/skills/oma-observability/resources/observability-as-code.md +666 -0
- package/skills/oma-observability/resources/signals/audit.md +310 -0
- package/skills/oma-observability/resources/signals/cost.md +303 -0
- package/skills/oma-observability/resources/signals/logs.md +263 -0
- package/skills/oma-observability/resources/signals/metrics.md +478 -0
- package/skills/oma-observability/resources/signals/privacy.md +351 -0
- package/skills/oma-observability/resources/signals/profiles.md +245 -0
- package/skills/oma-observability/resources/signals/traces.md +360 -0
- package/skills/oma-observability/resources/standards.md +214 -0
- package/skills/oma-observability/resources/transport/collector-topology.md +308 -0
- package/skills/oma-observability/resources/transport/otlp-grpc-vs-http.md +256 -0
- package/skills/oma-observability/resources/transport/sampling-recipes.md +297 -0
- package/skills/oma-observability/resources/transport/udp-statsd-mtu.md +167 -0
- package/skills/oma-observability/resources/vendor-categories.md +352 -0
- package/skills/oma-orchestration/SKILL.md +302 -0
- package/skills/oma-orchestration/config/cli-config.yaml +92 -0
- package/skills/oma-orchestration/resources/memory-schema.md +232 -0
- package/skills/oma-orchestration/resources/subagent-prompt-template.md +30 -0
- package/skills/oma-orchestration/scripts/parallel-run.sh +6 -0
- package/skills/oma-orchestration/scripts/spawn-agent.sh +5 -0
- package/skills/oma-orchestration/scripts/verify.sh +20 -0
- package/skills/oma-orchestration/templates/backend-task.md +19 -0
- package/skills/oma-orchestration/templates/debug-task.md +16 -0
- package/skills/oma-orchestration/templates/frontend-task.md +18 -0
- package/skills/oma-orchestration/templates/mobile-task.md +18 -0
- package/skills/oma-orchestration/templates/qa-task.md +16 -0
- package/skills/oma-orchestration/templates/tasks-example.yaml +15 -0
- package/skills/oma-pdf/SKILL.md +162 -0
- package/skills/oma-pdf/config/pdf-config.yaml +27 -0
- package/skills/oma-pdf/resources/execution-protocol.md +127 -0
- package/skills/oma-pm/SKILL.md +157 -0
- package/skills/oma-pm/resources/error-playbook.md +75 -0
- package/skills/oma-pm/resources/examples.md +439 -0
- package/skills/oma-pm/resources/execution-protocol.md +62 -0
- package/skills/oma-pm/resources/iso-planning.md +110 -0
- package/skills/oma-pm/resources/plan-phase-protocol.md +66 -0
- package/skills/oma-pm/resources/task-template.json +86 -0
- package/skills/oma-qa/SKILL.md +141 -0
- package/skills/oma-qa/resources/checklist.md +339 -0
- package/skills/oma-qa/resources/error-playbook.md +98 -0
- package/skills/oma-qa/resources/execution-protocol.md +169 -0
- package/skills/oma-qa/resources/iso-quality.md +82 -0
- package/skills/oma-qa/resources/verify-ship-protocol.md +116 -0
- package/skills/oma-recap/SKILL.md +245 -0
- package/skills/oma-recap/resources/output-formats.md +83 -0
- package/skills/oma-refactor/SKILL.md +184 -0
- package/skills/oma-refactor/resources/definition.md +108 -0
- package/skills/oma-refactor/resources/governance.md +33 -0
- package/skills/oma-refactor/resources/hotspots.py +44 -0
- package/skills/oma-refactor/resources/measurement.md +93 -0
- package/skills/oma-scholar/SKILL.md +276 -0
- package/skills/oma-scholar/config/scholar-config.yaml +79 -0
- package/skills/oma-scholar/resources/api-endpoints.md +174 -0
- package/skills/oma-scholar/resources/checklist.md +92 -0
- package/skills/oma-scholar/resources/execution-protocol.md +224 -0
- package/skills/oma-scholar/resources/fallback-providers.md +143 -0
- package/skills/oma-scholar/resources/setup-openalex.md +85 -0
- package/skills/oma-scholar/resources/sidecar-spec.md +341 -0
- package/skills/oma-scholar/resources/upstream-spec-cache.md +972 -0
- package/skills/oma-scm/SKILL.md +103 -0
- package/skills/oma-scm/resources/cm-operations.md +56 -0
- package/skills/oma-scm/resources/codeowners-playbook.md +45 -0
- package/skills/oma-scm/resources/conventional-commits.md +108 -0
- package/skills/oma-scm/resources/merge-risk.md +76 -0
- package/skills/oma-scm/resources/onboarding-risk-signals.md +71 -0
- package/skills/oma-search/SKILL.md +125 -0
- package/skills/oma-search/resources/checklist.md +36 -0
- package/skills/oma-search/resources/error-playbook.md +66 -0
- package/skills/oma-search/resources/examples.md +80 -0
- package/skills/oma-search/resources/execution-protocol.md +86 -0
- package/skills/oma-search/resources/intent-rules.md +47 -0
- package/skills/oma-search/resources/trust-registry.md +53 -0
- package/skills/oma-security/SKILL.md +172 -0
- package/skills/oma-security/resources/artex.md +108 -0
- package/skills/oma-security/resources/ci.md +134 -0
- package/skills/oma-security/resources/cisco-source.md +108 -0
- package/skills/oma-security/resources/deepsec-config.md +45 -0
- package/skills/oma-security/resources/deepsec-matchers.md +35 -0
- package/skills/oma-security/resources/deepsec-scanning.md +45 -0
- package/skills/oma-security/resources/deepsec-setup.md +41 -0
- package/skills/oma-security/resources/findings-contract.md +408 -0
- package/skills/oma-security/resources/mcp-scanning.md +122 -0
- package/skills/oma-security/resources/skill-scanning.md +106 -0
- package/skills/oma-security/resources/validation.md +71 -0
- package/skills/oma-skill-creation/SKILL.md +84 -0
- package/skills/oma-skill-creation/resources/prompt-evaluation.md +36 -0
- package/skills/oma-skill-creation/resources/ssl-lite-template.md +108 -0
- package/skills/oma-skill-creation/resources/validation-checklist.md +101 -0
- package/skills/oma-slide/SKILL.md +277 -0
- package/skills/oma-slide/resources/animation-patterns.md +245 -0
- package/skills/oma-slide/resources/assets/deck-stage.js +514 -0
- package/skills/oma-slide/resources/assets/viewport-base.css +257 -0
- package/skills/oma-slide/resources/canva-integration.md +203 -0
- package/skills/oma-slide/resources/checklist.md +46 -0
- package/skills/oma-slide/resources/design-doctrine.md +260 -0
- package/skills/oma-slide/resources/fixed-stage.md +232 -0
- package/skills/oma-slide/resources/generation-protocol.md +393 -0
- package/skills/oma-slide/resources/native-pptx.md +84 -0
- package/skills/oma-slide/resources/selection-index.json +461 -0
- package/skills/oma-slide/resources/style-presets.LICENSE +10 -0
- package/skills/oma-slide/resources/style-presets.md +520 -0
- package/skills/oma-tf-infra/SKILL.md +201 -0
- package/skills/oma-tf-infra/resources/checklist.md +53 -0
- package/skills/oma-tf-infra/resources/cost-optimization.md +574 -0
- package/skills/oma-tf-infra/resources/error-playbook.md +68 -0
- package/skills/oma-tf-infra/resources/examples.md +38 -0
- package/skills/oma-tf-infra/resources/execution-protocol.md +129 -0
- package/skills/oma-tf-infra/resources/iso-42001-infra.md +229 -0
- package/skills/oma-tf-infra/resources/multi-cloud-examples.md +241 -0
- package/skills/oma-tf-infra/resources/policy-testing-examples.md +332 -0
- package/skills/oma-translation/SKILL.md +229 -0
- package/skills/oma-translation/resources/anti-ai-patterns.md +104 -0
- package/skills/oma-translation/resources/lang/_template.md +73 -0
- package/skills/oma-translation/resources/lang/en.md +123 -0
- package/skills/oma-translation/resources/lang/ja.md +274 -0
- package/skills/oma-translation/resources/lang/ko.md +228 -0
- package/skills/oma-translation/resources/lang/zh.md +285 -0
- package/skills/oma-translation/resources/style-skills.md +104 -0
- package/skills/oma-translation/resources/translation-rubric.md +126 -0
- package/skills/oma-video/SKILL.md +229 -0
- package/skills/oma-video/config/video-config.yaml +60 -0
- package/skills/oma-video/resources/checklist.md +26 -0
- package/skills/oma-video/resources/execution-protocol.md +122 -0
- package/skills/oma-video/resources/existing-media.md +185 -0
- package/skills/oma-video/resources/hyperframes-authoring/README.md +44 -0
- package/skills/oma-video/resources/hyperframes-authoring/demo.md +31 -0
- package/skills/oma-video/resources/hyperframes-authoring/explainer.md +10 -0
- package/skills/oma-video/resources/hyperframes-authoring/shorts.md +10 -0
- package/skills/oma-video/resources/motion-principles.md +81 -0
- package/skills/oma-video/resources/mpt/driver.py +301 -0
- package/skills/oma-video/resources/prompt-tips.md +75 -0
- package/skills/oma-video/resources/script-schema.md +81 -0
- package/skills/oma-video/resources/sound-design.md +127 -0
- package/skills/oma-video/resources/strudel/package.json +11 -0
- package/skills/oma-video/resources/strudel/page.html +87 -0
- package/skills/oma-video/resources/strudel/render.mjs +295 -0
- package/skills/oma-video/resources/vendor-matrix.md +124 -0
- package/skills/oma-voice/SKILL.md +249 -0
- package/skills/oma-voice/config/voice-config.yaml +30 -0
- package/skills/oma-voice/resources/audio-processing.md +119 -0
- package/skills/oma-voice/resources/checklist.md +47 -0
- package/skills/oma-voice/resources/execution-protocol.md +215 -0
- package/skills/oma-voice/resources/prompt-tips.md +43 -0
- package/skills/oma-voice/resources/voice-matrix.md +51 -0
- package/skills/oma-voice/resources/voicestudio.md +87 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Stakeholder Synthesis Protocol
|
|
2
|
+
|
|
3
|
+
Consult stakeholder agents only when the decision is cross-cutting enough to justify the cost.
|
|
4
|
+
|
|
5
|
+
## Consultation Thresholds
|
|
6
|
+
|
|
7
|
+
### Solo Analysis
|
|
8
|
+
|
|
9
|
+
Use when:
|
|
10
|
+
- single module or local subsystem
|
|
11
|
+
- no major cross-domain effects
|
|
12
|
+
- decision can be made from direct code/context analysis
|
|
13
|
+
|
|
14
|
+
### Targeted Consultation
|
|
15
|
+
|
|
16
|
+
Consult 1-3 agents when:
|
|
17
|
+
- the decision affects multiple layers
|
|
18
|
+
- tradeoffs are real but bounded
|
|
19
|
+
- specific specialist input is needed
|
|
20
|
+
|
|
21
|
+
Typical pairings (agent ids, not skill names — see the mapping table in `.agents/workflows/orchestrate.md`):
|
|
22
|
+
- `pm`: business constraints, scope, product priorities
|
|
23
|
+
- `backend`: service/API/domain concerns
|
|
24
|
+
- `db`: data ownership, schema, consistency
|
|
25
|
+
- `tf-infra`: deployment and operational architecture
|
|
26
|
+
- `qa`: risk, performance, security, testability
|
|
27
|
+
- `frontend` / `mobile`: client integration and complexity costs
|
|
28
|
+
|
|
29
|
+
### Full Stakeholder Sweep
|
|
30
|
+
|
|
31
|
+
Use when:
|
|
32
|
+
- architecture is system-wide
|
|
33
|
+
- multiple teams/domains are materially affected
|
|
34
|
+
- the decision will constrain future roadmap work
|
|
35
|
+
|
|
36
|
+
## Dispatch Mechanics
|
|
37
|
+
|
|
38
|
+
Consultation is a real subagent call, not an imagined persona.
|
|
39
|
+
|
|
40
|
+
1. Resolve dispatch per the project's Per-Agent Dispatch rules (`target_vendor_for_agent` in `.agents/oma-config.yaml`):
|
|
41
|
+
- same vendor as the current runtime → the runtime's native subagent path (e.g., Claude Code Agent tool)
|
|
42
|
+
- different vendor, or no native subagent support → `oma agent spawn <agent>` for that agent only
|
|
43
|
+
2. Give each consulted agent a bounded charter:
|
|
44
|
+
- the decision in one sentence
|
|
45
|
+
- constraints that are already fixed (not up for debate)
|
|
46
|
+
- the specific question for that specialty
|
|
47
|
+
- expected output: position plus top risk, 10 lines or fewer
|
|
48
|
+
3. One round only by default; a second round requires a named unresolved conflict.
|
|
49
|
+
4. Cost bound: targeted consultation is 1-3 agents. A full sweep must state its cross-cutting justification in the artifact.
|
|
50
|
+
|
|
51
|
+
## Synthesis Rules
|
|
52
|
+
|
|
53
|
+
1. Capture perspectives as inputs, not votes
|
|
54
|
+
2. Separate:
|
|
55
|
+
- agreements
|
|
56
|
+
- conflicts
|
|
57
|
+
- assumptions
|
|
58
|
+
3. Name the real tradeoff behind disagreements
|
|
59
|
+
4. Make an explicit recommendation even if perspectives differ
|
|
60
|
+
5. If user decision is required, present framed options rather than an unstructured summary
|
|
61
|
+
|
|
62
|
+
## Output Section
|
|
63
|
+
|
|
64
|
+
Include a section like:
|
|
65
|
+
|
|
66
|
+
```md
|
|
67
|
+
## Stakeholder Perspectives
|
|
68
|
+
- PM: ...
|
|
69
|
+
- Backend: ...
|
|
70
|
+
- DB: ...
|
|
71
|
+
|
|
72
|
+
## Agreements
|
|
73
|
+
- ...
|
|
74
|
+
|
|
75
|
+
## Tensions
|
|
76
|
+
- ...
|
|
77
|
+
|
|
78
|
+
## Recommendation
|
|
79
|
+
- ...
|
|
80
|
+
```
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: oma-backend
|
|
3
|
+
description: Implement server APIs, authentication, and application data access.
|
|
4
|
+
Schema modeling and query tuning use oma-db.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Backend Agent - API & Server Specialist
|
|
8
|
+
|
|
9
|
+
## Scheduling
|
|
10
|
+
|
|
11
|
+
### Goal
|
|
12
|
+
Implement or review backend APIs, authentication, database integration, server-side business logic, and migrations using the project's existing backend stack and clean architecture boundaries.
|
|
13
|
+
|
|
14
|
+
### Intent signature
|
|
15
|
+
- User asks for API, endpoint, REST, GraphQL, auth, server, migration, repository, service, router, or background job work.
|
|
16
|
+
- User needs backend code that coordinates validation, business logic, persistence, transactions, and backing services.
|
|
17
|
+
|
|
18
|
+
### When to use
|
|
19
|
+
- Building REST APIs or GraphQL endpoints
|
|
20
|
+
- Database design and migrations
|
|
21
|
+
- Authentication and authorization
|
|
22
|
+
- Server-side business logic
|
|
23
|
+
- Background jobs and queues
|
|
24
|
+
|
|
25
|
+
### When NOT to use
|
|
26
|
+
- Frontend UI -> use Frontend Agent
|
|
27
|
+
- Mobile-specific code -> use Mobile Agent
|
|
28
|
+
|
|
29
|
+
### Expected inputs
|
|
30
|
+
- Target feature, endpoint, migration, auth flow, or server behavior
|
|
31
|
+
- Existing backend stack files such as manifests, routes, services, models, and database config
|
|
32
|
+
- API contracts, schemas, validation rules, and persistence requirements
|
|
33
|
+
- Required verification commands or project conventions
|
|
34
|
+
|
|
35
|
+
### Expected outputs
|
|
36
|
+
- Backend code changes in router, service, repository, model, migration, or test files
|
|
37
|
+
- Validated inputs, safe queries, transaction boundaries, and error handling
|
|
38
|
+
- Verification results from the execution checklist
|
|
39
|
+
|
|
40
|
+
### Dependencies
|
|
41
|
+
- Project stack manifests and existing backend conventions
|
|
42
|
+
- `resources/execution-protocol.md`, `resources/checklist.md`, and `resources/orm-reference.md`
|
|
43
|
+
<!-- oma-docs:ignore-start -->
|
|
44
|
+
- Optional `stack/stack.yaml`, `stack/tech-stack.md`, snippets, and API templates
|
|
45
|
+
<!-- oma-docs:ignore-end -->
|
|
46
|
+
- Database, queue, cache, mail, auth, or external API resources configured through environment or secret managers
|
|
47
|
+
|
|
48
|
+
### Control-flow features
|
|
49
|
+
- Branches by detected stack, ORM/query pattern, auth requirement, migration impact, and transaction scope
|
|
50
|
+
- Reads and writes codebase files
|
|
51
|
+
- May touch local database migrations or generated code
|
|
52
|
+
- Must not hardcode secrets or share unsafe ORM lifecycle objects across concurrent work
|
|
53
|
+
|
|
54
|
+
## Structural Flow
|
|
55
|
+
|
|
56
|
+
### Entry
|
|
57
|
+
1. Detect the backend stack from project files first.
|
|
58
|
+
2. Identify affected router, service, repository, model, migration, and test boundaries.
|
|
59
|
+
3. Load stack-specific references only when needed.
|
|
60
|
+
|
|
61
|
+
### Scenes
|
|
62
|
+
1. **PREPARE**: Determine stack, architecture boundaries, and acceptance criteria.
|
|
63
|
+
2. **ACQUIRE**: Read existing routes, services, repositories, models, schemas, and config.
|
|
64
|
+
3. **ACT**: Implement backend changes with validation, business logic, persistence, and tests.
|
|
65
|
+
4. **VERIFY**: Run relevant lint, type, test, migration, and checklist commands.
|
|
66
|
+
5. **FINALIZE**: Report changed behavior, verification, and unresolved risks.
|
|
67
|
+
|
|
68
|
+
### Transitions
|
|
69
|
+
- If stack files exist, follow them before generic guidance.
|
|
70
|
+
- If ORM performance, relationship loading, transactions, or N+1 risk appears, use `resources/orm-reference.md`.
|
|
71
|
+
- If database schema impact is primary and API work is secondary, coordinate with `oma-db`.
|
|
72
|
+
- If auth server setup touches DB adapters or server libraries, keep it in backend scope.
|
|
73
|
+
|
|
74
|
+
### Failure and recovery
|
|
75
|
+
- If stack cannot be determined, ask the user or suggest running `/stack-set`.
|
|
76
|
+
- If verification fails, fix root cause before handoff.
|
|
77
|
+
- If required secrets or services are unavailable, document the blocker and keep code configurable.
|
|
78
|
+
|
|
79
|
+
### Exit
|
|
80
|
+
- Success: backend change is implemented, tested, and aligned with local architecture.
|
|
81
|
+
- Partial success: blocker, missing dependency, or verification gap is explicit.
|
|
82
|
+
|
|
83
|
+
## Logical Operations
|
|
84
|
+
|
|
85
|
+
### Actions
|
|
86
|
+
| Action | SSL primitive | Evidence |
|
|
87
|
+
|--------|---------------|----------|
|
|
88
|
+
| Detect stack and conventions | `READ` | Manifests, stack files, existing code |
|
|
89
|
+
| Select implementation boundary | `SELECT` | Router/service/repository pattern |
|
|
90
|
+
| Validate inputs and schemas | `VALIDATE` | Stack validation library |
|
|
91
|
+
| Implement business logic | `WRITE` | Service layer code |
|
|
92
|
+
| Implement persistence | `WRITE` | Repository/model/migration code |
|
|
93
|
+
| Call external/backing services | `CALL_TOOL` | DB, queue, cache, auth, or API clients |
|
|
94
|
+
| Run verification | `CALL_TOOL` | Tests, typecheck, lint, migrations |
|
|
95
|
+
| Report result | `NOTIFY` | Final summary |
|
|
96
|
+
|
|
97
|
+
### Tools and instruments
|
|
98
|
+
- Project language/framework toolchain
|
|
99
|
+
- ORM or database client
|
|
100
|
+
- Test, lint, typecheck, and migration commands
|
|
101
|
+
- Stack-specific templates and snippets when present
|
|
102
|
+
|
|
103
|
+
### Canonical workflow path
|
|
104
|
+
Use the configured code-intelligence provider to locate files and inspect symbols
|
|
105
|
+
or content. For Serena, use `find_file`, `search_for_pattern`,
|
|
106
|
+
`get_symbols_overview`, and `find_symbol`. Native search is limited to the
|
|
107
|
+
provider exclusions and non-code paths permitted by the project's search policy.
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
<!-- oma-docs:ignore-start -->
|
|
111
|
+
Then run the project's discovered verification commands, usually lint/typecheck/tests and migrations when schema changes are involved. Prefer `stack/stack.yaml` `verify:` commands when present.
|
|
112
|
+
<!-- oma-docs:ignore-end -->
|
|
113
|
+
|
|
114
|
+
### Resource scope
|
|
115
|
+
| Scope | Resource target |
|
|
116
|
+
|-------|-----------------|
|
|
117
|
+
| `CODEBASE` | Backend source, tests, schemas, migrations |
|
|
118
|
+
| `LOCAL_FS` | Stack references and generated artifacts |
|
|
119
|
+
| `PROCESS` | Test, lint, typecheck, migration commands |
|
|
120
|
+
| `CREDENTIALS` | Environment-managed DB URLs, API keys, secrets |
|
|
121
|
+
| `NETWORK` | External APIs or backing services when required |
|
|
122
|
+
|
|
123
|
+
### Preconditions
|
|
124
|
+
- Target behavior and affected backend boundary are identifiable.
|
|
125
|
+
- Project stack and verification commands can be inferred or are provided.
|
|
126
|
+
- Required credentials remain outside source code.
|
|
127
|
+
|
|
128
|
+
### Effects and side effects
|
|
129
|
+
- Mutates backend source files, tests, and possibly migrations.
|
|
130
|
+
- May change database schema, API behavior, auth behavior, or service contracts.
|
|
131
|
+
- May require generated clients or migration artifacts.
|
|
132
|
+
|
|
133
|
+
### Guardrails
|
|
134
|
+
Apply framework, library, architecture, and data-model defaults only when the target project has no established choice. Scoped edits do not authorize a stack migration or unrelated infrastructure.
|
|
135
|
+
|
|
136
|
+
1. **DRY (Don't Repeat Yourself)**: Business logic in `Service`, data access logic in `Repository`
|
|
137
|
+
2. **SOLID**:
|
|
138
|
+
- **Single Responsibility**: Classes and functions should have one responsibility
|
|
139
|
+
- **Dependency Inversion**: Use your framework's DI mechanism
|
|
140
|
+
3. **KISS**: Keep it simple and clear
|
|
141
|
+
|
|
142
|
+
### Architecture Pattern
|
|
143
|
+
|
|
144
|
+
```
|
|
145
|
+
Router (HTTP) → Service (Business Logic) → Repository (Data Access) → Models
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### Repository Layer
|
|
149
|
+
- Encapsulate DB CRUD and query logic
|
|
150
|
+
- No business logic, return ORM entities
|
|
151
|
+
|
|
152
|
+
### Service Layer
|
|
153
|
+
- Business logic, Repository composition, external API calls
|
|
154
|
+
- Business decisions only here
|
|
155
|
+
|
|
156
|
+
### Router Layer
|
|
157
|
+
- Receive HTTP requests, input validation, call Service, return response
|
|
158
|
+
- No business logic, inject Service via DI
|
|
159
|
+
|
|
160
|
+
### Core Rules
|
|
161
|
+
|
|
162
|
+
1. **Clean architecture**: router → service → repository → models
|
|
163
|
+
2. **No business logic in route handlers**
|
|
164
|
+
3. **All inputs validated** with your stack's validation library
|
|
165
|
+
4. **Parameterized queries only** (never string interpolation)
|
|
166
|
+
5. **JWT + Argon2id for auth** (bcrypt acceptable for legacy compatibility); rate limit auth endpoints
|
|
167
|
+
6. **Async where supported**; type annotations on all signatures
|
|
168
|
+
7. **Custom exceptions** via centralized error module (not raw HTTP exceptions)
|
|
169
|
+
8. **Explicit ORM loading strategy**: do not rely on default relation loading when query shape matters
|
|
170
|
+
9. **Explicit transaction boundaries**: group one business operation into one request/service-scoped unit of work
|
|
171
|
+
10. **Safe ORM lifecycle**: do not share mutable ORM session/entity manager/client objects across concurrent work unless the ORM explicitly supports it
|
|
172
|
+
11. **Validate required configuration**: DB URLs, API keys, secrets, and feature flags come from environment variables or secret managers. Missing credentials fail clearly in default and production modes. Deterministic fixtures require an explicitly selected test/demo mode; label simulated results and never treat simulated payment, authentication, mail, or other effects as completed real operations.
|
|
173
|
+
12. **Stateless services**: no in-memory session or user state between requests; use external stores (DB, Redis, cache) for shared state
|
|
174
|
+
13. **Backing services as resources**: DB, queue, cache, mail are swappable attached resources connected via config; Repository layer must not assume a specific instance
|
|
175
|
+
|
|
176
|
+
### Stack Detection
|
|
177
|
+
|
|
178
|
+
1. **Project files first**: Read existing code, package manifests (pyproject.toml, package.json, Cargo.toml, go.mod, pom.xml, etc.) to determine the tech stack
|
|
179
|
+
2. **stack/ second**: If `stack/` exists, use it as supplementary reference for coding conventions and snippet templates
|
|
180
|
+
3. **Neither exists**: Ask the user or suggest running `/stack-set`
|
|
181
|
+
|
|
182
|
+
### Stack-Specific Reference
|
|
183
|
+
|
|
184
|
+
<!-- oma-docs:ignore-start -->
|
|
185
|
+
- **Stack manifest (SSOT)**: `stack/stack.yaml`: structured declaration (`language`, `framework`, `orm`) and `verify:` contract consumed by `oma verify agent backend`. Schema: `variants/stack.schema.json`.
|
|
186
|
+
- Tech stack narrative: `stack/tech-stack.md`: human-readable reference only; `stack.yaml` wins on conflict.
|
|
187
|
+
- Code snippets (copy-paste ready): `stack/snippets.md`
|
|
188
|
+
- API template: `stack/api-template.*`
|
|
189
|
+
<!-- oma-docs:ignore-end -->
|
|
190
|
+
|
|
191
|
+
## References
|
|
192
|
+
- Local code tools: `../_shared/core/code-intelligence.md` (code search/navigation)
|
|
193
|
+
|
|
194
|
+
- Execution steps (follow for the selected task): `resources/execution-protocol.md`
|
|
195
|
+
- Checklist (run before handoff): `resources/checklist.md`
|
|
196
|
+
- ORM reference: `resources/orm-reference.md`
|
|
197
|
+
- Error recovery: `resources/error-playbook.md`
|
|
198
|
+
- Context loading: `../_shared/core/context-loading.md`
|
|
199
|
+
- Clarification: `../_shared/core/clarification-protocol.md`
|
|
200
|
+
- Context budget: `../_shared/core/context-budget.md`
|
|
201
|
+
- Lessons learned: `../_shared/core/lessons-learned.md` (matching prior failure or requested retrospective)
|
|
202
|
+
- Observability handoff: `../oma-observability/SKILL.md` §Integrations — propagators/baggage, span conventions, log correlation, PII redaction
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Backend Agent - Self-Verification Checklist
|
|
2
|
+
|
|
3
|
+
Run through every item before submitting your work.
|
|
4
|
+
|
|
5
|
+
## API Design
|
|
6
|
+
- [ ] RESTful conventions followed (proper HTTP methods, status codes)
|
|
7
|
+
- [ ] OpenAPI documentation complete (all endpoints documented)
|
|
8
|
+
- [ ] Request/response schemas defined with validation library
|
|
9
|
+
- [ ] Pagination for list endpoints returning > 20 items
|
|
10
|
+
- [ ] Consistent error response format
|
|
11
|
+
|
|
12
|
+
## Database
|
|
13
|
+
- [ ] Migrations created and tested
|
|
14
|
+
- [ ] Indexes on foreign keys and frequently queried columns
|
|
15
|
+
- [ ] No N+1 queries; relation loading strategy chosen explicitly for the ORM in use
|
|
16
|
+
- [ ] No over-fetching; selected only required fields/columns/attributes
|
|
17
|
+
- [ ] Transactions used for multi-step operations with explicit unit-of-work boundaries
|
|
18
|
+
- [ ] ORM session/client/entity-manager lifecycle matches the framework's concurrency model
|
|
19
|
+
- [ ] Query risks reviewed: missing indexes, full scans, repeated identical queries, join row multiplication
|
|
20
|
+
|
|
21
|
+
## Security
|
|
22
|
+
- [ ] JWT authentication on protected endpoints
|
|
23
|
+
- [ ] Password hashing with Argon2id (bcrypt cost 10-12 acceptable for legacy compatibility)
|
|
24
|
+
- [ ] Rate limiting on auth endpoints
|
|
25
|
+
- [ ] Input validation enforced (no raw user input in queries)
|
|
26
|
+
- [ ] SQL injection protected (ORM or parameterized queries)
|
|
27
|
+
- [ ] No secrets in code or logs
|
|
28
|
+
|
|
29
|
+
## Testing
|
|
30
|
+
- [ ] Unit tests for service layer logic
|
|
31
|
+
- [ ] Integration tests for all endpoints (happy + error paths)
|
|
32
|
+
- [ ] Auth scenarios tested (missing token, expired, wrong role)
|
|
33
|
+
- [ ] Project coverage target met; if no target exists, document changed behavior coverage and any justified exclusions
|
|
34
|
+
|
|
35
|
+
## Code Quality
|
|
36
|
+
- [ ] Clean architecture layers: router -> service -> repository
|
|
37
|
+
- [ ] No business logic in route handlers
|
|
38
|
+
- [ ] Async/await used consistently
|
|
39
|
+
- [ ] Type annotations on all function signatures
|
|
40
|
+
|
|
41
|
+
## Cloud Readiness
|
|
42
|
+
- [ ] No hardcoded config values (DB URLs, API keys, ports); all from env vars
|
|
43
|
+
- [ ] No in-process state between requests (sessions, caches, counters)
|
|
44
|
+
- [ ] Logs written to stdout/stderr, not file; structured format (JSON) preferred
|
|
45
|
+
- [ ] Graceful shutdown handled for background jobs and open connections
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# Backend Agent - Error Recovery Playbook
|
|
2
|
+
|
|
3
|
+
When you encounter a failure, find the matching scenario and follow the recovery steps.
|
|
4
|
+
Use the relevant recovery steps. If required information or authority is missing, pause the dependent action and continue independent work.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Import / Module Not Found
|
|
9
|
+
|
|
10
|
+
**Symptoms**: Module/package not found errors
|
|
11
|
+
|
|
12
|
+
1. Check the import path: typo? wrong package name?
|
|
13
|
+
2. Verify the dependency exists in your package manifest
|
|
14
|
+
3. If missing: note it in your result as "requires install the missing dependency"; do NOT install yourself
|
|
15
|
+
4. If it's a local module: check the directory structure with `get_symbols_overview`
|
|
16
|
+
5. If the path changed: use `search_for_pattern("class ClassName")` to find the new location
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Test Failure
|
|
21
|
+
|
|
22
|
+
**Symptoms**: test runner returns FAILED, assertion errors
|
|
23
|
+
|
|
24
|
+
1. Read the full error output: which test, which assertion, expected vs actual
|
|
25
|
+
2. `find_symbol("test_function_name")` to read the test code
|
|
26
|
+
3. Determine: is the test wrong or is the implementation wrong?
|
|
27
|
+
- Test expects old behavior → update test
|
|
28
|
+
- Implementation has a bug → fix implementation
|
|
29
|
+
4. Run the specific failing test with verbose output
|
|
30
|
+
5. After the fix, run affected regression tests; run a broader suite only when impact or project requirements justify it
|
|
31
|
+
6. **After 3 failures**: Try a different approach. Record current attempt in progress and implement alternative
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Database Migration Error
|
|
36
|
+
|
|
37
|
+
**Symptoms**: Migration command fails, `IntegrityError`, duplicate column
|
|
38
|
+
|
|
39
|
+
1. Read the error; is it a conflict with existing migration?
|
|
40
|
+
2. Check current DB state: Check current migration state
|
|
41
|
+
3. Inspect applied steps and partial changes first. In production or shared environments, prefer a reviewed forward fix. Roll back only in disposable development databases or with a tested, data-safe down migration; do not rewrite an already-applied migration.
|
|
42
|
+
4. If schema mismatch: compare model with actual DB schema
|
|
43
|
+
5. **NEVER do this**: Force-mark migrations as applied (risk of data loss)
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Authentication / JWT Error
|
|
48
|
+
|
|
49
|
+
**Symptoms**: 401/403 responses, `InvalidTokenError`, `ExpiredSignatureError`
|
|
50
|
+
|
|
51
|
+
1. Check: is the secret key consistent between encode and decode?
|
|
52
|
+
2. Check: is the algorithm specified (`HS256` vs `RS256`)?
|
|
53
|
+
3. Check: is the token being sent in the correct header format? (`Bearer {token}`)
|
|
54
|
+
4. Check: is token expiry set correctly? (access: 15min, refresh: 7day)
|
|
55
|
+
5. Test with a manually created token to isolate the issue
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## N+1 Query / Slow Response
|
|
60
|
+
|
|
61
|
+
**Symptoms**: API response > 500ms, many similar SQL queries in logs
|
|
62
|
+
|
|
63
|
+
1. Enable SQL logging on the database connection
|
|
64
|
+
2. Count queries for a single request
|
|
65
|
+
3. If N+1: add eager loading strategy appropriate for your ORM to the query
|
|
66
|
+
4. If slow single query: check indexes with `EXPLAIN ANALYZE`
|
|
67
|
+
5. If still slow: consider caching with Redis
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Rate Limit / Quota Error (LLM runtime)
|
|
72
|
+
|
|
73
|
+
**Symptoms**: `429`, `RESOURCE_EXHAUSTED`, `rate limit exceeded` (any vendor runtime — Gemini, Claude, Codex, etc.)
|
|
74
|
+
|
|
75
|
+
1. Identify the source. An expected rate-limit response from the application under review is a test result, not an agent-provider quota failure.
|
|
76
|
+
2. For provider quota exhaustion, stop affected provider calls and record the unavailable checks; continue independent authorized work when possible.
|
|
77
|
+
3. Preserve injected session/task/run IDs and the claim path. Save progress/results under the configured memory base using the task/run-scoped names in `../../_shared/runtime/memory-protocol.md`.
|
|
78
|
+
4. Use a valid claim status (`partial`, `blocked`, or `failed`) with the actual cause and unresolved work per `../../_shared/runtime/result-contract.md`; do not invent a `quota_exceeded` status.
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Workflow State Unavailable
|
|
83
|
+
|
|
84
|
+
Follow `../../_shared/runtime/memory-protocol.md`; state storage is independent of the code-intelligence provider.
|
|
85
|
+
|
|
86
|
+
1. Use the injected progress/result paths and session/task identity.
|
|
87
|
+
2. If a file operation fails, retry once when the failure may be transient.
|
|
88
|
+
3. Preserve work and report the failed path and error to the coordinator. Do not silently redirect artifacts to `/tmp` or mark a missing result as completed.
|
|
89
|
+
4. For read-only tasks, return the result through the runtime's response channel as required by the dispatch contract.
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## General Principles
|
|
94
|
+
|
|
95
|
+
- **After 3 failures**: If same approach fails 3 times, must try a different method
|
|
96
|
+
- **Blocked**: If no progress after 5 turns, save current state and record `Status: blocked` in result
|
|
97
|
+
- **Out of scope**: If you find issues in another agent's domain, only record in result; do not modify directly
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Backend Agent - Execution Protocol
|
|
2
|
+
|
|
3
|
+
## Preparation
|
|
4
|
+
Use the task's scope, existing project conventions, and acceptance criteria. Follow `../../_shared/core/execution-policy.md` when it has not already been supplied. Read only references needed by the selected operation; consult lessons or recovery guides for an observed issue. Expand planning depth only when the change requires it.
|
|
5
|
+
|
|
6
|
+
## Step 1: Analyze
|
|
7
|
+
- Read the task requirements carefully
|
|
8
|
+
- Identify which endpoints, models, and services are needed
|
|
9
|
+
- Inspect existing structure and relevant symbols via `../../_shared/core/code-intelligence.md`; if the configured provider is unavailable, use native search only for paths outside this project or ignored paths
|
|
10
|
+
- If the task is ORM-heavy, load `resources/orm-reference.md` before deciding on loading strategy, transaction scope, or client/session lifecycle
|
|
11
|
+
- List assumptions; ask if unclear
|
|
12
|
+
|
|
13
|
+
## Step 2: Plan
|
|
14
|
+
- Decide on file structure: models, schemas, routes, services
|
|
15
|
+
- Define API contracts (method, path, request/response types)
|
|
16
|
+
- Plan database schema changes (tables, columns, indexes, migrations)
|
|
17
|
+
- Plan relation loading strategy, transaction boundary, and ORM lifecycle constraints explicitly
|
|
18
|
+
- Identify security requirements (auth, validation, rate limiting)
|
|
19
|
+
|
|
20
|
+
## Step 3: Implement
|
|
21
|
+
- **Honor the task's `test_approach`** (see `../../_shared/core/test-approach.md`): for `tdd` tasks, write and run the focused test first (record the RED failure), make the minimal change (GREEN), then continue; for `tdd` the test comes before item 3 below
|
|
22
|
+
- Typical affected files (choose an order from actual dependencies):
|
|
23
|
+
1. Database models + migrations
|
|
24
|
+
2. Validation schemas (request/response)
|
|
25
|
+
3. Service layer (business logic)
|
|
26
|
+
4. API routes (thin, delegate to services)
|
|
27
|
+
5. Tests (unit + integration)
|
|
28
|
+
- Use `stack/api-template.*` as reference
|
|
29
|
+
- Follow clean architecture: router -> service -> repository -> models
|
|
30
|
+
|
|
31
|
+
## Step 4: Verify
|
|
32
|
+
- Check applicable items in `resources/checklist.md`
|
|
33
|
+
- Use `../../_shared/core/common-checklist.md` only for cross-domain verification
|
|
34
|
+
- Ensure affected tests and required project checks pass
|
|
35
|
+
- For `tdd` tasks, append the `TDD_EVIDENCE` block (test command, RED, GREEN) to the result file per `../../_shared/core/test-approach.md`
|
|
36
|
+
- Confirm OpenAPI docs are complete
|
|
37
|
+
|
|
38
|
+
## On Error
|
|
39
|
+
See `resources/error-playbook.md` for recovery steps.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Backend Agent - ORM Reference
|
|
2
|
+
|
|
3
|
+
Use this guide when the task involves ORM query design, relation loading, transaction scoping, or session/client lifecycle decisions.
|
|
4
|
+
|
|
5
|
+
## ORM Rules
|
|
6
|
+
|
|
7
|
+
### 1. Relation loading must be chosen per use case
|
|
8
|
+
|
|
9
|
+
Backend Agent should therefore:
|
|
10
|
+
- choose loading strategy per endpoint or service method
|
|
11
|
+
- compare join-based eager loading, batched/select-in loading, and separate follow-up queries
|
|
12
|
+
- choose SQLAlchemy's `joinedload`, `selectinload`, `lazyload`, or `raiseload` explicitly for the access pattern
|
|
13
|
+
- use Sequelize `include` for join-based eager loading or `separate: true` for `hasMany` when separate loading fits the query
|
|
14
|
+
- treat accidental lazy loads in loops as a performance bug
|
|
15
|
+
|
|
16
|
+
### 2. Transaction boundaries must follow business operations
|
|
17
|
+
|
|
18
|
+
Backend Agent should therefore:
|
|
19
|
+
- open one explicit transaction for one business operation; in Sequelize, use a managed transaction callback for that unit of work
|
|
20
|
+
- keep read-modify-write flows inside the same transaction boundary
|
|
21
|
+
- avoid per-statement auto-commit designs
|
|
22
|
+
- never hold a database transaction open across user think time
|
|
23
|
+
|
|
24
|
+
### 3. ORM lifecycle objects are not generic shared singletons
|
|
25
|
+
|
|
26
|
+
Backend Agent should therefore:
|
|
27
|
+
- reuse factory/client objects only when the ORM recommends reuse
|
|
28
|
+
- keep transaction-scoped mutable objects request-scoped or task-scoped
|
|
29
|
+
- never share stateful unit-of-work objects across concurrent tasks unless the vendor explicitly permits it
|
|
30
|
+
|
|
31
|
+
Operational reading:
|
|
32
|
+
- Prisma: reuse one `PrismaClient` in long-running apps; do not create a new client per query; do not disconnect after every request
|
|
33
|
+
- SQLAlchemy: `Session` and `AsyncSession` are mutable, transaction-scoped, and the documented model is session-per-thread / async-session-per-task
|
|
34
|
+
- Hibernate: prefer session-per-request over session-per-operation
|
|
35
|
+
|
|
36
|
+
### 4. Field projection is mandatory unless full entity hydration is required
|
|
37
|
+
|
|
38
|
+
Backend Agent should therefore:
|
|
39
|
+
- fetch only required columns, attributes, or nested fields using Prisma nested `select`, TypeORM `select`, or Sequelize `attributes`
|
|
40
|
+
- prefer projections, DTO shaping, or raw results when domain objects are not needed; use TypeORM `getRawMany()` or Sequelize `{ raw: true }` when entity hydration is unnecessary
|
|
41
|
+
- treat over-fetching as a query design flaw, not a minor optimization item
|
|
42
|
+
|
|
43
|
+
### 5. Mapping defaults must never be trusted blindly
|
|
44
|
+
|
|
45
|
+
Lazy and eager defaults are convenience features, not query plans. Multiple vendors warn that both directions can fail differently:
|
|
46
|
+
- lazy defaults can explode into N+1
|
|
47
|
+
- eager defaults can create oversized joins, duplicate parent rows, or unnecessary payloads
|
|
48
|
+
|
|
49
|
+
Backend Agent should therefore:
|
|
50
|
+
- inspect relation defaults before changing repository or endpoint behavior
|
|
51
|
+
- override defaults at query time when access shape differs from mapping defaults
|
|
52
|
+
- prefer repository-level query shaping over relying on entity metadata alone
|
|
53
|
+
|
|
54
|
+
### 6. Query review must include access-path and row-shape checks
|
|
55
|
+
|
|
56
|
+
Backend Agent should therefore review:
|
|
57
|
+
- missing indexes on filters, joins, and foreign keys
|
|
58
|
+
- full table scans
|
|
59
|
+
- repeated identical queries that should be cached or batched
|
|
60
|
+
- row multiplication from `hasMany` / collection eager joins
|
|
61
|
+
- memory cost of hydrating full entities when raw results or projections are enough
|