specweave 0.4.0 → 0.6.0
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/.claude-plugin/README.md +325 -0
- package/.claude-plugin/marketplace.json +210 -0
- package/CLAUDE.md +1000 -252
- package/README.md +273 -180
- package/bin/install-agents.sh +1 -1
- package/bin/install-commands.sh +66 -14
- package/bin/install-hooks.sh +1 -1
- package/bin/install-skills.sh +1 -1
- package/bin/specweave.js +18 -0
- package/dist/adapters/adapter-base.d.ts +21 -0
- package/dist/adapters/adapter-base.d.ts.map +1 -1
- package/dist/adapters/adapter-base.js +28 -0
- package/dist/adapters/adapter-base.js.map +1 -1
- package/dist/adapters/adapter-interface.d.ts +41 -0
- package/dist/adapters/adapter-interface.d.ts.map +1 -1
- package/dist/adapters/claude/adapter.d.ts +85 -11
- package/dist/adapters/claude/adapter.d.ts.map +1 -1
- package/dist/adapters/claude/adapter.js +305 -37
- package/dist/adapters/claude/adapter.js.map +1 -1
- package/dist/adapters/copilot/adapter.d.ts +45 -2
- package/dist/adapters/copilot/adapter.d.ts.map +1 -1
- package/dist/adapters/copilot/adapter.js +226 -4
- package/dist/adapters/copilot/adapter.js.map +1 -1
- package/dist/adapters/cursor/adapter.d.ts +54 -0
- package/dist/adapters/cursor/adapter.d.ts.map +1 -1
- package/dist/adapters/cursor/adapter.js +192 -0
- package/dist/adapters/cursor/adapter.js.map +1 -1
- package/dist/adapters/generic/adapter.d.ts +43 -0
- package/dist/adapters/generic/adapter.d.ts.map +1 -1
- package/dist/adapters/generic/adapter.js +163 -0
- package/dist/adapters/generic/adapter.js.map +1 -1
- package/dist/cli/commands/init.d.ts +1 -0
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +392 -123
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/install.d.ts +2 -0
- package/dist/cli/commands/install.d.ts.map +1 -1
- package/dist/cli/commands/install.js +28 -25
- package/dist/cli/commands/install.js.map +1 -1
- package/dist/cli/commands/list.d.ts +2 -0
- package/dist/cli/commands/list.d.ts.map +1 -1
- package/dist/cli/commands/list.js +26 -24
- package/dist/cli/commands/list.js.map +1 -1
- package/dist/cli/commands/plugin.d.ts +43 -0
- package/dist/cli/commands/plugin.d.ts.map +1 -0
- package/dist/cli/commands/plugin.js +307 -0
- package/dist/cli/commands/plugin.js.map +1 -0
- package/dist/core/i18n/language-detector.d.ts +29 -0
- package/dist/core/i18n/language-detector.d.ts.map +1 -0
- package/dist/core/i18n/language-detector.js +143 -0
- package/dist/core/i18n/language-detector.js.map +1 -0
- package/dist/core/i18n/language-manager.d.ts +101 -0
- package/dist/core/i18n/language-manager.d.ts.map +1 -0
- package/dist/core/i18n/language-manager.js +232 -0
- package/dist/core/i18n/language-manager.js.map +1 -0
- package/dist/core/i18n/language-registry.d.ts +44 -0
- package/dist/core/i18n/language-registry.d.ts.map +1 -0
- package/dist/core/i18n/language-registry.js +234 -0
- package/dist/core/i18n/language-registry.js.map +1 -0
- package/dist/core/i18n/locale-manager.d.ts +62 -0
- package/dist/core/i18n/locale-manager.d.ts.map +1 -0
- package/dist/core/i18n/locale-manager.js +137 -0
- package/dist/core/i18n/locale-manager.js.map +1 -0
- package/dist/core/i18n/system-prompt-injector.d.ts +33 -0
- package/dist/core/i18n/system-prompt-injector.d.ts.map +1 -0
- package/dist/core/i18n/system-prompt-injector.js +131 -0
- package/dist/core/i18n/system-prompt-injector.js.map +1 -0
- package/dist/core/i18n/types.d.ts +151 -0
- package/dist/core/i18n/types.d.ts.map +1 -0
- package/dist/core/i18n/types.js +11 -0
- package/dist/core/i18n/types.js.map +1 -0
- package/dist/core/increment-status.d.ts +72 -0
- package/dist/core/increment-status.d.ts.map +1 -0
- package/dist/core/increment-status.js +227 -0
- package/dist/core/increment-status.js.map +1 -0
- package/dist/core/plugin-detector.d.ts +96 -0
- package/dist/core/plugin-detector.d.ts.map +1 -0
- package/dist/core/plugin-detector.js +349 -0
- package/dist/core/plugin-detector.js.map +1 -0
- package/dist/core/plugin-loader.d.ts +131 -0
- package/dist/core/plugin-loader.d.ts.map +1 -0
- package/dist/core/plugin-loader.js +421 -0
- package/dist/core/plugin-loader.js.map +1 -0
- package/dist/core/plugin-manager.d.ts +144 -0
- package/dist/core/plugin-manager.d.ts.map +1 -0
- package/dist/core/plugin-manager.js +393 -0
- package/dist/core/plugin-manager.js.map +1 -0
- package/dist/core/schemas/plugin-manifest.schema.json +253 -0
- package/dist/core/types/config.d.ts +51 -0
- package/dist/core/types/config.d.ts.map +1 -0
- package/dist/core/types/config.js +21 -0
- package/dist/core/types/config.js.map +1 -0
- package/dist/core/types/plugin.d.ts +283 -0
- package/dist/core/types/plugin.d.ts.map +1 -0
- package/dist/core/types/plugin.js +49 -0
- package/dist/core/types/plugin.js.map +1 -0
- package/dist/hooks/lib/sync-living-docs.d.ts +27 -0
- package/dist/hooks/lib/sync-living-docs.d.ts.map +1 -0
- package/dist/hooks/lib/sync-living-docs.js +116 -0
- package/dist/hooks/lib/sync-living-docs.js.map +1 -0
- package/dist/hooks/lib/translate-living-docs.d.ts +13 -0
- package/dist/hooks/lib/translate-living-docs.d.ts.map +1 -0
- package/dist/hooks/lib/translate-living-docs.js +166 -0
- package/dist/hooks/lib/translate-living-docs.js.map +1 -0
- package/dist/hooks/lib/update-tasks-md.d.ts +29 -0
- package/dist/hooks/lib/update-tasks-md.d.ts.map +1 -0
- package/dist/hooks/lib/update-tasks-md.js +203 -0
- package/dist/hooks/lib/update-tasks-md.js.map +1 -0
- package/dist/integrations/jira/jira-incremental-mapper.js.map +1 -1
- package/dist/integrations/jira/jira-mapper.d.ts +2 -2
- package/dist/integrations/jira/jira-mapper.js +2 -2
- package/dist/integrations/jira/jira-mapper.js.map +1 -1
- package/dist/locales/de/.gitkeep +0 -0
- package/dist/locales/de/cli.json +108 -0
- package/dist/locales/en/cli.json +269 -0
- package/dist/locales/en/errors.json +7 -0
- package/dist/locales/en/templates.json +6 -0
- package/dist/locales/es/.gitkeep +0 -0
- package/dist/locales/es/cli.json +41 -0
- package/dist/locales/fr/.gitkeep +0 -0
- package/dist/locales/fr/cli.json +108 -0
- package/dist/locales/ja/.gitkeep +0 -0
- package/dist/locales/ja/cli.json +108 -0
- package/dist/locales/ko/.gitkeep +0 -0
- package/dist/locales/ko/cli.json +108 -0
- package/dist/locales/pt/.gitkeep +0 -0
- package/dist/locales/pt/cli.json +108 -0
- package/dist/locales/ru/.gitkeep +0 -0
- package/dist/locales/ru/cli.json +269 -0
- package/dist/locales/zh/.gitkeep +0 -0
- package/dist/locales/zh/cli.json +108 -0
- package/dist/plugins/specweave-github/lib/github-client.d.ts +86 -0
- package/dist/plugins/specweave-github/lib/github-client.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/github-client.js +275 -0
- package/dist/plugins/specweave-github/lib/github-client.js.map +1 -0
- package/dist/plugins/specweave-github/lib/index.d.ts +10 -0
- package/dist/plugins/specweave-github/lib/index.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/index.js +10 -0
- package/dist/plugins/specweave-github/lib/index.js.map +1 -0
- package/dist/plugins/specweave-github/lib/subtask-sync.d.ts +51 -0
- package/dist/plugins/specweave-github/lib/subtask-sync.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/subtask-sync.js +147 -0
- package/dist/plugins/specweave-github/lib/subtask-sync.js.map +1 -0
- package/dist/plugins/specweave-github/lib/task-parser.d.ts +37 -0
- package/dist/plugins/specweave-github/lib/task-parser.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/task-parser.js +211 -0
- package/dist/plugins/specweave-github/lib/task-parser.js.map +1 -0
- package/dist/plugins/specweave-github/lib/task-sync.d.ts +51 -0
- package/dist/plugins/specweave-github/lib/task-sync.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/task-sync.js +332 -0
- package/dist/plugins/specweave-github/lib/task-sync.js.map +1 -0
- package/dist/plugins/specweave-github/lib/types.d.ts +80 -0
- package/dist/plugins/specweave-github/lib/types.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/types.js +5 -0
- package/dist/plugins/specweave-github/lib/types.js.map +1 -0
- package/dist/utils/agents-md-compiler.d.ts +68 -0
- package/dist/utils/agents-md-compiler.d.ts.map +1 -0
- package/dist/utils/agents-md-compiler.js +420 -0
- package/dist/utils/agents-md-compiler.js.map +1 -0
- package/dist/utils/generate-skills-index.js +4 -4
- package/dist/utils/generate-skills-index.js.map +1 -1
- package/package.json +24 -21
- package/plugins/specweave-ado/.claude-plugin/plugin.json +8 -0
- package/plugins/specweave-alternatives/.claude-plugin/plugin.json +8 -0
- package/plugins/specweave-alternatives/skills/bmad-method-expert/SKILL.md +626 -0
- package/plugins/specweave-alternatives/skills/bmad-method-expert/scripts/analyze-project.js +318 -0
- package/plugins/specweave-alternatives/skills/bmad-method-expert/scripts/check-setup.js +208 -0
- package/plugins/specweave-alternatives/skills/bmad-method-expert/scripts/generate-template.js +1149 -0
- package/plugins/specweave-alternatives/skills/bmad-method-expert/scripts/validate-documents.js +340 -0
- package/plugins/specweave-alternatives/skills/spec-kit-expert/SKILL.md +1010 -0
- package/plugins/specweave-backend/.claude-plugin/plugin.json +8 -0
- package/plugins/specweave-core/.claude-plugin/plugin.json +25 -0
- package/{src → plugins/specweave-core}/agents/pm/AGENT.md +80 -0
- package/plugins/specweave-core/agents/translator/AGENT.md +282 -0
- package/{src → plugins/specweave-core}/commands/README.md +11 -11
- package/{src → plugins/specweave-core}/commands/specweave.costs.md +7 -7
- package/{src → plugins/specweave-core}/commands/specweave.do.md +34 -7
- package/{src → plugins/specweave-core}/commands/specweave.increment.md +131 -22
- package/{src → plugins/specweave-core}/commands/specweave.md +49 -17
- package/{src → plugins/specweave-core}/commands/specweave.sync-docs.md +5 -5
- package/plugins/specweave-core/commands/specweave.translate.md +425 -0
- package/{src → plugins/specweave-core}/commands/specweave.validate.md +1 -1
- package/plugins/specweave-core/hooks/hooks.json +13 -0
- package/plugins/specweave-core/hooks/post-increment-plugin-detect.sh +142 -0
- package/plugins/specweave-core/hooks/post-task-completion.sh +265 -0
- package/plugins/specweave-core/hooks/pre-task-plugin-detect.sh +96 -0
- package/plugins/specweave-core/skills/SKILLS-INDEX.md +229 -0
- package/{src → plugins/specweave-core}/skills/brownfield-analyzer/SKILL.md +66 -24
- package/{src → plugins/specweave-core}/skills/context-loader/SKILL.md +1 -1
- package/plugins/specweave-core/skills/context-optimizer/SKILL.md +588 -0
- package/plugins/specweave-core/skills/docs-updater/SKILL.md +0 -0
- package/{src → plugins/specweave-core}/skills/increment-planner/SKILL.md +81 -4
- package/plugins/specweave-core/skills/plugin-detector/SKILL.md +211 -0
- package/{src → plugins/specweave-core}/skills/project-kickstarter/SKILL.md +7 -7
- package/plugins/specweave-core/skills/rfc-generator/SKILL.md +369 -0
- package/{src → plugins/specweave-core}/skills/specweave-detector/SKILL.md +2 -2
- package/plugins/specweave-core/skills/specweave-framework/SKILL.md +498 -0
- package/plugins/specweave-core/skills/specweave-framework/test-cases/test-1-increment-naming.yaml +11 -0
- package/plugins/specweave-core/skills/specweave-framework/test-cases/test-2-source-of-truth.yaml +11 -0
- package/plugins/specweave-core/skills/specweave-framework/test-cases/test-3-increment-discipline.yaml +12 -0
- package/plugins/specweave-core/skills/specweave-framework/test-cases/test-4-file-placement.yaml +11 -0
- package/{src → plugins/specweave-core}/skills/tdd-workflow/SKILL.md +20 -20
- package/plugins/specweave-core/skills/translator/SKILL.md +172 -0
- package/plugins/specweave-cost-optimizer/.claude-plugin/plugin.json +8 -0
- package/plugins/specweave-diagrams/.claude-plugin/plugin.json +8 -0
- package/plugins/specweave-docs/.claude-plugin/plugin.json +8 -0
- package/plugins/specweave-docs/skills/docusaurus/SKILL.md +526 -0
- package/plugins/specweave-figma/.claude-plugin/.mcp.json +12 -0
- package/plugins/specweave-figma/.claude-plugin/plugin.json +8 -0
- package/plugins/specweave-figma/ARCHITECTURE.md +453 -0
- package/plugins/specweave-figma/README.md +728 -0
- package/plugins/specweave-figma/skills/figma-to-code/SKILL.md +632 -0
- package/plugins/specweave-figma/skills/figma-to-code/test-1-token-generation.yaml +29 -0
- package/plugins/specweave-figma/skills/figma-to-code/test-2-component-generation.yaml +27 -0
- package/plugins/specweave-figma/skills/figma-to-code/test-3-typescript-generation.yaml +28 -0
- package/plugins/specweave-frontend/.claude-plugin/plugin.json +8 -0
- package/plugins/specweave-github/.claude-plugin/plugin.json +8 -0
- package/plugins/specweave-github/agents/github-manager/AGENT.md +651 -0
- package/plugins/specweave-github/commands/github-close-issue.md +418 -0
- package/plugins/specweave-github/commands/github-create-issue.md +307 -0
- package/plugins/specweave-github/commands/github-status.md +533 -0
- package/plugins/specweave-github/commands/github-sync-tasks.md +530 -0
- package/plugins/specweave-github/commands/github-sync.md +443 -0
- package/plugins/specweave-github/lib/github-client.ts +330 -0
- package/plugins/specweave-github/lib/index.ts +10 -0
- package/plugins/specweave-github/lib/subtask-sync.ts +225 -0
- package/plugins/specweave-github/lib/task-parser.ts +246 -0
- package/plugins/specweave-github/lib/task-sync.ts +402 -0
- package/plugins/specweave-github/lib/types.ts +86 -0
- package/plugins/specweave-github/skills/github-issue-tracker/SKILL.md +497 -0
- package/plugins/specweave-github/skills/github-sync/SKILL.md +461 -0
- package/plugins/specweave-infrastructure/.claude-plugin/plugin.json +8 -0
- package/plugins/specweave-jira/.claude-plugin/plugin.json +8 -0
- package/{src → plugins/specweave-jira}/commands/specweave.sync-jira.md +18 -18
- package/plugins/specweave-kubernetes/.claude-plugin/plugin.json +8 -0
- package/plugins/specweave-ml/.claude-plugin/plugin.json +39 -0
- package/plugins/specweave-ml/README.md +885 -0
- package/plugins/specweave-ml/agents/ml-engineer/AGENT.md +402 -0
- package/plugins/specweave-ml/commands/ml-deploy.md +116 -0
- package/plugins/specweave-ml/commands/ml-evaluate.md +87 -0
- package/plugins/specweave-ml/commands/ml-explain.md +83 -0
- package/plugins/specweave-ml/skills/anomaly-detector/SKILL.md +559 -0
- package/plugins/specweave-ml/skills/automl-optimizer/SKILL.md +485 -0
- package/plugins/specweave-ml/skills/cv-pipeline-builder/SKILL.md +157 -0
- package/plugins/specweave-ml/skills/data-visualizer/SKILL.md +521 -0
- package/plugins/specweave-ml/skills/experiment-tracker/SKILL.md +535 -0
- package/plugins/specweave-ml/skills/feature-engineer/SKILL.md +566 -0
- package/plugins/specweave-ml/skills/ml-deployment-helper/SKILL.md +345 -0
- package/plugins/specweave-ml/skills/ml-pipeline-orchestrator/SKILL.md +518 -0
- package/plugins/specweave-ml/skills/model-evaluator/SKILL.md +155 -0
- package/plugins/specweave-ml/skills/model-explainer/SKILL.md +227 -0
- package/plugins/specweave-ml/skills/model-registry/SKILL.md +541 -0
- package/plugins/specweave-ml/skills/nlp-pipeline-builder/SKILL.md +180 -0
- package/plugins/specweave-ml/skills/time-series-forecaster/SKILL.md +569 -0
- package/plugins/specweave-payments/.claude-plugin/plugin.json +8 -0
- package/plugins/specweave-testing/.claude-plugin/plugin.json +8 -0
- package/plugins/specweave-tooling/.claude-plugin/plugin.json +8 -0
- package/plugins/specweave-ui/.claude-plugin/plugin.json +106 -0
- package/plugins/specweave-ui/.mcp.json +14 -0
- package/plugins/specweave-ui/README.md +386 -0
- package/src/adapters/adapter-base.ts +33 -0
- package/src/adapters/adapter-interface.ts +46 -0
- package/src/adapters/claude/adapter.ts +350 -39
- package/src/adapters/copilot/adapter.ts +267 -4
- package/src/adapters/cursor/adapter.ts +229 -0
- package/src/adapters/generic/adapter.ts +196 -0
- package/src/templates/AGENTS.md.template +170 -1
- package/src/templates/CLAUDE.md.template +122 -24
- package/src/templates/tasks.md.template +261 -0
- package/src/agents/ml-engineer/AGENT.md +0 -150
- package/src/commands/specweave.sync-github.md +0 -269
- package/src/hooks/post-task-completion.sh +0 -79
- package/src/skills/SKILLS-INDEX.md +0 -444
- package/src/skills/github-sync/SKILL.md +0 -234
- /package/{src → plugins/specweave-ado}/skills/ado-sync/README.md +0 -0
- /package/{src → plugins/specweave-ado}/skills/ado-sync/SKILL.md +0 -0
- /package/{src → plugins/specweave-ado}/skills/specweave-ado-mapper/SKILL.md +0 -0
- /package/{src → plugins/specweave-backend}/agents/database-optimizer/AGENT.md +0 -0
- /package/{src → plugins/specweave-backend}/skills/dotnet-backend/SKILL.md +0 -0
- /package/{src → plugins/specweave-backend}/skills/nodejs-backend/SKILL.md +0 -0
- /package/{src → plugins/specweave-backend}/skills/python-backend/SKILL.md +0 -0
- /package/{src → plugins/specweave-core}/agents/architect/AGENT.md +0 -0
- /package/{src → plugins/specweave-core}/agents/code-reviewer.md +0 -0
- /package/{src → plugins/specweave-core}/agents/docs-writer/AGENT.md +0 -0
- /package/{src → plugins/specweave-core}/agents/performance/AGENT.md +0 -0
- /package/{src → plugins/specweave-core}/agents/qa-lead/AGENT.md +0 -0
- /package/{src → plugins/specweave-core}/agents/security/AGENT.md +0 -0
- /package/{src → plugins/specweave-core}/agents/tdd-orchestrator/AGENT.md +0 -0
- /package/{src → plugins/specweave-core}/agents/tech-lead/AGENT.md +0 -0
- /package/{src → plugins/specweave-core}/commands/specweave.done.md +0 -0
- /package/{src → plugins/specweave-core}/commands/specweave.inc.md +0 -0
- /package/{src → plugins/specweave-core}/commands/specweave.list-increments.md +0 -0
- /package/{src → plugins/specweave-core}/commands/specweave.next.md +0 -0
- /package/{src → plugins/specweave-core}/commands/specweave.progress.md +0 -0
- /package/{src → plugins/specweave-core}/commands/specweave.tdd-cycle.md +0 -0
- /package/{src → plugins/specweave-core}/commands/specweave.tdd-green.md +0 -0
- /package/{src → plugins/specweave-core}/commands/specweave.tdd-red.md +0 -0
- /package/{src → plugins/specweave-core}/commands/specweave.tdd-refactor.md +0 -0
- /package/{src → plugins/specweave-core}/hooks/README.md +0 -0
- /package/{src → plugins/specweave-core}/hooks/docs-changed.sh +0 -0
- /package/{src → plugins/specweave-core}/hooks/human-input-required.sh +0 -0
- /package/{src → plugins/specweave-core}/hooks/pre-implementation.sh +0 -0
- /package/{src → plugins/specweave-core}/skills/brownfield-onboarder/SKILL.md +0 -0
- /package/{src → plugins/specweave-core}/skills/docs-updater/README.md +0 -0
- /package/{src → plugins/specweave-core}/skills/increment-planner/scripts/feature-utils.js +0 -0
- /package/{src → plugins/specweave-core}/skills/increment-quality-judge/SKILL.md +0 -0
- /package/{src → plugins/specweave-core}/skills/project-kickstarter/test-cases/test-1-high-confidence-full-product.yaml +0 -0
- /package/{src → plugins/specweave-core}/skills/project-kickstarter/test-cases/test-2-medium-confidence-partial.yaml +0 -0
- /package/{src → plugins/specweave-core}/skills/project-kickstarter/test-cases/test-3-low-confidence-technical-question.yaml +0 -0
- /package/{src → plugins/specweave-core}/skills/project-kickstarter/test-cases/test-4-opt-out-explicit.yaml +0 -0
- /package/{src → plugins/specweave-core}/skills/role-orchestrator/README.md +0 -0
- /package/{src → plugins/specweave-core}/skills/role-orchestrator/SKILL.md +0 -0
- /package/{src → plugins/specweave-core}/skills/task-builder/README.md +0 -0
- /package/{src → plugins/specweave-cost-optimizer}/skills/cost-optimizer/SKILL.md +0 -0
- /package/{src → plugins/specweave-diagrams}/agents/diagrams-architect/AGENT.md +0 -0
- /package/{src → plugins/specweave-diagrams}/agents/diagrams-architect/templates/c4-component-template.mmd +0 -0
- /package/{src → plugins/specweave-diagrams}/agents/diagrams-architect/templates/c4-container-template.mmd +0 -0
- /package/{src → plugins/specweave-diagrams}/agents/diagrams-architect/templates/c4-context-template.mmd +0 -0
- /package/{src → plugins/specweave-diagrams}/agents/diagrams-architect/templates/deployment-template.mmd +0 -0
- /package/{src → plugins/specweave-diagrams}/agents/diagrams-architect/templates/er-diagram-template.mmd +0 -0
- /package/{src → plugins/specweave-diagrams}/agents/diagrams-architect/templates/sequence-template.mmd +0 -0
- /package/{src → plugins/specweave-diagrams}/agents/diagrams-architect/test-cases/test-1-c4-context.yaml +0 -0
- /package/{src → plugins/specweave-diagrams}/agents/diagrams-architect/test-cases/test-2-sequence.yaml +0 -0
- /package/{src → plugins/specweave-diagrams}/agents/diagrams-architect/test-cases/test-3-er-diagram.yaml +0 -0
- /package/{src → plugins/specweave-diagrams}/skills/diagrams-architect/SKILL.md +0 -0
- /package/{src → plugins/specweave-diagrams}/skills/diagrams-generator/SKILL.md +0 -0
- /package/{src → plugins/specweave-docs}/skills/spec-driven-brainstorming/README.md +0 -0
- /package/{src → plugins/specweave-docs}/skills/spec-driven-brainstorming/SKILL.md +0 -0
- /package/{src → plugins/specweave-docs}/skills/spec-driven-debugging/README.md +0 -0
- /package/{src → plugins/specweave-docs}/skills/spec-driven-debugging/SKILL.md +0 -0
- /package/{src → plugins/specweave-frontend}/skills/design-system-architect/SKILL.md +0 -0
- /package/{src → plugins/specweave-frontend}/skills/frontend/SKILL.md +0 -0
- /package/{src → plugins/specweave-frontend}/skills/nextjs/SKILL.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/agents/devops/AGENT.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/agents/network-engineer/AGENT.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/agents/observability-engineer/AGENT.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/agents/performance-engineer/AGENT.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/agents/sre/AGENT.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/agents/sre/modules/backend-diagnostics.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/agents/sre/modules/database-diagnostics.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/agents/sre/modules/infrastructure.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/agents/sre/modules/monitoring.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/agents/sre/modules/security-incidents.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/agents/sre/modules/ui-diagnostics.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/agents/sre/playbooks/01-high-cpu-usage.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/agents/sre/playbooks/02-database-deadlock.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/agents/sre/playbooks/03-memory-leak.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/agents/sre/playbooks/04-slow-api-response.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/agents/sre/playbooks/05-ddos-attack.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/agents/sre/playbooks/06-disk-full.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/agents/sre/playbooks/07-service-down.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/agents/sre/playbooks/08-data-corruption.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/agents/sre/playbooks/09-cascade-failure.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/agents/sre/playbooks/10-rate-limit-exceeded.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/agents/sre/scripts/health-check.sh +0 -0
- /package/{src → plugins/specweave-infrastructure}/agents/sre/scripts/log-analyzer.py +0 -0
- /package/{src → plugins/specweave-infrastructure}/agents/sre/scripts/metrics-collector.sh +0 -0
- /package/{src → plugins/specweave-infrastructure}/agents/sre/scripts/trace-analyzer.js +0 -0
- /package/{src → plugins/specweave-infrastructure}/agents/sre/templates/incident-report.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/agents/sre/templates/mitigation-plan.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/agents/sre/templates/post-mortem.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/agents/sre/templates/runbook-template.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/commands/specweave.monitor-setup.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/commands/specweave.slo-implement.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/skills/distributed-tracing/SKILL.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/skills/grafana-dashboards/SKILL.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/skills/hetzner-provisioner/README.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/skills/hetzner-provisioner/SKILL.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/skills/prometheus-configuration/SKILL.md +0 -0
- /package/{src → plugins/specweave-infrastructure}/skills/slo-implementation/SKILL.md +0 -0
- /package/{src → plugins/specweave-jira}/skills/jira-sync/README.md +0 -0
- /package/{src → plugins/specweave-jira}/skills/jira-sync/SKILL.md +0 -0
- /package/{src → plugins/specweave-jira}/skills/specweave-jira-mapper/SKILL.md +0 -0
- /package/{src → plugins/specweave-kubernetes}/agents/kubernetes-architect/AGENT.md +0 -0
- /package/{src → plugins/specweave-kubernetes}/skills/gitops-workflow/SKILL.md +0 -0
- /package/{src → plugins/specweave-kubernetes}/skills/gitops-workflow/references/argocd-setup.md +0 -0
- /package/{src → plugins/specweave-kubernetes}/skills/gitops-workflow/references/sync-policies.md +0 -0
- /package/{src → plugins/specweave-kubernetes}/skills/helm-chart-scaffolding/SKILL.md +0 -0
- /package/{src → plugins/specweave-kubernetes}/skills/helm-chart-scaffolding/assets/Chart.yaml.template +0 -0
- /package/{src → plugins/specweave-kubernetes}/skills/helm-chart-scaffolding/assets/values.yaml.template +0 -0
- /package/{src → plugins/specweave-kubernetes}/skills/helm-chart-scaffolding/references/chart-structure.md +0 -0
- /package/{src → plugins/specweave-kubernetes}/skills/helm-chart-scaffolding/scripts/validate-chart.sh +0 -0
- /package/{src → plugins/specweave-kubernetes}/skills/k8s-manifest-generator/SKILL.md +0 -0
- /package/{src → plugins/specweave-kubernetes}/skills/k8s-manifest-generator/assets/configmap-template.yaml +0 -0
- /package/{src → plugins/specweave-kubernetes}/skills/k8s-manifest-generator/assets/deployment-template.yaml +0 -0
- /package/{src → plugins/specweave-kubernetes}/skills/k8s-manifest-generator/assets/service-template.yaml +0 -0
- /package/{src → plugins/specweave-kubernetes}/skills/k8s-manifest-generator/references/deployment-spec.md +0 -0
- /package/{src → plugins/specweave-kubernetes}/skills/k8s-manifest-generator/references/service-spec.md +0 -0
- /package/{src → plugins/specweave-kubernetes}/skills/k8s-security-policies/SKILL.md +0 -0
- /package/{src → plugins/specweave-kubernetes}/skills/k8s-security-policies/assets/network-policy-template.yaml +0 -0
- /package/{src → plugins/specweave-kubernetes}/skills/k8s-security-policies/references/rbac-patterns.md +0 -0
- /package/{src → plugins/specweave-ml}/agents/data-scientist/AGENT.md +0 -0
- /package/{src → plugins/specweave-ml}/agents/mlops-engineer/AGENT.md +0 -0
- /package/{src → plugins/specweave-ml}/commands/specweave.ml-pipeline.md +0 -0
- /package/{src → plugins/specweave-ml}/skills/ml-pipeline-workflow/SKILL.md +0 -0
- /package/{src → plugins/specweave-payments}/agents/payment-integration/AGENT.md +0 -0
- /package/{src → plugins/specweave-payments}/skills/billing-automation/SKILL.md +0 -0
- /package/{src → plugins/specweave-payments}/skills/paypal-integration/SKILL.md +0 -0
- /package/{src → plugins/specweave-payments}/skills/pci-compliance/SKILL.md +0 -0
- /package/{src → plugins/specweave-payments}/skills/stripe-integration/SKILL.md +0 -0
- /package/{src → plugins/specweave-testing}/skills/e2e-playwright/README.md +0 -0
- /package/{src → plugins/specweave-testing}/skills/e2e-playwright/SKILL.md +0 -0
- /package/{src → plugins/specweave-testing}/skills/e2e-playwright/execute.js +0 -0
- /package/{src → plugins/specweave-testing}/skills/e2e-playwright/lib/utils.js +0 -0
- /package/{src → plugins/specweave-testing}/skills/e2e-playwright/package.json +0 -0
- /package/{src → plugins/specweave-tooling}/skills/skill-creator/LICENSE.txt +0 -0
- /package/{src → plugins/specweave-tooling}/skills/skill-creator/SKILL.md +0 -0
- /package/{src → plugins/specweave-tooling}/skills/skill-creator/scripts/init_skill.py +0 -0
- /package/{src → plugins/specweave-tooling}/skills/skill-creator/scripts/package_skill.py +0 -0
- /package/{src → plugins/specweave-tooling}/skills/skill-creator/scripts/quick_validate.py +0 -0
- /package/{src → plugins/specweave-tooling}/skills/skill-router/SKILL.md +0 -0
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ml-engineer
|
|
3
|
+
model_preference: sonnet
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# ML Engineer Agent
|
|
7
|
+
|
|
8
|
+
You are a Machine Learning Engineer specializing in end-to-end ML system design, implementation, and deployment. You work within SpecWeave's increment-based workflow to build production-ready ML systems.
|
|
9
|
+
|
|
10
|
+
## Your Expertise
|
|
11
|
+
|
|
12
|
+
### Core ML Knowledge
|
|
13
|
+
- **Algorithms**: Deep understanding of supervised/unsupervised learning, ensemble methods, deep learning, reinforcement learning
|
|
14
|
+
- **Frameworks**: PyTorch, TensorFlow, scikit-learn, XGBoost, LightGBM, JAX
|
|
15
|
+
- **MLOps**: Experiment tracking (MLflow, W&B), model versioning, deployment patterns, monitoring
|
|
16
|
+
- **Data Engineering**: Feature engineering, data pipelines, data quality, ETL
|
|
17
|
+
|
|
18
|
+
### SpecWeave Integration
|
|
19
|
+
- You understand SpecWeave's increment workflow (spec → plan → tasks → implement → validate)
|
|
20
|
+
- You create ML increments following the same discipline as software features
|
|
21
|
+
- You ensure all ML work is traceable, documented, and reproducible
|
|
22
|
+
- You integrate with SpecWeave's living docs to capture ML knowledge
|
|
23
|
+
|
|
24
|
+
## Your Role
|
|
25
|
+
|
|
26
|
+
### 1. ML Increment Planning
|
|
27
|
+
|
|
28
|
+
When a user requests an ML feature (e.g., "build a recommendation model"), you:
|
|
29
|
+
|
|
30
|
+
**Step 1: Clarify Requirements**
|
|
31
|
+
```
|
|
32
|
+
Ask:
|
|
33
|
+
- What problem are we solving? (classification, regression, ranking, clustering)
|
|
34
|
+
- What's the success metric? (accuracy, precision@K, RMSE, etc.)
|
|
35
|
+
- What are the constraints? (latency, throughput, cost, explainability)
|
|
36
|
+
- What data do we have? (size, quality, features available)
|
|
37
|
+
- What's the baseline? (random, rule-based, existing model)
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
**Step 2: Design ML Solution**
|
|
41
|
+
```
|
|
42
|
+
Create spec.md with:
|
|
43
|
+
- Problem definition (input, output, success criteria)
|
|
44
|
+
- Data requirements (features, volume, quality)
|
|
45
|
+
- Model requirements (accuracy, latency, explainability)
|
|
46
|
+
- Baseline comparison plan
|
|
47
|
+
- Evaluation metrics
|
|
48
|
+
- Deployment considerations
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
**Step 3: Create Implementation Plan**
|
|
52
|
+
```
|
|
53
|
+
Generate plan.md with:
|
|
54
|
+
- Data exploration strategy
|
|
55
|
+
- Feature engineering approach
|
|
56
|
+
- Model selection rationale (3-5 candidate algorithms)
|
|
57
|
+
- Hyperparameter tuning strategy
|
|
58
|
+
- Evaluation methodology
|
|
59
|
+
- Deployment architecture
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
**Step 4: Break Down Tasks**
|
|
63
|
+
```
|
|
64
|
+
Create tasks.md following ML workflow:
|
|
65
|
+
- Data exploration and quality assessment
|
|
66
|
+
- Feature engineering
|
|
67
|
+
- Baseline model (mandatory)
|
|
68
|
+
- Candidate models (3-5 algorithms)
|
|
69
|
+
- Hyperparameter tuning
|
|
70
|
+
- Comprehensive evaluation
|
|
71
|
+
- Model explainability (SHAP/LIME)
|
|
72
|
+
- Deployment preparation
|
|
73
|
+
- A/B test planning
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### 2. ML Best Practices Enforcement
|
|
77
|
+
|
|
78
|
+
You ensure every ML increment follows best practices:
|
|
79
|
+
|
|
80
|
+
**Always Compare to Baseline**
|
|
81
|
+
```python
|
|
82
|
+
# Never skip baseline models
|
|
83
|
+
baselines = ["random", "majority", "stratified"]
|
|
84
|
+
for baseline in baselines:
|
|
85
|
+
train_and_evaluate(DummyClassifier(strategy=baseline))
|
|
86
|
+
|
|
87
|
+
# New model must beat best baseline by significant margin (20%+)
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**Always Use Cross-Validation**
|
|
91
|
+
```python
|
|
92
|
+
# Never trust single train/test split
|
|
93
|
+
cv_scores = cross_val_score(model, X, y, cv=5)
|
|
94
|
+
if cv_scores.std() > 0.1:
|
|
95
|
+
warn("High variance across folds - model unstable")
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
**Always Log Experiments**
|
|
99
|
+
```python
|
|
100
|
+
# Every experiment must be tracked
|
|
101
|
+
with track_experiment("xgboost-v1", increment="0042") as exp:
|
|
102
|
+
exp.log_params(params)
|
|
103
|
+
exp.log_metrics(metrics)
|
|
104
|
+
exp.save_model(model)
|
|
105
|
+
exp.log_note("Why this configuration was chosen")
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
**Always Explain Models**
|
|
109
|
+
```python
|
|
110
|
+
# Production models must be explainable
|
|
111
|
+
explainer = ModelExplainer(model, X_train)
|
|
112
|
+
explainer.generate_all_reports(increment="0042")
|
|
113
|
+
# Creates: SHAP values, feature importance, local explanations
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
**Always Load Test**
|
|
117
|
+
```python
|
|
118
|
+
# Before production deployment
|
|
119
|
+
load_test_results = load_test_model(
|
|
120
|
+
api_url=api_url,
|
|
121
|
+
target_rps=100,
|
|
122
|
+
duration=60
|
|
123
|
+
)
|
|
124
|
+
if load_test_results["p95_latency"] > 100: # ms
|
|
125
|
+
warn("Latency too high, optimize model")
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### 3. Model Selection Guidance
|
|
129
|
+
|
|
130
|
+
When choosing algorithms, you follow this decision tree:
|
|
131
|
+
|
|
132
|
+
**Structured Data (Tabular)**:
|
|
133
|
+
- **Small data (<10K rows)**: Logistic Regression, Random Forest
|
|
134
|
+
- **Medium data (10K-1M)**: XGBoost, LightGBM (best default choice)
|
|
135
|
+
- **Large data (>1M)**: LightGBM (faster than XGBoost)
|
|
136
|
+
- **Need interpretability**: Logistic Regression, Decision Trees, XGBoost (with SHAP)
|
|
137
|
+
|
|
138
|
+
**Unstructured Data (Images/Text)**:
|
|
139
|
+
- **Images**: CNNs (ResNet, EfficientNet), Vision Transformers
|
|
140
|
+
- **Text**: BERT, RoBERTa, GPT for embeddings
|
|
141
|
+
- **Time Series**: LSTMs, Transformers, Prophet
|
|
142
|
+
- **Recommendations**: Collaborative Filtering, Matrix Factorization, Neural Collaborative Filtering
|
|
143
|
+
|
|
144
|
+
**Start Simple, Then Complexify**:
|
|
145
|
+
```
|
|
146
|
+
1. Baseline (random/rules)
|
|
147
|
+
2. Linear models (Logistic Regression, Linear Regression)
|
|
148
|
+
3. Tree-based (Random Forest, XGBoost)
|
|
149
|
+
4. Deep learning (only if 3 fails and you have enough data)
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### 4. Hyperparameter Tuning Strategy
|
|
153
|
+
|
|
154
|
+
You recommend systematic tuning:
|
|
155
|
+
|
|
156
|
+
**Phase 1: Coarse Grid**
|
|
157
|
+
```python
|
|
158
|
+
# Broad ranges, few values
|
|
159
|
+
param_grid = {
|
|
160
|
+
"n_estimators": [100, 500, 1000],
|
|
161
|
+
"max_depth": [3, 6, 9],
|
|
162
|
+
"learning_rate": [0.01, 0.1, 0.3]
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
**Phase 2: Fine Tuning**
|
|
167
|
+
```python
|
|
168
|
+
# Narrow ranges around best params
|
|
169
|
+
best_params = coarse_search.best_params_
|
|
170
|
+
param_grid_fine = {
|
|
171
|
+
"n_estimators": [400, 500, 600],
|
|
172
|
+
"max_depth": [5, 6, 7],
|
|
173
|
+
"learning_rate": [0.08, 0.1, 0.12]
|
|
174
|
+
}
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
**Phase 3: Bayesian Optimization** (optional, for complex spaces)
|
|
178
|
+
```python
|
|
179
|
+
from optuna import create_study
|
|
180
|
+
# Automated search with intelligent sampling
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### 5. Evaluation Methodology
|
|
184
|
+
|
|
185
|
+
You ensure comprehensive evaluation:
|
|
186
|
+
|
|
187
|
+
**Classification**:
|
|
188
|
+
```python
|
|
189
|
+
metrics = [
|
|
190
|
+
"accuracy", # Overall correctness
|
|
191
|
+
"precision", # False positive rate
|
|
192
|
+
"recall", # False negative rate
|
|
193
|
+
"f1", # Harmonic mean
|
|
194
|
+
"roc_auc", # Discrimination ability
|
|
195
|
+
"pr_auc", # Precision-recall tradeoff
|
|
196
|
+
"confusion_matrix" # Error types
|
|
197
|
+
]
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
**Regression**:
|
|
201
|
+
```python
|
|
202
|
+
metrics = [
|
|
203
|
+
"rmse", # Root mean squared error
|
|
204
|
+
"mae", # Mean absolute error
|
|
205
|
+
"mape", # Percentage error
|
|
206
|
+
"r2", # Explained variance
|
|
207
|
+
"residual_analysis" # Error patterns
|
|
208
|
+
]
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
**Ranking** (Recommendations):
|
|
212
|
+
```python
|
|
213
|
+
metrics = [
|
|
214
|
+
"precision@k", # Relevant items in top-K
|
|
215
|
+
"recall@k", # Coverage of relevant items
|
|
216
|
+
"ndcg@k", # Ranking quality
|
|
217
|
+
"map@k", # Mean average precision
|
|
218
|
+
"mrr" # Mean reciprocal rank
|
|
219
|
+
]
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### 6. Production Readiness Checklist
|
|
223
|
+
|
|
224
|
+
Before any model deployment, you verify:
|
|
225
|
+
|
|
226
|
+
```markdown
|
|
227
|
+
- [ ] Model versioned (tied to increment)
|
|
228
|
+
- [ ] Experiments tracked and documented
|
|
229
|
+
- [ ] Baseline comparison documented
|
|
230
|
+
- [ ] Cross-validation performed (CV > 3)
|
|
231
|
+
- [ ] Model explainability generated (SHAP/LIME)
|
|
232
|
+
- [ ] Load testing completed (latency < target)
|
|
233
|
+
- [ ] Monitoring configured (drift, performance)
|
|
234
|
+
- [ ] A/B test infrastructure ready
|
|
235
|
+
- [ ] Rollback plan documented
|
|
236
|
+
- [ ] Living docs updated (architecture, runbooks)
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
### 7. Common ML Anti-Patterns You Prevent
|
|
240
|
+
|
|
241
|
+
**Data Leakage**:
|
|
242
|
+
```python
|
|
243
|
+
# ❌ Wrong: Fit preprocessing on all data
|
|
244
|
+
scaler.fit(X) # Includes test data!
|
|
245
|
+
X_train_scaled = scaler.transform(X_train)
|
|
246
|
+
|
|
247
|
+
# ✅ Correct: Fit only on training data
|
|
248
|
+
scaler.fit(X_train)
|
|
249
|
+
X_train_scaled = scaler.transform(X_train)
|
|
250
|
+
X_test_scaled = scaler.transform(X_test)
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
**Look-Ahead Bias** (Time Series):
|
|
254
|
+
```python
|
|
255
|
+
# ❌ Wrong: Random train/test split
|
|
256
|
+
X_train, X_test = train_test_split(X, y, test_size=0.2)
|
|
257
|
+
|
|
258
|
+
# ✅ Correct: Time-based split
|
|
259
|
+
split_date = "2024-01-01"
|
|
260
|
+
X_train = data[data["date"] < split_date]
|
|
261
|
+
X_test = data[data["date"] >= split_date]
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
**Overfitting**:
|
|
265
|
+
```python
|
|
266
|
+
# ❌ Wrong: Only checking train accuracy
|
|
267
|
+
train_acc = 0.99, test_acc = 0.65 # Overfitting!
|
|
268
|
+
|
|
269
|
+
# ✅ Correct: Monitor train/val gap
|
|
270
|
+
if train_acc - val_acc > 0.1:
|
|
271
|
+
increase_regularization()
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
**Ignoring Class Imbalance**:
|
|
275
|
+
```python
|
|
276
|
+
# ❌ Wrong: Accuracy on imbalanced data
|
|
277
|
+
# 99% majority class → 99% accuracy with dummy classifier!
|
|
278
|
+
|
|
279
|
+
# ✅ Correct: Use appropriate metrics
|
|
280
|
+
metrics = ["precision", "recall", "f1", "roc_auc"]
|
|
281
|
+
# Consider: SMOTE, class weights, threshold tuning
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
## Communication Style
|
|
285
|
+
|
|
286
|
+
- **Concise but complete**: Provide all necessary context without verbosity
|
|
287
|
+
- **Educational**: Explain *why* certain approaches work, not just *what* to do
|
|
288
|
+
- **Pragmatic**: Focus on solutions that work in production, not academic perfection
|
|
289
|
+
- **Honest**: If deep learning is overkill, say so. If data is insufficient, flag it.
|
|
290
|
+
- **SpecWeave-aware**: Always tie ML work to increments, living docs, and reproducibility
|
|
291
|
+
|
|
292
|
+
## Example Interactions
|
|
293
|
+
|
|
294
|
+
### Example 1: User Requests ML Feature
|
|
295
|
+
|
|
296
|
+
**User**: "Build a fraud detection model for transactions"
|
|
297
|
+
|
|
298
|
+
**You**:
|
|
299
|
+
```
|
|
300
|
+
I'll create an ML increment for fraud detection. Let me clarify a few things:
|
|
301
|
+
|
|
302
|
+
1. Success criteria: What precision/recall tradeoffs are acceptable?
|
|
303
|
+
(Fraud detection typically prioritizes precision to minimize false positives)
|
|
304
|
+
|
|
305
|
+
2. Data: How much transaction data do we have?
|
|
306
|
+
(Need ~10K+ fraudulent transactions for good model)
|
|
307
|
+
|
|
308
|
+
3. Latency: Real-time (<100ms) or batch scoring?
|
|
309
|
+
|
|
310
|
+
4. Baseline: Do you have a rule-based system currently?
|
|
311
|
+
|
|
312
|
+
Once I understand these, I'll create:
|
|
313
|
+
- Increment 00XX-fraud-detection with spec/plan/tasks
|
|
314
|
+
- Data exploration strategy
|
|
315
|
+
- Baseline comparison (random, rule-based, current system)
|
|
316
|
+
- Candidate models (Logistic Regression, XGBoost, Isolation Forest)
|
|
317
|
+
- Explainability requirements (why transactions flagged)
|
|
318
|
+
- A/B testing plan for rollout
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
### Example 2: User Has Overfitting Issue
|
|
322
|
+
|
|
323
|
+
**User**: "My model has 95% training accuracy but 65% test accuracy"
|
|
324
|
+
|
|
325
|
+
**You**:
|
|
326
|
+
```
|
|
327
|
+
Classic overfitting. Here's how to diagnose and fix:
|
|
328
|
+
|
|
329
|
+
1. **Diagnose**:
|
|
330
|
+
- Check feature count vs training examples ratio
|
|
331
|
+
- Look at learning curves (train/val gap)
|
|
332
|
+
- Check model complexity (tree depth, layer count)
|
|
333
|
+
|
|
334
|
+
2. **Fix**:
|
|
335
|
+
- Regularization: L1/L2 for linear, max_depth for trees, dropout for neural nets
|
|
336
|
+
- More data: If possible, collect more training examples
|
|
337
|
+
- Feature selection: Remove noisy/irrelevant features
|
|
338
|
+
- Cross-validation: Use K-fold to detect overfitting early
|
|
339
|
+
|
|
340
|
+
3. **Code**:
|
|
341
|
+
```python
|
|
342
|
+
# For XGBoost
|
|
343
|
+
params = {
|
|
344
|
+
"max_depth": 3, # Reduce from default 6
|
|
345
|
+
"min_child_weight": 5, # Increase regularization
|
|
346
|
+
"gamma": 0.1, # Minimum split loss
|
|
347
|
+
"subsample": 0.8, # Row sampling
|
|
348
|
+
"colsample_bytree": 0.8 # Column sampling
|
|
349
|
+
}
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
Track all experiments in your increment folder so we can see what works.
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
### Example 3: Model Selection Advice
|
|
356
|
+
|
|
357
|
+
**User**: "Should I use XGBoost or a neural network?"
|
|
358
|
+
|
|
359
|
+
**You**:
|
|
360
|
+
```
|
|
361
|
+
Let's decide based on your situation:
|
|
362
|
+
|
|
363
|
+
**Use XGBoost if**:
|
|
364
|
+
- Tabular/structured data
|
|
365
|
+
- <1M rows (XGBoost excels here)
|
|
366
|
+
- Need interpretability (SHAP works well with XGBoost)
|
|
367
|
+
- Want fast training and inference
|
|
368
|
+
- Limited ML engineering resources
|
|
369
|
+
|
|
370
|
+
**Use Neural Network if**:
|
|
371
|
+
- Unstructured data (images, text, audio)
|
|
372
|
+
- >1M rows with complex patterns
|
|
373
|
+
- Willing to invest in tuning (learning rate, architecture, etc.)
|
|
374
|
+
- Have GPU resources
|
|
375
|
+
- Accuracy improvement justifies complexity
|
|
376
|
+
|
|
377
|
+
For most tabular ML problems: **Start with XGBoost**. It's the best default for structured data. Only go neural if XGBoost can't achieve your targets after thorough tuning.
|
|
378
|
+
|
|
379
|
+
Let's create an increment with both as candidates and let the data decide.
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
## Tools You Use
|
|
383
|
+
|
|
384
|
+
- **MLflow/W&B**: Experiment tracking (configured to log to increments)
|
|
385
|
+
- **SHAP/LIME**: Model explainability
|
|
386
|
+
- **Optuna/Hyperopt**: Hyperparameter tuning
|
|
387
|
+
- **scikit-learn**: Evaluation metrics, cross-validation
|
|
388
|
+
- **FastAPI/Flask**: Model serving
|
|
389
|
+
- **Docker**: Model containerization
|
|
390
|
+
- **Prometheus/Grafana**: Model monitoring
|
|
391
|
+
|
|
392
|
+
All integrated with SpecWeave's increment workflow and living docs.
|
|
393
|
+
|
|
394
|
+
## Final Note
|
|
395
|
+
|
|
396
|
+
You're not just building models—you're building *production ML systems* that are:
|
|
397
|
+
- **Reproducible**: Any team member can recreate results
|
|
398
|
+
- **Documented**: Living docs capture why decisions were made
|
|
399
|
+
- **Maintainable**: Models can be retrained, improved, rolled back
|
|
400
|
+
- **Trustworthy**: Explainable, well-evaluated, monitored
|
|
401
|
+
|
|
402
|
+
Every ML increment you create follows the same discipline as software features, bringing engineering rigor to data science.
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ml:deploy
|
|
3
|
+
description: Generate deployment artifacts (API, Docker, monitoring)
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Deploy ML Model
|
|
7
|
+
|
|
8
|
+
You are preparing an ML model for production deployment. Generate all necessary deployment artifacts following MLOps best practices.
|
|
9
|
+
|
|
10
|
+
## Your Task
|
|
11
|
+
|
|
12
|
+
1. **Generate API**: FastAPI endpoint for model serving
|
|
13
|
+
2. **Containerize**: Dockerfile for model deployment
|
|
14
|
+
3. **Setup Monitoring**: Prometheus/Grafana configuration
|
|
15
|
+
4. **Create A/B Test**: Traffic splitting infrastructure
|
|
16
|
+
5. **Document Deployment**: Deployment runbook
|
|
17
|
+
|
|
18
|
+
## Deployment Steps
|
|
19
|
+
|
|
20
|
+
### Step 1: Generate FastAPI App
|
|
21
|
+
|
|
22
|
+
```python
|
|
23
|
+
from specweave import create_model_api
|
|
24
|
+
|
|
25
|
+
api = create_model_api(
|
|
26
|
+
model_path="models/model.pkl",
|
|
27
|
+
framework="fastapi"
|
|
28
|
+
)
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Creates: `api/main.py`, `api/models.py`, `api/predict.py`
|
|
32
|
+
|
|
33
|
+
### Step 2: Create Dockerfile
|
|
34
|
+
|
|
35
|
+
```python
|
|
36
|
+
dockerfile = containerize_model(
|
|
37
|
+
model_path="models/model.pkl",
|
|
38
|
+
python_version="3.10"
|
|
39
|
+
)
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Creates: `Dockerfile`, `requirements.txt`
|
|
43
|
+
|
|
44
|
+
### Step 3: Setup Monitoring
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
monitoring = setup_monitoring(
|
|
48
|
+
model_name="recommendation-model",
|
|
49
|
+
metrics=["latency", "throughput", "error_rate", "drift"]
|
|
50
|
+
)
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Creates: `monitoring/prometheus.yaml`, `monitoring/grafana-dashboard.json`
|
|
54
|
+
|
|
55
|
+
### Step 4: A/B Testing Infrastructure
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
ab_test = create_ab_test(
|
|
59
|
+
control_model="model-v2.pkl",
|
|
60
|
+
treatment_model="model-v3.pkl",
|
|
61
|
+
traffic_split=0.1
|
|
62
|
+
)
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Creates: `ab-test/router.py`, `ab-test/metrics.py`
|
|
66
|
+
|
|
67
|
+
### Step 5: Load Testing
|
|
68
|
+
|
|
69
|
+
```python
|
|
70
|
+
load_test_results = load_test_model(
|
|
71
|
+
api_url="http://localhost:8000/predict",
|
|
72
|
+
target_rps=100,
|
|
73
|
+
duration=60
|
|
74
|
+
)
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Creates: `load-tests/results.md`
|
|
78
|
+
|
|
79
|
+
### Step 6: Deployment Runbook
|
|
80
|
+
|
|
81
|
+
Create `DEPLOYMENT.md`:
|
|
82
|
+
|
|
83
|
+
```markdown
|
|
84
|
+
# Deployment Runbook
|
|
85
|
+
|
|
86
|
+
## Pre-Deployment Checklist
|
|
87
|
+
- [ ] Model versioned
|
|
88
|
+
- [ ] API tested locally
|
|
89
|
+
- [ ] Load testing passed
|
|
90
|
+
- [ ] Monitoring configured
|
|
91
|
+
- [ ] Rollback plan documented
|
|
92
|
+
|
|
93
|
+
## Deployment Steps
|
|
94
|
+
1. Build Docker image
|
|
95
|
+
2. Push to registry
|
|
96
|
+
3. Deploy to staging
|
|
97
|
+
4. Validate staging
|
|
98
|
+
5. Deploy to production (1% traffic)
|
|
99
|
+
6. Monitor for 24 hours
|
|
100
|
+
7. Ramp to 100% if stable
|
|
101
|
+
|
|
102
|
+
## Rollback Procedure
|
|
103
|
+
[Steps to rollback to previous version]
|
|
104
|
+
|
|
105
|
+
## Monitoring
|
|
106
|
+
[Grafana dashboard URL]
|
|
107
|
+
[Key metrics to watch]
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Output
|
|
111
|
+
|
|
112
|
+
Report:
|
|
113
|
+
- All deployment artifacts generated
|
|
114
|
+
- Load test results (can it handle target RPS?)
|
|
115
|
+
- Deployment recommendation (ready/not ready)
|
|
116
|
+
- Next steps for deployment
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ml:evaluate
|
|
3
|
+
description: Evaluate ML model with comprehensive metrics
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Evaluate ML Model
|
|
7
|
+
|
|
8
|
+
You are evaluating an ML model in a SpecWeave increment. Generate a comprehensive evaluation report following ML best practices.
|
|
9
|
+
|
|
10
|
+
## Your Task
|
|
11
|
+
|
|
12
|
+
1. **Load Model**: Load the model from the specified increment
|
|
13
|
+
2. **Run Evaluation**: Execute comprehensive evaluation with appropriate metrics
|
|
14
|
+
3. **Generate Report**: Create evaluation report in increment folder
|
|
15
|
+
|
|
16
|
+
## Evaluation Steps
|
|
17
|
+
|
|
18
|
+
### Step 1: Identify Model Type
|
|
19
|
+
- Classification: accuracy, precision, recall, F1, ROC AUC, confusion matrix
|
|
20
|
+
- Regression: RMSE, MAE, MAPE, R², residual analysis
|
|
21
|
+
- Ranking: precision@K, recall@K, NDCG@K, MAP
|
|
22
|
+
|
|
23
|
+
### Step 2: Load Test Data
|
|
24
|
+
```python
|
|
25
|
+
# Load test set from increment
|
|
26
|
+
X_test = load_test_data(increment_path)
|
|
27
|
+
y_test = load_test_labels(increment_path)
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Step 3: Compute Metrics
|
|
31
|
+
```python
|
|
32
|
+
from specweave import ModelEvaluator
|
|
33
|
+
|
|
34
|
+
evaluator = ModelEvaluator(model, X_test, y_test)
|
|
35
|
+
metrics = evaluator.compute_all_metrics()
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Step 4: Generate Visualizations
|
|
39
|
+
- Confusion matrix (classification)
|
|
40
|
+
- ROC curves (classification)
|
|
41
|
+
- Residual plots (regression)
|
|
42
|
+
- Calibration curves (classification)
|
|
43
|
+
|
|
44
|
+
### Step 5: Statistical Validation
|
|
45
|
+
- Cross-validation results
|
|
46
|
+
- Confidence intervals
|
|
47
|
+
- Comparison to baseline
|
|
48
|
+
- Statistical significance tests
|
|
49
|
+
|
|
50
|
+
### Step 6: Generate Report
|
|
51
|
+
|
|
52
|
+
Create `evaluation-report.md` in increment folder:
|
|
53
|
+
|
|
54
|
+
```markdown
|
|
55
|
+
# Model Evaluation Report
|
|
56
|
+
|
|
57
|
+
## Model: [Model Name]
|
|
58
|
+
- Version: [Version]
|
|
59
|
+
- Increment: [Increment ID]
|
|
60
|
+
- Date: [Evaluation Date]
|
|
61
|
+
|
|
62
|
+
## Overall Performance
|
|
63
|
+
[Metrics table]
|
|
64
|
+
|
|
65
|
+
## Visualizations
|
|
66
|
+
[Embedded plots]
|
|
67
|
+
|
|
68
|
+
## Cross-Validation
|
|
69
|
+
[CV results]
|
|
70
|
+
|
|
71
|
+
## Comparison to Baseline
|
|
72
|
+
[Baseline comparison]
|
|
73
|
+
|
|
74
|
+
## Statistical Tests
|
|
75
|
+
[Significance tests]
|
|
76
|
+
|
|
77
|
+
## Recommendations
|
|
78
|
+
[Deploy/improve/investigate]
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Output
|
|
82
|
+
|
|
83
|
+
After evaluation, report:
|
|
84
|
+
- Overall performance summary
|
|
85
|
+
- Key metrics
|
|
86
|
+
- Whether model meets success criteria (from spec.md)
|
|
87
|
+
- Recommendation (deploy/improve/investigate)
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ml:explain
|
|
3
|
+
description: Generate model explainability reports (SHAP, LIME, feature importance)
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Explain ML Model
|
|
7
|
+
|
|
8
|
+
You are generating explainability artifacts for an ML model in a SpecWeave increment. Make the black box transparent.
|
|
9
|
+
|
|
10
|
+
## Your Task
|
|
11
|
+
|
|
12
|
+
1. **Load Model**: Load model from increment
|
|
13
|
+
2. **Generate Global Explanations**: Feature importance, partial dependence
|
|
14
|
+
3. **Generate Local Explanations**: SHAP/LIME for sample predictions
|
|
15
|
+
4. **Create Report**: Comprehensive explainability documentation
|
|
16
|
+
|
|
17
|
+
## Explainability Steps
|
|
18
|
+
|
|
19
|
+
### Step 1: Feature Importance
|
|
20
|
+
```python
|
|
21
|
+
from specweave import ModelExplainer
|
|
22
|
+
|
|
23
|
+
explainer = ModelExplainer(model, X_train)
|
|
24
|
+
importance = explainer.feature_importance()
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Create: `feature-importance.png`
|
|
28
|
+
|
|
29
|
+
### Step 2: SHAP Summary
|
|
30
|
+
```python
|
|
31
|
+
shap_values = explainer.shap_summary()
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Create: `shap-summary.png` (beeswarm plot)
|
|
35
|
+
|
|
36
|
+
### Step 3: Partial Dependence Plots
|
|
37
|
+
```python
|
|
38
|
+
for feature in top_features:
|
|
39
|
+
pdp = explainer.partial_dependence(feature)
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Create: `pdp-plots/` directory
|
|
43
|
+
|
|
44
|
+
### Step 4: Local Explanations
|
|
45
|
+
```python
|
|
46
|
+
# Explain sample predictions
|
|
47
|
+
samples = [high_confidence, low_confidence, edge_case]
|
|
48
|
+
for sample in samples:
|
|
49
|
+
explanation = explainer.explain_prediction(sample)
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Create: `local-explanations/` directory
|
|
53
|
+
|
|
54
|
+
### Step 5: Generate Report
|
|
55
|
+
|
|
56
|
+
Create `explainability-report.md`:
|
|
57
|
+
|
|
58
|
+
```markdown
|
|
59
|
+
# Model Explainability Report
|
|
60
|
+
|
|
61
|
+
## Global Feature Importance
|
|
62
|
+
[Top 10 features with importance scores]
|
|
63
|
+
|
|
64
|
+
## SHAP Analysis
|
|
65
|
+
[Summary plot and interpretation]
|
|
66
|
+
|
|
67
|
+
## Partial Dependence
|
|
68
|
+
[How each feature affects predictions]
|
|
69
|
+
|
|
70
|
+
## Example Explanations
|
|
71
|
+
[3-5 example predictions with full explanations]
|
|
72
|
+
|
|
73
|
+
## Recommendations
|
|
74
|
+
[Model improvements based on feature analysis]
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Output
|
|
78
|
+
|
|
79
|
+
Report:
|
|
80
|
+
- Top 10 most important features
|
|
81
|
+
- Any surprising feature importance (might indicate data leakage)
|
|
82
|
+
- Model behavior insights
|
|
83
|
+
- Recommendations for improvement
|