@relipa/ai-flow-kit 0.1.1-beta.0 → 0.1.2-beta.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.
Files changed (247) hide show
  1. package/README.md +0 -0
  2. package/bin/aiflow.js +55 -2
  3. package/bin/ak.js +0 -0
  4. package/custom/mcp-presets/README.md +204 -204
  5. package/custom/mcp-presets/backlog.json +0 -0
  6. package/custom/mcp-presets/figma-desktop.json +0 -0
  7. package/custom/mcp-presets/figma.json +0 -0
  8. package/custom/mcp-presets/gitnexus.json +0 -0
  9. package/custom/mcp-presets/google-sheets.json +0 -0
  10. package/custom/mcp-presets/jira.json +0 -0
  11. package/custom/prompts/bug-fix.md +0 -0
  12. package/custom/prompts/feature.md +0 -0
  13. package/custom/prompts/investigation.md +0 -0
  14. package/custom/rules/code-style.md +0 -0
  15. package/custom/rules/java/code-style.md +0 -0
  16. package/custom/rules/java/naming.md +0 -0
  17. package/custom/rules/java/review-checklist.md +0 -0
  18. package/custom/rules/java/spring-boot-examples.md +0 -0
  19. package/custom/rules/javascript/code-style.md +0 -0
  20. package/custom/rules/javascript/naming.md +0 -0
  21. package/custom/rules/ml-conventions.md +88 -0
  22. package/custom/rules/ml-review-checklist.md +14 -0
  23. package/custom/rules/naming.md +0 -0
  24. package/custom/rules/php/code-style.md +0 -0
  25. package/custom/rules/php/naming.md +0 -0
  26. package/custom/rules/project-conventions.md +0 -0
  27. package/custom/rules/review-checklist.md +0 -0
  28. package/custom/skills/deploy-model/SKILL.md +90 -0
  29. package/custom/skills/design-experiment/SKILL.md +88 -0
  30. package/custom/skills/evaluate-model/SKILL.md +93 -0
  31. package/custom/skills/explore-data/SKILL.md +87 -0
  32. package/custom/skills/figma-to-component/SKILL.md +164 -59
  33. package/custom/skills/frame-ml-problem/SKILL.md +88 -0
  34. package/custom/skills/generate-spec/SKILL.md +0 -0
  35. package/custom/skills/impact-analysis/SKILL.md +0 -0
  36. package/custom/skills/improve-algorithm/SKILL.md +74 -0
  37. package/custom/skills/investigate-bug/SKILL.md +0 -0
  38. package/custom/skills/read-study-requirement/SKILL.md +0 -0
  39. package/custom/skills/report-customer/SKILL.md +0 -0
  40. package/custom/skills/review-plan/SKILL.md +0 -0
  41. package/custom/skills/train-model/SKILL.md +78 -0
  42. package/custom/templates/laravel.md +0 -0
  43. package/custom/templates/nestjs.md +0 -0
  44. package/custom/templates/nextjs.md +0 -0
  45. package/custom/templates/nodejs-express.md +0 -0
  46. package/custom/templates/php-plain.md +0 -0
  47. package/custom/templates/php.md +0 -0
  48. package/custom/templates/python-django.md +0 -0
  49. package/custom/templates/python-fastapi.md +0 -0
  50. package/custom/templates/python-ml.md +273 -0
  51. package/custom/templates/python.md +0 -0
  52. package/custom/templates/reactjs.md +0 -0
  53. package/custom/templates/shared/gate-workflow.md +0 -0
  54. package/custom/templates/shared/ml-gate-workflow.md +103 -0
  55. package/custom/templates/spring-boot.md +0 -0
  56. package/custom/templates/tools/claude.md +0 -0
  57. package/custom/templates/tools/copilot.md +0 -0
  58. package/custom/templates/tools/cursor.md +0 -0
  59. package/custom/templates/tools/gemini.md +0 -0
  60. package/custom/templates/tools/generic.md +0 -0
  61. package/custom/templates/vue-nuxt.md +0 -0
  62. package/docs/common/AIFLOW.md +512 -512
  63. package/docs/common/CHANGELOG.md +16 -0
  64. package/docs/common/QUICK_START.md +0 -0
  65. package/docs/common/ai-integration.md +0 -0
  66. package/docs/common/cli-reference.md +0 -0
  67. package/docs/common/configuration.md +0 -0
  68. package/docs/common/getting-started.md +0 -0
  69. package/docs/common/troubleshooting.md +0 -0
  70. package/docs/common/workflows/bug-fix.md +0 -0
  71. package/docs/common/workflows/feature.md +0 -0
  72. package/docs/common/workflows/figma.md +0 -0
  73. package/docs/common/workflows/impact-analysis.md +0 -0
  74. package/docs/common/workflows/investigation.md +0 -0
  75. package/docs/common/workflows/refactor.md +0 -0
  76. package/docs/project/ARCHITECTURE.md +0 -0
  77. package/index.js +0 -0
  78. package/package.json +2 -2
  79. package/scripts/checkpoint.js +0 -0
  80. package/scripts/config.js +0 -0
  81. package/scripts/context.js +0 -0
  82. package/scripts/create-score-excel.js +0 -0
  83. package/scripts/detect.js +239 -239
  84. package/scripts/doctor.js +192 -218
  85. package/scripts/gitnexus-worker.js +0 -0
  86. package/scripts/guide.js +0 -0
  87. package/scripts/hooks/block-git-write.js +0 -0
  88. package/scripts/hooks/session-start.js +0 -0
  89. package/scripts/hooks/session-stop.js +0 -0
  90. package/scripts/init.js +1112 -1009
  91. package/scripts/link-resolver.js +0 -0
  92. package/scripts/memory.js +0 -0
  93. package/scripts/prompt.js +538 -538
  94. package/scripts/remove.js +0 -0
  95. package/scripts/task.js +546 -546
  96. package/scripts/telemetry/cli.js +0 -0
  97. package/scripts/telemetry/config.js +0 -0
  98. package/scripts/telemetry/crypto.js +0 -0
  99. package/scripts/telemetry/flush.js +0 -0
  100. package/scripts/telemetry/record.js +0 -0
  101. package/scripts/update.js +10 -7
  102. package/scripts/use.js +33 -12
  103. package/scripts/validate.js +0 -0
  104. package/upstream/.claude-plugin/marketplace.json +0 -0
  105. package/upstream/.claude-plugin/plugin.json +0 -0
  106. package/upstream/.codex/INSTALL.md +0 -0
  107. package/upstream/.cursor-plugin/plugin.json +0 -0
  108. package/upstream/.gitattributes +0 -0
  109. package/upstream/.github/FUNDING.yml +0 -0
  110. package/upstream/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  111. package/upstream/.github/ISSUE_TEMPLATE/config.yml +0 -0
  112. package/upstream/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  113. package/upstream/.github/ISSUE_TEMPLATE/platform_support.md +0 -0
  114. package/upstream/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  115. package/upstream/.opencode/INSTALL.md +0 -0
  116. package/upstream/.opencode/plugins/superpowers.js +0 -0
  117. package/upstream/.version-bump.json +0 -0
  118. package/upstream/AGENTS.md +0 -0
  119. package/upstream/CHANGELOG.md +0 -0
  120. package/upstream/CLAUDE.md +0 -0
  121. package/upstream/CODE_OF_CONDUCT.md +0 -0
  122. package/upstream/GEMINI.md +0 -0
  123. package/upstream/LICENSE +0 -0
  124. package/upstream/README.md +0 -0
  125. package/upstream/RELEASE-NOTES.md +0 -0
  126. package/upstream/agents/code-reviewer.md +0 -0
  127. package/upstream/commands/brainstorm.md +0 -0
  128. package/upstream/commands/execute-plan.md +0 -0
  129. package/upstream/commands/write-plan.md +0 -0
  130. package/upstream/docs/README.codex.md +0 -0
  131. package/upstream/docs/README.opencode.md +0 -0
  132. package/upstream/docs/plans/2025-11-22-opencode-support-design.md +0 -0
  133. package/upstream/docs/plans/2025-11-22-opencode-support-implementation.md +0 -0
  134. package/upstream/docs/plans/2025-11-28-skills-improvements-from-user-feedback.md +0 -0
  135. package/upstream/docs/plans/2026-01-17-visual-brainstorming.md +0 -0
  136. package/upstream/docs/superpowers/plans/2026-01-22-document-review-system.md +0 -0
  137. package/upstream/docs/superpowers/plans/2026-02-19-visual-brainstorming-refactor.md +0 -0
  138. package/upstream/docs/superpowers/plans/2026-03-11-zero-dep-brainstorm-server.md +0 -0
  139. package/upstream/docs/superpowers/plans/2026-03-23-codex-app-compatibility.md +0 -0
  140. package/upstream/docs/superpowers/specs/2026-01-22-document-review-system-design.md +0 -0
  141. package/upstream/docs/superpowers/specs/2026-02-19-visual-brainstorming-refactor-design.md +0 -0
  142. package/upstream/docs/superpowers/specs/2026-03-11-zero-dep-brainstorm-server-design.md +0 -0
  143. package/upstream/docs/superpowers/specs/2026-03-23-codex-app-compatibility-design.md +0 -0
  144. package/upstream/docs/testing.md +0 -0
  145. package/upstream/docs/windows/polyglot-hooks.md +0 -0
  146. package/upstream/gemini-extension.json +0 -0
  147. package/upstream/hooks/hooks-cursor.json +0 -0
  148. package/upstream/hooks/hooks.json +0 -0
  149. package/upstream/hooks/run-hook.cmd +0 -0
  150. package/upstream/hooks/session-start +0 -0
  151. package/upstream/package.json +0 -0
  152. package/upstream/scripts/bump-version.sh +0 -0
  153. package/upstream/skills/brainstorming/SKILL.md +0 -0
  154. package/upstream/skills/brainstorming/scripts/frame-template.html +0 -0
  155. package/upstream/skills/brainstorming/scripts/helper.js +0 -0
  156. package/upstream/skills/brainstorming/scripts/server.cjs +0 -0
  157. package/upstream/skills/brainstorming/scripts/start-server.sh +0 -0
  158. package/upstream/skills/brainstorming/scripts/stop-server.sh +0 -0
  159. package/upstream/skills/brainstorming/spec-document-reviewer-prompt.md +0 -0
  160. package/upstream/skills/brainstorming/visual-companion.md +0 -0
  161. package/upstream/skills/dispatching-parallel-agents/SKILL.md +0 -0
  162. package/upstream/skills/executing-plans/SKILL.md +0 -0
  163. package/upstream/skills/finishing-a-development-branch/SKILL.md +0 -0
  164. package/upstream/skills/receiving-code-review/SKILL.md +0 -0
  165. package/upstream/skills/requesting-code-review/SKILL.md +0 -0
  166. package/upstream/skills/requesting-code-review/code-reviewer.md +0 -0
  167. package/upstream/skills/subagent-driven-development/SKILL.md +0 -0
  168. package/upstream/skills/subagent-driven-development/code-quality-reviewer-prompt.md +0 -0
  169. package/upstream/skills/subagent-driven-development/implementer-prompt.md +0 -0
  170. package/upstream/skills/subagent-driven-development/spec-reviewer-prompt.md +0 -0
  171. package/upstream/skills/systematic-debugging/CREATION-LOG.md +0 -0
  172. package/upstream/skills/systematic-debugging/SKILL.md +0 -0
  173. package/upstream/skills/systematic-debugging/condition-based-waiting-example.ts +0 -0
  174. package/upstream/skills/systematic-debugging/condition-based-waiting.md +0 -0
  175. package/upstream/skills/systematic-debugging/defense-in-depth.md +0 -0
  176. package/upstream/skills/systematic-debugging/find-polluter.sh +0 -0
  177. package/upstream/skills/systematic-debugging/root-cause-tracing.md +0 -0
  178. package/upstream/skills/systematic-debugging/test-academic.md +0 -0
  179. package/upstream/skills/systematic-debugging/test-pressure-1.md +0 -0
  180. package/upstream/skills/systematic-debugging/test-pressure-2.md +0 -0
  181. package/upstream/skills/systematic-debugging/test-pressure-3.md +0 -0
  182. package/upstream/skills/tdd-lean/SKILL.md +0 -0
  183. package/upstream/skills/test-driven-development/SKILL.md +0 -0
  184. package/upstream/skills/test-driven-development/testing-anti-patterns.md +0 -0
  185. package/upstream/skills/using-git-worktrees/SKILL.md +0 -0
  186. package/upstream/skills/using-superpowers/SKILL.md +0 -0
  187. package/upstream/skills/using-superpowers/references/codex-tools.md +0 -0
  188. package/upstream/skills/using-superpowers/references/copilot-tools.md +0 -0
  189. package/upstream/skills/using-superpowers/references/gemini-tools.md +0 -0
  190. package/upstream/skills/verification-before-completion/SKILL.md +0 -0
  191. package/upstream/skills/writing-plans/SKILL.md +0 -0
  192. package/upstream/skills/writing-plans/plan-document-reviewer-prompt.md +0 -0
  193. package/upstream/skills/writing-skills/SKILL.md +0 -0
  194. package/upstream/skills/writing-skills/anthropic-best-practices.md +0 -0
  195. package/upstream/skills/writing-skills/examples/CLAUDE_MD_TESTING.md +0 -0
  196. package/upstream/skills/writing-skills/graphviz-conventions.dot +0 -0
  197. package/upstream/skills/writing-skills/persuasion-principles.md +0 -0
  198. package/upstream/skills/writing-skills/render-graphs.js +0 -0
  199. package/upstream/skills/writing-skills/testing-skills-with-subagents.md +0 -0
  200. package/upstream/tests/brainstorm-server/package-lock.json +0 -0
  201. package/upstream/tests/brainstorm-server/package.json +0 -0
  202. package/upstream/tests/brainstorm-server/server.test.js +0 -0
  203. package/upstream/tests/brainstorm-server/windows-lifecycle.test.sh +0 -0
  204. package/upstream/tests/brainstorm-server/ws-protocol.test.js +0 -0
  205. package/upstream/tests/claude-code/README.md +0 -0
  206. package/upstream/tests/claude-code/analyze-token-usage.py +0 -0
  207. package/upstream/tests/claude-code/run-skill-tests.sh +0 -0
  208. package/upstream/tests/claude-code/test-document-review-system.sh +0 -0
  209. package/upstream/tests/claude-code/test-helpers.sh +0 -0
  210. package/upstream/tests/claude-code/test-subagent-driven-development-integration.sh +0 -0
  211. package/upstream/tests/claude-code/test-subagent-driven-development.sh +0 -0
  212. package/upstream/tests/explicit-skill-requests/prompts/action-oriented.txt +0 -0
  213. package/upstream/tests/explicit-skill-requests/prompts/after-planning-flow.txt +0 -0
  214. package/upstream/tests/explicit-skill-requests/prompts/claude-suggested-it.txt +0 -0
  215. package/upstream/tests/explicit-skill-requests/prompts/i-know-what-sdd-means.txt +0 -0
  216. package/upstream/tests/explicit-skill-requests/prompts/mid-conversation-execute-plan.txt +0 -0
  217. package/upstream/tests/explicit-skill-requests/prompts/please-use-brainstorming.txt +0 -0
  218. package/upstream/tests/explicit-skill-requests/prompts/skip-formalities.txt +0 -0
  219. package/upstream/tests/explicit-skill-requests/prompts/subagent-driven-development-please.txt +0 -0
  220. package/upstream/tests/explicit-skill-requests/prompts/use-systematic-debugging.txt +0 -0
  221. package/upstream/tests/explicit-skill-requests/run-all.sh +0 -0
  222. package/upstream/tests/explicit-skill-requests/run-claude-describes-sdd.sh +0 -0
  223. package/upstream/tests/explicit-skill-requests/run-extended-multiturn-test.sh +0 -0
  224. package/upstream/tests/explicit-skill-requests/run-haiku-test.sh +0 -0
  225. package/upstream/tests/explicit-skill-requests/run-multiturn-test.sh +0 -0
  226. package/upstream/tests/explicit-skill-requests/run-test.sh +0 -0
  227. package/upstream/tests/opencode/run-tests.sh +0 -0
  228. package/upstream/tests/opencode/setup.sh +0 -0
  229. package/upstream/tests/opencode/test-plugin-loading.sh +0 -0
  230. package/upstream/tests/opencode/test-priority.sh +0 -0
  231. package/upstream/tests/opencode/test-tools.sh +0 -0
  232. package/upstream/tests/skill-triggering/prompts/dispatching-parallel-agents.txt +0 -0
  233. package/upstream/tests/skill-triggering/prompts/executing-plans.txt +0 -0
  234. package/upstream/tests/skill-triggering/prompts/requesting-code-review.txt +0 -0
  235. package/upstream/tests/skill-triggering/prompts/systematic-debugging.txt +0 -0
  236. package/upstream/tests/skill-triggering/prompts/test-driven-development.txt +0 -0
  237. package/upstream/tests/skill-triggering/prompts/writing-plans.txt +0 -0
  238. package/upstream/tests/skill-triggering/run-all.sh +0 -0
  239. package/upstream/tests/skill-triggering/run-test.sh +0 -0
  240. package/upstream/tests/subagent-driven-dev/go-fractals/design.md +0 -0
  241. package/upstream/tests/subagent-driven-dev/go-fractals/plan.md +0 -0
  242. package/upstream/tests/subagent-driven-dev/go-fractals/scaffold.sh +0 -0
  243. package/upstream/tests/subagent-driven-dev/run-test.sh +0 -0
  244. package/upstream/tests/subagent-driven-dev/svelte-todo/design.md +0 -0
  245. package/upstream/tests/subagent-driven-dev/svelte-todo/plan.md +0 -0
  246. package/upstream/tests/subagent-driven-dev/svelte-todo/scaffold.sh +0 -0
  247. package/scripts/score_members.js +0 -320
