mustflow 1.15.97
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/LICENSE +16 -0
- package/README.md +422 -0
- package/dist/cli/commands/check.js +73 -0
- package/dist/cli/commands/classify.js +104 -0
- package/dist/cli/commands/context.js +95 -0
- package/dist/cli/commands/contract-lint.js +74 -0
- package/dist/cli/commands/dashboard.js +654 -0
- package/dist/cli/commands/docs.js +382 -0
- package/dist/cli/commands/doctor.js +232 -0
- package/dist/cli/commands/explain.js +293 -0
- package/dist/cli/commands/help.js +148 -0
- package/dist/cli/commands/impact.js +120 -0
- package/dist/cli/commands/index.js +70 -0
- package/dist/cli/commands/init.js +986 -0
- package/dist/cli/commands/line-endings.js +102 -0
- package/dist/cli/commands/map.js +95 -0
- package/dist/cli/commands/run.js +442 -0
- package/dist/cli/commands/search.js +166 -0
- package/dist/cli/commands/status.js +65 -0
- package/dist/cli/commands/update.js +443 -0
- package/dist/cli/commands/verify.js +448 -0
- package/dist/cli/commands/version-sources.js +79 -0
- package/dist/cli/commands/version.js +57 -0
- package/dist/cli/i18n/en.js +702 -0
- package/dist/cli/i18n/es.js +702 -0
- package/dist/cli/i18n/fr.js +702 -0
- package/dist/cli/i18n/hi.js +702 -0
- package/dist/cli/i18n/ko.js +702 -0
- package/dist/cli/i18n/zh.js +702 -0
- package/dist/cli/index.js +218 -0
- package/dist/cli/lib/agent-context.js +342 -0
- package/dist/cli/lib/browser-open.js +58 -0
- package/dist/cli/lib/cli-output.js +36 -0
- package/dist/cli/lib/command-contract.js +1 -0
- package/dist/cli/lib/command-registry.js +107 -0
- package/dist/cli/lib/dashboard-html.js +1866 -0
- package/dist/cli/lib/dashboard-locale.js +309 -0
- package/dist/cli/lib/dashboard-preferences.js +405 -0
- package/dist/cli/lib/doc-review-ledger.js +226 -0
- package/dist/cli/lib/filesystem.js +125 -0
- package/dist/cli/lib/git-changes.js +13 -0
- package/dist/cli/lib/i18n.js +55 -0
- package/dist/cli/lib/local-index.js +1014 -0
- package/dist/cli/lib/locale-tags.js +4 -0
- package/dist/cli/lib/manifest-lock.js +131 -0
- package/dist/cli/lib/npm-version-check.js +97 -0
- package/dist/cli/lib/package-info.js +13 -0
- package/dist/cli/lib/preferences-options.js +8 -0
- package/dist/cli/lib/project-root.js +23 -0
- package/dist/cli/lib/repo-map.js +635 -0
- package/dist/cli/lib/reporter.js +8 -0
- package/dist/cli/lib/run-receipt.js +1 -0
- package/dist/cli/lib/template-i18n.js +265 -0
- package/dist/cli/lib/templates.js +188 -0
- package/dist/cli/lib/toml.js +1 -0
- package/dist/cli/lib/validation.js +1639 -0
- package/dist/cli/lib/version-sources.js +1 -0
- package/dist/core/authority-resolution.js +155 -0
- package/dist/core/change-classification.js +122 -0
- package/dist/core/change-verification.js +80 -0
- package/dist/core/check-issues.js +67 -0
- package/dist/core/command-classification.js +22 -0
- package/dist/core/command-contract-rules.js +27 -0
- package/dist/core/command-contract-validation.js +197 -0
- package/dist/core/command-cwd.js +12 -0
- package/dist/core/command-effects.js +182 -0
- package/dist/core/command-explanation.js +135 -0
- package/dist/core/command-intent-eligibility.js +76 -0
- package/dist/core/config-loading.js +54 -0
- package/dist/core/contract-lint.js +110 -0
- package/dist/core/contract-models.js +53 -0
- package/dist/core/dashboard-verification.js +132 -0
- package/dist/core/doc-review-triage.js +92 -0
- package/dist/core/line-endings.js +144 -0
- package/dist/core/public-json-contracts.js +112 -0
- package/dist/core/public-surface-explanation.js +49 -0
- package/dist/core/release-version-validation.js +53 -0
- package/dist/core/retention-explanation.js +74 -0
- package/dist/core/retention-policy.js +57 -0
- package/dist/core/run-receipt.js +77 -0
- package/dist/core/skill-route-alignment.js +100 -0
- package/dist/core/skill-route-explanation.js +117 -0
- package/dist/core/source-anchor-explanation.js +33 -0
- package/dist/core/source-anchor-status.js +269 -0
- package/dist/core/source-anchor-symbols.js +181 -0
- package/dist/core/source-anchor-validation.js +158 -0
- package/dist/core/source-anchors.js +194 -0
- package/dist/core/surface-decision-model.js +18 -0
- package/dist/core/toml.js +11 -0
- package/dist/core/verification-plan.js +41 -0
- package/dist/core/verification-scheduler.js +92 -0
- package/dist/core/version-impact.js +54 -0
- package/dist/core/version-sources.js +235 -0
- package/dist/core/version-sync-policy.js +85 -0
- package/examples/README.md +13 -0
- package/examples/docs-only/README.md +72 -0
- package/examples/host-instruction-conflicts/README.md +47 -0
- package/examples/minimal-js/README.md +98 -0
- package/examples/missing-command-contracts/README.md +70 -0
- package/examples/nested-repos/README.md +62 -0
- package/package.json +80 -0
- package/schemas/README.md +32 -0
- package/schemas/change-verification-report.schema.json +319 -0
- package/schemas/classify-report.schema.json +113 -0
- package/schemas/commands.schema.json +116 -0
- package/schemas/context-report.schema.json +341 -0
- package/schemas/contract-lint-report.schema.json +61 -0
- package/schemas/docs-review-list.schema.json +72 -0
- package/schemas/doctor-report.schema.json +175 -0
- package/schemas/explain-report.schema.json +471 -0
- package/schemas/impact-report.schema.json +121 -0
- package/schemas/line-endings-report.schema.json +63 -0
- package/schemas/run-receipt.schema.json +75 -0
- package/schemas/verify-report.schema.json +67 -0
- package/schemas/version-sources-report.schema.json +42 -0
- package/templates/default/common/.mustflow/config/commands.toml +251 -0
- package/templates/default/common/.mustflow/config/mustflow.toml +424 -0
- package/templates/default/common/.mustflow/config/preferences.toml +125 -0
- package/templates/default/common/gitignore.mustflow +9 -0
- package/templates/default/i18n.toml +483 -0
- package/templates/default/locales/en/.mustflow/context/INDEX.md +39 -0
- package/templates/default/locales/en/.mustflow/context/PROJECT.md +66 -0
- package/templates/default/locales/en/.mustflow/docs/agent-workflow.md +345 -0
- package/templates/default/locales/en/.mustflow/skills/INDEX.md +78 -0
- package/templates/default/locales/en/.mustflow/skills/adapter-boundary/SKILL.md +193 -0
- package/templates/default/locales/en/.mustflow/skills/artifact-integrity-check/SKILL.md +121 -0
- package/templates/default/locales/en/.mustflow/skills/behavior-preserving-refactor/SKILL.md +182 -0
- package/templates/default/locales/en/.mustflow/skills/code-review/SKILL.md +115 -0
- package/templates/default/locales/en/.mustflow/skills/codebase-orientation/SKILL.md +115 -0
- package/templates/default/locales/en/.mustflow/skills/command-pattern/SKILL.md +247 -0
- package/templates/default/locales/en/.mustflow/skills/composition-over-inheritance/SKILL.md +176 -0
- package/templates/default/locales/en/.mustflow/skills/contract-sync-check/SKILL.md +116 -0
- package/templates/default/locales/en/.mustflow/skills/date-number-audit/SKILL.md +116 -0
- package/templates/default/locales/en/.mustflow/skills/dependency-injection/SKILL.md +161 -0
- package/templates/default/locales/en/.mustflow/skills/dependency-reality-check/SKILL.md +115 -0
- package/templates/default/locales/en/.mustflow/skills/diff-risk-review/SKILL.md +143 -0
- package/templates/default/locales/en/.mustflow/skills/docs-prose-review/SKILL.md +119 -0
- package/templates/default/locales/en/.mustflow/skills/docs-update/SKILL.md +100 -0
- package/templates/default/locales/en/.mustflow/skills/external-prompt-injection-defense/SKILL.md +124 -0
- package/templates/default/locales/en/.mustflow/skills/facade-pattern/SKILL.md +210 -0
- package/templates/default/locales/en/.mustflow/skills/failure-triage/SKILL.md +97 -0
- package/templates/default/locales/en/.mustflow/skills/instruction-conflict-scope-check/SKILL.md +118 -0
- package/templates/default/locales/en/.mustflow/skills/line-ending-hygiene/SKILL.md +111 -0
- package/templates/default/locales/en/.mustflow/skills/migration-safety-check/SKILL.md +117 -0
- package/templates/default/locales/en/.mustflow/skills/multi-agent-work-coordination/SKILL.md +260 -0
- package/templates/default/locales/en/.mustflow/skills/null-object-pattern/SKILL.md +196 -0
- package/templates/default/locales/en/.mustflow/skills/pattern-scout/SKILL.md +110 -0
- package/templates/default/locales/en/.mustflow/skills/performance-budget-check/SKILL.md +121 -0
- package/templates/default/locales/en/.mustflow/skills/project-context-authoring/SKILL.md +107 -0
- package/templates/default/locales/en/.mustflow/skills/pure-core-imperative-shell/SKILL.md +212 -0
- package/templates/default/locales/en/.mustflow/skills/readme-authoring/SKILL.md +115 -0
- package/templates/default/locales/en/.mustflow/skills/repo-improvement-loop/SKILL.md +150 -0
- package/templates/default/locales/en/.mustflow/skills/repro-first-debug/SKILL.md +112 -0
- package/templates/default/locales/en/.mustflow/skills/requirement-regression-guard/SKILL.md +152 -0
- package/templates/default/locales/en/.mustflow/skills/result-option/SKILL.md +186 -0
- package/templates/default/locales/en/.mustflow/skills/security-privacy-review/SKILL.md +130 -0
- package/templates/default/locales/en/.mustflow/skills/security-regression-tests/SKILL.md +157 -0
- package/templates/default/locales/en/.mustflow/skills/skill-authoring/SKILL.md +110 -0
- package/templates/default/locales/en/.mustflow/skills/source-freshness-check/SKILL.md +111 -0
- package/templates/default/locales/en/.mustflow/skills/state-machine-pattern/SKILL.md +214 -0
- package/templates/default/locales/en/.mustflow/skills/strategy-pattern/SKILL.md +215 -0
- package/templates/default/locales/en/.mustflow/skills/structure-discovery-gate/SKILL.md +159 -0
- package/templates/default/locales/en/.mustflow/skills/test-maintenance/SKILL.md +122 -0
- package/templates/default/locales/en/.mustflow/skills/ui-quality-gate/SKILL.md +119 -0
- package/templates/default/locales/en/.mustflow/skills/visual-review-artifact/SKILL.md +127 -0
- package/templates/default/locales/en/.mustflow/skills/visual-review-artifact/assets/review-template.html +286 -0
- package/templates/default/locales/en/.mustflow/skills/visual-review-artifact/resources.toml +7 -0
- package/templates/default/locales/en/.mustflow/skills/web-asset-optimization/SKILL.md +108 -0
- package/templates/default/locales/en/AGENTS.md +114 -0
- package/templates/default/locales/es/.mustflow/context/INDEX.md +39 -0
- package/templates/default/locales/es/.mustflow/context/PROJECT.md +63 -0
- package/templates/default/locales/es/.mustflow/docs/agent-workflow.md +365 -0
- package/templates/default/locales/es/.mustflow/skills/INDEX.md +78 -0
- package/templates/default/locales/es/.mustflow/skills/adapter-boundary/SKILL.md +193 -0
- package/templates/default/locales/es/.mustflow/skills/artifact-integrity-check/SKILL.md +114 -0
- package/templates/default/locales/es/.mustflow/skills/behavior-preserving-refactor/SKILL.md +182 -0
- package/templates/default/locales/es/.mustflow/skills/code-review/SKILL.md +115 -0
- package/templates/default/locales/es/.mustflow/skills/codebase-orientation/SKILL.md +115 -0
- package/templates/default/locales/es/.mustflow/skills/command-pattern/SKILL.md +247 -0
- package/templates/default/locales/es/.mustflow/skills/composition-over-inheritance/SKILL.md +176 -0
- package/templates/default/locales/es/.mustflow/skills/contract-sync-check/SKILL.md +116 -0
- package/templates/default/locales/es/.mustflow/skills/date-number-audit/SKILL.md +116 -0
- package/templates/default/locales/es/.mustflow/skills/dependency-injection/SKILL.md +161 -0
- package/templates/default/locales/es/.mustflow/skills/dependency-reality-check/SKILL.md +115 -0
- package/templates/default/locales/es/.mustflow/skills/diff-risk-review/SKILL.md +136 -0
- package/templates/default/locales/es/.mustflow/skills/docs-prose-review/SKILL.md +119 -0
- package/templates/default/locales/es/.mustflow/skills/docs-update/SKILL.md +97 -0
- package/templates/default/locales/es/.mustflow/skills/external-prompt-injection-defense/SKILL.md +116 -0
- package/templates/default/locales/es/.mustflow/skills/facade-pattern/SKILL.md +210 -0
- package/templates/default/locales/es/.mustflow/skills/failure-triage/SKILL.md +97 -0
- package/templates/default/locales/es/.mustflow/skills/instruction-conflict-scope-check/SKILL.md +118 -0
- package/templates/default/locales/es/.mustflow/skills/line-ending-hygiene/SKILL.md +111 -0
- package/templates/default/locales/es/.mustflow/skills/migration-safety-check/SKILL.md +117 -0
- package/templates/default/locales/es/.mustflow/skills/multi-agent-work-coordination/SKILL.md +260 -0
- package/templates/default/locales/es/.mustflow/skills/null-object-pattern/SKILL.md +196 -0
- package/templates/default/locales/es/.mustflow/skills/pattern-scout/SKILL.md +110 -0
- package/templates/default/locales/es/.mustflow/skills/performance-budget-check/SKILL.md +121 -0
- package/templates/default/locales/es/.mustflow/skills/project-context-authoring/SKILL.md +107 -0
- package/templates/default/locales/es/.mustflow/skills/pure-core-imperative-shell/SKILL.md +212 -0
- package/templates/default/locales/es/.mustflow/skills/readme-authoring/SKILL.md +115 -0
- package/templates/default/locales/es/.mustflow/skills/repo-improvement-loop/SKILL.md +150 -0
- package/templates/default/locales/es/.mustflow/skills/repro-first-debug/SKILL.md +112 -0
- package/templates/default/locales/es/.mustflow/skills/requirement-regression-guard/SKILL.md +152 -0
- package/templates/default/locales/es/.mustflow/skills/result-option/SKILL.md +186 -0
- package/templates/default/locales/es/.mustflow/skills/security-privacy-review/SKILL.md +116 -0
- package/templates/default/locales/es/.mustflow/skills/security-regression-tests/SKILL.md +131 -0
- package/templates/default/locales/es/.mustflow/skills/skill-authoring/SKILL.md +110 -0
- package/templates/default/locales/es/.mustflow/skills/source-freshness-check/SKILL.md +111 -0
- package/templates/default/locales/es/.mustflow/skills/state-machine-pattern/SKILL.md +214 -0
- package/templates/default/locales/es/.mustflow/skills/strategy-pattern/SKILL.md +215 -0
- package/templates/default/locales/es/.mustflow/skills/structure-discovery-gate/SKILL.md +159 -0
- package/templates/default/locales/es/.mustflow/skills/test-maintenance/SKILL.md +122 -0
- package/templates/default/locales/es/.mustflow/skills/ui-quality-gate/SKILL.md +117 -0
- package/templates/default/locales/es/.mustflow/skills/visual-review-artifact/SKILL.md +127 -0
- package/templates/default/locales/es/.mustflow/skills/visual-review-artifact/assets/review-template.html +286 -0
- package/templates/default/locales/es/.mustflow/skills/visual-review-artifact/resources.toml +7 -0
- package/templates/default/locales/es/.mustflow/skills/web-asset-optimization/SKILL.md +108 -0
- package/templates/default/locales/es/AGENTS.md +83 -0
- package/templates/default/locales/fr/.mustflow/context/INDEX.md +39 -0
- package/templates/default/locales/fr/.mustflow/context/PROJECT.md +63 -0
- package/templates/default/locales/fr/.mustflow/docs/agent-workflow.md +368 -0
- package/templates/default/locales/fr/.mustflow/skills/INDEX.md +78 -0
- package/templates/default/locales/fr/.mustflow/skills/adapter-boundary/SKILL.md +193 -0
- package/templates/default/locales/fr/.mustflow/skills/artifact-integrity-check/SKILL.md +114 -0
- package/templates/default/locales/fr/.mustflow/skills/behavior-preserving-refactor/SKILL.md +182 -0
- package/templates/default/locales/fr/.mustflow/skills/code-review/SKILL.md +115 -0
- package/templates/default/locales/fr/.mustflow/skills/codebase-orientation/SKILL.md +115 -0
- package/templates/default/locales/fr/.mustflow/skills/command-pattern/SKILL.md +247 -0
- package/templates/default/locales/fr/.mustflow/skills/composition-over-inheritance/SKILL.md +176 -0
- package/templates/default/locales/fr/.mustflow/skills/contract-sync-check/SKILL.md +116 -0
- package/templates/default/locales/fr/.mustflow/skills/date-number-audit/SKILL.md +116 -0
- package/templates/default/locales/fr/.mustflow/skills/dependency-injection/SKILL.md +161 -0
- package/templates/default/locales/fr/.mustflow/skills/dependency-reality-check/SKILL.md +115 -0
- package/templates/default/locales/fr/.mustflow/skills/diff-risk-review/SKILL.md +136 -0
- package/templates/default/locales/fr/.mustflow/skills/docs-prose-review/SKILL.md +119 -0
- package/templates/default/locales/fr/.mustflow/skills/docs-update/SKILL.md +97 -0
- package/templates/default/locales/fr/.mustflow/skills/external-prompt-injection-defense/SKILL.md +116 -0
- package/templates/default/locales/fr/.mustflow/skills/facade-pattern/SKILL.md +210 -0
- package/templates/default/locales/fr/.mustflow/skills/failure-triage/SKILL.md +97 -0
- package/templates/default/locales/fr/.mustflow/skills/instruction-conflict-scope-check/SKILL.md +118 -0
- package/templates/default/locales/fr/.mustflow/skills/line-ending-hygiene/SKILL.md +111 -0
- package/templates/default/locales/fr/.mustflow/skills/migration-safety-check/SKILL.md +117 -0
- package/templates/default/locales/fr/.mustflow/skills/multi-agent-work-coordination/SKILL.md +260 -0
- package/templates/default/locales/fr/.mustflow/skills/null-object-pattern/SKILL.md +196 -0
- package/templates/default/locales/fr/.mustflow/skills/pattern-scout/SKILL.md +110 -0
- package/templates/default/locales/fr/.mustflow/skills/performance-budget-check/SKILL.md +121 -0
- package/templates/default/locales/fr/.mustflow/skills/project-context-authoring/SKILL.md +107 -0
- package/templates/default/locales/fr/.mustflow/skills/pure-core-imperative-shell/SKILL.md +212 -0
- package/templates/default/locales/fr/.mustflow/skills/readme-authoring/SKILL.md +115 -0
- package/templates/default/locales/fr/.mustflow/skills/repo-improvement-loop/SKILL.md +150 -0
- package/templates/default/locales/fr/.mustflow/skills/repro-first-debug/SKILL.md +112 -0
- package/templates/default/locales/fr/.mustflow/skills/requirement-regression-guard/SKILL.md +152 -0
- package/templates/default/locales/fr/.mustflow/skills/result-option/SKILL.md +186 -0
- package/templates/default/locales/fr/.mustflow/skills/security-privacy-review/SKILL.md +116 -0
- package/templates/default/locales/fr/.mustflow/skills/security-regression-tests/SKILL.md +131 -0
- package/templates/default/locales/fr/.mustflow/skills/skill-authoring/SKILL.md +110 -0
- package/templates/default/locales/fr/.mustflow/skills/source-freshness-check/SKILL.md +111 -0
- package/templates/default/locales/fr/.mustflow/skills/state-machine-pattern/SKILL.md +214 -0
- package/templates/default/locales/fr/.mustflow/skills/strategy-pattern/SKILL.md +215 -0
- package/templates/default/locales/fr/.mustflow/skills/structure-discovery-gate/SKILL.md +159 -0
- package/templates/default/locales/fr/.mustflow/skills/test-maintenance/SKILL.md +122 -0
- package/templates/default/locales/fr/.mustflow/skills/ui-quality-gate/SKILL.md +117 -0
- package/templates/default/locales/fr/.mustflow/skills/visual-review-artifact/SKILL.md +127 -0
- package/templates/default/locales/fr/.mustflow/skills/visual-review-artifact/assets/review-template.html +286 -0
- package/templates/default/locales/fr/.mustflow/skills/visual-review-artifact/resources.toml +7 -0
- package/templates/default/locales/fr/.mustflow/skills/web-asset-optimization/SKILL.md +108 -0
- package/templates/default/locales/fr/AGENTS.md +84 -0
- package/templates/default/locales/hi/.mustflow/context/INDEX.md +39 -0
- package/templates/default/locales/hi/.mustflow/context/PROJECT.md +65 -0
- package/templates/default/locales/hi/.mustflow/docs/agent-workflow.md +359 -0
- package/templates/default/locales/hi/.mustflow/skills/INDEX.md +78 -0
- package/templates/default/locales/hi/.mustflow/skills/adapter-boundary/SKILL.md +193 -0
- package/templates/default/locales/hi/.mustflow/skills/artifact-integrity-check/SKILL.md +114 -0
- package/templates/default/locales/hi/.mustflow/skills/behavior-preserving-refactor/SKILL.md +182 -0
- package/templates/default/locales/hi/.mustflow/skills/code-review/SKILL.md +115 -0
- package/templates/default/locales/hi/.mustflow/skills/codebase-orientation/SKILL.md +115 -0
- package/templates/default/locales/hi/.mustflow/skills/command-pattern/SKILL.md +247 -0
- package/templates/default/locales/hi/.mustflow/skills/composition-over-inheritance/SKILL.md +176 -0
- package/templates/default/locales/hi/.mustflow/skills/contract-sync-check/SKILL.md +116 -0
- package/templates/default/locales/hi/.mustflow/skills/date-number-audit/SKILL.md +116 -0
- package/templates/default/locales/hi/.mustflow/skills/dependency-injection/SKILL.md +161 -0
- package/templates/default/locales/hi/.mustflow/skills/dependency-reality-check/SKILL.md +115 -0
- package/templates/default/locales/hi/.mustflow/skills/diff-risk-review/SKILL.md +136 -0
- package/templates/default/locales/hi/.mustflow/skills/docs-prose-review/SKILL.md +119 -0
- package/templates/default/locales/hi/.mustflow/skills/docs-update/SKILL.md +97 -0
- package/templates/default/locales/hi/.mustflow/skills/external-prompt-injection-defense/SKILL.md +116 -0
- package/templates/default/locales/hi/.mustflow/skills/facade-pattern/SKILL.md +210 -0
- package/templates/default/locales/hi/.mustflow/skills/failure-triage/SKILL.md +97 -0
- package/templates/default/locales/hi/.mustflow/skills/instruction-conflict-scope-check/SKILL.md +118 -0
- package/templates/default/locales/hi/.mustflow/skills/line-ending-hygiene/SKILL.md +111 -0
- package/templates/default/locales/hi/.mustflow/skills/migration-safety-check/SKILL.md +117 -0
- package/templates/default/locales/hi/.mustflow/skills/multi-agent-work-coordination/SKILL.md +260 -0
- package/templates/default/locales/hi/.mustflow/skills/null-object-pattern/SKILL.md +196 -0
- package/templates/default/locales/hi/.mustflow/skills/pattern-scout/SKILL.md +110 -0
- package/templates/default/locales/hi/.mustflow/skills/performance-budget-check/SKILL.md +121 -0
- package/templates/default/locales/hi/.mustflow/skills/project-context-authoring/SKILL.md +107 -0
- package/templates/default/locales/hi/.mustflow/skills/pure-core-imperative-shell/SKILL.md +212 -0
- package/templates/default/locales/hi/.mustflow/skills/readme-authoring/SKILL.md +115 -0
- package/templates/default/locales/hi/.mustflow/skills/repo-improvement-loop/SKILL.md +150 -0
- package/templates/default/locales/hi/.mustflow/skills/repro-first-debug/SKILL.md +112 -0
- package/templates/default/locales/hi/.mustflow/skills/requirement-regression-guard/SKILL.md +152 -0
- package/templates/default/locales/hi/.mustflow/skills/result-option/SKILL.md +186 -0
- package/templates/default/locales/hi/.mustflow/skills/security-privacy-review/SKILL.md +116 -0
- package/templates/default/locales/hi/.mustflow/skills/security-regression-tests/SKILL.md +131 -0
- package/templates/default/locales/hi/.mustflow/skills/skill-authoring/SKILL.md +110 -0
- package/templates/default/locales/hi/.mustflow/skills/source-freshness-check/SKILL.md +111 -0
- package/templates/default/locales/hi/.mustflow/skills/state-machine-pattern/SKILL.md +214 -0
- package/templates/default/locales/hi/.mustflow/skills/strategy-pattern/SKILL.md +215 -0
- package/templates/default/locales/hi/.mustflow/skills/structure-discovery-gate/SKILL.md +159 -0
- package/templates/default/locales/hi/.mustflow/skills/test-maintenance/SKILL.md +122 -0
- package/templates/default/locales/hi/.mustflow/skills/ui-quality-gate/SKILL.md +117 -0
- package/templates/default/locales/hi/.mustflow/skills/visual-review-artifact/SKILL.md +127 -0
- package/templates/default/locales/hi/.mustflow/skills/visual-review-artifact/assets/review-template.html +286 -0
- package/templates/default/locales/hi/.mustflow/skills/visual-review-artifact/resources.toml +7 -0
- package/templates/default/locales/hi/.mustflow/skills/web-asset-optimization/SKILL.md +108 -0
- package/templates/default/locales/hi/AGENTS.md +83 -0
- package/templates/default/locales/ko/.mustflow/context/INDEX.md +39 -0
- package/templates/default/locales/ko/.mustflow/context/PROJECT.md +66 -0
- package/templates/default/locales/ko/.mustflow/docs/agent-workflow.md +506 -0
- package/templates/default/locales/ko/.mustflow/skills/INDEX.md +78 -0
- package/templates/default/locales/ko/.mustflow/skills/adapter-boundary/SKILL.md +193 -0
- package/templates/default/locales/ko/.mustflow/skills/artifact-integrity-check/SKILL.md +114 -0
- package/templates/default/locales/ko/.mustflow/skills/behavior-preserving-refactor/SKILL.md +182 -0
- package/templates/default/locales/ko/.mustflow/skills/code-review/SKILL.md +118 -0
- package/templates/default/locales/ko/.mustflow/skills/codebase-orientation/SKILL.md +115 -0
- package/templates/default/locales/ko/.mustflow/skills/command-pattern/SKILL.md +247 -0
- package/templates/default/locales/ko/.mustflow/skills/composition-over-inheritance/SKILL.md +176 -0
- package/templates/default/locales/ko/.mustflow/skills/contract-sync-check/SKILL.md +116 -0
- package/templates/default/locales/ko/.mustflow/skills/date-number-audit/SKILL.md +116 -0
- package/templates/default/locales/ko/.mustflow/skills/dependency-injection/SKILL.md +161 -0
- package/templates/default/locales/ko/.mustflow/skills/dependency-reality-check/SKILL.md +115 -0
- package/templates/default/locales/ko/.mustflow/skills/diff-risk-review/SKILL.md +136 -0
- package/templates/default/locales/ko/.mustflow/skills/docs-prose-review/SKILL.md +119 -0
- package/templates/default/locales/ko/.mustflow/skills/docs-update/SKILL.md +107 -0
- package/templates/default/locales/ko/.mustflow/skills/external-prompt-injection-defense/SKILL.md +116 -0
- package/templates/default/locales/ko/.mustflow/skills/facade-pattern/SKILL.md +210 -0
- package/templates/default/locales/ko/.mustflow/skills/failure-triage/SKILL.md +119 -0
- package/templates/default/locales/ko/.mustflow/skills/instruction-conflict-scope-check/SKILL.md +118 -0
- package/templates/default/locales/ko/.mustflow/skills/line-ending-hygiene/SKILL.md +111 -0
- package/templates/default/locales/ko/.mustflow/skills/migration-safety-check/SKILL.md +117 -0
- package/templates/default/locales/ko/.mustflow/skills/multi-agent-work-coordination/SKILL.md +259 -0
- package/templates/default/locales/ko/.mustflow/skills/null-object-pattern/SKILL.md +196 -0
- package/templates/default/locales/ko/.mustflow/skills/pattern-scout/SKILL.md +110 -0
- package/templates/default/locales/ko/.mustflow/skills/performance-budget-check/SKILL.md +121 -0
- package/templates/default/locales/ko/.mustflow/skills/project-context-authoring/SKILL.md +107 -0
- package/templates/default/locales/ko/.mustflow/skills/pure-core-imperative-shell/SKILL.md +212 -0
- package/templates/default/locales/ko/.mustflow/skills/readme-authoring/SKILL.md +115 -0
- package/templates/default/locales/ko/.mustflow/skills/repo-improvement-loop/SKILL.md +150 -0
- package/templates/default/locales/ko/.mustflow/skills/repro-first-debug/SKILL.md +112 -0
- package/templates/default/locales/ko/.mustflow/skills/requirement-regression-guard/SKILL.md +152 -0
- package/templates/default/locales/ko/.mustflow/skills/result-option/SKILL.md +186 -0
- package/templates/default/locales/ko/.mustflow/skills/security-privacy-review/SKILL.md +116 -0
- package/templates/default/locales/ko/.mustflow/skills/security-regression-tests/SKILL.md +131 -0
- package/templates/default/locales/ko/.mustflow/skills/skill-authoring/SKILL.md +110 -0
- package/templates/default/locales/ko/.mustflow/skills/source-freshness-check/SKILL.md +111 -0
- package/templates/default/locales/ko/.mustflow/skills/state-machine-pattern/SKILL.md +214 -0
- package/templates/default/locales/ko/.mustflow/skills/strategy-pattern/SKILL.md +215 -0
- package/templates/default/locales/ko/.mustflow/skills/structure-discovery-gate/SKILL.md +159 -0
- package/templates/default/locales/ko/.mustflow/skills/test-maintenance/SKILL.md +130 -0
- package/templates/default/locales/ko/.mustflow/skills/ui-quality-gate/SKILL.md +117 -0
- package/templates/default/locales/ko/.mustflow/skills/visual-review-artifact/SKILL.md +127 -0
- package/templates/default/locales/ko/.mustflow/skills/visual-review-artifact/assets/review-template.html +286 -0
- package/templates/default/locales/ko/.mustflow/skills/visual-review-artifact/resources.toml +7 -0
- package/templates/default/locales/ko/.mustflow/skills/web-asset-optimization/SKILL.md +108 -0
- package/templates/default/locales/ko/AGENTS.md +85 -0
- package/templates/default/locales/zh/.mustflow/context/INDEX.md +39 -0
- package/templates/default/locales/zh/.mustflow/context/PROJECT.md +64 -0
- package/templates/default/locales/zh/.mustflow/docs/agent-workflow.md +310 -0
- package/templates/default/locales/zh/.mustflow/skills/INDEX.md +78 -0
- package/templates/default/locales/zh/.mustflow/skills/adapter-boundary/SKILL.md +193 -0
- package/templates/default/locales/zh/.mustflow/skills/artifact-integrity-check/SKILL.md +114 -0
- package/templates/default/locales/zh/.mustflow/skills/behavior-preserving-refactor/SKILL.md +182 -0
- package/templates/default/locales/zh/.mustflow/skills/code-review/SKILL.md +115 -0
- package/templates/default/locales/zh/.mustflow/skills/codebase-orientation/SKILL.md +115 -0
- package/templates/default/locales/zh/.mustflow/skills/command-pattern/SKILL.md +247 -0
- package/templates/default/locales/zh/.mustflow/skills/composition-over-inheritance/SKILL.md +176 -0
- package/templates/default/locales/zh/.mustflow/skills/contract-sync-check/SKILL.md +116 -0
- package/templates/default/locales/zh/.mustflow/skills/date-number-audit/SKILL.md +116 -0
- package/templates/default/locales/zh/.mustflow/skills/dependency-injection/SKILL.md +161 -0
- package/templates/default/locales/zh/.mustflow/skills/dependency-reality-check/SKILL.md +115 -0
- package/templates/default/locales/zh/.mustflow/skills/diff-risk-review/SKILL.md +136 -0
- package/templates/default/locales/zh/.mustflow/skills/docs-prose-review/SKILL.md +119 -0
- package/templates/default/locales/zh/.mustflow/skills/docs-update/SKILL.md +97 -0
- package/templates/default/locales/zh/.mustflow/skills/external-prompt-injection-defense/SKILL.md +116 -0
- package/templates/default/locales/zh/.mustflow/skills/facade-pattern/SKILL.md +210 -0
- package/templates/default/locales/zh/.mustflow/skills/failure-triage/SKILL.md +96 -0
- package/templates/default/locales/zh/.mustflow/skills/instruction-conflict-scope-check/SKILL.md +118 -0
- package/templates/default/locales/zh/.mustflow/skills/line-ending-hygiene/SKILL.md +111 -0
- package/templates/default/locales/zh/.mustflow/skills/migration-safety-check/SKILL.md +117 -0
- package/templates/default/locales/zh/.mustflow/skills/multi-agent-work-coordination/SKILL.md +260 -0
- package/templates/default/locales/zh/.mustflow/skills/null-object-pattern/SKILL.md +196 -0
- package/templates/default/locales/zh/.mustflow/skills/pattern-scout/SKILL.md +110 -0
- package/templates/default/locales/zh/.mustflow/skills/performance-budget-check/SKILL.md +121 -0
- package/templates/default/locales/zh/.mustflow/skills/project-context-authoring/SKILL.md +107 -0
- package/templates/default/locales/zh/.mustflow/skills/pure-core-imperative-shell/SKILL.md +212 -0
- package/templates/default/locales/zh/.mustflow/skills/readme-authoring/SKILL.md +115 -0
- package/templates/default/locales/zh/.mustflow/skills/repo-improvement-loop/SKILL.md +150 -0
- package/templates/default/locales/zh/.mustflow/skills/repro-first-debug/SKILL.md +112 -0
- package/templates/default/locales/zh/.mustflow/skills/requirement-regression-guard/SKILL.md +152 -0
- package/templates/default/locales/zh/.mustflow/skills/result-option/SKILL.md +186 -0
- package/templates/default/locales/zh/.mustflow/skills/security-privacy-review/SKILL.md +116 -0
- package/templates/default/locales/zh/.mustflow/skills/security-regression-tests/SKILL.md +131 -0
- package/templates/default/locales/zh/.mustflow/skills/skill-authoring/SKILL.md +110 -0
- package/templates/default/locales/zh/.mustflow/skills/source-freshness-check/SKILL.md +111 -0
- package/templates/default/locales/zh/.mustflow/skills/state-machine-pattern/SKILL.md +214 -0
- package/templates/default/locales/zh/.mustflow/skills/strategy-pattern/SKILL.md +215 -0
- package/templates/default/locales/zh/.mustflow/skills/structure-discovery-gate/SKILL.md +159 -0
- package/templates/default/locales/zh/.mustflow/skills/test-maintenance/SKILL.md +122 -0
- package/templates/default/locales/zh/.mustflow/skills/ui-quality-gate/SKILL.md +117 -0
- package/templates/default/locales/zh/.mustflow/skills/visual-review-artifact/SKILL.md +127 -0
- package/templates/default/locales/zh/.mustflow/skills/visual-review-artifact/assets/review-template.html +286 -0
- package/templates/default/locales/zh/.mustflow/skills/visual-review-artifact/resources.toml +7 -0
- package/templates/default/locales/zh/.mustflow/skills/web-asset-optimization/SKILL.md +108 -0
- package/templates/default/locales/zh/AGENTS.md +86 -0
- package/templates/default/manifest.toml +339 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
---
|
|
2
|
+
mustflow_doc: skill.skill-authoring
|
|
3
|
+
locale: zh
|
|
4
|
+
canonical: false
|
|
5
|
+
revision: 3
|
|
6
|
+
lifecycle: mustflow-owned
|
|
7
|
+
authority: procedure
|
|
8
|
+
name: skill-authoring
|
|
9
|
+
description: Apply this skill when creating or maintaining `.mustflow/skills/*/SKILL.md` procedures and `.mustflow/skills/INDEX.md` routes.
|
|
10
|
+
metadata:
|
|
11
|
+
mustflow_schema: "1"
|
|
12
|
+
mustflow_kind: procedure
|
|
13
|
+
pack_id: mustflow.core
|
|
14
|
+
skill_id: mustflow.core.skill-authoring
|
|
15
|
+
command_intents:
|
|
16
|
+
- mustflow_check
|
|
17
|
+
- docs_validate
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
# Skill Authoring
|
|
21
|
+
|
|
22
|
+
<!-- mustflow-section: purpose -->
|
|
23
|
+
## Purpose
|
|
24
|
+
|
|
25
|
+
Create narrow, repeatable mustflow skill procedures without turning skills into broad advice, project context, or command-permission sources.
|
|
26
|
+
|
|
27
|
+
<!-- mustflow-section: use-when -->
|
|
28
|
+
## Use When
|
|
29
|
+
|
|
30
|
+
- A `.mustflow/skills/<name>/SKILL.md` file is created, renamed, split, removed, or substantially changed.
|
|
31
|
+
- `.mustflow/skills/INDEX.md` needs a new or updated route for a skill.
|
|
32
|
+
- A skill needs clearer use conditions, exclusion conditions, required inputs, command intent references, verification, or failure handling.
|
|
33
|
+
- A broad prompt, checklist, or outside recommendation needs to be adapted into mustflow's skill format.
|
|
34
|
+
|
|
35
|
+
<!-- mustflow-section: do-not-use-when -->
|
|
36
|
+
## Do Not Use When
|
|
37
|
+
|
|
38
|
+
- The task only applies an existing skill to code, docs, tests, context, or assets.
|
|
39
|
+
- The content belongs in `AGENTS.md`, `.mustflow/docs/agent-workflow.md`, `.mustflow/context/PROJECT.md`, or `.mustflow/config/commands.toml`.
|
|
40
|
+
- The proposed skill is broad advice such as "write better code" or "be careful" without a repeatable trigger and procedure.
|
|
41
|
+
- The skill would duplicate project-domain context, authorize commands, install dependencies, or define raw shell commands.
|
|
42
|
+
|
|
43
|
+
<!-- mustflow-section: required-inputs -->
|
|
44
|
+
## Required Inputs
|
|
45
|
+
|
|
46
|
+
- The user request and the repeated task the skill should cover.
|
|
47
|
+
- Existing `.mustflow/skills/INDEX.md` and nearby skill documents.
|
|
48
|
+
- `.mustflow/config/commands.toml` command intent names relevant to verification.
|
|
49
|
+
- Any repository evidence showing that the task is repeatable and not better handled by an existing skill.
|
|
50
|
+
- Localization and template metadata when the skill is part of an installed template.
|
|
51
|
+
|
|
52
|
+
<!-- mustflow-section: preconditions -->
|
|
53
|
+
## Preconditions
|
|
54
|
+
|
|
55
|
+
- The task matches the Use When conditions and does not match the Do Not Use When exclusions.
|
|
56
|
+
- Required inputs are available, or missing inputs can be reported without guessing.
|
|
57
|
+
- Higher-priority instructions and `.mustflow/config/commands.toml` have been checked for the current scope.
|
|
58
|
+
|
|
59
|
+
<!-- mustflow-section: allowed-edits -->
|
|
60
|
+
## Allowed Edits
|
|
61
|
+
|
|
62
|
+
- Keep edits within the scope described by this skill, the user request, and the matching route in `.mustflow/skills/INDEX.md`.
|
|
63
|
+
- Do not broaden command permission, invent project facts, or change unrelated workflow files.
|
|
64
|
+
|
|
65
|
+
<!-- mustflow-section: procedure -->
|
|
66
|
+
## Procedure
|
|
67
|
+
|
|
68
|
+
1. Define the smallest repeatable task the skill should cover. If the task is too broad, split it or leave it as repository guidance instead of creating a skill.
|
|
69
|
+
2. Search existing skills before adding a new one. Prefer updating a matching skill over creating overlapping procedures.
|
|
70
|
+
3. Use a stable folder name and matching frontmatter `name`. Set `mustflow_doc` to `skill.<name>`, `metadata.mustflow_schema` to `"1"`, `metadata.mustflow_kind` to `procedure`, `metadata.pack_id` to the package namespace, and `metadata.skill_id` to `<pack_id>.<name>`.
|
|
71
|
+
4. 编写标准章节:目标、使用时机、不适用时机、必要输入、前置条件、允许编辑范围、流程、后置条件、验证、失败处理和输出格式。
|
|
72
|
+
5. Keep the procedure concrete and bounded. Include what to read, what to change, what to avoid, and what evidence to report.
|
|
73
|
+
6. Reference command intent names only. Do not include raw shell command blocks or claim that the skill authorizes command execution.
|
|
74
|
+
7. 使用紧凑路由更新 `.mustflow/skills/INDEX.md`,其中包含触发条件、所需输入、编辑范围、风险、验证意图和预期输出。
|
|
75
|
+
8. If the skill is installed by a template, update template manifests, localization metadata, installation docs, package tests, and public docs that list installed files.
|
|
76
|
+
|
|
77
|
+
<!-- mustflow-section: postconditions -->
|
|
78
|
+
## Postconditions
|
|
79
|
+
|
|
80
|
+
- The expected output can be produced with clear evidence, executed command intents, skipped checks, and remaining risks.
|
|
81
|
+
- Any missing command intent, unknown input, or authority conflict is reported instead of hidden.
|
|
82
|
+
|
|
83
|
+
<!-- mustflow-section: verification -->
|
|
84
|
+
## Verification
|
|
85
|
+
|
|
86
|
+
Use configured oneshot command intents when available:
|
|
87
|
+
|
|
88
|
+
- `mustflow_check`
|
|
89
|
+
- `docs_validate`
|
|
90
|
+
|
|
91
|
+
If the skill changes tests or behavior-sensitive template output, also use the relevant configured test or build intents.
|
|
92
|
+
|
|
93
|
+
<!-- mustflow-section: failure-handling -->
|
|
94
|
+
## Failure Handling
|
|
95
|
+
|
|
96
|
+
- If `mustflow_check` reports missing sections, metadata drift, unknown command intents, raw shell commands, or command-permission claims, fix the skill contract before changing unrelated files.
|
|
97
|
+
- If two skills overlap, tighten their use and non-use conditions or merge the duplicate procedure.
|
|
98
|
+
- If a needed command intent is missing, record the missing intent instead of inventing a command inside the skill.
|
|
99
|
+
- If translation confidence is low, keep the source skill authoritative and mark translations for review through template metadata.
|
|
100
|
+
|
|
101
|
+
<!-- mustflow-section: output-format -->
|
|
102
|
+
## Output Format
|
|
103
|
+
|
|
104
|
+
- Skill files added, updated, renamed, or removed
|
|
105
|
+
- Skill index routes changed
|
|
106
|
+
- Command intents referenced
|
|
107
|
+
- Template or localization metadata updated
|
|
108
|
+
- Command intents run
|
|
109
|
+
- Skipped command intents and reasons
|
|
110
|
+
- Remaining overlap, translation, or validation risks
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
---
|
|
2
|
+
mustflow_doc: skill.source-freshness-check
|
|
3
|
+
locale: zh
|
|
4
|
+
canonical: false
|
|
5
|
+
revision: 1
|
|
6
|
+
lifecycle: mustflow-owned
|
|
7
|
+
authority: procedure
|
|
8
|
+
name: source-freshness-check
|
|
9
|
+
description: Apply this skill when a task depends on information that may become stale, such as current versions, external docs, prices, dates, schedules, or product behavior.
|
|
10
|
+
metadata:
|
|
11
|
+
mustflow_schema: "1"
|
|
12
|
+
mustflow_kind: procedure
|
|
13
|
+
pack_id: mustflow.core
|
|
14
|
+
skill_id: mustflow.core.source-freshness-check
|
|
15
|
+
command_intents:
|
|
16
|
+
- changes_status
|
|
17
|
+
- docs_validate_fast
|
|
18
|
+
- mustflow_check
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
# Source Freshness Check
|
|
22
|
+
|
|
23
|
+
<!-- mustflow-section: purpose -->
|
|
24
|
+
## Purpose
|
|
25
|
+
|
|
26
|
+
Prevent stale or unverifiable claims from entering code, documentation, templates, release notes, or final reports.
|
|
27
|
+
|
|
28
|
+
<!-- mustflow-section: use-when -->
|
|
29
|
+
## Use When
|
|
30
|
+
|
|
31
|
+
- The task asks for the latest, current, newest, today, yesterday, tomorrow, or a specific recent date.
|
|
32
|
+
- A claim depends on external products, APIs, package versions, pricing, legal rules, schedules, sports, markets, or vendor documentation.
|
|
33
|
+
- Documentation or user-facing text mentions support status, release behavior, command availability, or compatibility that may drift.
|
|
34
|
+
- A source, quote, screenshot, or generated summary may be older than the current task.
|
|
35
|
+
|
|
36
|
+
<!-- mustflow-section: do-not-use-when -->
|
|
37
|
+
## Do Not Use When
|
|
38
|
+
|
|
39
|
+
- The fact is purely local to the repository and can be verified from current files.
|
|
40
|
+
- The task is a mechanical edit that does not introduce or preserve time-sensitive claims.
|
|
41
|
+
- The user explicitly provides the source text to use and asks only for formatting or translation.
|
|
42
|
+
|
|
43
|
+
<!-- mustflow-section: required-inputs -->
|
|
44
|
+
## Required Inputs
|
|
45
|
+
|
|
46
|
+
- The claim or decision that may become stale.
|
|
47
|
+
- The file, command output, source page, screenshot, or user-provided text that supports the claim.
|
|
48
|
+
- The date or version context when it is visible.
|
|
49
|
+
- Any repository policy about allowed sources, official documentation, or offline work.
|
|
50
|
+
|
|
51
|
+
<!-- mustflow-section: preconditions -->
|
|
52
|
+
## Preconditions
|
|
53
|
+
|
|
54
|
+
- The task matches the Use When conditions and does not match the Do Not Use When exclusions.
|
|
55
|
+
- Required inputs are available, or missing inputs can be reported without guessing.
|
|
56
|
+
- Higher-priority instructions and `.mustflow/config/commands.toml` have been checked for the current scope.
|
|
57
|
+
|
|
58
|
+
<!-- mustflow-section: allowed-edits -->
|
|
59
|
+
## Allowed Edits
|
|
60
|
+
|
|
61
|
+
- Add or update source-date notes only where they clarify freshness risk.
|
|
62
|
+
- Replace unstable wording such as "latest" with a dated or versioned claim when appropriate.
|
|
63
|
+
- Mark translations or docs for review when the source cannot be verified confidently.
|
|
64
|
+
- Do not invent citations, release dates, compatibility ranges, or vendor behavior.
|
|
65
|
+
|
|
66
|
+
<!-- mustflow-section: procedure -->
|
|
67
|
+
## Procedure
|
|
68
|
+
|
|
69
|
+
1. Identify every claim that depends on time, external behavior, or an upstream source.
|
|
70
|
+
2. Prefer the current repository file, official source, declared package metadata, or user-provided source text before secondary summaries.
|
|
71
|
+
3. Capture the freshness boundary: date checked, version checked, release tag, documentation page, or reason the claim is local and stable.
|
|
72
|
+
4. If a claim cannot be refreshed within the allowed tools or command contract, keep the wording conservative and report the unverified source.
|
|
73
|
+
5. Avoid open-ended words such as "latest", "current", or "recent" unless the sentence includes the concrete date or version that makes the claim inspectable.
|
|
74
|
+
6. When editing documentation, keep source notes close to the claim or in the final report rather than adding broad provenance sections.
|
|
75
|
+
7. Run the smallest configured verification that covers the changed files.
|
|
76
|
+
|
|
77
|
+
<!-- mustflow-section: postconditions -->
|
|
78
|
+
## Postconditions
|
|
79
|
+
|
|
80
|
+
- Time-sensitive claims are either verified, dated, versioned, or explicitly reported as unverified.
|
|
81
|
+
- Documentation does not imply live freshness when only a snapshot was checked.
|
|
82
|
+
- The final report names skipped refresh checks and any remaining stale-source risk.
|
|
83
|
+
|
|
84
|
+
<!-- mustflow-section: verification -->
|
|
85
|
+
## Verification
|
|
86
|
+
|
|
87
|
+
Use configured oneshot command intents when available:
|
|
88
|
+
|
|
89
|
+
- `changes_status`
|
|
90
|
+
- `docs_validate_fast`
|
|
91
|
+
- `mustflow_check`
|
|
92
|
+
|
|
93
|
+
Also run the relevant configured test, build, or documentation intent if the refreshed claim changes executable behavior or public documentation.
|
|
94
|
+
|
|
95
|
+
<!-- mustflow-section: failure-handling -->
|
|
96
|
+
## Failure Handling
|
|
97
|
+
|
|
98
|
+
- If the requested source cannot be accessed, report the access gap and avoid presenting the claim as current.
|
|
99
|
+
- If sources conflict, prefer the highest-authority source and report the conflict.
|
|
100
|
+
- If the freshness check changes meaning in translated docs, mark the affected translation for review.
|
|
101
|
+
- If checking freshness would require network access or tools outside the current host permissions, stop at the permission boundary and state what remains unchecked.
|
|
102
|
+
|
|
103
|
+
<!-- mustflow-section: output-format -->
|
|
104
|
+
## Output Format
|
|
105
|
+
|
|
106
|
+
- Freshness-sensitive claims found
|
|
107
|
+
- Source or version checked
|
|
108
|
+
- Wording changed or claim left conservative
|
|
109
|
+
- Command intents run
|
|
110
|
+
- Skipped source checks and reasons
|
|
111
|
+
- Remaining stale-source risk
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
---
|
|
2
|
+
mustflow_doc: skill.state-machine-pattern
|
|
3
|
+
locale: zh
|
|
4
|
+
canonical: false
|
|
5
|
+
revision: 1
|
|
6
|
+
lifecycle: mustflow-owned
|
|
7
|
+
authority: procedure
|
|
8
|
+
name: state-machine-pattern
|
|
9
|
+
description: Apply this skill when domain objects have lifecycle state, allowed actions depend on state, status changes are scattered, or state transitions need explicit events, guards, effects, history, idempotency, and concurrency control.
|
|
10
|
+
metadata:
|
|
11
|
+
mustflow_schema: "1"
|
|
12
|
+
mustflow_kind: procedure
|
|
13
|
+
pack_id: mustflow.core
|
|
14
|
+
skill_id: mustflow.core.state-machine-pattern
|
|
15
|
+
command_intents:
|
|
16
|
+
- changes_status
|
|
17
|
+
- changes_diff_summary
|
|
18
|
+
- test_related
|
|
19
|
+
- test
|
|
20
|
+
- lint
|
|
21
|
+
- build
|
|
22
|
+
- docs_validate_fast
|
|
23
|
+
- test_release
|
|
24
|
+
- mustflow_check
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
# State Machine Pattern
|
|
28
|
+
|
|
29
|
+
<!-- mustflow-section: purpose -->
|
|
30
|
+
## Purpose
|
|
31
|
+
|
|
32
|
+
Keep lifecycle state changes in one explicit rule system.
|
|
33
|
+
|
|
34
|
+
The state machine pattern applies when an entity moves through meaningful lifecycle states and the allowed actions, errors, follow-up work, or audit expectations depend on the current state. The core artifact is not a class hierarchy. The core artifact is the transition table: current state, event, guard, next state, and effects as data.
|
|
35
|
+
|
|
36
|
+
Use this skill to prevent scattered `if`, `switch`, direct assignment, silent no-op transitions, duplicate webhook damage, and state changes that bypass audit, outbox, or concurrency rules.
|
|
37
|
+
|
|
38
|
+
<!-- mustflow-section: use-when -->
|
|
39
|
+
## Use When
|
|
40
|
+
|
|
41
|
+
- A domain object has three or more states, or fields named `status`, `state`, `phase`, `step`, or `stage`.
|
|
42
|
+
- State determines which actions, API calls, buttons, jobs, events, or commands are allowed.
|
|
43
|
+
- The lifecycle includes cancel, approve, reject, expire, retry, fail, refund, suspend, restore, archive, delete, publish, ship, or deliver flows.
|
|
44
|
+
- State changes must produce history, audit records, domain events, outbox messages, or external effects.
|
|
45
|
+
- Multiple users, workers, queues, webhooks, or external systems can attempt transitions on the same entity.
|
|
46
|
+
- External service results change state and require pending, success, and failure states.
|
|
47
|
+
- Code repeatedly asks whether an action is possible from the current state.
|
|
48
|
+
- State rules are scattered across handlers, repositories, jobs, UI code, adapters, SQL queries, or broad services.
|
|
49
|
+
- Several booleans actually encode one lifecycle and can create impossible combinations.
|
|
50
|
+
|
|
51
|
+
<!-- mustflow-section: do-not-use-when -->
|
|
52
|
+
## Do Not Use When
|
|
53
|
+
|
|
54
|
+
- The value is simple display state rather than domain lifecycle state.
|
|
55
|
+
- The state is a simple two-value toggle with no lifecycle rules, history, side effects, concurrency risk, or irreversible transition.
|
|
56
|
+
- State does not affect allowed actions.
|
|
57
|
+
- The code is a pure calculation, formatter, mapper, parser, or local UI-only state update.
|
|
58
|
+
- A simple create, read, update, delete flow only distinguishes active and deleted and has no meaningful transition rules.
|
|
59
|
+
|
|
60
|
+
Two states can still require this skill when the lifecycle is meaningful, such as active to suspended to deleted, deleted being irreversible, or suspension requiring audit and authorization.
|
|
61
|
+
|
|
62
|
+
<!-- mustflow-section: required-inputs -->
|
|
63
|
+
## Required Inputs
|
|
64
|
+
|
|
65
|
+
- The entity and state field under change.
|
|
66
|
+
- Complete state list and which states are terminal.
|
|
67
|
+
- Complete event list and the facts each event carries.
|
|
68
|
+
- Current places that change state, validate actions, check state, or render available actions.
|
|
69
|
+
- Guards, authorization facts, time facts, external facts, and loaded domain data needed to decide transitions.
|
|
70
|
+
- Effects, domain events, outbox records, audit records, transition history, idempotency keys, and concurrency protections required by the lifecycle.
|
|
71
|
+
- Existing local patterns for `Result`, events, outbox, repositories, command handlers, pure core decisions, transition tables, tests, and documentation.
|
|
72
|
+
- Relevant command-intent contract entries for verification.
|
|
73
|
+
|
|
74
|
+
<!-- mustflow-section: preconditions -->
|
|
75
|
+
## Preconditions
|
|
76
|
+
|
|
77
|
+
- Higher-priority instructions and `.mustflow/config/commands.toml` have been checked for the current scope.
|
|
78
|
+
- If changing existing behavior is not the goal, current behavior is protected with tests, fixtures, examples, or explicit verification evidence.
|
|
79
|
+
- If the state-changing operation is a user or system command, `command-pattern` has been used for payload, context, authorization, transaction, idempotency, audit, retry, and outbox execution.
|
|
80
|
+
- If the transition decision is mixed with I/O, `pure-core-imperative-shell` has been used so the transition function stays deterministic and the shell handles persistence and effects.
|
|
81
|
+
- If expected failures or meaningful absence are involved, `result-option` has been used for the error and absence shape.
|
|
82
|
+
- If external services or provider responses influence transitions, `adapter-boundary` and `dependency-injection` have been used before provider facts enter the transition function.
|
|
83
|
+
|
|
84
|
+
<!-- mustflow-section: allowed-edits -->
|
|
85
|
+
## Allowed Edits
|
|
86
|
+
|
|
87
|
+
- Add or update state unions, event unions, transition tables, guard functions, effect descriptions, transition result types, and state-machine errors.
|
|
88
|
+
- Replace direct state assignment with a transition function.
|
|
89
|
+
- Add dispatch or shell code that loads the entity, applies the pure transition, saves state, records transition history, stores idempotency records, and writes outbox rows in one transaction.
|
|
90
|
+
- Add available-action helpers derived from the transition table when UI or API callers need possible actions.
|
|
91
|
+
- Add tests for valid transitions, invalid transitions, guard success and failure, terminal states, generated effects, duplicate events, concurrency conflicts, and transition history.
|
|
92
|
+
- Add lifecycle documentation or diagrams only when this repository already documents domain state machines or the changed domain needs an operational reference.
|
|
93
|
+
- Do not create a class hierarchy just to represent states.
|
|
94
|
+
- Do not duplicate the server state machine in UI logic.
|
|
95
|
+
|
|
96
|
+
<!-- mustflow-section: procedure -->
|
|
97
|
+
## Procedure
|
|
98
|
+
|
|
99
|
+
1. Decide whether the lifecycle warrants a state machine.
|
|
100
|
+
- Apply it when state controls allowed actions, external work, audit, retries, concurrency, or long-running lifecycle behavior.
|
|
101
|
+
- Avoid it for simple display values and toggles without transition rules.
|
|
102
|
+
2. Replace boolean clusters with explicit state.
|
|
103
|
+
- Convert combinations such as `isPaid`, `isCancelled`, `isShipped`, and `isRefunded` into one lifecycle state or several independent state machines.
|
|
104
|
+
- Make states mutually exclusive within one state machine.
|
|
105
|
+
3. Name states by domain meaning.
|
|
106
|
+
- Prefer states such as `DRAFT`, `PENDING_REVIEW`, `APPROVED`, `PAYMENT_PENDING`, `PAID`, `FULFILLMENT_PENDING`, `SHIPPED`, `DELIVERED`, `CANCELLED`, `REFUND_PENDING`, `REFUNDED`, `EXPIRED`, or `ARCHIVED`.
|
|
107
|
+
- Avoid UI or placeholder names such as `STEP_1`, `STEP_2`, `BUTTON_DISABLED`, `GRAY`, `READY2`, `TEMP`, and broad states such as `PROCESSING` when a more specific waiting state exists.
|
|
108
|
+
4. Name events as facts that happened.
|
|
109
|
+
- Prefer events such as `PAYMENT_STARTED`, `PAYMENT_SUCCEEDED`, `PAYMENT_FAILED`, `CANCEL_REQUESTED`, `REFUND_APPROVED`, `SHIPMENT_CREATED`, `DELIVERY_CONFIRMED`, `TIMEOUT_REACHED`, and `EMAIL_VERIFIED`.
|
|
110
|
+
- Avoid command-like or meaningless events such as `SET_STATUS`, `CHANGE_STATUS`, `UPDATE_STATE`, `MAKE_ACTIVE`, `NEXT`, and `UPDATE`.
|
|
111
|
+
- Distinguish commands from events: commands request work, events record what happened.
|
|
112
|
+
5. Write the transition table first.
|
|
113
|
+
- Include every source state, allowed event, guard name, target state, and effect description.
|
|
114
|
+
- Include terminal states explicitly with no outgoing transitions when they are truly terminal.
|
|
115
|
+
- Do not hide transition rules inside handler branches, repository filters, database queries, adapter code, or UI code.
|
|
116
|
+
6. Keep guards pure.
|
|
117
|
+
- Guards may inspect entity state, event data, context facts, loaded external facts, current time passed through context, and authorization facts passed through context.
|
|
118
|
+
- Guards must not query databases, call SDKs, send messages, write logs, mutate state, read current time directly, generate random values, or trigger external work.
|
|
119
|
+
- If a guard needs an external fact, load it before transition and pass the normalized fact through context.
|
|
120
|
+
7. Model external work with pending, success, and failure events.
|
|
121
|
+
- Do not jump directly from request to success for payment, refund, shipment, email, file processing, AI processing, or other external operations.
|
|
122
|
+
- Use states such as `PAYMENT_PENDING`, `REFUND_PENDING`, `FULFILLMENT_PENDING`, or `ANALYSIS_PENDING`, then model provider success and failure as separate events.
|
|
123
|
+
8. Model time as events.
|
|
124
|
+
- Expiration, scheduled cancellation, automatic approval, automatic archive, retry window elapsed, and timeout should enter the state machine as events.
|
|
125
|
+
- Do not scatter direct time checks that assign state outside the transition function.
|
|
126
|
+
9. Keep transition functions pure.
|
|
127
|
+
- Inputs are entity, event, and context.
|
|
128
|
+
- Success returns previous state, next state, updated entity or patch, transition log data, domain events, and effect descriptions.
|
|
129
|
+
- Failure returns a typed error such as invalid transition, guard failed, concurrent transition, or duplicate event conflict.
|
|
130
|
+
- The pure transition function must not persist, publish, send, call providers, log, read environment variables, read current time directly, or mutate external state.
|
|
131
|
+
10. Separate transition from persistence and effects.
|
|
132
|
+
- Application or shell code loads the entity, calls the pure transition, and persists the result.
|
|
133
|
+
- State update, version update, transition log, processed event record, and outbox record should be saved in one transaction when the state is durable.
|
|
134
|
+
- External effects should run after commit through an outbox, pending effect table, queue, or worker.
|
|
135
|
+
11. Protect durable state with concurrency control.
|
|
136
|
+
- Use optimistic version checks, compare-and-swap saves, unique constraints, row locks, or conditional updates.
|
|
137
|
+
- If another transition wins first, return a conflict, reload and recompute, or enqueue a domain-specific retry only when that policy is explicit.
|
|
138
|
+
12. Make duplicate events safe.
|
|
139
|
+
- Include idempotency keys, provider event identifiers, webhook identifiers, command identifiers, or an equivalent deduplication key.
|
|
140
|
+
- Same key and same payload should return the prior result.
|
|
141
|
+
- Same key and different payload should return a duplicate conflict.
|
|
142
|
+
- Different key with an impossible current state should return invalid transition rather than silently succeeding.
|
|
143
|
+
13. Record transition history when the lifecycle matters operationally.
|
|
144
|
+
- History should include entity type, entity identifier, from state, event type, to state, actor identifier when known, idempotency key, payload hash, reason when safe, and timestamp from context.
|
|
145
|
+
- Use transition history for debugging, customer support, dispute handling, audit, and security review.
|
|
146
|
+
14. Derive available actions from the state machine.
|
|
147
|
+
- UI or API layers may display available actions, but they must not own an independent copy of transition rules.
|
|
148
|
+
- Prefer a server-side helper that evaluates possible events or exposes allowed actions derived from the transition table.
|
|
149
|
+
- Treat UI checks as guidance only. Server transition validation remains authoritative.
|
|
150
|
+
15. Split state machines when one state string explodes.
|
|
151
|
+
- If payment, fulfillment, refund, moderation, or account status change independently, use separate state machines.
|
|
152
|
+
- State-machine splits require explicit cross-machine invariants, such as fulfillment not shipping before payment succeeds.
|
|
153
|
+
- Put cross-machine coordination in a domain service, command handler, workflow, or pure policy that calls the smaller machines.
|
|
154
|
+
16. Document only the useful lifecycle contract.
|
|
155
|
+
- For important domains, document state list, event list, transition table, terminal states, guards, effects, concurrency method, duplicate-event handling, and any cross-machine invariants.
|
|
156
|
+
- Diagrams are secondary. The code transition table is the source of truth.
|
|
157
|
+
17. Test from the transition table.
|
|
158
|
+
- Test every valid transition.
|
|
159
|
+
- Test representative invalid transitions, especially terminal states and dangerous skipped states.
|
|
160
|
+
- Test guard success and guard failure separately.
|
|
161
|
+
- Test that successful transitions produce the expected effects or outbox descriptions.
|
|
162
|
+
- Test that failed transitions produce no effects.
|
|
163
|
+
- Test duplicate events, duplicate conflicts, transition history, and concurrency behavior when the state is persisted.
|
|
164
|
+
|
|
165
|
+
<!-- mustflow-section: postconditions -->
|
|
166
|
+
## Postconditions
|
|
167
|
+
|
|
168
|
+
- State cannot be changed outside the transition function or dispatch path.
|
|
169
|
+
- Every allowed transition is visible in one transition table.
|
|
170
|
+
- Impossible transitions return explicit errors instead of being ignored.
|
|
171
|
+
- Guards are pure and external facts are passed through context.
|
|
172
|
+
- External work is represented through pending, success, and failure events, with effects executed after persistence.
|
|
173
|
+
- Durable state transitions use concurrency control and duplicate-event handling when needed.
|
|
174
|
+
- Important lifecycle changes leave transition history and outbox or effect records.
|
|
175
|
+
- Tests cover the transition table and the highest-risk invalid, duplicate, and concurrent paths.
|
|
176
|
+
|
|
177
|
+
<!-- mustflow-section: verification -->
|
|
178
|
+
## Verification
|
|
179
|
+
|
|
180
|
+
Use configured oneshot command intents when available:
|
|
181
|
+
|
|
182
|
+
- `changes_status`
|
|
183
|
+
- `changes_diff_summary`
|
|
184
|
+
- `test_related`
|
|
185
|
+
- `test`
|
|
186
|
+
- `lint`
|
|
187
|
+
- `build`
|
|
188
|
+
- `docs_validate_fast`
|
|
189
|
+
- `test_release`
|
|
190
|
+
- `mustflow_check`
|
|
191
|
+
|
|
192
|
+
Choose the narrowest configured verification that covers the changed state machine, dispatch path, tests, templates, docs, release metadata, and mustflow routing.
|
|
193
|
+
|
|
194
|
+
<!-- mustflow-section: failure-handling -->
|
|
195
|
+
## Failure Handling
|
|
196
|
+
|
|
197
|
+
- If states or events are unknown, stop and list the missing lifecycle decisions before coding.
|
|
198
|
+
- If direct assignment remains outside the transition path, report the remaining bypass or finish removing it before claiming the state machine is enforced.
|
|
199
|
+
- If a guard needs I/O, move the I/O to the shell and pass the result as context.
|
|
200
|
+
- If external effects cannot be made reliable through outbox, pending actions, provider idempotency, or compensation, report the reliability gap.
|
|
201
|
+
- If duplicate-event handling is missing for webhook, queue, payment, refund, or worker flows, do not call the transition safe to retry.
|
|
202
|
+
- If a single state machine is becoming unreadable, split independent lifecycle dimensions and document cross-machine invariants.
|
|
203
|
+
|
|
204
|
+
<!-- mustflow-section: output-format -->
|
|
205
|
+
## Output Format
|
|
206
|
+
|
|
207
|
+
- Entity and lifecycle modeled
|
|
208
|
+
- States, terminal states, and events introduced or changed
|
|
209
|
+
- Transition table location and source-of-truth note
|
|
210
|
+
- Guards and context facts
|
|
211
|
+
- Effects, outbox, history, idempotency, and concurrency choices
|
|
212
|
+
- Direct state assignments removed or remaining bypasses
|
|
213
|
+
- Tests or verification evidence
|
|
214
|
+
- Skipped checks and remaining state-machine risk
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
---
|
|
2
|
+
mustflow_doc: skill.strategy-pattern
|
|
3
|
+
locale: zh
|
|
4
|
+
canonical: false
|
|
5
|
+
revision: 3
|
|
6
|
+
lifecycle: mustflow-owned
|
|
7
|
+
authority: procedure
|
|
8
|
+
name: strategy-pattern
|
|
9
|
+
description: Apply this skill when code has multiple interchangeable algorithms, policies, calculations, provider choices, scoring methods, sorting methods, recommendation methods, pricing rules, discount rules, shipping methods, notification methods, permission policies, feature-flag variants, or repeated if/switch branches that choose how to do the same kind of work.
|
|
10
|
+
metadata:
|
|
11
|
+
mustflow_schema: "1"
|
|
12
|
+
mustflow_kind: procedure
|
|
13
|
+
pack_id: mustflow.core
|
|
14
|
+
skill_id: mustflow.core.strategy-pattern
|
|
15
|
+
command_intents:
|
|
16
|
+
- changes_status
|
|
17
|
+
- changes_diff_summary
|
|
18
|
+
- test_related
|
|
19
|
+
- test
|
|
20
|
+
- lint
|
|
21
|
+
- build
|
|
22
|
+
- docs_validate_fast
|
|
23
|
+
- test_release
|
|
24
|
+
- mustflow_check
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
# Strategy Pattern
|
|
28
|
+
|
|
29
|
+
<!-- mustflow-section: purpose -->
|
|
30
|
+
## Purpose
|
|
31
|
+
|
|
32
|
+
Separate changeable algorithms, policies, calculations, and execution methods from the stable workflow that uses them.
|
|
33
|
+
|
|
34
|
+
The strategy pattern applies when several implementations serve the same purpose but differ in how they calculate, decide, rank, price, discount, ship, pay, notify, authorize, search, recommend, or call a provider. The caller should depend on a shared strategy contract, not on concrete implementation branches.
|
|
35
|
+
|
|
36
|
+
Use this skill to reduce repeated `if` and `switch` branches, keep policy changes out of core flow code, add new variants with minimal existing-code edits, and test each policy independently.
|
|
37
|
+
|
|
38
|
+
<!-- mustflow-section: use-when -->
|
|
39
|
+
## Use When
|
|
40
|
+
|
|
41
|
+
- Several implementations do the same kind of work, such as pricing, discounts, shipping fees, payment handling, permission checks, ranking, search, recommendation, notification, file conversion, retry policy, or provider selection.
|
|
42
|
+
- Branches differ by method, plan, region, country, user tier, feature flag, experiment group, input type, provider, format, or business policy.
|
|
43
|
+
- `if`, `else if`, `switch`, `case`, or dictionary dispatch repeatedly chooses the variant and then runs variant-specific logic inline.
|
|
44
|
+
- Adding a new variant requires modifying a central service, handler, controller, command handler, or pure decision function.
|
|
45
|
+
- Variant selection and variant execution are mixed in one function.
|
|
46
|
+
- Variant-specific tests would be clearer than testing one large branching function.
|
|
47
|
+
- A feature would otherwise introduce subclasses, template methods, or base classes just to reuse or swap behavior.
|
|
48
|
+
- Runtime configuration or feature flags choose between old and new algorithms.
|
|
49
|
+
- One variant is an honest no-op, disabled, identity, empty, or zero policy that shares the same contract as real variants.
|
|
50
|
+
|
|
51
|
+
<!-- mustflow-section: do-not-use-when -->
|
|
52
|
+
## Do Not Use When
|
|
53
|
+
|
|
54
|
+
- There is only one implementation or two stable branches with little chance of growth.
|
|
55
|
+
- Branches perform different user intents or different use cases rather than different methods for the same purpose.
|
|
56
|
+
- Lifecycle state and allowed transitions are the main concern; use `state-machine-pattern`.
|
|
57
|
+
- Object construction is the only thing that varies; use a factory or local construction helper instead.
|
|
58
|
+
- External provider shape, protocol, SDK response, timeout, retry, or error translation is the main concern; use `adapter-boundary`.
|
|
59
|
+
- A state-changing operation needs payload, actor context, transaction, idempotency, audit, retry, and outbox semantics; use `command-pattern`.
|
|
60
|
+
- A caller needs one stable high-level operation that coordinates several dependencies or subsystem steps; use `facade-pattern` and keep strategies only for interchangeable policies inside that workflow.
|
|
61
|
+
- A pure business decision is mixed with I/O; use `pure-core-imperative-shell` first.
|
|
62
|
+
- The strategy variants would combine many independent dimensions into an exploding list of classes; split the dimensions into smaller policies instead.
|
|
63
|
+
|
|
64
|
+
<!-- mustflow-section: required-inputs -->
|
|
65
|
+
## Required Inputs
|
|
66
|
+
|
|
67
|
+
- The stable workflow that needs variable behavior.
|
|
68
|
+
- The variants and the shared purpose they serve.
|
|
69
|
+
- Current branch locations, strategy-like implementations, and selection logic.
|
|
70
|
+
- Common input facts each variant needs.
|
|
71
|
+
- Common output shape and expected failure model.
|
|
72
|
+
- Selection criteria, such as validated user option, server-side policy, config value, feature flag, region, plan, or provider capability.
|
|
73
|
+
- Local patterns for functions, policy objects, registries, dependency injection, decorators, `Result`, tests, and observability.
|
|
74
|
+
- Relevant command-intent contract entries for verification.
|
|
75
|
+
|
|
76
|
+
<!-- mustflow-section: preconditions -->
|
|
77
|
+
## Preconditions
|
|
78
|
+
|
|
79
|
+
- Higher-priority instructions and `.mustflow/config/commands.toml` have been checked for the current scope.
|
|
80
|
+
- The variants have one shared purpose. If they do not, split the workflow into separate use cases instead of forcing a strategy abstraction.
|
|
81
|
+
- If preserving existing behavior, use `behavior-preserving-refactor` before moving branch bodies.
|
|
82
|
+
- If the strategy depends on external systems, use `adapter-boundary` and `dependency-injection` so provider details stay outside the strategy contract.
|
|
83
|
+
- If normal business failures or unsupported variants are expected, use `result-option` for explicit return and error shapes.
|
|
84
|
+
- If one strategy represents intentional absence or disabled behavior, use `null-object-pattern` to verify that the neutral behavior does not fake success or hide a required failure.
|
|
85
|
+
- If a strategy affects lifecycle transitions, use `state-machine-pattern` for the transition table and use strategies only for replaceable calculations or policies inside that lifecycle.
|
|
86
|
+
- If the strategy is only one part of a larger multi-step subsystem workflow, use `facade-pattern` for the caller-facing workflow and keep the strategy behind its contract.
|
|
87
|
+
|
|
88
|
+
<!-- mustflow-section: allowed-edits -->
|
|
89
|
+
## Allowed Edits
|
|
90
|
+
|
|
91
|
+
- Add or update strategy function types, interfaces, policy objects, concrete strategies, selectors, resolvers, registries, decorators, and focused tests.
|
|
92
|
+
- Move inline variant logic from handlers, services, command handlers, or core decision functions into named strategies.
|
|
93
|
+
- Keep simple strategies as functions when they are pure calculations.
|
|
94
|
+
- Use classes only when dependencies, framework injection, complex helpers, or test doubles justify them.
|
|
95
|
+
- Add observability around selected strategy keys when it helps operations and does not leak sensitive data.
|
|
96
|
+
- Do not create broad `Manager`, `Processor`, `Handler`, `Advanced`, `Special`, or `New` strategy names.
|
|
97
|
+
- Do not add strategy ceremony for trivial stable branches.
|
|
98
|
+
|
|
99
|
+
<!-- mustflow-section: procedure -->
|
|
100
|
+
## Procedure
|
|
101
|
+
|
|
102
|
+
1. Classify the branch.
|
|
103
|
+
- Use strategy when branches choose how to do the same work.
|
|
104
|
+
- Do not use strategy when branches choose different user intents, object creation only, external shape translation, lifecycle transitions, or command execution units.
|
|
105
|
+
2. Name the strategy family by business purpose.
|
|
106
|
+
- Prefer names such as `ShippingFeeStrategy`, `DiscountPolicy`, `PaymentCaptureStrategy`, `RecommendationRankingStrategy`, or `PermissionPolicy`.
|
|
107
|
+
- Avoid vague names such as `Strategy1`, `NewStrategy`, `AdvancedStrategy`, `SpecialStrategy`, `Handler`, `Processor`, and `Manager`.
|
|
108
|
+
3. Define one shared contract.
|
|
109
|
+
- Fix the input type, output type, and expected error shape.
|
|
110
|
+
- Keep the input object narrow enough to describe the strategy family, not the entire application context.
|
|
111
|
+
- Every strategy in the family must accept the same input shape and return the same output shape.
|
|
112
|
+
4. Prefer function strategies for simple pure policies.
|
|
113
|
+
- Use a function type when the policy is stateless, deterministic, and has no external dependency.
|
|
114
|
+
- Use a class or object when the strategy needs injected collaborators, configuration, complex helpers, lifecycle management, or framework container integration.
|
|
115
|
+
5. Separate selection from execution.
|
|
116
|
+
- A selector or resolver chooses the strategy key or strategy implementation.
|
|
117
|
+
- The strategy executes the variant-specific behavior.
|
|
118
|
+
- The context or service owns the workflow and calls the selected strategy through the shared contract.
|
|
119
|
+
- Conditions do not need to disappear; they should move to selection and stop containing variant execution details.
|
|
120
|
+
6. Keep the context ignorant of concrete strategies.
|
|
121
|
+
- The context may depend on a selector, resolver, registry, or one injected strategy contract.
|
|
122
|
+
- It should not instantiate concrete strategies or branch on concrete strategy names.
|
|
123
|
+
7. Keep strategy registration discoverable.
|
|
124
|
+
- Register strategy implementations in one searchable registry, module, dependency-injection assembly, or configuration binding.
|
|
125
|
+
- Adding a strategy should usually require only a new implementation, registration, and tests, plus a typed key update when the key set is closed.
|
|
126
|
+
8. Treat unknown strategy keys explicitly.
|
|
127
|
+
- Do not silently fall back when a provided key is invalid.
|
|
128
|
+
- Distinguish missing optional input that should use an explicit default from unsupported input that should return an error.
|
|
129
|
+
- Validate user-provided keys before resolving a strategy.
|
|
130
|
+
- Keep explicit default strategies separate from invalid-key fallback. A no-op or disabled strategy is valid only when it is selected by an explicit rule.
|
|
131
|
+
9. Do not let user input directly select privileged behavior.
|
|
132
|
+
- A request may contain a desired option, but server-side validation and business rules must decide the final strategy.
|
|
133
|
+
- This matters for pricing, discounts, payment methods, authorization, shipping, quotas, experiments, and provider selection.
|
|
134
|
+
10. Keep strategies stateless per request.
|
|
135
|
+
- Store dependencies, immutable configuration, and static lookup data on strategy instances.
|
|
136
|
+
- Do not store current user, current order, request body, transaction state, intermediate result, or other request-specific data in strategy fields.
|
|
137
|
+
- Pass request-specific facts through the input object.
|
|
138
|
+
11. Split validation correctly.
|
|
139
|
+
- Common validation belongs before selection or before strategy execution.
|
|
140
|
+
- Variant-specific validation belongs inside the strategy.
|
|
141
|
+
- Expected business failures should return typed `Result` values or local equivalents, not raw strings or normal-flow exceptions.
|
|
142
|
+
- A no-op, disabled, identity, empty, or zero strategy must return an honest neutral result and must not pretend that a side effect, payment, permission grant, save, upload, or audit record happened.
|
|
143
|
+
12. Avoid strategy combination explosion.
|
|
144
|
+
- If strategy names grow by combining region, plan, item type, speed, provider, and user tier, split those dimensions into smaller policies and compose them.
|
|
145
|
+
- Use a composite strategy only when each sub-policy has one clear responsibility.
|
|
146
|
+
13. Keep configuration in the right role.
|
|
147
|
+
- Configuration may choose a strategy key or enable a feature-flag variant.
|
|
148
|
+
- Do not hide complex business rules as untyped string expressions in config files.
|
|
149
|
+
- Feature flags should usually be read by the selector or shell, not inside individual strategies.
|
|
150
|
+
- Remove obsolete experiment strategies after the experiment ends.
|
|
151
|
+
14. Add observability at the context or decorator boundary when useful.
|
|
152
|
+
- Record selected strategy key, safe selection reason, duration, outcome, and error code.
|
|
153
|
+
- Do not log secrets, raw personal data, payment payloads, tokens, or sensitive provider responses.
|
|
154
|
+
- Prefer decorators for repeated logging, timing, retry, caching, or metrics behavior across strategies.
|
|
155
|
+
15. Test the layers separately.
|
|
156
|
+
- Strategy contract tests verify every strategy returns the expected shape.
|
|
157
|
+
- Strategy-specific tests verify each policy's unique behavior.
|
|
158
|
+
- Selector tests verify which strategy is chosen for each selection condition.
|
|
159
|
+
- Context tests use fake strategies and verify orchestration, not policy internals.
|
|
160
|
+
16. Refactor incrementally.
|
|
161
|
+
- Extract one strategy family at a time.
|
|
162
|
+
- Move existing branch bodies into strategies without changing behavior unless the task explicitly asks for a behavior fix.
|
|
163
|
+
- Remove dead branches and direct concrete strategy knowledge from the context after tests pass.
|
|
164
|
+
|
|
165
|
+
<!-- mustflow-section: postconditions -->
|
|
166
|
+
## Postconditions
|
|
167
|
+
|
|
168
|
+
- Strategy variants have one shared purpose and one shared contract.
|
|
169
|
+
- The stable context no longer contains variant-specific execution branches.
|
|
170
|
+
- Strategy selection is centralized in a selector, resolver, registry, or assembly boundary.
|
|
171
|
+
- Unknown or unauthorized strategy choices fail explicitly.
|
|
172
|
+
- User input is validated before it affects strategy choice.
|
|
173
|
+
- Strategies do not store request-specific mutable state.
|
|
174
|
+
- New variants can be added with minimal changes to existing workflow code.
|
|
175
|
+
- Tests cover strategy behavior, selection behavior, and context orchestration at the right layers.
|
|
176
|
+
|
|
177
|
+
<!-- mustflow-section: verification -->
|
|
178
|
+
## Verification
|
|
179
|
+
|
|
180
|
+
Use configured oneshot command intents when available:
|
|
181
|
+
|
|
182
|
+
- `changes_status`
|
|
183
|
+
- `changes_diff_summary`
|
|
184
|
+
- `test_related`
|
|
185
|
+
- `test`
|
|
186
|
+
- `lint`
|
|
187
|
+
- `build`
|
|
188
|
+
- `docs_validate_fast`
|
|
189
|
+
- `test_release`
|
|
190
|
+
- `mustflow_check`
|
|
191
|
+
|
|
192
|
+
Choose the narrowest configured verification that covers changed strategy code, selectors, registries, tests, templates, docs, release metadata, and mustflow routing.
|
|
193
|
+
|
|
194
|
+
<!-- mustflow-section: failure-handling -->
|
|
195
|
+
## Failure Handling
|
|
196
|
+
|
|
197
|
+
- If variants do not share a purpose, stop and split the use cases instead of forcing a strategy interface.
|
|
198
|
+
- If input or output cannot be made common without a giant dependency object, split the strategy family into smaller policies.
|
|
199
|
+
- If the context still knows concrete strategy names, move that knowledge into a selector, resolver, registry, or assembly root.
|
|
200
|
+
- If unknown keys silently default, replace the fallback with an explicit default case for missing input or an explicit error for unsupported input.
|
|
201
|
+
- If strategy count is growing by combinations, decompose independent dimensions before adding more classes.
|
|
202
|
+
- If a strategy needs I/O but the decision should be pure, move I/O to the shell or adapter and pass normalized facts into the strategy.
|
|
203
|
+
|
|
204
|
+
<!-- mustflow-section: output-format -->
|
|
205
|
+
## Output Format
|
|
206
|
+
|
|
207
|
+
- Strategy family and shared purpose
|
|
208
|
+
- Contract input, output, and failure shape
|
|
209
|
+
- Strategies added, reused, or deliberately avoided
|
|
210
|
+
- Selector, resolver, registry, or assembly location
|
|
211
|
+
- User-input validation and default behavior
|
|
212
|
+
- State, command, adapter, or pure-core boundaries used with this skill
|
|
213
|
+
- Facade boundary used or intentionally avoided
|
|
214
|
+
- Tests or verification evidence
|
|
215
|
+
- Skipped checks and remaining strategy risk
|