@@ -0,0 +1,90 @@
1
+ ---
2
+ name: deploy-model
3
+ description: Package and ship a model — versioned artifact, serving API, model card, and a monitoring plan for production.
4
+ keywords: deploy, serving, mlops, model card, monitoring, versioning, registry
5
+ ---
6
+
7
+ # Deploy Model
8
+
9
+ > Pairs with `superpowers:requesting-code-review` at Gate 5 — once the model is packaged and the monitoring plan is written, open the PR with the ticket link for peer review before any production rollout.
10
+
11
+ ---
12
+
13
+ ## When to use this skill
14
+
15
+ - Gate 5 of the ML workflow, after the evaluation has been APPROVED
16
+ - Any time a trained model artifact needs to be promoted from experiment to production
17
+ - When a new model version replaces an existing one in a registry or serving endpoint
18
+
19
+ ---
20
+
21
+ ## Steps
22
+
23
+ ### 1. Version the artifact
24
+
25
+ Register the model in the artifact store or model registry (MLflow Model Registry, Weights & Biases Artifacts, or equivalent). The registered entry must include:
26
+
27
+ - Model version number
28
+ - Training data version (DVC hash, dataset URI, or snapshot timestamp)
29
+ - Code commit SHA that produced the artifact
30
+ - Config file used for training (hyperparameters, seed)
31
+
32
+ Without these four identifiers, the artifact cannot be reproduced or audited. Do not promote an unversioned artifact to production.
33
+
34
+ ### 2. Package the full inference pipeline
35
+
36
+ Save the complete end-to-end inference pipeline — preprocessing transforms plus the model — as a single serializable object (sklearn `Pipeline`, MLflow `pyfunc` model, ONNX graph, TorchScript, TF SavedModel, etc.). The packaging must guarantee **train/serve parity**: the identical preprocessing that was applied during training must run at inference time, with no manual re-implementation in the serving layer.
37
+
38
+ Pin the serving environment to the same dependency versions used during training. Document any framework-specific serialization caveats (e.g., custom PyTorch modules, sklearn custom transformers).
39
+
40
+ ### 3. Expose a serving API
41
+
42
+ Build or configure an inference endpoint with the following properties:
43
+
44
+ - **Input validation:** reject malformed or out-of-range inputs with a clear error before they reach the model
45
+ - **Batch and timeout handling:** define the maximum batch size and inference timeout; return a graceful error on timeout
46
+ - **Health check endpoint:** a lightweight `/health` or equivalent that confirms the model is loaded and responsive — required for orchestrators and load balancers
47
+ - **Versioned endpoint path:** include the model version in the route so multiple versions can coexist during a canary or A/B rollout
48
+
49
+ Example minimal stack: FastAPI + uvicorn with a Pydantic input schema for validation.
50
+
51
+ ### 4. Define the monitoring plan
52
+
53
+ Specify what will be observed in production and what actions each signal triggers. The plan must cover:
54
+
55
+ - **Input drift:** statistical test (e.g., KS test, PSI) on feature distributions vs the training baseline; alert threshold
56
+ - **Prediction distribution drift:** shift in output scores or class probabilities; alert threshold
57
+ - **Latency:** p50 / p95 / p99 response times; SLA breach alert
58
+ - **Error rate:** HTTP 5xx and model exception rate; alert threshold
59
+ - **Retraining trigger:** the specific condition (drift score, metric degradation, elapsed time, data volume) that initiates a retraining pipeline run
60
+
61
+ Document the monitoring plan in the model card and link it to the observability tooling (Prometheus, Grafana, Arize, Evidently, etc.).
62
+
63
+ ### 5. Finalize the model card
64
+
65
+ Update the model card drafted at Gate 4 with:
66
+
67
+ - Intended use and out-of-scope uses
68
+ - Training data description (source, version, date range, class balance)
69
+ - Evaluation metrics (held-out results, baseline comparison, per-slice breakdown)
70
+ - Known limitations and failure modes identified in error analysis
71
+ - Monitoring and retraining plan summary
72
+ - Owner name and contact; approval date
73
+
74
+ The model card is the primary audit document for the deployed model.
75
+
76
+ ### 6. Create the PR
77
+
78
+ Invoke `superpowers:requesting-code-review`. Open a PR that includes: serving code, model card, monitoring plan, and any pipeline changes. Link the ticket. Reference the eval report and the registered artifact version in the PR description.
79
+
80
+ ---
81
+
82
+ ## Completion Checklist
83
+
84
+ - [ ] Artifact registered with data version, code commit, and config
85
+ - [ ] Full inference pipeline packaged — preprocessing + model, train/serve parity guaranteed
86
+ - [ ] Serving environment pinned to training-time dependency versions
87
+ - [ ] Inference API includes input validation, batch/timeout handling, and health check
88
+ - [ ] Monitoring plan defined: input drift, prediction drift, latency, error rate, retraining trigger
89
+ - [ ] Model card finalized: intended use, data, metrics, limitations, monitoring summary, owner
90
+ - [ ] PR created with ticket link, eval report reference, and artifact version noted
@@ -0,0 +1,88 @@
1
+ ---
2
+ name: design-experiment
3
+ description: Design a leakage-safe validation strategy and experiment plan with ablations and tracking before training begins.
4
+ keywords: experiment, validation, cross-validation, ablation, tracking, splits
5
+ ---
6
+
7
+ # Design Experiment
8
+
9
+ ## When to use this skill
10
+
11
+ - Gate 2, after the problem framing document (`ml-problem.md`) has been APPROVED
12
+ - Any time a new round of experiments is planned after a framing change
13
+ - Before writing any model training code — the plan must exist first
14
+
15
+ ---
16
+
17
+ ## Steps
18
+
19
+ ### 1. Choose the validation strategy
20
+
21
+ Select the CV scheme that matches the data structure and justify the choice explicitly:
22
+ - **Stratified k-fold:** use when the target is imbalanced; preserves class proportions in every fold
23
+ - **Group k-fold / GroupShuffleSplit:** use when rows belong to named entities (users, patients, stores) and the task requires generalising to unseen entities — random splits would let the same entity appear in train and validation
24
+ - **TimeSeriesSplit:** use for temporal data; always respect chronological order; never shuffle before splitting
25
+
26
+ State the number of folds (or holdout fraction) and why that choice is appropriate given the dataset size and variance of the metric.
27
+
28
+ ### 2. Define the leakage-safe split protocol
29
+
30
+ Specify the exact sequence of operations to prevent any information from the validation or test set contaminating the training fold:
31
+ - **Split before fit:** the train/validation boundary is established before any preprocessing step is fitted
32
+ - **Pipeline inside CV:** all transformations (scaling, encoding, imputation, feature selection) are wrapped in a `Pipeline` (sklearn) or equivalent so they are fit on each training fold and applied to the validation fold — never fit on the combined data
33
+ - **Test set quarantine:** the held-out test set is touched only at Gate 4 evaluation; it is never used to tune hyperparameters or select features
34
+
35
+ ### 3. Enumerate candidate approaches and feature sets
36
+
37
+ List experiments in ascending order of complexity:
38
+ 1. **Baseline** (from `frame-ml-problem`): the simplest reference (majority class, median, or current rule)
39
+ 2. **Simple model** (e.g. logistic regression, linear regression, decision tree) with a minimal feature set
40
+ 3. **Intermediate model** (e.g. gradient-boosted trees) with engineered features
41
+ 4. **Complex model** (e.g. neural network, fine-tuned transformer) if warranted by the problem
42
+
43
+ For each approach, list the feature set explicitly — which raw columns, which engineered features. Separating feature sets from model families makes it possible to attribute performance differences cleanly.
44
+
45
+ ### 4. Define the ablation plan
46
+
47
+ Describe what each experiment isolates. The rule is **one change at a time**:
48
+ - Vary the model family while holding the feature set constant
49
+ - Add a feature group while holding the model constant
50
+ - Vary a key hyperparameter while holding everything else fixed
51
+ - Document the hypothesis for each ablation (what do you expect and why)
52
+
53
+ A plan with no ablations is not acceptable — it produces no actionable insight.
54
+
55
+ ### 5. Set up experiment tracking
56
+
57
+ Define what every tracked run must log before any experiment is executed:
58
+ - **Parameters:** all hyperparameters, including their defaults; the feature set identifier; the validation scheme
59
+ - **Metrics:** primary metric (from Gate 1) per fold + mean ± std; secondary metrics if relevant
60
+ - **Reproducibility metadata:** random seed, data version (hash or DVC tag), git commit SHA
61
+ - Agree on the tracking tool (MLflow, wandb, or simple CSV) and the run-naming convention from `ml-conventions.md` (`[ticket-id]_[approach]_[yyyymmdd-n]`)
62
+
63
+ ### 6. Define the stopping and decision rule
64
+
65
+ State, before any experiment runs, how you will decide which approach moves forward:
66
+ - Which metric on which split is the decision criterion
67
+ - What constitutes a meaningful improvement over the baseline (link to the success threshold from Gate 1)
68
+ - The budget: maximum number of experiments or wall-clock time before a decision is forced
69
+
70
+ An open-ended experiment loop with no stopping rule is out of scope for a gated workflow.
71
+
72
+ ### 7. Output the experiment plan
73
+
74
+ Write all of the above to `plan/[ticket-id]/experiment-plan.md`. The document must be self-contained: a developer who did not attend the framing discussion should be able to reproduce the full experiment sequence from the plan alone.
75
+
76
+ ---
77
+
78
+ ## Completion Checklist
79
+
80
+ - [ ] Validation scheme chosen (stratified k-fold / group k-fold / time-series split) and justified
81
+ - [ ] Leakage-safe split protocol defined (split before fit; transforms inside pipeline; test set quarantined)
82
+ - [ ] Candidate approaches listed in ascending complexity order
83
+ - [ ] Feature sets enumerated per approach
84
+ - [ ] Ablation plan written (one change at a time; hypothesis stated for each ablation)
85
+ - [ ] Experiment tracking configured (params, metrics, seed, data version, git commit)
86
+ - [ ] Run-naming convention agreed and follows `ml-conventions.md`
87
+ - [ ] Stopping and decision rule stated (metric, threshold, experiment budget)
88
+ - [ ] Full plan written to `plan/[ticket-id]/experiment-plan.md`
@@ -0,0 +1,93 @@
1
+ ---
2
+ name: evaluate-model
3
+ description: Rigorous model evaluation — held-out metrics vs baseline, error analysis, and overfitting/leakage/drift detection with reproducibility verification.
4
+ keywords: evaluation, error analysis, overfitting, leakage, robustness, model card
5
+ ---
6
+
7
+ # Evaluate Model
8
+
9
+ > Run `superpowers:verification-before-completion` first — evaluation runs must reproduce cleanly before any success claim is made. If results cannot be reproduced from the logged seed and config, the evaluation is not valid.
10
+
11
+ ---
12
+
13
+ ## When to use this skill
14
+
15
+ - Gate 4 of the ML workflow, after training and iteration are complete
16
+ - Any time a claim about model quality needs to be verified before sharing with stakeholders
17
+ - When preparing the eval report and model card for review
18
+
19
+ ---
20
+
21
+ ## Steps
22
+
23
+ ### 1. Evaluate on the held-out test set
24
+
25
+ Run inference on the test set — the split that was never touched during training or hyperparameter tuning. Report the primary metric agreed in Gate 1. Where feasible, include a confidence interval (bootstrap CI, or Wilson interval for classification). Report secondary metrics if relevant to the use case.
26
+
27
+ ### 2. Compare to baseline and success threshold
28
+
29
+ State pass or fail explicitly:
30
+
31
+ - Did the model beat the baseline (majority class / heuristic / current production model)?
32
+ - Did it meet the success threshold defined in Gate 1?
33
+
34
+ A result that beats baseline but falls short of the threshold is a fail — report it honestly and return to Gate 3 or Gate 1 as appropriate.
35
+
36
+ ### 3. Error analysis
37
+
38
+ Identify where and how the model fails:
39
+
40
+ - Break down the metric by slice (class, demographic, time period, data source, input length, etc.)
41
+ - For classification: examine the confusion matrix; find the most common error patterns
42
+ - Select representative failure cases and inspect them manually — understand the failure mode before claiming the model is production-ready
43
+
44
+ ### 4. Overfitting check
45
+
46
+ Compare train, validation, and test metrics side by side. Plot learning curves (metric vs training set size or epoch). Characterize the gap:
47
+
48
+ - Large train/val gap → overfitting; the model did not generalize
49
+ - Large train/test gap after acceptable val → distribution shift or leakage in val
50
+
51
+ A large gap must be resolved or explained before the evaluation is APPROVED.
52
+
53
+ ### 5. Leakage re-check
54
+
55
+ Re-run all three leakage checks from `explore-data` on the final pipeline:
56
+
57
+ 1. **Target leakage** — does any feature embed information derived from or computed after the target?
58
+ 2. **Train/test contamination** — were any transforms fitted on data that includes test rows? Are there duplicate IDs across splits?
59
+ 3. **Temporal leakage** — for time-ordered data, does any feature use information that would not have been available at prediction time?
60
+
61
+ Document the result of each check. A positive finding is a Gate 1 regression, not a Gate 4 footnote.
62
+
63
+ ### 6. Robustness assessment
64
+
65
+ Test behavior under distribution shifts and edge cases relevant to the production use case:
66
+
67
+ - Inject noise or missing values; check metric degradation
68
+ - Test on known difficult slices (rare classes, short inputs, boundary values)
69
+ - If the model affects decisions about people, check for disparate performance across sensitive groups and flag for review
70
+
71
+ ### 7. Verify reproducibility
72
+
73
+ Re-run the final eval using only the logged seed, the pinned config, and the registered data version. Confirm the reported number matches to within numerical noise. If it does not reproduce, stop — do not proceed to Gate 5 until the discrepancy is resolved.
74
+
75
+ ### 8. Write the eval report and model card
76
+
77
+ Output `plan/[ticket-id]/eval-report.md` containing: the metric table (baseline, threshold, achieved), error analysis findings, overfitting gap, leakage check results, and robustness notes.
78
+
79
+ Draft a model card covering: intended use, training data description, evaluation metrics and their context, known limitations, and owner/contact.
80
+
81
+ ---
82
+
83
+ ## Completion Checklist
84
+
85
+ - [ ] Held-out test metric reported with confidence interval where feasible
86
+ - [ ] Explicit pass/fail against baseline and success threshold stated
87
+ - [ ] Error analysis performed — worst slices, confusion patterns, representative failure cases
88
+ - [ ] Train / validation / test gap inspected; learning curves reviewed
89
+ - [ ] All three leakage types re-checked and documented (target, contamination, temporal)
90
+ - [ ] Robustness assessed under noise, edge cases, and sensitive slices
91
+ - [ ] Result reproduced from logged seed and config — numbers match
92
+ - [ ] `plan/[ticket-id]/eval-report.md` written
93
+ - [ ] Model card drafted (intended use, data, metrics, limitations, owner)
@@ -0,0 +1,87 @@
1
+ ---
2
+ name: explore-data
3
+ description: Systematic EDA and data-quality assessment with explicit data-leakage detection before modeling.
4
+ keywords: eda, data, leakage, data quality, exploration, dataset
5
+ ---
6
+
7
+ # Explore Data
8
+
9
+ > This skill borrows the investigative mindset of `superpowers:systematic-debugging` — form
10
+ > hypotheses about the data, verify each one with evidence, and document what you find.
11
+ > Do not skip a check because the data "looks clean".
12
+
13
+ ---
14
+
15
+ ## When to use this skill
16
+
17
+ - Gate 1, immediately after `frame-ml-problem` has defined the target and metric
18
+ - Any time a new dataset enters the project (new data source, updated extract, external dataset)
19
+ - Before re-training when data distribution changes are suspected
20
+
21
+ ---
22
+
23
+ ## Steps
24
+
25
+ ### 1. Profile the dataset
26
+
27
+ Establish the basic facts before any analysis:
28
+ - **Shape:** row count, column count; confirm against expected data volume from the ticket
29
+ - **dtypes:** numeric, categorical, datetime, free text, binary — flag any type mismatches (e.g. numeric column stored as string)
30
+ - **Missing values:** per-column missing rate; distinguish structural missing (feature does not apply) from random missing (collection gap)
31
+ - **Duplicates:** exact duplicate rows; near-duplicate rows (same entity, slightly different values); duplicate IDs that should be unique
32
+ - **Target distribution:** class balance for classification (report majority-class baseline accuracy); value range, skew, and outliers for regression
33
+
34
+ ### 2. Univariate and bivariate analysis
35
+
36
+ - **Univariate:** distribution shape, outliers, value ranges, cardinality of categoricals
37
+ - **Bivariate:** feature–target correlations or mutual information; flag suspiciously high correlations that may indicate leakage (see Step 3)
38
+ - **Temporal trends:** if a time column exists, plot target rate and key features over time to detect distribution shift
39
+
40
+ ### 3. Leakage detection (mandatory)
41
+
42
+ Run all three checks explicitly and document the result of each — do not skip any.
43
+
44
+ **(a) Target leakage** — features derived from or computed after the target event:
45
+ - Identify any column that could not be known at prediction time (e.g. a "days to resolution" column when predicting whether a ticket will be resolved)
46
+ - Drop or exclude any such column before training
47
+ - Flag columns with suspiciously high predictive power; investigate their origin
48
+
49
+ **(b) Train/test contamination** — information bleeding between splits:
50
+ - Check for duplicate or near-duplicate rows that may span the train and test sets
51
+ - Verify that entity IDs (user IDs, order IDs) do not appear in both splits if the task requires generalising to unseen entities
52
+ - Confirm that scalers, encoders, and imputers will be fit on the training fold only — fitting on the full dataset before splitting is a hard error
53
+
54
+ **(c) Temporal leakage** — using future data to predict the past:
55
+ - If the data has a time dimension, verify that all features for a given row reflect information available strictly before the prediction timestamp
56
+ - Check for lag features or aggregation windows that inadvertently include the target period
57
+ - Time-series splits must respect chronological order; random splits are wrong for temporal data
58
+
59
+ ### 4. Data-quality flags
60
+
61
+ Document any of the following that are present:
62
+ - **Inconsistent units:** mixed currencies, mixed date formats, mixed length units
63
+ - **Label noise:** suspiciously contradictory labels for near-identical features
64
+ - **Sampling bias:** is the historical sample representative of the production population? Check for selection effects (e.g. data collected only from active users)
65
+ - **Train / serving distribution drift:** if serving statistics are available, compare them to training distributions on key features; flag deviations above a sensible threshold
66
+
67
+ ### 5. Record findings in the Gate 1 data report
68
+
69
+ Write the EDA results into the `ml-problem.md` file created by `frame-ml-problem`:
70
+ - Data shape, quality issues, and missing-value strategy
71
+ - Leakage assessment — one paragraph per leakage type stating what was checked and what was found
72
+ - Cleaning actions required before training (drop columns, impute, clip outliers, re-encode)
73
+
74
+ ---
75
+
76
+ ## Completion Checklist
77
+
78
+ - [ ] Dataset shape, dtypes, and missing-value rates profiled
79
+ - [ ] Duplicate rows and duplicate IDs checked
80
+ - [ ] Target distribution inspected (class balance or value distribution)
81
+ - [ ] Univariate and bivariate analysis completed; suspiciously high correlations investigated
82
+ - [ ] **Target leakage** checked and documented (no future-derived features in the feature set)
83
+ - [ ] **Train/test contamination** checked and documented (no ID overlap, no full-data fitting)
84
+ - [ ] **Temporal leakage** checked and documented (chronological integrity verified if applicable)
85
+ - [ ] Data-quality issues listed (units, label noise, sampling bias, drift)
86
+ - [ ] Required cleaning steps noted
87
+ - [ ] All findings written into `plan/[ticket-id]/ml-problem.md` data report section