mindforge-cc 1.0.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 (324) hide show
  1. package/.agent/CLAUDE.md +462 -0
  2. package/.agent/forge/help.md +7 -0
  3. package/.agent/forge/init-project.md +32 -0
  4. package/.agent/forge/plan-phase.md +30 -0
  5. package/.agent/mindforge/approve.md +18 -0
  6. package/.agent/mindforge/audit.md +30 -0
  7. package/.agent/mindforge/benchmark.md +33 -0
  8. package/.agent/mindforge/complete-milestone.md +18 -0
  9. package/.agent/mindforge/debug.md +126 -0
  10. package/.agent/mindforge/discuss-phase.md +138 -0
  11. package/.agent/mindforge/execute-phase.md +165 -0
  12. package/.agent/mindforge/health.md +21 -0
  13. package/.agent/mindforge/help.md +23 -0
  14. package/.agent/mindforge/init-org.md +131 -0
  15. package/.agent/mindforge/init-project.md +155 -0
  16. package/.agent/mindforge/install-skill.md +15 -0
  17. package/.agent/mindforge/map-codebase.md +298 -0
  18. package/.agent/mindforge/metrics.md +22 -0
  19. package/.agent/mindforge/migrate.md +40 -0
  20. package/.agent/mindforge/milestone.md +12 -0
  21. package/.agent/mindforge/next.md +105 -0
  22. package/.agent/mindforge/plan-phase.md +125 -0
  23. package/.agent/mindforge/plugins.md +40 -0
  24. package/.agent/mindforge/pr-review.md +41 -0
  25. package/.agent/mindforge/profile-team.md +23 -0
  26. package/.agent/mindforge/publish-skill.md +19 -0
  27. package/.agent/mindforge/quick.md +135 -0
  28. package/.agent/mindforge/release.md +10 -0
  29. package/.agent/mindforge/retrospective.md +26 -0
  30. package/.agent/mindforge/review.md +157 -0
  31. package/.agent/mindforge/security-scan.md +233 -0
  32. package/.agent/mindforge/ship.md +100 -0
  33. package/.agent/mindforge/skills.md +141 -0
  34. package/.agent/mindforge/status.md +104 -0
  35. package/.agent/mindforge/sync-confluence.md +11 -0
  36. package/.agent/mindforge/sync-jira.md +12 -0
  37. package/.agent/mindforge/tokens.md +8 -0
  38. package/.agent/mindforge/update.md +42 -0
  39. package/.agent/mindforge/verify-phase.md +62 -0
  40. package/.agent/mindforge/workspace.md +29 -0
  41. package/.claude/CLAUDE.md +462 -0
  42. package/.claude/commands/forge/help.md +7 -0
  43. package/.claude/commands/forge/init-project.md +32 -0
  44. package/.claude/commands/forge/plan-phase.md +30 -0
  45. package/.claude/commands/mindforge/approve.md +18 -0
  46. package/.claude/commands/mindforge/audit.md +30 -0
  47. package/.claude/commands/mindforge/benchmark.md +33 -0
  48. package/.claude/commands/mindforge/complete-milestone.md +18 -0
  49. package/.claude/commands/mindforge/debug.md +126 -0
  50. package/.claude/commands/mindforge/discuss-phase.md +138 -0
  51. package/.claude/commands/mindforge/execute-phase.md +165 -0
  52. package/.claude/commands/mindforge/health.md +21 -0
  53. package/.claude/commands/mindforge/help.md +23 -0
  54. package/.claude/commands/mindforge/init-org.md +131 -0
  55. package/.claude/commands/mindforge/init-project.md +155 -0
  56. package/.claude/commands/mindforge/install-skill.md +15 -0
  57. package/.claude/commands/mindforge/map-codebase.md +298 -0
  58. package/.claude/commands/mindforge/metrics.md +22 -0
  59. package/.claude/commands/mindforge/migrate.md +40 -0
  60. package/.claude/commands/mindforge/milestone.md +12 -0
  61. package/.claude/commands/mindforge/next.md +105 -0
  62. package/.claude/commands/mindforge/plan-phase.md +125 -0
  63. package/.claude/commands/mindforge/plugins.md +40 -0
  64. package/.claude/commands/mindforge/pr-review.md +41 -0
  65. package/.claude/commands/mindforge/profile-team.md +23 -0
  66. package/.claude/commands/mindforge/publish-skill.md +19 -0
  67. package/.claude/commands/mindforge/quick.md +135 -0
  68. package/.claude/commands/mindforge/release.md +10 -0
  69. package/.claude/commands/mindforge/retrospective.md +26 -0
  70. package/.claude/commands/mindforge/review.md +157 -0
  71. package/.claude/commands/mindforge/security-scan.md +233 -0
  72. package/.claude/commands/mindforge/ship.md +100 -0
  73. package/.claude/commands/mindforge/skills.md +141 -0
  74. package/.claude/commands/mindforge/status.md +104 -0
  75. package/.claude/commands/mindforge/sync-confluence.md +11 -0
  76. package/.claude/commands/mindforge/sync-jira.md +12 -0
  77. package/.claude/commands/mindforge/tokens.md +8 -0
  78. package/.claude/commands/mindforge/update.md +42 -0
  79. package/.claude/commands/mindforge/verify-phase.md +62 -0
  80. package/.claude/commands/mindforge/workspace.md +29 -0
  81. package/.forge/org/CONVENTIONS.md +0 -0
  82. package/.forge/org/ORG.md +0 -0
  83. package/.forge/org/SECURITY.md +0 -0
  84. package/.forge/org/TOOLS.md +0 -0
  85. package/.forge/personas/analyst.md +0 -0
  86. package/.forge/personas/architect.md +0 -0
  87. package/.forge/personas/debug-specialist.md +0 -0
  88. package/.forge/personas/developer.md +26 -0
  89. package/.forge/personas/qa-engineer.md +0 -0
  90. package/.forge/personas/release-manager.md +0 -0
  91. package/.forge/personas/security-reviewer.md +33 -0
  92. package/.forge/personas/tech-writer.md +0 -0
  93. package/.forge/skills/api-design/SKILL.md +0 -0
  94. package/.forge/skills/code-quality/SKILL.md +0 -0
  95. package/.forge/skills/documentation/SKILL.md +0 -0
  96. package/.forge/skills/security-review/SKILL.md +23 -0
  97. package/.forge/skills/testing-standards/SKILL.md +27 -0
  98. package/.github/workflows/mindforge-ci.yml +224 -0
  99. package/.gitlab-ci-mindforge.yml +18 -0
  100. package/.mindforge/MINDFORGE-SCHEMA.json +165 -0
  101. package/.mindforge/audit/AUDIT-SCHEMA.md +451 -0
  102. package/.mindforge/ci/ci-config-schema.md +21 -0
  103. package/.mindforge/ci/ci-mode.md +179 -0
  104. package/.mindforge/ci/github-actions-adapter.md +224 -0
  105. package/.mindforge/ci/gitlab-ci-adapter.md +31 -0
  106. package/.mindforge/ci/jenkins-adapter.md +44 -0
  107. package/.mindforge/distribution/registry-client.md +166 -0
  108. package/.mindforge/distribution/registry-schema.md +96 -0
  109. package/.mindforge/distribution/skill-publisher.md +44 -0
  110. package/.mindforge/distribution/skill-validator.md +74 -0
  111. package/.mindforge/engine/compaction-protocol.md +182 -0
  112. package/.mindforge/engine/context-injector.md +128 -0
  113. package/.mindforge/engine/dependency-parser.md +113 -0
  114. package/.mindforge/engine/skills/conflict-resolver.md +69 -0
  115. package/.mindforge/engine/skills/loader.md +184 -0
  116. package/.mindforge/engine/skills/registry.md +98 -0
  117. package/.mindforge/engine/skills/versioning.md +75 -0
  118. package/.mindforge/engine/verification-pipeline.md +111 -0
  119. package/.mindforge/engine/wave-executor.md +235 -0
  120. package/.mindforge/governance/GOVERNANCE-CONFIG.md +17 -0
  121. package/.mindforge/governance/approval-workflow.md +37 -0
  122. package/.mindforge/governance/change-classifier.md +63 -0
  123. package/.mindforge/governance/compliance-gates.md +31 -0
  124. package/.mindforge/integrations/confluence.md +27 -0
  125. package/.mindforge/integrations/connection-manager.md +163 -0
  126. package/.mindforge/integrations/github.md +25 -0
  127. package/.mindforge/integrations/gitlab.md +13 -0
  128. package/.mindforge/integrations/jira.md +102 -0
  129. package/.mindforge/integrations/slack.md +41 -0
  130. package/.mindforge/intelligence/antipattern-detector.md +75 -0
  131. package/.mindforge/intelligence/difficulty-scorer.md +55 -0
  132. package/.mindforge/intelligence/health-engine.md +208 -0
  133. package/.mindforge/intelligence/skill-gap-analyser.md +40 -0
  134. package/.mindforge/intelligence/smart-compaction.md +71 -0
  135. package/.mindforge/metrics/METRICS-SCHEMA.md +42 -0
  136. package/.mindforge/metrics/quality-tracker.md +32 -0
  137. package/.mindforge/monorepo/cross-package-planner.md +114 -0
  138. package/.mindforge/monorepo/dependency-graph-builder.md +32 -0
  139. package/.mindforge/monorepo/workspace-detector.md +129 -0
  140. package/.mindforge/org/CONVENTIONS.md +62 -0
  141. package/.mindforge/org/ORG.md +51 -0
  142. package/.mindforge/org/SECURITY.md +50 -0
  143. package/.mindforge/org/TOOLS.md +53 -0
  144. package/.mindforge/org/integrations/INTEGRATIONS-CONFIG.md +58 -0
  145. package/.mindforge/org/skills/MANIFEST.md +38 -0
  146. package/.mindforge/personas/analyst.md +52 -0
  147. package/.mindforge/personas/architect.md +75 -0
  148. package/.mindforge/personas/debug-specialist.md +52 -0
  149. package/.mindforge/personas/developer.md +85 -0
  150. package/.mindforge/personas/overrides/README.md +85 -0
  151. package/.mindforge/personas/qa-engineer.md +61 -0
  152. package/.mindforge/personas/release-manager.md +76 -0
  153. package/.mindforge/personas/security-reviewer.md +91 -0
  154. package/.mindforge/personas/tech-writer.md +51 -0
  155. package/.mindforge/plugins/PLUGINS-MANIFEST.md +23 -0
  156. package/.mindforge/plugins/plugin-loader.md +93 -0
  157. package/.mindforge/plugins/plugin-registry.md +44 -0
  158. package/.mindforge/plugins/plugin-schema.md +68 -0
  159. package/.mindforge/pr-review/ai-reviewer.md +266 -0
  160. package/.mindforge/pr-review/finding-formatter.md +46 -0
  161. package/.mindforge/pr-review/review-prompt-templates.md +44 -0
  162. package/.mindforge/production/compatibility-layer.md +39 -0
  163. package/.mindforge/production/migration-engine.md +52 -0
  164. package/.mindforge/production/production-checklist.md +165 -0
  165. package/.mindforge/production/token-optimiser.md +68 -0
  166. package/.mindforge/skills/accessibility/SKILL.md +106 -0
  167. package/.mindforge/skills/api-design/SKILL.md +98 -0
  168. package/.mindforge/skills/code-quality/SKILL.md +88 -0
  169. package/.mindforge/skills/data-privacy/SKILL.md +126 -0
  170. package/.mindforge/skills/database-patterns/SKILL.md +192 -0
  171. package/.mindforge/skills/documentation/SKILL.md +91 -0
  172. package/.mindforge/skills/incident-response/SKILL.md +180 -0
  173. package/.mindforge/skills/performance/SKILL.md +120 -0
  174. package/.mindforge/skills/security-review/SKILL.md +83 -0
  175. package/.mindforge/skills/testing-standards/SKILL.md +97 -0
  176. package/.mindforge/team/TEAM-PROFILE.md +42 -0
  177. package/.mindforge/team/multi-handoff.md +23 -0
  178. package/.mindforge/team/profiles/README.md +13 -0
  179. package/.mindforge/team/session-merger.md +18 -0
  180. package/.planning/ARCHITECTURE.md +0 -0
  181. package/.planning/AUDIT.jsonl +0 -0
  182. package/.planning/HANDOFF.json +28 -0
  183. package/.planning/PROJECT.md +33 -0
  184. package/.planning/RELEASE-CHECKLIST.md +68 -0
  185. package/.planning/REQUIREMENTS.md +0 -0
  186. package/.planning/ROADMAP.md +0 -0
  187. package/.planning/STATE.md +31 -0
  188. package/.planning/approvals/.gitkeep +1 -0
  189. package/.planning/archive/.gitkeep +1 -0
  190. package/.planning/audit-archive/.gitkeep +1 -0
  191. package/.planning/decisions/.gitkeep +0 -0
  192. package/.planning/decisions/ADR-001-handoff-tracking.md +41 -0
  193. package/.planning/decisions/ADR-002-markdown-commands.md +46 -0
  194. package/.planning/decisions/ADR-003-skills-trigger-model.md +37 -0
  195. package/.planning/decisions/ADR-004-wave-parallelism-model.md +45 -0
  196. package/.planning/decisions/ADR-005-append-only-audit-log.md +51 -0
  197. package/.planning/decisions/ADR-006-tiered-skills-system.md +22 -0
  198. package/.planning/decisions/ADR-007-trigger-keyword-model.md +22 -0
  199. package/.planning/decisions/ADR-008-just-in-time-skill-loading.md +29 -0
  200. package/.planning/decisions/ADR-009-enterprise-integration-retry-policy.md +8 -0
  201. package/.planning/decisions/ADR-010-governance-tier-escalation.md +8 -0
  202. package/.planning/decisions/ADR-011-multi-developer-handoff-contract.md +8 -0
  203. package/.planning/decisions/ADR-012-intelligence-feedback-loops.md +19 -0
  204. package/.planning/decisions/ADR-013-mindforge-md-constitution.md +16 -0
  205. package/.planning/decisions/ADR-014-metrics-as-signals-not-evaluation.md +15 -0
  206. package/.planning/decisions/ADR-015-npm-based-skill-registry.md +26 -0
  207. package/.planning/decisions/ADR-016-ci-exit-code-0-on-timeout.md +27 -0
  208. package/.planning/decisions/ADR-017-sdk-localhost-only.md +28 -0
  209. package/.planning/decisions/ADR-018-installer-self-install-detection.md +15 -0
  210. package/.planning/decisions/ADR-019-self-update-scope-preservation.md +14 -0
  211. package/.planning/decisions/ADR-020-v1.0.0-stable-interface-contract.md +23 -0
  212. package/.planning/jira-sync.json +9 -0
  213. package/.planning/milestones/.gitkeep +1 -0
  214. package/.planning/phases/day1/REVIEW-DAY1.md +50 -0
  215. package/.planning/phases/day1/SECURITY-REVIEW-DAY1.md +15 -0
  216. package/.planning/phases/day2/REVIEW-DAY2.md +521 -0
  217. package/.planning/phases/day3/REVIEW-DAY3.md +234 -0
  218. package/.planning/slack-threads.json +6 -0
  219. package/CHANGELOG.md +175 -0
  220. package/LICENSE +21 -0
  221. package/MINDFORGE.md +76 -0
  222. package/README.md +182 -0
  223. package/RELEASENOTES.md +41 -0
  224. package/SECURITY.md +4 -0
  225. package/bin/install.js +120 -0
  226. package/bin/installer-core.js +292 -0
  227. package/bin/migrations/0.1.0-to-0.5.0.js +37 -0
  228. package/bin/migrations/0.5.0-to-0.6.0.js +17 -0
  229. package/bin/migrations/0.6.0-to-1.0.0.js +100 -0
  230. package/bin/migrations/migrate.js +151 -0
  231. package/bin/migrations/schema-versions.js +64 -0
  232. package/bin/updater/changelog-fetcher.js +62 -0
  233. package/bin/updater/self-update.js +169 -0
  234. package/bin/updater/version-comparator.js +68 -0
  235. package/bin/validate-config.js +92 -0
  236. package/bin/wizard/config-generator.js +112 -0
  237. package/bin/wizard/environment-detector.js +76 -0
  238. package/bin/wizard/setup-wizard.js +237 -0
  239. package/docs/Context/Master-Context.md +701 -0
  240. package/docs/architecture/README.md +35 -0
  241. package/docs/architecture/decision-records-index.md +26 -0
  242. package/docs/ci-cd-integration.md +30 -0
  243. package/docs/ci-quickstart.md +78 -0
  244. package/docs/commands-reference.md +11 -0
  245. package/docs/contributing/CONTRIBUTING.md +38 -0
  246. package/docs/contributing/plugin-authoring.md +50 -0
  247. package/docs/contributing/skill-authoring.md +41 -0
  248. package/docs/enterprise-setup.md +25 -0
  249. package/docs/faq.md +38 -0
  250. package/docs/getting-started.md +36 -0
  251. package/docs/governance-guide.md +23 -0
  252. package/docs/mindforge-md-reference.md +53 -0
  253. package/docs/monorepo-guide.md +26 -0
  254. package/docs/persona-customisation.md +56 -0
  255. package/docs/quick-verify.md +33 -0
  256. package/docs/reference/audit-events.md +53 -0
  257. package/docs/reference/commands.md +82 -0
  258. package/docs/reference/config-reference.md +64 -0
  259. package/docs/reference/sdk-api.md +48 -0
  260. package/docs/reference/skills-api.md +57 -0
  261. package/docs/release-checklist-guide.md +37 -0
  262. package/docs/requirements.md +29 -0
  263. package/docs/sdk-reference.md +27 -0
  264. package/docs/security/SECURITY.md +42 -0
  265. package/docs/security/penetration-test-results.md +31 -0
  266. package/docs/security/threat-model.md +142 -0
  267. package/docs/skills-authoring-guide.md +119 -0
  268. package/docs/skills-publishing-guide.md +21 -0
  269. package/docs/team-setup-guide.md +21 -0
  270. package/docs/troubleshooting.md +119 -0
  271. package/docs/tutorial.md +195 -0
  272. package/docs/upgrade.md +44 -0
  273. package/docs/user-guide.md +131 -0
  274. package/docs/usp-features.md +214 -0
  275. package/eslint.config.mjs +31 -0
  276. package/examples/starter-project/.planning/AUDIT.jsonl +1 -0
  277. package/examples/starter-project/.planning/HANDOFF.json +23 -0
  278. package/examples/starter-project/.planning/PROJECT.md +27 -0
  279. package/examples/starter-project/.planning/STATE.md +10 -0
  280. package/examples/starter-project/MINDFORGE.md +40 -0
  281. package/examples/starter-project/README.md +14 -0
  282. package/implementation-roadmap/day-1-imp/DAY1-HARDEN.md +823 -0
  283. package/implementation-roadmap/day-1-imp/DAY1-IMPLEMENT.md +2459 -0
  284. package/implementation-roadmap/day-1-imp/DAY1-REVIEW.md +288 -0
  285. package/implementation-roadmap/day-2-imp/DAY2-HARDEN.md +954 -0
  286. package/implementation-roadmap/day-2-imp/DAY2-IMPLEMENT.md +2347 -0
  287. package/implementation-roadmap/day-2-imp/DAY2-REVIEW.md +422 -0
  288. package/implementation-roadmap/day-3-imp/DAY3-HARDEN.md +870 -0
  289. package/implementation-roadmap/day-3-imp/DAY3-IMPLEMENT.md +2798 -0
  290. package/implementation-roadmap/day-3-imp/DAY3-REVIEW.md +484 -0
  291. package/implementation-roadmap/day-4-imp/DAY4-HARDEN.md +1087 -0
  292. package/implementation-roadmap/day-4-imp/DAY4-IMPLEMENT.md +2874 -0
  293. package/implementation-roadmap/day-4-imp/DAY4-REVIEW.md +386 -0
  294. package/implementation-roadmap/day-5-imp/DAY5-HARDEN.md +1078 -0
  295. package/implementation-roadmap/day-5-imp/DAY5-IMPLEMENT.md +3151 -0
  296. package/implementation-roadmap/day-5-imp/DAY5-REVIEW.md +345 -0
  297. package/implementation-roadmap/day-6-imp/DAY6-COMPLETE.md +3919 -0
  298. package/implementation-roadmap/day-7-imp-prod/DAY7-PRODUCTION-FINAL.md +4513 -0
  299. package/package.json +31 -0
  300. package/sdk/README.md +69 -0
  301. package/sdk/eslint.config.mjs +34 -0
  302. package/sdk/package-lock.json +1507 -0
  303. package/sdk/package.json +30 -0
  304. package/sdk/src/client.ts +133 -0
  305. package/sdk/src/commands.ts +63 -0
  306. package/sdk/src/events.ts +166 -0
  307. package/sdk/src/index.ts +22 -0
  308. package/sdk/src/types.ts +87 -0
  309. package/sdk/tsconfig.json +13 -0
  310. package/tests/audit.test.js +206 -0
  311. package/tests/ci-mode.test.js +162 -0
  312. package/tests/compaction.test.js +161 -0
  313. package/tests/distribution.test.js +205 -0
  314. package/tests/e2e.test.js +618 -0
  315. package/tests/governance.test.js +130 -0
  316. package/tests/install.test.js +209 -0
  317. package/tests/integrations.test.js +128 -0
  318. package/tests/intelligence.test.js +117 -0
  319. package/tests/metrics.test.js +96 -0
  320. package/tests/migration.test.js +309 -0
  321. package/tests/production.test.js +416 -0
  322. package/tests/sdk.test.js +200 -0
  323. package/tests/skills-platform.test.js +403 -0
  324. package/tests/wave-engine.test.js +338 -0
@@ -0,0 +1,2798 @@
1
+ # MindForge — Day 3 Implementation Prompt
2
+ # Branch: `feat/mindforge-skills-platform`
3
+ # Prerequisite: `feat/mindforge-wave-engine` merged to `main`
4
+
5
+ ---
6
+
7
+ ## BRANCH SETUP (run before anything else)
8
+
9
+ ```bash
10
+ git checkout main
11
+ git pull origin main
12
+ git checkout -b feat/mindforge-skills-platform
13
+ ```
14
+
15
+ Verify Day 1 and Day 2 are fully present:
16
+
17
+ ```bash
18
+ ls .mindforge/engine/wave-executor.md # Day 2 engine
19
+ ls .mindforge/engine/compaction-protocol.md # Day 2 compaction
20
+ ls .planning/AUDIT.jsonl # Day 2 audit
21
+ ls .claude/commands/mindforge/next.md # Day 2 commands
22
+ node tests/install.test.js && \
23
+ node tests/wave-engine.test.js && \
24
+ node tests/audit.test.js && \
25
+ node tests/compaction.test.js
26
+ # All must pass before Day 3 begins
27
+ ```
28
+
29
+ If any test fails — stop. Do not start Day 3 on a broken Day 2.
30
+
31
+ ---
32
+
33
+ ## DAY 3 SCOPE
34
+
35
+ Day 3 builds the **Skills & Intelligence Platform** — the layer that makes
36
+ MindForge's agents genuinely expert rather than generically capable.
37
+
38
+ | Component | Description |
39
+ |---|---|
40
+ | Skills distribution system | Tiered skill registry: Core → Org → Project |
41
+ | 5 new skill packs | performance, accessibility, data-privacy, incident-response, database-patterns |
42
+ | Skills versioning engine | Semver for skills, compatibility checks, upgrade path |
43
+ | `/mindforge:skills` command | Full CLI: list, add, update, validate, info |
44
+ | `/mindforge:review` command | Full code review using code-quality + security skill |
45
+ | `/mindforge:security-scan` command | Standalone security scan on any path or diff |
46
+ | `/mindforge:map-codebase` command | Brownfield project onboarding — analyse any codebase |
47
+ | `/mindforge:discuss-phase` command | Pre-planning discussion to capture implementation decisions |
48
+ | Persona customisation system | Override persona defaults per project or per phase |
49
+ | Skills auto-loader upgrade | Multi-skill loading, conflict resolution, priority ordering |
50
+ | `tests/skills-platform.test.js` | Full test suite for Day 3 components |
51
+
52
+ **Do not** implement on Day 3:
53
+ - Jira / Confluence / Slack integrations (Day 4)
54
+ - Team collaboration and multi-developer HANDOFF (Day 4)
55
+ - GUI dashboard (Day 5+)
56
+ - Public skills registry / npm-distributed skills (Day 5+)
57
+
58
+ ---
59
+
60
+ ## TASK 1 — Scaffold Day 3 directory additions
61
+
62
+ ```bash
63
+ # Skills platform engine
64
+ mkdir -p .mindforge/engine/skills
65
+ touch .mindforge/engine/skills/registry.md
66
+ touch .mindforge/engine/skills/loader.md
67
+ touch .mindforge/engine/skills/versioning.md
68
+ touch .mindforge/engine/skills/conflict-resolver.md
69
+
70
+ # 5 new skill packs
71
+ mkdir -p .mindforge/skills/performance
72
+ mkdir -p .mindforge/skills/accessibility
73
+ mkdir -p .mindforge/skills/data-privacy
74
+ mkdir -p .mindforge/skills/incident-response
75
+ mkdir -p .mindforge/skills/database-patterns
76
+ touch .mindforge/skills/performance/SKILL.md
77
+ touch .mindforge/skills/accessibility/SKILL.md
78
+ touch .mindforge/skills/data-privacy/SKILL.md
79
+ touch .mindforge/skills/incident-response/SKILL.md
80
+ touch .mindforge/skills/database-patterns/SKILL.md
81
+
82
+ # Persona customisation system
83
+ mkdir -p .mindforge/personas/overrides
84
+ touch .mindforge/personas/overrides/README.md
85
+
86
+ # Org-level skill distribution
87
+ mkdir -p .mindforge/org/skills
88
+ touch .mindforge/org/skills/MANIFEST.md
89
+
90
+ # New commands
91
+ touch .claude/commands/mindforge/skills.md
92
+ touch .claude/commands/mindforge/review.md
93
+ touch .claude/commands/mindforge/security-scan.md
94
+ touch .claude/commands/mindforge/map-codebase.md
95
+ touch .claude/commands/mindforge/discuss-phase.md
96
+
97
+ # Mirror to Antigravity
98
+ for cmd in skills review security-scan map-codebase discuss-phase; do
99
+ cp .claude/commands/mindforge/${cmd}.md .agent/mindforge/${cmd}.md
100
+ done
101
+
102
+ # Tests
103
+ touch tests/skills-platform.test.js
104
+
105
+ # Docs
106
+ touch docs/skills-authoring-guide.md
107
+ touch docs/persona-customisation.md
108
+ ```
109
+
110
+ **Commit:**
111
+ ```bash
112
+ git add .
113
+ git commit -m "chore(day3): scaffold Day 3 skills platform directory structure"
114
+ ```
115
+
116
+ ---
117
+
118
+ ## TASK 2 — Write the Skills Registry and Distribution System
119
+
120
+ The registry is the source of truth for what skills exist, where they live,
121
+ and whether they are compatible with the current MindForge version.
122
+
123
+ ---
124
+
125
+ ### `.mindforge/engine/skills/registry.md`
126
+
127
+ ```markdown
128
+ # MindForge Skills Engine — Registry
129
+
130
+ ## Purpose
131
+ The skills registry tracks every available skill pack across all three tiers,
132
+ their versions, trigger keywords, compatibility requirements, and source locations.
133
+ The registry is the first thing the skills loader reads.
134
+
135
+ ## Registry file location
136
+ `.mindforge/org/skills/MANIFEST.md` — org-level manifest (shared via git)
137
+
138
+ ## Manifest format
139
+
140
+ The MANIFEST.md uses a structured table format readable by both humans and agents:
141
+
142
+ ```markdown
143
+ # MindForge Skills Manifest
144
+ # Version: 1.0.0
145
+ # MindForge compatibility: >=0.1.0
146
+ # Last updated: [ISO-8601]
147
+
148
+ ## Core Skills (Tier 1 — maintained by MindForge)
149
+
150
+ | Name | Version | Status | Min MindForge | Triggers (excerpt) |
151
+ |---|---|---|---|---|
152
+ | security-review | 1.0.0 | stable | 0.1.0 | auth, password, token, JWT |
153
+ | code-quality | 1.0.0 | stable | 0.1.0 | refactor, review, lint |
154
+ | api-design | 1.0.0 | stable | 0.1.0 | API, endpoint, REST |
155
+ | testing-standards | 1.0.0 | stable | 0.1.0 | test, spec, coverage |
156
+ | documentation | 1.0.0 | stable | 0.1.0 | README, docs, changelog |
157
+ | performance | 1.0.0 | stable | 0.3.0 | performance, latency, cache |
158
+ | accessibility | 1.0.0 | stable | 0.3.0 | a11y, aria, wcag, screen reader |
159
+ | data-privacy | 1.0.0 | stable | 0.3.0 | GDPR, PII, consent, retention |
160
+ | incident-response | 1.0.0 | stable | 0.3.0 | incident, outage, postmortem |
161
+ | database-patterns | 1.0.0 | stable | 0.3.0 | query, index, migration, N+1 |
162
+
163
+ ## Org Skills (Tier 2 — maintained by your organisation)
164
+
165
+ | Name | Version | Status | Min MindForge | Triggers (excerpt) |
166
+ |---|---|---|---|---|
167
+ | [org-skill-name] | 1.0.0 | stable | 0.1.0 | [trigger keywords] |
168
+
169
+ ## Project Skills (Tier 3 — maintained per project)
170
+
171
+ | Name | Version | Status | Min MindForge | Triggers (excerpt) |
172
+ |---|---|---|---|---|
173
+ | [project-skill-name] | 1.0.0 | stable | 0.1.0 | [trigger keywords] |
174
+ ```
175
+
176
+ ## Registry operations
177
+
178
+ ### Scan and build registry (run at session start)
179
+ 1. Read `.mindforge/org/skills/MANIFEST.md`
180
+ 2. For each skill in the manifest, verify its SKILL.md file exists at the expected path
181
+ 3. If a skill in the manifest has no corresponding file: mark as `missing`
182
+ 4. If a SKILL.md file exists but is not in the manifest: mark as `unregistered`
183
+ 5. Build the in-session registry: a flat list of all valid skills with their metadata
184
+
185
+ ### Registry health check
186
+ Run as part of `/mindforge:health`:
187
+ - All manifest entries have corresponding SKILL.md files ✅ / ❌ missing
188
+ - All SKILL.md files have valid frontmatter (name, version, triggers) ✅ / ❌ invalid
189
+ - No trigger keyword conflicts between skills at the same tier ✅ / ⚠️ conflict
190
+ - All skill versions are valid semver strings ✅ / ❌ invalid
191
+
192
+ ### Adding a skill to the registry
193
+ 1. Create the skill directory and SKILL.md (content per the authoring guide)
194
+ 2. Validate the SKILL.md frontmatter is complete and correct
195
+ 3. Add an entry to MANIFEST.md in the correct tier section
196
+ 4. Commit: `feat(skills): add [skill-name] v[version]`
197
+
198
+ ### Removing a skill from the registry
199
+ 1. Mark the skill as `deprecated` in MANIFEST.md (do not delete the entry)
200
+ 2. Add a `deprecated_at` and `replacement` field to the SKILL.md frontmatter
201
+ 3. After 2 sprints of deprecation: delete the skill directory and manifest entry
202
+ 4. Never hard-delete a skill that might still be referenced in existing PLAN files
203
+
204
+ ## Tier priority for conflict resolution
205
+ When two skills at different tiers have overlapping trigger keywords:
206
+ Priority order: Project (Tier 3) > Org (Tier 2) > Core (Tier 1)
207
+
208
+ The higher-priority tier's skill is loaded. The lower-priority skill is not loaded.
209
+ This allows org and project skills to override core skill behaviour intentionally.
210
+
211
+ When two skills at the SAME tier have conflicting trigger keywords:
212
+ See `conflict-resolver.md`.
213
+ ```
214
+
215
+ ---
216
+
217
+ ### `.mindforge/engine/skills/loader.md`
218
+
219
+ ```markdown
220
+ # MindForge Skills Engine — Loader
221
+
222
+ ## Purpose
223
+ Discover, load, and inject the correct skill packs for any given task context.
224
+ The loader is invoked at the start of every task execution.
225
+
226
+ ## Loading sequence
227
+
228
+ ### Step 1 — Build the trigger index
229
+ At session start (or when skills are updated):
230
+ 1. Read MANIFEST.md to get all registered skills
231
+ 2. For each valid skill, read its frontmatter `triggers:` list
232
+ 3. Build an in-memory trigger index:
233
+ ```
234
+ {
235
+ "auth": ["security-review"],
236
+ "authentication": ["security-review"],
237
+ "password": ["security-review"],
238
+ "refactor": ["code-quality"],
239
+ "performance": ["performance"],
240
+ "N+1": ["database-patterns"],
241
+ "GDPR": ["data-privacy"],
242
+ ...
243
+ }
244
+ ```
245
+ 4. Where multiple skills share a trigger, record all of them (conflict resolution happens at load time)
246
+
247
+ ### Step 2 — Match task to skills
248
+ Given a task description and the files in `<files>`:
249
+
250
+ **Text matching (primary):**
251
+ For every word and phrase in the task description `<n>`, `<action>`, and `<context>` fields:
252
+ - Exact keyword match against the trigger index
253
+ - Case-insensitive matching
254
+ - Multi-word trigger matching: "database migration" matches "migration" trigger
255
+ - Acronym expansion: "a11y" matches "accessibility" trigger
256
+
257
+ **File path matching (secondary):**
258
+ Examine the file paths in `<files>` for structural hints:
259
+ - `/auth/` or `/security/` in path → load security-review
260
+ - `/api/` or `/routes/` in path → load api-design
261
+ - `/tests/` or `.test.ts` in path → load testing-standards
262
+ - `/db/` or `/migrations/` in path → load database-patterns
263
+ - `/components/` or `.tsx` in path → load accessibility (UI components should be accessible)
264
+ - `privacy` or `consent` in path → load data-privacy
265
+
266
+ **Combined match:**
267
+ Skills triggered by EITHER text OR file path matching are loaded.
268
+ A skill only needs ONE matching signal to be loaded.
269
+
270
+ ### Step 3 — Resolve conflicts
271
+ If two skills from the same tier both match:
272
+ - See `conflict-resolver.md` for the resolution protocol
273
+ - Default: load both skills, but flag the overlap to the agent
274
+
275
+ ### Step 4 — Load the matched skills
276
+ For each matched skill (in tier priority order: Project → Org → Core):
277
+ 1. Read the full SKILL.md content
278
+ 2. Check compatibility: does `min_mindforge_version` in frontmatter satisfy current version?
279
+ If not: warn but still load (do not block execution on version mismatch)
280
+ 3. Inject the skill content into the agent's context package (per `context-injector.md`)
281
+ 4. Log which skills were loaded in the task's `task_started` AUDIT entry
282
+
283
+ ### Step 5 — Post-load verification
284
+ After loading:
285
+ - Report to the agent: "Skills loaded for this task: [list]"
286
+ - If zero skills were loaded for a complex task: consider whether any manual skill
287
+ loading is appropriate. Some tasks genuinely need no skills (simple refactors, etc.)
288
+ - If more than 3 skills are loaded simultaneously: warn that context budget may be tight.
289
+ Summarise the less-relevant skills rather than injecting their full content.
290
+
291
+ ## Context budget management for skills
292
+
293
+ Each SKILL.md file costs tokens when injected. Track the budget:
294
+
295
+ | Skills loaded | Estimated cost | Status |
296
+ |---|---|---|
297
+ | 1 skill | ~3-5K tokens | ✅ Comfortable |
298
+ | 2 skills | ~6-10K tokens | ✅ Fine |
299
+ | 3 skills | ~9-15K tokens | ⚠️ Monitor total context |
300
+ | 4+ skills | 12K+ tokens | 🔴 Summarise lower-priority skills |
301
+
302
+ When injecting 4+ skills: summarise skills ranked 4th and below to their
303
+ trigger keywords, mandatory actions list, and output format only.
304
+ Do not inject the full content. Full content goes to the top 3 most relevant skills.
305
+
306
+ ## Skills loading report format
307
+
308
+ After loading, write to the task's AUDIT `task_started` entry:
309
+ ```json
310
+ {
311
+ "skills_loaded": [
312
+ { "name": "security-review", "version": "1.0.0", "tier": 1, "trigger": "auth" },
313
+ { "name": "api-design", "version": "1.0.0", "tier": 1, "trigger": "/api/" }
314
+ ],
315
+ "skills_summarised": [],
316
+ "total_skill_tokens_est": 8500
317
+ }
318
+ ```
319
+ ```
320
+
321
+ ---
322
+
323
+ ### `.mindforge/engine/skills/versioning.md`
324
+
325
+ ```markdown
326
+ # MindForge Skills Engine — Versioning
327
+
328
+ ## Purpose
329
+ Define how skill versions work, what constitutes a breaking change, and how
330
+ agents handle version mismatches between what is installed and what is needed.
331
+
332
+ ## Versioning scheme
333
+ Skills use Semantic Versioning (semver.org): MAJOR.MINOR.PATCH
334
+
335
+ | Increment | When | Example |
336
+ |---|---|---|
337
+ | MAJOR | Breaking change to skill interface (removed triggers, changed output format, changed mandatory actions) | 1.0.0 → 2.0.0 |
338
+ | MINOR | New trigger keywords, new optional sections, new examples | 1.0.0 → 1.1.0 |
339
+ | PATCH | Clarifications, typo fixes, improved examples with no behaviour change | 1.0.0 → 1.0.1 |
340
+
341
+ ## Frontmatter version fields
342
+
343
+ Every SKILL.md must have these frontmatter fields:
344
+
345
+ ```yaml
346
+ ---
347
+ name: security-review
348
+ version: 1.2.0
349
+ min_mindforge_version: 0.1.0
350
+ status: stable
351
+ deprecated_at: # ISO-8601 date if deprecated, empty if not
352
+ replacement: # skill name if deprecated, empty if not
353
+ breaking_changes:
354
+ - "2.0.0: removed 'xss' as standalone trigger (now part of 'injection' trigger)"
355
+ changelog:
356
+ - "1.2.0: added supply chain security check"
357
+ - "1.1.0: expanded OWASP checklist to include A08-A10"
358
+ - "1.0.0: initial stable release"
359
+ ---
360
+ ```
361
+
362
+ ## Compatibility check protocol
363
+
364
+ Before loading any skill, verify compatibility:
365
+
366
+ ### Check 1 — MindForge version compatibility
367
+ Read `min_mindforge_version` from the skill's frontmatter.
368
+ Compare against the current MindForge version (from `package.json`).
369
+
370
+ If skill's `min_mindforge_version` > current MindForge version:
371
+ - Log a warning: "Skill [name] v[X] requires MindForge v[min] but current is v[current]."
372
+ - Load the skill anyway (do not block execution)
373
+ - Add to AUDIT entry: `"compatibility_warning": "skill requires newer MindForge"`
374
+
375
+ ### Check 2 — Deprecation check
376
+ If the skill's `deprecated_at` field is set:
377
+ - Warn: "Skill [name] was deprecated on [date]. Use [replacement] instead."
378
+ - Load the replacement skill (if available) in addition to the deprecated one
379
+ - Add to AUDIT entry: `"deprecated_skill_loaded": true`
380
+
381
+ ### Check 3 — Breaking change awareness
382
+ If the skill has a MAJOR version bump since it was last used in this project:
383
+ - List the breaking changes from the `breaking_changes` field
384
+ - Alert: "Skill [name] has breaking changes since your last usage.
385
+ Review these before continuing: [list changes]"
386
+
387
+ ## Skill upgrade protocol
388
+
389
+ When `/mindforge:skills update [skill-name]` is run:
390
+
391
+ 1. Check current version from MANIFEST.md
392
+ 2. Compare against the latest version in the MindForge repository
393
+ 3. If a newer version exists:
394
+ a. Show the diff in behaviour (changelog entries)
395
+ b. If MINOR or PATCH: auto-update, no confirmation needed
396
+ c. If MAJOR: show breaking changes, require explicit confirmation
397
+ 4. After update: re-validate all PLAN files that reference this skill
398
+ (check if any `<context>` fields would be affected by the breaking changes)
399
+ 5. Update MANIFEST.md with new version
400
+ 6. Commit: `chore(skills): upgrade [name] v[old] → v[new]`
401
+ ```
402
+
403
+ ---
404
+
405
+ ### `.mindforge/engine/skills/conflict-resolver.md`
406
+
407
+ ```markdown
408
+ # MindForge Skills Engine — Conflict Resolver
409
+
410
+ ## Purpose
411
+ Resolve cases where two or more skills at the same tier have overlapping trigger
412
+ keywords. Define clear, deterministic resolution rules.
413
+
414
+ ## Types of conflicts
415
+
416
+ ### Type 1 — Same trigger keyword, different skills, same tier
417
+ Example: Both `security-review` and `api-design` have `endpoint` as a trigger.
418
+ A task with "create an authenticated endpoint" would match both.
419
+
420
+ **Resolution: Load both.**
421
+ Multiple skills addressing the same task from different angles is additive,
422
+ not conflicting. The agent benefits from both security review AND API design guidance.
423
+ Inject both skill contents (subject to context budget in `loader.md`).
424
+
425
+ ### Type 2 — Same trigger keyword, same skill name, different tiers
426
+ Example: Org has a custom `security-review` v2.0 and Core has `security-review` v1.2.
427
+ Both trigger on "auth".
428
+
429
+ **Resolution: Higher tier wins.**
430
+ Project (T3) > Org (T2) > Core (T1).
431
+ Load the higher-tier version. Do not load both. Org skills intentionally override Core.
432
+
433
+ ### Type 3 — Trigger subset (one skill's triggers are a subset of another's)
434
+ Example: `database-patterns` triggers on "query", `api-design` triggers on "query, endpoint".
435
+ A task about "database query optimisation" matches both.
436
+
437
+ **Resolution: Load the more specific skill as primary, secondary as supporting.**
438
+ If one skill's triggers are a strict subset of the task's matching keywords:
439
+ that skill is more specifically targeted and should be the primary (first in context order).
440
+
441
+ ### Type 4 — Mutual exclusion (skills define themselves as mutually exclusive)
442
+ Some skills may define `mutually_exclusive_with` in their frontmatter.
443
+ Example: A project has both a `rest-api` and `graphql-api` skill. Loading both
444
+ would give contradictory guidance.
445
+
446
+ ```yaml
447
+ mutually_exclusive_with: graphql-api
448
+ ```
449
+
450
+ **Resolution: Load the skill whose triggers had the most keyword matches.
451
+ If tied: load the higher-tier skill. If still tied: ask the user.**
452
+
453
+ ## Conflict log
454
+ When any conflict resolution occurs, write to the AUDIT log:
455
+ ```json
456
+ {
457
+ "event": "skill_conflict_resolved",
458
+ "conflict_type": "same_trigger_different_skills",
459
+ "resolution": "loaded_both",
460
+ "skills": ["security-review", "api-design"],
461
+ "trigger": "endpoint"
462
+ }
463
+ ```
464
+
465
+ ## Developer guide: avoiding conflicts
466
+ When authoring skills:
467
+ - Make trigger keywords as specific as possible
468
+ - Avoid generic words like "data", "create", "update" as triggers
469
+ - Use domain-specific terms: "argon2" not "hash", "WCAG" not "accessibility" (if you can)
470
+ - If your skill should override a core skill: declare it in the same name as the core
471
+ skill and place it in a higher tier — the tier priority system handles the rest
472
+ ```
473
+
474
+ **Commit:**
475
+ ```bash
476
+ git add .mindforge/engine/skills/
477
+ git commit -m "feat(skills-engine): implement registry, loader, versioning, conflict resolver"
478
+ ```
479
+
480
+ ---
481
+
482
+ ## TASK 3 — Write the 5 new core skill packs
483
+
484
+ ---
485
+
486
+ ### `.mindforge/skills/performance/SKILL.md`
487
+
488
+ ```markdown
489
+ ---
490
+ name: performance
491
+ version: 1.0.0
492
+ min_mindforge_version: 0.3.0
493
+ status: stable
494
+ triggers: performance, latency, throughput, cache, caching, slow, optimise, optimize,
495
+ bottleneck, profil, load time, bundle size, memory, CPU, N+1, query time,
496
+ response time, timeout, rate limit, debounce, throttle, memoize, lazy load,
497
+ code split, tree shake, LCP, CLS, FID, INP, Core Web Vitals, lighthouse
498
+ ---
499
+
500
+ # Skill — Performance Engineering
501
+
502
+ ## When this skill activates
503
+ Any task involving response time, resource usage, bundle size, database query
504
+ performance, or user-perceived load time metrics.
505
+
506
+ ## Mandatory actions when this skill is active
507
+
508
+ ### Before writing any code
509
+ 1. Identify what is being measured. Never optimise without a baseline.
510
+ 2. Read the relevant metric from REQUIREMENTS.md (NFRs):
511
+ - API response time target (e.g., p95 < 200ms)
512
+ - Page load time target (e.g., LCP < 2.5s)
513
+ - Bundle size budget (e.g., < 200KB gzipped initial JS)
514
+ 3. If no NFR is defined: ask the user to define one before optimising.
515
+ "Optimisation without a target is premature optimisation."
516
+
517
+ ### Backend performance standards
518
+
519
+ **Database queries:**
520
+ - Every query must use indexes for its WHERE, JOIN, and ORDER BY columns
521
+ - Detect N+1 queries: if fetching a list then querying per item, use JOIN or batch fetch
522
+ - Pagination: always paginate list endpoints (default page size: 20, max: 100)
523
+ - Avoid `SELECT *` — select only the columns needed
524
+ - Use `EXPLAIN ANALYZE` (PostgreSQL) or `EXPLAIN` (MySQL) to verify query plans
525
+ - Cache repeated identical queries: Redis with appropriate TTL
526
+
527
+ **API response time:**
528
+ - Target: p50 < 100ms, p95 < 500ms, p99 < 2000ms for most endpoints
529
+ - Slow endpoints (> 500ms): must be async (return immediately, use webhooks or polling)
530
+ - Database connection pooling: always use a connection pool (never open/close per request)
531
+ - Avoid synchronous I/O in request handlers
532
+
533
+ **Caching strategy:**
534
+ | Data type | Recommended cache | TTL |
535
+ |---|---|---|
536
+ | User session data | Redis | 24 hours |
537
+ | Computed aggregates | Redis | 1–5 minutes |
538
+ | Static reference data | Redis | 1 hour |
539
+ | User-specific data | Redis with user key | 15 minutes |
540
+ | API responses | HTTP Cache-Control | depends on freshness needs |
541
+
542
+ ### Frontend performance standards
543
+
544
+ **Bundle size budgets:**
545
+ | Asset | Budget (gzipped) |
546
+ |---|---|
547
+ | Initial JavaScript | < 200KB |
548
+ | Initial CSS | < 50KB |
549
+ | Per-route chunk | < 100KB |
550
+ | Images (hero) | < 200KB WebP |
551
+ | Fonts | < 50KB per weight |
552
+
553
+ **Core Web Vitals targets (Google's thresholds):**
554
+ | Metric | Good | Needs improvement | Poor |
555
+ |---|---|---|---|
556
+ | LCP (Largest Contentful Paint) | < 2.5s | 2.5–4s | > 4s |
557
+ | INP (Interaction to Next Paint) | < 200ms | 200–500ms | > 500ms |
558
+ | CLS (Cumulative Layout Shift) | < 0.1 | 0.1–0.25 | > 0.25 |
559
+
560
+ **Implementation patterns:**
561
+ - Route-based code splitting: every route is its own chunk
562
+ - Lazy load non-critical components: `React.lazy()` + `Suspense`
563
+ - Image optimisation: use `next/image` or equivalent. Always specify `width`/`height`.
564
+ - Font loading: `font-display: swap`. Preload critical fonts.
565
+ - Avoid layout thrashing: batch DOM reads before DOM writes
566
+ - Debounce user input handlers (search: 300ms, resize: 100ms)
567
+ - Memoize expensive computations: `useMemo` / `useCallback` where measured
568
+
569
+ ### Performance measurement commands
570
+
571
+ ```bash
572
+ # Backend: measure API response time
573
+ curl -w "@curl-format.txt" -o /dev/null -s https://api.example.com/endpoint
574
+
575
+ # Frontend: Lighthouse CI
576
+ npx lighthouse https://example.com --output json --output-path ./lighthouse.json
577
+
578
+ # Bundle analysis
579
+ npx bundle-analyzer stats.json
580
+
581
+ # Node.js profiling
582
+ node --prof app.js
583
+ node --prof-process isolate-*.log > profile.txt
584
+
585
+ # Database: explain query
586
+ EXPLAIN ANALYZE SELECT * FROM users WHERE email = 'test@example.com';
587
+ ```
588
+
589
+ ## Performance review checklist
590
+ Before marking any task done that involves a query or endpoint:
591
+ - [ ] Query uses appropriate indexes (verified with EXPLAIN)
592
+ - [ ] No N+1 queries in list endpoints
593
+ - [ ] Response time verified locally (curl with timing)
594
+ - [ ] No `SELECT *` in production queries
595
+ - [ ] Caching applied where data is read-heavy and tolerance allows staleness
596
+
597
+ ## Output
598
+ Write performance notes to SUMMARY.md:
599
+ - Baseline metric (before)
600
+ - Achieved metric (after)
601
+ - What optimisation was applied
602
+ - Whether the NFR target was met ✅ or still needs work ⚠️
603
+ ```
604
+
605
+ ---
606
+
607
+ ### `.mindforge/skills/accessibility/SKILL.md`
608
+
609
+ ```markdown
610
+ ---
611
+ name: accessibility
612
+ version: 1.0.0
613
+ min_mindforge_version: 0.3.0
614
+ status: stable
615
+ triggers: accessibility, a11y, aria, ARIA, wcag, WCAG, screen reader, keyboard,
616
+ focus, tab order, colour contrast, color contrast, alt text, semantic HTML,
617
+ form label, button, interactive, disabled, skip link, heading hierarchy,
618
+ landmark, live region, modal, dialog, tooltip, dropdown, combobox
619
+ ---
620
+
621
+ # Skill — Accessibility Engineering
622
+
623
+ ## When this skill activates
624
+ Any task involving UI components, forms, interactive elements, or user-facing HTML.
625
+ Load this skill for ALL frontend work — accessibility is not optional.
626
+
627
+ ## Mandatory standard
628
+ WCAG 2.1 Level AA is the minimum. This is the legal requirement in most jurisdictions.
629
+ Level AAA elements (where achievable without design compromise) are recommended.
630
+
631
+ ## Mandatory actions when this skill is active
632
+
633
+ ### Before writing any UI component
634
+ 1. Identify the semantic HTML element that best represents the component.
635
+ Use native HTML before ARIA. A `<button>` is always better than a `<div role="button">`.
636
+ 2. Map all interactive states: default, hover, focus, active, disabled, error, loading.
637
+ 3. Confirm colour contrast meets WCAG AA:
638
+ - Normal text: contrast ratio ≥ 4.5:1
639
+ - Large text (≥ 18pt or ≥ 14pt bold): contrast ratio ≥ 3:1
640
+ - UI components and graphics: contrast ratio ≥ 3:1
641
+
642
+ ### HTML semantics checklist (apply to every component)
643
+
644
+ **Structure:**
645
+ - [ ] One `<h1>` per page. Heading hierarchy is sequential (h1 → h2 → h3, never skip levels)
646
+ - [ ] Landmark roles present: `<main>`, `<nav>`, `<header>`, `<footer>`, `<aside>`
647
+ - [ ] Skip navigation link as the first focusable element on every page
648
+
649
+ **Forms:**
650
+ - [ ] Every input has a visible `<label>` (not just placeholder text)
651
+ - [ ] Label is programmatically associated: `<label for="id">` or `aria-labelledby`
652
+ - [ ] Required fields marked: `required` attribute + visual indicator + aria description
653
+ - [ ] Error messages: `role="alert"` or `aria-live="polite"`, associated with field via `aria-describedby`
654
+ - [ ] Validation errors describe the problem AND the fix, not just "Invalid input"
655
+
656
+ **Interactive components:**
657
+ - [ ] All interactive elements reachable by Tab key
658
+ - [ ] Focus visible: never `outline: none` without a custom visible focus style
659
+ - [ ] Keyboard shortcuts documented and not conflicting with browser/OS shortcuts
660
+ - [ ] Custom widgets implement the correct ARIA pattern (see ARIA Authoring Practices Guide)
661
+
662
+ **Images and media:**
663
+ - [ ] Decorative images: `alt=""` (empty string, not omitted)
664
+ - [ ] Informative images: `alt` describes the information conveyed
665
+ - [ ] Complex images (charts, diagrams): `aria-describedby` pointing to a full text description
666
+ - [ ] Videos: captions required. Audio descriptions for visual-only information.
667
+
668
+ **Dynamic content:**
669
+ - [ ] Content that updates dynamically: `aria-live="polite"` (non-critical) or `aria-live="assertive"` (critical)
670
+ - [ ] Modals/dialogs: focus moves to modal on open, returns to trigger on close, `aria-modal="true"`
671
+ - [ ] Loading states: `aria-busy="true"` on the container being updated
672
+
673
+ ### ARIA usage rules
674
+ - Use ARIA only when no native HTML element conveys the role
675
+ - ARIA roles override native semantics — applying a role to `<button>` changes it
676
+ - Required ARIA properties: never use a role without its required properties
677
+ (e.g., `role="checkbox"` requires `aria-checked`)
678
+ - Never use `aria-hidden="true"` on focusable elements
679
+
680
+ ### Testing protocol
681
+ ```bash
682
+ # Automated testing (catches ~30-40% of issues)
683
+ npx axe-cli https://localhost:3000
684
+
685
+ # Keyboard testing (manual — must be done for every interactive component)
686
+ # 1. Tab through every interactive element — order must be logical
687
+ # 2. Activate every control with Enter/Space — must work
688
+ # 3. Navigate dropdowns/menus with arrow keys
689
+ # 4. Escape dismisses modals and dropdowns
690
+
691
+ # Screen reader testing (minimum: test with NVDA + Chrome on Windows OR
692
+ # VoiceOver + Safari on macOS)
693
+ # Key checks:
694
+ # - Every interactive element announced with role, name, and state
695
+ # - Dynamic updates announced appropriately
696
+ # - Images described correctly
697
+
698
+ # Contrast checking
699
+ # Install: axe DevTools browser extension or Colour Contrast Analyser
700
+ ```
701
+
702
+ ## Self-check before task completion
703
+ - [ ] Ran `axe-cli` — zero violations
704
+ - [ ] Keyboard navigation tested manually
705
+ - [ ] All interactive elements have accessible names
706
+ - [ ] Colour contrast meets 4.5:1 for text
707
+ - [ ] Focus management correct for modals and dynamic content
708
+ - [ ] No `aria-hidden` on focusable elements
709
+ ```
710
+
711
+ ---
712
+
713
+ ### `.mindforge/skills/data-privacy/SKILL.md`
714
+
715
+ ```markdown
716
+ ---
717
+ name: data-privacy
718
+ version: 1.0.0
719
+ min_mindforge_version: 0.3.0
720
+ status: stable
721
+ triggers: GDPR, CCPA, privacy, PII, personal data, personal information, consent,
722
+ data retention, right to erasure, right to access, data portability,
723
+ data subject, anonymise, anonymize, pseudonymise, pseudonymize,
724
+ data minimisation, data minimization, lawful basis, cookie, tracking,
725
+ analytics, marketing, third party, data transfer, cross-border
726
+ ---
727
+
728
+ # Skill — Data Privacy Engineering
729
+
730
+ ## When this skill activates
731
+ Any task touching personal data collection, storage, processing, or transfer.
732
+ Also activates for consent management, analytics, cookie handling, and any
733
+ feature where user data flows to third parties.
734
+
735
+ ## Regulatory coverage
736
+ This skill covers: GDPR (EU/UK), CCPA/CPRA (California), PIPEDA (Canada),
737
+ PDPA (Thailand/Singapore variants), LGPD (Brazil). Requirements often overlap —
738
+ implementing GDPR correctly satisfies most other frameworks.
739
+
740
+ ## Mandatory actions when this skill is active
741
+
742
+ ### Data audit — before touching any data feature
743
+ Answer these questions before writing code:
744
+ 1. **What personal data is collected?** (Name, email, IP, device ID, location, behaviour)
745
+ 2. **What is the lawful basis for processing?** (Consent / Contract / Legitimate interest / Legal obligation)
746
+ 3. **How long is it retained?** (Must have a defined retention period — not "indefinitely")
747
+ 4. **Who does it flow to?** (Internal systems only / third-party processors / international transfer)
748
+ 5. **Can users access, export, and delete their data?**
749
+
750
+ If you cannot answer all 5: stop. Write the answers in ARCHITECTURE.md under
751
+ "Data Privacy" before implementing anything.
752
+
753
+ ### PII handling standards
754
+
755
+ **Collection:**
756
+ - Collect the minimum data required for the stated purpose (data minimisation)
757
+ - Obtain consent before collecting non-essential data (analytics, marketing)
758
+ - Consent must be: specific, informed, freely given, unambiguous, and withdrawable
759
+ - Never pre-tick consent checkboxes. Never bundle consent for different purposes.
760
+
761
+ **Storage:**
762
+ - PII fields in the database must be identified (document in ARCHITECTURE.md)
763
+ - Encrypt sensitive PII at rest: financial data, health data, government IDs
764
+ - Pseudonymisation: where possible, store a user ID reference rather than PII inline
765
+ - Never store PII in: logs, AUDIT.jsonl, git commits, error messages, URL parameters
766
+
767
+ **Transfer:**
768
+ - Third-party processors: must have a Data Processing Agreement (DPA)
769
+ - International transfer (out of EU): requires Standard Contractual Clauses or adequacy decision
770
+ - Document all third-party data flows in ARCHITECTURE.md
771
+
772
+ **Retention and deletion:**
773
+ - Define retention period for every PII field in the data model
774
+ - Implement automated deletion or anonymisation when retention period expires
775
+ - Implement "right to erasure": a complete user delete must remove or anonymise ALL their PII
776
+ - Implement "right to access": export of all user data in a portable format (JSON/CSV)
777
+ - Test deletion: verify that deleted user data does not appear in any API response
778
+
779
+ ### Cookie and tracking standards
780
+ ```javascript
781
+ // Required: granular consent per category
782
+ const consentCategories = {
783
+ necessary: true, // Always true — no consent needed
784
+ functional: false, // Requires consent
785
+ analytics: false, // Requires consent
786
+ marketing: false, // Requires consent — highest bar
787
+ };
788
+
789
+ // Required: record consent with timestamp and version
790
+ await recordConsent({
791
+ userId: user.id,
792
+ categories: consentCategories,
793
+ timestamp: new Date().toISOString(),
794
+ policyVersion: '2026-01',
795
+ ipHash: hash(userIp), // Store hash not raw IP for GDPR compliance
796
+ });
797
+
798
+ // Required: honour opt-out immediately
799
+ // If analytics: false — stop sending analytics events NOW, not on next page load
800
+ ```
801
+
802
+ ### Code patterns that are FORBIDDEN under data privacy
803
+ ```
804
+ // ❌ NEVER: Log PII
805
+ console.log(`User ${user.email} logged in`) // email in logs = GDPR violation
806
+ logger.info({ user }) // entire user object = PII in logs
807
+
808
+ // ✅ ALWAYS: Log identifiers, never PII
809
+ logger.info({ userId: user.id, event: 'login' })
810
+
811
+ // ❌ NEVER: PII in error messages
812
+ throw new Error(`Could not find user ${user.email}`) // exposed in stack traces
813
+
814
+ // ✅ ALWAYS: identifiers in errors
815
+ throw new Error(`Could not find user [id:${user.id}]`)
816
+
817
+ // ❌ NEVER: PII in URL parameters
818
+ GET /api/users?email=john@example.com // logged by web servers, CDNs, browsers
819
+
820
+ // ✅ ALWAYS: POST body or path parameter by ID
821
+ GET /api/users/{id}
822
+ ```
823
+
824
+ ## Privacy review checklist
825
+ Before marking any data-related task done:
826
+ - [ ] Lawful basis identified for every data point collected
827
+ - [ ] PII never appears in logs, error messages, or URL parameters
828
+ - [ ] Retention period defined for every new PII field
829
+ - [ ] Third-party data flows documented in ARCHITECTURE.md
830
+ - [ ] User delete removes or anonymises ALL PII ✅ / not yet implemented ⚠️
831
+ - [ ] Consent UI does not use dark patterns (pre-ticked, bundled, misleading)
832
+ ```
833
+
834
+ ---
835
+
836
+ ### `.mindforge/skills/incident-response/SKILL.md`
837
+
838
+ ```markdown
839
+ ---
840
+ name: incident-response
841
+ version: 1.0.0
842
+ min_mindforge_version: 0.3.0
843
+ status: stable
844
+ triggers: incident, outage, downtime, alert, pagerduty, oncall, on-call, postmortem,
845
+ post-mortem, runbook, degraded, unavailable, error rate, p0, P0, p1, P1,
846
+ rollback, hotfix, revert, emergency, spike, anomaly, SLA, SLO, SLI
847
+ ---
848
+
849
+ # Skill — Incident Response Engineering
850
+
851
+ ## When this skill activates
852
+ Any task involving incident runbooks, monitoring setup, alerting configuration,
853
+ hotfixes, rollbacks, or post-incident review documentation.
854
+
855
+ ## Incident severity classification
856
+
857
+ | Level | Definition | Response time | Examples |
858
+ |---|---|---|---|
859
+ | P0 (Critical) | Complete service outage affecting all users | Immediate (24/7) | Site down, database unreachable, payment processing failed |
860
+ | P1 (High) | Major feature broken for all/most users | < 15 minutes | Login broken, core feature unavailable |
861
+ | P2 (Medium) | Feature degraded, workaround exists | < 2 hours | Slow API, intermittent errors for subset of users |
862
+ | P3 (Low) | Minor issue, cosmetic or edge case | Next business day | UI glitch, non-critical feature broken |
863
+
864
+ ## Runbook template (write one for every critical path)
865
+
866
+ File: `docs/runbooks/[service-name]-[issue-type].md`
867
+
868
+ ```markdown
869
+ # Runbook: [Service/Feature] — [Issue Type]
870
+
871
+ ## Overview
872
+ **Service:** [name]
873
+ **Symptom:** [what the monitoring alert describes]
874
+ **Impact:** [who is affected and how]
875
+ **Severity:** P[0-3]
876
+
877
+ ## Detection
878
+ **Alert:** [alert name and source — PagerDuty, Datadog, etc.]
879
+ **Metrics to check:**
880
+ - [metric 1]: normal range [X-Y], alert threshold [Z]
881
+ - [metric 2]: normal range [X-Y], alert threshold [Z]
882
+
883
+ ## Immediate actions (first 5 minutes)
884
+ 1. Acknowledge the alert in [alerting tool]
885
+ 2. Check [dashboard URL] for current status
886
+ 3. [Specific first diagnostic step]
887
+ 4. [Specific second diagnostic step]
888
+ 5. If confirmed P0/P1: page the on-call lead
889
+
890
+ ## Diagnosis steps
891
+ 1. Check [log location] for errors: `grep -E "ERROR|FATAL" [log file] | tail -50`
892
+ 2. Check database connectivity: `[connection test command]`
893
+ 3. Check external dependencies: `curl -I [dependency health URL]`
894
+ 4. Check recent deployments: `git log --oneline -5`
895
+
896
+ ## Mitigation options (in order of preference)
897
+ 1. **Restart the service:** `[restart command]` — use if: [condition]
898
+ 2. **Scale horizontally:** `[scale command]` — use if: [condition]
899
+ 3. **Rollback deployment:** `[rollback command]` — use if: [condition]
900
+ 4. **Failover to backup:** `[failover steps]` — use if: [condition]
901
+ 5. **Feature flag off:** `[flag command]` — use if: [condition]
902
+
903
+ ## Communication template
904
+ **Internal Slack:** "@oncall [P0] [service] is [symptom]. Investigating. ETA: [X] min"
905
+ **Status page:** "[Service] is currently experiencing [symptom]. We are investigating."
906
+ **Customer email:** [only for P0 lasting > 30 minutes]
907
+
908
+ ## Post-incident (after mitigation)
909
+ 1. Update status page: "Resolved. [Brief cause]."
910
+ 2. Write postmortem within 48 hours (see template below)
911
+ 3. Create follow-up tickets for permanent fix
912
+
913
+ ## Escalation path
914
+ L1 On-call → L2 Senior engineer → L3 Engineering lead → L4 CTO
915
+ Escalate when: unable to mitigate within [X] minutes or if [condition]
916
+ ```
917
+
918
+ ## Postmortem template (blameless — always)
919
+
920
+ File: `docs/postmortems/[YYYY-MM-DD]-[short-title].md`
921
+
922
+ ```markdown
923
+ # Postmortem: [Title]
924
+ **Date of incident:** [ISO-8601]
925
+ **Duration:** [start] → [end] ([X] minutes)
926
+ **Severity:** P[0-3]
927
+ **Author:** [who wrote this]
928
+ **Reviewed by:** [who reviewed]
929
+
930
+ ## Summary
931
+ [2-3 sentences: what happened, what the impact was, what resolved it]
932
+
933
+ ## Timeline (UTC)
934
+ | Time | Event |
935
+ |---|---|
936
+ | HH:MM | [Alert fired / Issue observed] |
937
+ | HH:MM | [First responder acknowledged] |
938
+ | HH:MM | [Root cause identified] |
939
+ | HH:MM | [Mitigation applied] |
940
+ | HH:MM | [Incident resolved] |
941
+
942
+ ## Root cause
943
+ [One paragraph describing the technical root cause. Factual, no blame.]
944
+
945
+ ## Impact
946
+ - Users affected: [number or percentage]
947
+ - Duration: [X] minutes
948
+ - Data loss: Yes / No (if yes: what data, how much)
949
+ - Revenue impact: [estimate if known]
950
+ - SLA breach: Yes / No
951
+
952
+ ## What went well
953
+ - [Thing 1 that helped: good alert, good runbook, fast diagnosis]
954
+ - [Thing 2]
955
+
956
+ ## What went poorly
957
+ - [Thing 1 that slowed resolution: no runbook, missed alert, unclear owner]
958
+ - [Thing 2]
959
+
960
+ ## Action items
961
+ | Action | Owner | Due date | Priority |
962
+ |---|---|---|---|
963
+ | [Preventive action 1] | [name] | [date] | P[1-3] |
964
+ | [Detection improvement] | [name] | [date] | P[1-3] |
965
+
966
+ ## Lessons learned
967
+ [What systemic changes does this incident motivate?]
968
+ ```
969
+
970
+ ## Monitoring standards (write monitoring alongside every feature)
971
+
972
+ Every new feature must ship with:
973
+ 1. **Health check endpoint:** `GET /health` returns 200 when service is operational
974
+ 2. **Key metrics instrumented:** request count, error rate, p95 latency, queue depth
975
+ 3. **Alerts defined:** at minimum:
976
+ - Error rate > 1% for 5 minutes → P1 alert
977
+ - p95 latency > [NFR threshold] for 5 minutes → P2 alert
978
+ - Zero requests for 5 minutes (if expected traffic) → P1 alert
979
+ 4. **Runbook linked in alert:** every alert description links to its runbook
980
+
981
+ ## Hotfix protocol
982
+
983
+ When a production issue requires an immediate code fix:
984
+
985
+ ```bash
986
+ # 1. Create hotfix branch from production tag
987
+ git checkout -b hotfix/[description] v[last-release-tag]
988
+
989
+ # 2. Apply the minimal fix — do not add anything else
990
+ # 3. Write or update the test that catches this bug
991
+ # 4. Verify the fix
992
+ npm test
993
+
994
+ # 5. PR to main AND to the release branch
995
+ # 6. Deploy to production immediately after approval
996
+ # 7. Tag the hotfix release
997
+ git tag -a v[X.Y.Z+1] -m "Hotfix: [description]"
998
+ ```
999
+ ```
1000
+
1001
+ ---
1002
+
1003
+ ### `.mindforge/skills/database-patterns/SKILL.md`
1004
+
1005
+ ```markdown
1006
+ ---
1007
+ name: database-patterns
1008
+ version: 1.0.0
1009
+ min_mindforge_version: 0.3.0
1010
+ status: stable
1011
+ triggers: database, DB, SQL, query, migration, schema, index, indexing, N+1,
1012
+ transaction, ACID, foreign key, join, aggregate, pagination, cursor,
1013
+ connection pool, ORM, Prisma, SQLAlchemy, Drizzle, Sequelize,
1014
+ PostgreSQL, MySQL, SQLite, MongoDB, Redis, Elasticsearch
1015
+ ---
1016
+
1017
+ # Skill — Database Patterns
1018
+
1019
+ ## When this skill activates
1020
+ Any task involving database schema design, query writing, migrations, or
1021
+ ORM configuration.
1022
+
1023
+ ## Mandatory actions when this skill is active
1024
+
1025
+ ### Schema design standards
1026
+
1027
+ **Naming conventions (PostgreSQL default):**
1028
+ ```sql
1029
+ -- Tables: snake_case, plural
1030
+ CREATE TABLE user_profiles (...);
1031
+ CREATE TABLE order_items (...);
1032
+
1033
+ -- Columns: snake_case
1034
+ user_id, created_at, updated_at, deleted_at
1035
+
1036
+ -- Primary keys: always id (UUID preferred over auto-increment)
1037
+ id UUID PRIMARY KEY DEFAULT gen_random_uuid()
1038
+
1039
+ -- Foreign keys: {referenced_table_singular}_id
1040
+ user_id UUID REFERENCES users(id) ON DELETE CASCADE
1041
+ order_id UUID REFERENCES orders(id) ON DELETE SET NULL
1042
+
1043
+ -- Indexes: idx_{table}_{column(s)}
1044
+ CREATE INDEX idx_users_email ON users(email);
1045
+ CREATE INDEX idx_orders_user_id_created_at ON orders(user_id, created_at DESC);
1046
+ ```
1047
+
1048
+ **Standard columns every table should have:**
1049
+ ```sql
1050
+ id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
1051
+ created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
1052
+ updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
1053
+ -- For soft delete (preferred over hard delete):
1054
+ deleted_at TIMESTAMPTZ -- NULL = active, timestamp = deleted
1055
+ ```
1056
+
1057
+ **Soft delete implementation:**
1058
+ Use soft delete (setting `deleted_at`) instead of hard delete for:
1059
+ - User records (GDPR right to erasure exception: anonymise, don't delete)
1060
+ - Financial records (audit requirements)
1061
+ - Any record that might be referenced by other records
1062
+
1063
+ For hard delete: cascade must be configured. Document the cascade in ARCHITECTURE.md.
1064
+
1065
+ ### Query standards
1066
+
1067
+ **N+1 query detection and prevention:**
1068
+ ```typescript
1069
+ // ❌ N+1 pattern: 1 query for users + N queries for their orders
1070
+ const users = await db.users.findMany()
1071
+ for (const user of users) {
1072
+ user.orders = await db.orders.findMany({ where: { userId: user.id } })
1073
+ }
1074
+
1075
+ // ✅ Single query with JOIN or include
1076
+ const users = await db.users.findMany({
1077
+ include: { orders: true } // Prisma generates a single JOIN query
1078
+ })
1079
+
1080
+ // ✅ Or batch load with WHERE IN
1081
+ const userIds = users.map(u => u.id)
1082
+ const orders = await db.orders.findMany({ where: { userId: { in: userIds } } })
1083
+ const ordersByUser = groupBy(orders, 'userId')
1084
+ ```
1085
+
1086
+ **Pagination patterns:**
1087
+ ```typescript
1088
+ // ❌ OFFSET pagination (slow on large datasets — scans all previous rows)
1089
+ SELECT * FROM posts ORDER BY created_at DESC LIMIT 20 OFFSET 10000;
1090
+
1091
+ // ✅ CURSOR pagination (consistent performance regardless of position)
1092
+ SELECT * FROM posts
1093
+ WHERE created_at < :cursor
1094
+ ORDER BY created_at DESC
1095
+ LIMIT 20;
1096
+
1097
+ // Always return a cursor for the next page:
1098
+ {
1099
+ "data": [...],
1100
+ "nextCursor": "2026-01-15T10:30:00Z", // last item's created_at
1101
+ "hasMore": true
1102
+ }
1103
+ ```
1104
+
1105
+ **Transaction usage:**
1106
+ ```typescript
1107
+ // Use transactions whenever multiple writes must succeed or fail together
1108
+ await db.$transaction(async (tx) => {
1109
+ const order = await tx.orders.create({ data: orderData })
1110
+ await tx.orderItems.createMany({ data: items.map(i => ({...i, orderId: order.id})) })
1111
+ await tx.inventory.updateMany({ /* deduct stock */ })
1112
+ // All three succeed or all three roll back
1113
+ })
1114
+ ```
1115
+
1116
+ ### Index strategy
1117
+
1118
+ **Always index:**
1119
+ - All foreign key columns (ORM does not always do this automatically)
1120
+ - Columns used in WHERE clauses on large tables
1121
+ - Columns used in ORDER BY on large tables
1122
+ - Columns used in JOIN conditions
1123
+
1124
+ **Composite indexes:**
1125
+ - Order columns from most selective (highest cardinality) to least
1126
+ - A composite index on (a, b) is used for queries filtering on a alone,
1127
+ or on both a and b. Not for b alone.
1128
+ - Example: index on (user_id, created_at DESC) for "get user's recent items"
1129
+
1130
+ **Never index:**
1131
+ - Boolean columns on large tables (index selectivity too low to help)
1132
+ - Columns that change very frequently (index maintenance overhead)
1133
+ - Tables with fewer than 10,000 rows (full scan is faster)
1134
+
1135
+ ### Migration standards
1136
+
1137
+ ```bash
1138
+ # Every schema change must have a migration file
1139
+ # Naming: [timestamp]_[descriptive-name].sql or per ORM convention
1140
+
1141
+ # Migration must be:
1142
+ # 1. Idempotent: safe to run multiple times
1143
+ # 2. Reversible: has both UP and DOWN migration
1144
+ # 3. Non-blocking: avoid full table locks in production migrations
1145
+
1146
+ # Non-blocking pattern for adding a column (PostgreSQL):
1147
+ # Step 1: Add column with default as NULL (instant)
1148
+ ALTER TABLE users ADD COLUMN phone_verified BOOLEAN;
1149
+
1150
+ # Step 2: Backfill in batches (separate deployment)
1151
+ UPDATE users SET phone_verified = false
1152
+ WHERE id IN (SELECT id FROM users WHERE phone_verified IS NULL LIMIT 1000);
1153
+
1154
+ # Step 3: Add NOT NULL constraint + default (after backfill completes)
1155
+ ALTER TABLE users ALTER COLUMN phone_verified SET NOT NULL;
1156
+ ALTER TABLE users ALTER COLUMN phone_verified SET DEFAULT false;
1157
+ ```
1158
+
1159
+ ## Query performance checklist
1160
+ Before committing any query-writing task:
1161
+ - [ ] Ran EXPLAIN ANALYZE on all non-trivial queries
1162
+ - [ ] All WHERE/JOIN/ORDER BY columns have indexes
1163
+ - [ ] No N+1 queries in list-fetching code
1164
+ - [ ] Large queries paginated (cursor-based for > 1K rows)
1165
+ - [ ] Transactions used for multi-write operations
1166
+ - [ ] Connection pooling configured (not creating connections per request)
1167
+ ```
1168
+
1169
+ **Commit:**
1170
+ ```bash
1171
+ git add .mindforge/skills/performance/ .mindforge/skills/accessibility/ \
1172
+ .mindforge/skills/data-privacy/ .mindforge/skills/incident-response/ \
1173
+ .mindforge/skills/database-patterns/
1174
+ git commit -m "feat(skills): add 5 new core skill packs (performance, a11y, privacy, incident, db)"
1175
+ ```
1176
+
1177
+ ---
1178
+
1179
+ ## TASK 4 — Update MANIFEST.md with all 10 skills
1180
+
1181
+ Write `.mindforge/org/skills/MANIFEST.md` with all 10 skills registered:
1182
+
1183
+ ```markdown
1184
+ # MindForge Skills Manifest
1185
+ # Schema version: 1.0.0
1186
+ # MindForge compatibility: >=0.1.0
1187
+ # Last updated: [ISO-8601 date when you create this file]
1188
+
1189
+ ## Core Skills — Tier 1 (maintained by MindForge)
1190
+
1191
+ | Name | Version | Status | Min MindForge | Path |
1192
+ |---|---|---|---|---|
1193
+ | security-review | 1.0.0 | stable | 0.1.0 | .mindforge/skills/security-review/SKILL.md |
1194
+ | code-quality | 1.0.0 | stable | 0.1.0 | .mindforge/skills/code-quality/SKILL.md |
1195
+ | api-design | 1.0.0 | stable | 0.1.0 | .mindforge/skills/api-design/SKILL.md |
1196
+ | testing-standards | 1.0.0 | stable | 0.1.0 | .mindforge/skills/testing-standards/SKILL.md |
1197
+ | documentation | 1.0.0 | stable | 0.1.0 | .mindforge/skills/documentation/SKILL.md |
1198
+ | performance | 1.0.0 | stable | 0.3.0 | .mindforge/skills/performance/SKILL.md |
1199
+ | accessibility | 1.0.0 | stable | 0.3.0 | .mindforge/skills/accessibility/SKILL.md |
1200
+ | data-privacy | 1.0.0 | stable | 0.3.0 | .mindforge/skills/data-privacy/SKILL.md |
1201
+ | incident-response | 1.0.0 | stable | 0.3.0 | .mindforge/skills/incident-response/SKILL.md |
1202
+ | database-patterns | 1.0.0 | stable | 0.3.0 | .mindforge/skills/database-patterns/SKILL.md |
1203
+
1204
+ ## Org Skills — Tier 2 (add your organisation's custom skills here)
1205
+
1206
+ | Name | Version | Status | Min MindForge | Path |
1207
+ |---|---|---|---|---|
1208
+ | (none yet — see docs/skills-authoring-guide.md to add org skills) | | | | |
1209
+
1210
+ ## Project Skills — Tier 3 (add project-specific skills here)
1211
+
1212
+ | Name | Version | Status | Min MindForge | Path |
1213
+ |---|---|---|---|---|
1214
+ | (none yet — see docs/skills-authoring-guide.md to add project skills) | | | | |
1215
+
1216
+ ## Conflict overrides (explicit conflict resolution rules)
1217
+ (none — add entries here when two skills clash on the same trigger keyword)
1218
+
1219
+ ## Changelog
1220
+ - 0.3.0: Added performance, accessibility, data-privacy, incident-response, database-patterns
1221
+ - 0.1.0: Initial manifest with 5 core skills
1222
+ ```
1223
+
1224
+ **Commit:**
1225
+ ```bash
1226
+ git add .mindforge/org/skills/MANIFEST.md
1227
+ git commit -m "feat(skills): register all 10 core skills in MANIFEST.md"
1228
+ ```
1229
+
1230
+ ---
1231
+
1232
+ ## TASK 5 — Write the Persona Customisation System
1233
+
1234
+ ### `.mindforge/personas/overrides/README.md`
1235
+
1236
+ ```markdown
1237
+ # MindForge Persona Customisation System
1238
+
1239
+ ## Purpose
1240
+ Override default persona behaviour for specific projects or phases without
1241
+ modifying the core persona files (which are versioned and shared).
1242
+
1243
+ ## How overrides work
1244
+
1245
+ 1. Create a file in `.mindforge/personas/overrides/` named after the persona:
1246
+ `developer.md`, `security-reviewer.md`, etc.
1247
+
1248
+ 2. The override file uses an additive format — it extends, not replaces:
1249
+
1250
+ ```markdown
1251
+ # Developer Persona Override — [Project Name]
1252
+ # This file ADDS to or MODIFIES developer.md. It does not replace it.
1253
+
1254
+ ## Additional coding standards (project-specific)
1255
+ - This project uses the Repository pattern. All database access via repositories.
1256
+ - All API responses use the ApiResponse<T> wrapper type (see src/types/api.ts)
1257
+ - Business logic belongs in src/services/ — never in src/routes/ or src/repositories/
1258
+
1259
+ ## Modified conventions (overrides developer.md)
1260
+ # Override: "Functions ≤ 40 lines" → this project permits up to 60 lines
1261
+ # for service methods that handle complex orchestration.
1262
+ MAX_FUNCTION_LINES: 60
1263
+
1264
+ ## Additional forbidden patterns (project-specific)
1265
+ - Never import from src/routes/ into src/services/ (one-way dependency rule)
1266
+ - Never use moment.js — this project uses date-fns exclusively
1267
+ - Never throw raw Error objects — use the AppError class (src/errors/AppError.ts)
1268
+ ```
1269
+
1270
+ 3. At task execution time, the loader merges: `base persona` + `override file`.
1271
+ Additive sections stack. Override sections replace.
1272
+
1273
+ ## Override resolution rules
1274
+
1275
+ | Override directive | Behaviour |
1276
+ |---|---|
1277
+ | `## Additional [section]` | Appended to the base persona's equivalent section |
1278
+ | `## Modified [section]` | Replaces the base persona's equivalent section |
1279
+ | `## Removed [section]` | Removes that section from the merged persona |
1280
+ | `MAX_FUNCTION_LINES: 60` | Key-value style — overrides a specific parameter |
1281
+
1282
+ ## Phase-level overrides
1283
+
1284
+ To override a persona for a specific phase only:
1285
+ Create: `.planning/phases/[N]/persona-overrides/developer.md`
1286
+
1287
+ Phase-level overrides take priority over project-level overrides:
1288
+ Phase override > Project override > Core persona
1289
+
1290
+ ## When to use overrides vs. creating a new persona
1291
+
1292
+ Use an **override** when:
1293
+ - You want to add project-specific coding conventions
1294
+ - You want to adjust one or two rules (not rebuild the whole persona)
1295
+ - The change is specific to this project and would not apply to others
1296
+
1297
+ Create a **new persona** when:
1298
+ - You need a wholly different cognitive mode (e.g., "ML Engineer" persona)
1299
+ - The persona would be useful across multiple projects (make it an Org persona)
1300
+ - The change is so extensive it is easier to write from scratch than to override
1301
+
1302
+ ## Override file template
1303
+
1304
+ ```markdown
1305
+ # [Persona Name] Override — [Project or Phase Name]
1306
+ # Scope: project | phase-[N]
1307
+ # Author: [who created this override]
1308
+ # Created: [ISO-8601]
1309
+
1310
+ ## Additional [conventions/standards/forbidden patterns/etc.]
1311
+ [Add to the base persona without replacing]
1312
+
1313
+ ## Modified [section name from base persona]
1314
+ [Replace a specific section]
1315
+
1316
+ ## Project-specific context
1317
+ [Facts about this project the persona should always know]
1318
+
1319
+ ## Project-specific forbidden patterns
1320
+ [Anti-patterns specific to this codebase]
1321
+ ```
1322
+ ```
1323
+
1324
+ **Commit:**
1325
+ ```bash
1326
+ git add .mindforge/personas/overrides/
1327
+ git commit -m "feat(personas): implement persona customisation override system"
1328
+ ```
1329
+
1330
+ ---
1331
+
1332
+ ## TASK 6 — Write `/mindforge:skills` command
1333
+
1334
+ ### `.claude/commands/mindforge/skills.md`
1335
+
1336
+ ```markdown
1337
+ # MindForge — Skills Command
1338
+ # Usage: /mindforge:skills [subcommand] [args]
1339
+ # Subcommands: list | add | update | validate | info | search
1340
+
1341
+ ## Subcommand: list
1342
+ `/mindforge:skills list`
1343
+
1344
+ Read MANIFEST.md. Display all registered skills in a formatted table:
1345
+
1346
+ ```
1347
+ MindForge Skills Registry
1348
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1349
+
1350
+ Tier 1 — Core Skills (10 installed)
1351
+ ────────────────────────────────────────────────────────────
1352
+ ✅ security-review v1.0.0 stable
1353
+ ✅ code-quality v1.0.0 stable
1354
+ ✅ api-design v1.0.0 stable
1355
+ ✅ testing-standards v1.0.0 stable
1356
+ ✅ documentation v1.0.0 stable
1357
+ ✅ performance v1.0.0 stable
1358
+ ✅ accessibility v1.0.0 stable
1359
+ ✅ data-privacy v1.0.0 stable
1360
+ ✅ incident-response v1.0.0 stable
1361
+ ✅ database-patterns v1.0.0 stable
1362
+
1363
+ Tier 2 — Org Skills (0 installed)
1364
+ ────────────────────────────────────────────────────────────
1365
+ (none — run /mindforge:skills add to add org skills)
1366
+
1367
+ Tier 3 — Project Skills (0 installed)
1368
+ ────────────────────────────────────────────────────────────
1369
+ (none)
1370
+
1371
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1372
+ Total: 10 skills | Run /mindforge:skills validate to check health
1373
+ ```
1374
+
1375
+ ## Subcommand: info
1376
+ `/mindforge:skills info [skill-name]`
1377
+
1378
+ Display detailed information about a specific skill:
1379
+
1380
+ ```
1381
+ Skill: security-review
1382
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1383
+ Version : 1.0.0
1384
+ Status : stable
1385
+ Tier : 1 (Core)
1386
+ Min MindForge: 0.1.0
1387
+ Path : .mindforge/skills/security-review/SKILL.md
1388
+
1389
+ Triggers (25):
1390
+ auth, authentication, authorisation, authorization, login,
1391
+ logout, password, token, JWT, session, cookie, OAuth,
1392
+ payment, billing, stripe, PII, GDPR, personal data,
1393
+ upload, file upload, credentials, API key, secret, env,
1394
+ environment variable, encryption, hashing, bcrypt, argon2
1395
+
1396
+ Changelog:
1397
+ 1.0.0 — Initial stable release
1398
+ ```
1399
+
1400
+ ## Subcommand: search
1401
+ `/mindforge:skills search [keyword]`
1402
+
1403
+ Find which skills would activate for a given keyword:
1404
+
1405
+ ```
1406
+ /mindforge:skills search "database query"
1407
+
1408
+ Matching skills for "database query":
1409
+ ────────────────────────────────────────────────────────────
1410
+ database-patterns v1.0.0 [tier 1] trigger: "database", "query"
1411
+ performance v1.0.0 [tier 1] trigger: "query time"
1412
+
1413
+ These 2 skills would be automatically loaded for a task
1414
+ containing "database query" in its description.
1415
+ ```
1416
+
1417
+ ## Subcommand: validate
1418
+ `/mindforge:skills validate`
1419
+
1420
+ Run a health check on all installed skills:
1421
+
1422
+ ```
1423
+ Validating skills...
1424
+
1425
+ ✅ security-review — frontmatter valid, file readable, triggers: 29
1426
+ ✅ code-quality — frontmatter valid, file readable, triggers: 14
1427
+ ✅ performance — frontmatter valid, file readable, triggers: 31
1428
+ ⚠️ [org-skill-name] — frontmatter valid but missing 'version' field
1429
+ ❌ [missing-skill] — listed in MANIFEST.md but file not found
1430
+
1431
+ Issues found: 2
1432
+ Run /mindforge:skills add to fix missing skills.
1433
+ Fix frontmatter issues manually in the SKILL.md file.
1434
+ ```
1435
+
1436
+ Validation checks:
1437
+ 1. Every manifest entry has a corresponding SKILL.md file
1438
+ 2. Every SKILL.md has: `name`, `version`, `status`, `triggers` in frontmatter
1439
+ 3. All versions are valid semver strings
1440
+ 4. No two skills at the same tier share the same trigger keyword (flag as ⚠️)
1441
+ 5. Every skill file is readable (not empty, not corrupted)
1442
+
1443
+ ## Subcommand: add
1444
+ `/mindforge:skills add [path-to-skill-dir]`
1445
+
1446
+ Register a new skill in the manifest:
1447
+
1448
+ 1. Read the SKILL.md in the provided path
1449
+ 2. Validate the frontmatter (all required fields present)
1450
+ 3. Check for trigger keyword conflicts with existing skills
1451
+ 4. Ask the user: "Which tier should this skill be registered as? (2=Org / 3=Project)"
1452
+ 5. Add the entry to MANIFEST.md in the correct section
1453
+ 6. Run `/mindforge:skills validate` to confirm registration is clean
1454
+ 7. Commit: `feat(skills): register [skill-name] v[version] as tier [N] skill`
1455
+
1456
+ ## Subcommand: update
1457
+ `/mindforge:skills update [skill-name]`
1458
+
1459
+ Update a skill to a newer version:
1460
+
1461
+ 1. Read current version from MANIFEST.md
1462
+ 2. Check the skill's changelog in SKILL.md for available updates
1463
+ 3. If MAJOR version change: show breaking changes, require confirmation
1464
+ 4. If MINOR or PATCH: update automatically
1465
+ 5. Update MANIFEST.md version entry
1466
+ 6. Run `/mindforge:skills validate` after update
1467
+ 7. Commit: `chore(skills): update [name] v[old] → v[new]`
1468
+
1469
+ ## Error handling
1470
+ - If MANIFEST.md does not exist: offer to create it with current skills
1471
+ - If a skill name is not found: suggest similar names (fuzzy match)
1472
+ - If validation finds critical errors: block any phase execution until fixed
1473
+ (A skills validation failure is a BLOCKING issue)
1474
+ ```
1475
+
1476
+ **Commit:**
1477
+ ```bash
1478
+ cp .claude/commands/mindforge/skills.md .agent/mindforge/skills.md
1479
+ git add .claude/commands/mindforge/skills.md .agent/mindforge/skills.md
1480
+ git commit -m "feat(commands): add /mindforge:skills full CLI command"
1481
+ ```
1482
+
1483
+ ---
1484
+
1485
+ ## TASK 7 — Write `/mindforge:review` command
1486
+
1487
+ ### `.claude/commands/mindforge/review.md`
1488
+
1489
+ ```markdown
1490
+ # MindForge — Review Command
1491
+ # Usage: /mindforge:review [path|phase N|--staged|--last-commit]
1492
+ # Performs a comprehensive code review using code-quality and security skills.
1493
+
1494
+ ## Review targets
1495
+ - `/mindforge:review` (no args) → review all uncommitted changes (`git diff`)
1496
+ - `/mindforge:review --staged` → review staged changes (`git diff --cached`)
1497
+ - `/mindforge:review --last-commit` → review the last commit (`git diff HEAD~1`)
1498
+ - `/mindforge:review phase [N]` → review all commits in phase N
1499
+ - `/mindforge:review [file-path]` → review a specific file
1500
+ - `/mindforge:review [dir-path]` → review all files in a directory
1501
+
1502
+ ## Step 1 — Establish review scope
1503
+
1504
+ Based on the target argument, build the file list to review:
1505
+ ```bash
1506
+ # Uncommitted changes
1507
+ git diff --name-only
1508
+
1509
+ # Staged changes
1510
+ git diff --cached --name-only
1511
+
1512
+ # Last commit
1513
+ git diff HEAD~1 --name-only
1514
+
1515
+ # Phase N (all commits between phase start and phase end tags)
1516
+ git log --oneline --name-only [phase-start-sha]..[phase-end-sha]
1517
+ ```
1518
+
1519
+ Display the file list to the user before reviewing:
1520
+ "Reviewing [N] files: [list]"
1521
+
1522
+ ## Step 2 — Load review personas and skills
1523
+
1524
+ Activate TWO personas simultaneously for a comprehensive review:
1525
+
1526
+ **Primary:** `code-quality.md` — structural quality, conventions, complexity
1527
+ **Secondary:** `security-reviewer.md` — security issues, data exposure, auth
1528
+
1529
+ Load these skills:
1530
+ - `code-quality/SKILL.md` — always
1531
+ - `security-review/SKILL.md` — always
1532
+ - Contextual skills based on file types detected in the diff:
1533
+ - `.ts`/`.tsx` → also load `api-design/SKILL.md` (if routes present)
1534
+ - Database migration files → also load `database-patterns/SKILL.md`
1535
+ - UI component files → also load `accessibility/SKILL.md`
1536
+
1537
+ ## Step 3 — Review each file
1538
+
1539
+ For each file in the review scope:
1540
+
1541
+ **Read the full file content** (not just the diff — context matters).
1542
+ **Read the diff for this file** to understand what changed.
1543
+
1544
+ Apply ALL of the following checks:
1545
+
1546
+ ### Code quality checks
1547
+ - [ ] Functions within length limits (CONVENTIONS.md standard)
1548
+ - [ ] Cyclomatic complexity ≤ 10 (count if/else/switch/catch/ternary branches)
1549
+ - [ ] No magic numbers (named constants used instead)
1550
+ - [ ] No commented-out code
1551
+ - [ ] No `TODO` or `FIXME` left uncommitted
1552
+ - [ ] Error handling is explicit (no empty catch blocks)
1553
+ - [ ] Naming is precise and unambiguous (no `data`, `info`, `temp`)
1554
+ - [ ] Every exported function has a JSDoc/docstring
1555
+ - [ ] DRY: no logic duplicated 3+ times
1556
+ - [ ] No dead code (imports/variables defined but never used)
1557
+
1558
+ ### Convention checks (from CONVENTIONS.md)
1559
+ - [ ] File naming follows convention
1560
+ - [ ] Import order follows the defined order
1561
+ - [ ] All forbidden patterns are absent
1562
+ - [ ] Architecture boundaries respected (services don't import routes, etc.)
1563
+
1564
+ ### Security checks (from security-review SKILL)
1565
+ - [ ] No hardcoded credentials or secrets
1566
+ - [ ] User input validated at boundaries
1567
+ - [ ] SQL queries parameterised
1568
+ - [ ] Sensitive data not in logs or error messages
1569
+ - [ ] New dependencies CVE-scanned
1570
+
1571
+ ### Type safety (TypeScript projects)
1572
+ - [ ] No `any` types without justification comment
1573
+ - [ ] No `as unknown as X` casting without justification
1574
+ - [ ] All function parameters typed (no implicit any)
1575
+ - [ ] Return types explicitly declared on public functions
1576
+
1577
+ ## Step 4 — Write the review report
1578
+
1579
+ Create `.planning/phases/[current-phase]/CODE-REVIEW-[timestamp].md`
1580
+ or `.planning/quick/review-[timestamp].md` for ad-hoc reviews:
1581
+
1582
+ ```markdown
1583
+ # Code Review Report
1584
+ **Date:** [ISO-8601]
1585
+ **Reviewer:** MindForge (code-quality + security-reviewer)
1586
+ **Scope:** [what was reviewed]
1587
+ **Files reviewed:** [N]
1588
+
1589
+ ## Summary
1590
+ [2-3 sentences: overall quality, major themes, recommendation]
1591
+
1592
+ ## Findings
1593
+
1594
+ ### 🔴 Blocking (must fix before merge)
1595
+ | # | File | Line | Issue | Recommendation |
1596
+ |---|---|---|---|---|
1597
+ | 1 | src/auth/login.ts | 47 | Parameterised query not used | Use `db.query('SELECT * FROM users WHERE id = $1', [id])` |
1598
+
1599
+ ### 🟠 Major (should fix in this PR)
1600
+ | # | File | Line | Issue | Recommendation |
1601
+ |---|---|---|---|---|
1602
+ | 1 | src/api/users.ts | 23 | Function is 67 lines (limit: 40) | Extract `validateUserInput` to separate function |
1603
+
1604
+ ### 🟡 Minor (fix in follow-up)
1605
+ | # | File | Line | Issue | Recommendation |
1606
+ |---|---|---|---|---|
1607
+ | 1 | src/models/order.ts | 8 | Missing JSDoc on exported function | Add `@param`, `@returns`, `@throws` |
1608
+
1609
+ ### 💡 Suggestions (optional improvements)
1610
+ | # | File | Line | Suggestion |
1611
+ |---|---|---|---|
1612
+ | 1 | src/services/email.ts | 15 | Consider memoising the template compilation |
1613
+
1614
+ ## Metrics
1615
+ - Files reviewed: [N]
1616
+ - Lines reviewed: [N]
1617
+ - Blocking findings: [N]
1618
+ - Major findings: [N]
1619
+ - Minor findings: [N]
1620
+ - Suggestions: [N]
1621
+
1622
+ ## Verdict
1623
+ ✅ APPROVED — No blocking or major findings
1624
+ ⚠️ APPROVED WITH CONDITIONS — Fix [N] major findings
1625
+ ❌ CHANGES REQUIRED — [N] blocking findings must be fixed
1626
+ ```
1627
+
1628
+ ## Step 5 — Write AUDIT entry
1629
+
1630
+ ```json
1631
+ {
1632
+ "event": "code_review_completed",
1633
+ "scope": "[what was reviewed]",
1634
+ "files_reviewed": [N],
1635
+ "blocking_findings": [N],
1636
+ "major_findings": [N],
1637
+ "verdict": "approved | changes_required",
1638
+ "report_path": ".planning/.../CODE-REVIEW-[timestamp].md"
1639
+ }
1640
+ ```
1641
+
1642
+ ## Step 6 — Report to user
1643
+
1644
+ Display a summary of findings.
1645
+ If blocking findings exist: do not allow merge.
1646
+ Tell the user: "Fix the [N] blocking issues, then run /mindforge:review again to re-check."
1647
+ ```
1648
+
1649
+ **Commit:**
1650
+ ```bash
1651
+ cp .claude/commands/mindforge/review.md .agent/mindforge/review.md
1652
+ git add .claude/commands/mindforge/review.md .agent/mindforge/review.md
1653
+ git commit -m "feat(commands): add /mindforge:review comprehensive code review command"
1654
+ ```
1655
+
1656
+ ---
1657
+
1658
+ ## TASK 8 — Write `/mindforge:security-scan` command
1659
+
1660
+ ### `.claude/commands/mindforge/security-scan.md`
1661
+
1662
+ ```markdown
1663
+ # MindForge — Security Scan Command
1664
+ # Usage: /mindforge:security-scan [path] [--deep] [--deps] [--secrets]
1665
+ # Standalone security scan. Can be run independently of the phase lifecycle.
1666
+
1667
+ ## Scan modes
1668
+ - Default: OWASP Top 10 review on the changed files or specified path
1669
+ - `--deep`: Extended scan including all files, not just changed
1670
+ - `--deps`: Dependency audit (CVE scan of package.json / requirements.txt)
1671
+ - `--secrets`: Secret detection scan only (fast, suitable for pre-commit hook)
1672
+ - Flags composable: `--deps --secrets` runs both dependency audit and secret detection
1673
+
1674
+ ## Step 1 — Activate Security Reviewer persona
1675
+
1676
+ Load `security-reviewer.md` persona immediately and completely.
1677
+ This command runs entirely in security mode. Do not switch personas.
1678
+
1679
+ ## Step 2 — Build scan scope
1680
+
1681
+ ```bash
1682
+ # Default: staged + unstaged changes
1683
+ git diff HEAD --name-only
1684
+
1685
+ # With path argument
1686
+ find [path] -name "*.ts" -o -name "*.js" -o -name "*.py"
1687
+
1688
+ # --deep: all source files
1689
+ find src/ -type f \( -name "*.ts" -o -name "*.js" -o -name "*.py" \)
1690
+ ```
1691
+
1692
+ ## Step 3 — OWASP Top 10 scan (always runs unless --secrets only)
1693
+
1694
+ For each file in scope, check all 10 OWASP categories:
1695
+
1696
+ ### A01 — Broken Access Control
1697
+ - Scan for: missing auth middleware, direct object references, path traversal
1698
+ - Patterns to flag:
1699
+ ```
1700
+ req.params.userId # Direct user ID from request — verify ownership check
1701
+ fs.readFile(userInput) # Path traversal risk
1702
+ WHERE id = ${id} # Direct injection without parameterisation
1703
+ ```
1704
+
1705
+ ### A02 — Cryptographic Failures
1706
+ - Scan for: weak algorithms, insecure transport, unencrypted sensitive data
1707
+ - Patterns to flag:
1708
+ ```
1709
+ md5(, sha1(, sha256(password # Weak password hashing
1710
+ http:// # Non-HTTPS URLs in API calls
1711
+ Math.random() # Cryptographically insecure random
1712
+ ```
1713
+
1714
+ ### A03 — Injection
1715
+ - Scan for: SQL, NoSQL, OS, LDAP injection
1716
+ - Patterns to flag:
1717
+ ```
1718
+ `SELECT * FROM users WHERE email = '${ # SQL injection
1719
+ exec(, execSync(, child_process # OS command injection
1720
+ eval(userInput # Code injection
1721
+ ```
1722
+
1723
+ ### A04 — Insecure Design
1724
+ - Scan for: missing rate limiting, no input validation, trust boundary issues
1725
+ - Patterns to flag: endpoints without validation middleware, no rate limit decorators
1726
+
1727
+ ### A05 — Security Misconfiguration
1728
+ - Scan for: debug mode in production, default credentials, verbose errors
1729
+ - Patterns to flag:
1730
+ ```
1731
+ console.error(err) # Exposes stack traces to clients
1732
+ NODE_ENV !== 'production' # Debug code paths
1733
+ ALLOW_ALL, *, cors({origin: '*'}) # Overly permissive CORS
1734
+ ```
1735
+
1736
+ ### A06 — Vulnerable Components
1737
+ - Run: `npm audit --audit-level=moderate` or `pip-audit`
1738
+ - Flag any HIGH or CRITICAL CVEs
1739
+
1740
+ ### A07 — Authentication Failures
1741
+ - Scan for: missing password complexity, no brute force protection, weak sessions
1742
+ - Patterns to flag:
1743
+ ```
1744
+ bcrypt.hashSync(pass, 1) # Cost factor too low
1745
+ jwt.verify(token, '', { # Empty secret
1746
+ session.destroy( # Verify redirect after destroy
1747
+ ```
1748
+
1749
+ ### A08 — Software and Data Integrity Failures
1750
+ - Check: no package-lock.json means no integrity guarantee
1751
+ - Check: any `curl | sh` or `wget | bash` patterns
1752
+
1753
+ ### A09 — Security Logging Failures
1754
+ - Scan for: no logging on auth failures, admin actions not logged, PII in logs
1755
+ - Patterns to flag:
1756
+ ```
1757
+ user.email in any log statement
1758
+ password in any log statement
1759
+ catch(e) {} # Silent failure = no security log
1760
+ ```
1761
+
1762
+ ### A10 — SSRF
1763
+ - Scan for: server-side requests to user-controlled URLs
1764
+ - Patterns to flag:
1765
+ ```
1766
+ fetch(req.body.url, # SSRF via user input
1767
+ axios.get(params.webhook, # SSRF via user input
1768
+ ```
1769
+
1770
+ ## Step 4 — Secret detection (--secrets or always as part of default scan)
1771
+
1772
+ Pattern-based scan across all files in scope:
1773
+
1774
+ ```bash
1775
+ # High confidence patterns (always flag as CRITICAL)
1776
+ grep -rn -E "(sk-[a-zA-Z0-9]{20,}|AKIA[A-Z0-9]{16}|ghp_[a-zA-Z0-9]{36})" .
1777
+
1778
+ # Credential assignment patterns (flag as HIGH)
1779
+ grep -rn -E "(password|passwd|secret|api_key|apikey|access_token)\s*=\s*['\"][^'\"]{8,}" .
1780
+
1781
+ # PEM/Certificate content
1782
+ grep -rn "-----BEGIN (RSA |EC |OPENSSH )?PRIVATE KEY-----" .
1783
+
1784
+ # Database URLs with credentials
1785
+ grep -rn -E "postgres://[^:]+:[^@]+@|mysql://[^:]+:[^@]+@" .
1786
+ ```
1787
+
1788
+ Report each finding with:
1789
+ - File and line number
1790
+ - The matched pattern (redact the actual secret value: show first 4 chars + ***)
1791
+ - Severity: CRITICAL if a real credential pattern, HIGH if credential-shaped pattern
1792
+
1793
+ ## Step 5 — Dependency audit (--deps flag)
1794
+
1795
+ ```bash
1796
+ # Node.js projects
1797
+ npm audit --json 2>/dev/null | node -e "
1798
+ const data = JSON.parse(require('fs').readFileSync('/dev/stdin', 'utf8'));
1799
+ const vulns = data.vulnerabilities || {};
1800
+ Object.entries(vulns).forEach(([name, v]) => {
1801
+ if (['high','critical'].includes(v.severity)) {
1802
+ console.log(v.severity.toUpperCase() + ': ' + name + ' — ' + v.via[0]?.title);
1803
+ }
1804
+ });
1805
+ "
1806
+
1807
+ # Python projects
1808
+ pip-audit --format json 2>/dev/null
1809
+ ```
1810
+
1811
+ ## Step 6 — Write security scan report
1812
+
1813
+ `.planning/SECURITY-SCAN-[timestamp].md`:
1814
+
1815
+ ```markdown
1816
+ # Security Scan Report
1817
+ **Date:** [ISO-8601]
1818
+ **Scope:** [what was scanned]
1819
+ **Scanner:** MindForge Security Reviewer
1820
+
1821
+ ## Executive Summary
1822
+ [1-2 sentences: overall security posture, number of findings by severity]
1823
+
1824
+ ## Critical Findings (fix immediately — block all merges)
1825
+ [OWASP category] | [File:Line] | [Description] | [Remediation]
1826
+
1827
+ ## High Findings (fix before next release)
1828
+ ...
1829
+
1830
+ ## Medium Findings (fix in next sprint)
1831
+ ...
1832
+
1833
+ ## Low Findings (backlog)
1834
+ ...
1835
+
1836
+ ## Dependency Audit
1837
+ | Package | Version | Severity | CVE | Fixed in |
1838
+ |---|---|---|---|---|
1839
+
1840
+ ## Secret Detection
1841
+ | File | Pattern | Severity | Action |
1842
+ |---|---|---|---|
1843
+
1844
+ ## Verdict
1845
+ ✅ CLEAN — No critical or high findings
1846
+ ⚠️ ISSUES — [N] critical, [N] high findings require attention
1847
+ ```
1848
+
1849
+ ## Step 7 — Write AUDIT entry
1850
+
1851
+ ```json
1852
+ {
1853
+ "event": "security_scan_completed",
1854
+ "scope": "[path or 'staged changes']",
1855
+ "flags": ["--deps", "--secrets"],
1856
+ "critical_findings": [N],
1857
+ "high_findings": [N],
1858
+ "secrets_detected": [N],
1859
+ "vulnerable_deps": [N],
1860
+ "report_path": ".planning/SECURITY-SCAN-[timestamp].md"
1861
+ }
1862
+ ```
1863
+
1864
+ ## Automatic blocking behaviour
1865
+ If CRITICAL findings are detected: print a prominent warning:
1866
+ ```
1867
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1868
+ 🔴 CRITICAL SECURITY FINDINGS DETECTED
1869
+
1870
+ [N] critical issues must be fixed before any code is merged.
1871
+ See: .planning/SECURITY-SCAN-[timestamp].md
1872
+
1873
+ Do NOT commit or deploy until these are resolved.
1874
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1875
+ ```
1876
+ ```
1877
+
1878
+ **Commit:**
1879
+ ```bash
1880
+ cp .claude/commands/mindforge/security-scan.md .agent/mindforge/security-scan.md
1881
+ git add .claude/commands/mindforge/security-scan.md .agent/mindforge/security-scan.md
1882
+ git commit -m "feat(commands): add /mindforge:security-scan standalone security command"
1883
+ ```
1884
+
1885
+ ---
1886
+
1887
+ ## TASK 9 — Write `/mindforge:map-codebase` command
1888
+
1889
+ ### `.claude/commands/mindforge/map-codebase.md`
1890
+
1891
+ ```markdown
1892
+ # MindForge — Map Codebase Command
1893
+ # Usage: /mindforge:map-codebase [area]
1894
+ # Onboards MindForge to an existing (brownfield) codebase.
1895
+ # Run this INSTEAD of /mindforge:init-project when joining an existing project.
1896
+
1897
+ ## When to use this command
1898
+ - Joining an existing project that has no MindForge context files
1899
+ - Adding MindForge to a team that already has a codebase
1900
+ - Onboarding to a new-to-you repository
1901
+ - Re-mapping after major architectural changes
1902
+
1903
+ ## What it produces
1904
+ - `.planning/ARCHITECTURE.md` — system architecture discovered from code
1905
+ - `.planning/PROJECT.md` — project identity inferred from codebase + user confirmation
1906
+ - `.mindforge/org/CONVENTIONS.md` — actual conventions found in the code
1907
+ - `.planning/STATE.md` — current position (MindForge onboarded, ready to plan)
1908
+ - `.planning/decisions/ADR-NNN-[title].md` — key architectural decisions found
1909
+
1910
+ ## Step 1 — Codebase inventory
1911
+
1912
+ Spawn FOUR parallel subagents. Each focuses on one analysis area.
1913
+ Each subagent writes its findings to a temporary file.
1914
+
1915
+ ### Subagent A — Technology Stack Analyst
1916
+ Context: minimal (CONVENTIONS.md template + task description)
1917
+ Persona: architect.md
1918
+ Task:
1919
+ ```
1920
+ Analyse this repository's technology stack. Read:
1921
+ - package.json / requirements.txt / Cargo.toml / go.mod (root and workspaces)
1922
+ - Dockerfile, docker-compose.yml (if present)
1923
+ - CI/CD configuration: .github/workflows/, .gitlab-ci.yml, .circleci/
1924
+ - Infrastructure files: terraform/, pulumi/, k8s/, helm/
1925
+
1926
+ Write to: .planning/map-temp/STACK.md
1927
+ Include:
1928
+ - Runtime/language and version
1929
+ - Framework(s) and versions
1930
+ - Database(s) used
1931
+ - Cache and queue systems
1932
+ - Testing framework(s)
1933
+ - Build and bundling tools
1934
+ - Deployment target (AWS/GCP/Azure/bare metal/etc.)
1935
+ - External services integrated (payment, email, auth, etc.)
1936
+ ```
1937
+
1938
+ ### Subagent B — Architecture Analyst
1939
+ Context: minimal
1940
+ Persona: architect.md
1941
+ Task:
1942
+ ```
1943
+ Analyse this repository's architecture. Read:
1944
+ - All files in src/ (or equivalent) — structure, not content
1945
+ - README.md and any docs/ directory
1946
+ - Any architecture diagrams (look for .png, .svg, .drawio in docs/)
1947
+ - Entry points: index.ts, main.py, app.go, server.ts (root-level)
1948
+
1949
+ Write to: .planning/map-temp/ARCHITECTURE-RAW.md
1950
+ Include:
1951
+ - Architectural pattern: MVC / Clean Architecture / Hexagonal / Modular Monolith / Microservices
1952
+ - Domain model: what are the core entities? (infer from models/, entities/, types/)
1953
+ - API surface: public endpoints found in routes/, controllers/, handlers/
1954
+ - Module structure: how is the code organised? Feature-based / Layer-based?
1955
+ - Key design patterns in use: Repository, Service, Factory, Observer, etc.
1956
+ ```
1957
+
1958
+ ### Subagent C — Conventions Analyst
1959
+ Context: minimal
1960
+ Persona: developer.md
1961
+ Task:
1962
+ ```
1963
+ Analyse the actual coding conventions used in this repository.
1964
+ Read 5-10 representative source files from different areas of the codebase.
1965
+
1966
+ Write to: .planning/map-temp/CONVENTIONS-RAW.md
1967
+ Infer and document:
1968
+ - Naming conventions: variables, functions, classes, files, database columns
1969
+ - Import order and grouping style
1970
+ - Error handling patterns: how are errors thrown and caught?
1971
+ - TypeScript patterns: preferred type patterns, generic usage
1972
+ - Comment style: JSDoc, inline, etc.
1973
+ - Test file naming and location pattern
1974
+ - Async patterns: callbacks / promises / async-await
1975
+ - State management (frontend): if applicable
1976
+ - Any recurring patterns that appear across multiple files
1977
+
1978
+ Important: document what IS there, not what should be there.
1979
+ This is a description of reality, not a prescription.
1980
+ ```
1981
+
1982
+ ### Subagent D — Quality Baseline Analyst
1983
+ Context: minimal
1984
+ Persona: qa-engineer.md
1985
+ Task:
1986
+ ```
1987
+ Assess the current quality baseline of this repository.
1988
+
1989
+ Write to: .planning/map-temp/QUALITY-BASELINE.md
1990
+ Check:
1991
+ - Test coverage: does a test suite exist? What framework? Run: [test command] --coverage
1992
+ - Linting: is a linter configured? (.eslintrc, .pylintrc, ruff.toml, etc.)
1993
+ - Type checking: TypeScript config? Strict mode enabled?
1994
+ - CI/CD: does it run tests on PRs?
1995
+ - Security: any security scanning in CI?
1996
+ - Known issues: open GitHub/GitLab issues, TODO count in source
1997
+
1998
+ Note: do not fix anything. Only document what exists.
1999
+ ```
2000
+
2001
+ ## Step 2 — Synthesise findings
2002
+
2003
+ Read all four temp files. Synthesise into the permanent context files.
2004
+
2005
+ ### Write `.planning/ARCHITECTURE.md`
2006
+
2007
+ Use ARCHITECTURE-RAW.md as input. Write a clean, structured architecture document:
2008
+
2009
+ ```markdown
2010
+ # [Project Name] — Architecture
2011
+
2012
+ ## System overview
2013
+ [2-3 sentences from the subagent's findings]
2014
+
2015
+ ## Technology stack
2016
+ [From STACK.md — organised by layer]
2017
+
2018
+ ## Architectural pattern
2019
+ [From ARCHITECTURE-RAW.md]
2020
+
2021
+ ## Domain model
2022
+ [Core entities and their relationships]
2023
+
2024
+ ## API surface
2025
+ [Key endpoints / GraphQL operations / gRPC services found]
2026
+
2027
+ ## Module structure
2028
+ [How the codebase is organised]
2029
+
2030
+ ## External integrations
2031
+ [Third-party services found]
2032
+
2033
+ ## Known architectural decisions
2034
+ [Any ADRs, architecture docs, or README decisions found]
2035
+
2036
+ ## Quality baseline
2037
+ [From QUALITY-BASELINE.md — honest assessment]
2038
+
2039
+ ## MindForge onboarding notes
2040
+ [What was inferred vs. confirmed, what needs human review]
2041
+ ```
2042
+
2043
+ ### Write `.mindforge/org/CONVENTIONS.md`
2044
+
2045
+ Use CONVENTIONS-RAW.md as input. Write the conventions file in the standard format,
2046
+ but clearly mark inferred conventions:
2047
+
2048
+ ```markdown
2049
+ # Coding Conventions — [Project Name]
2050
+ # Source: Inferred from codebase analysis by MindForge
2051
+ # Status: DRAFT — confirm with team before treating as authoritative
2052
+
2053
+ ## IMPORTANT
2054
+ These conventions were inferred from code analysis. Review each section
2055
+ and mark as [CONFIRMED] or [NEEDS REVIEW] before running /mindforge:plan-phase.
2056
+
2057
+ ## Naming conventions [NEEDS REVIEW]
2058
+ [What was found]
2059
+ ```
2060
+
2061
+ ## Step 3 — Present findings for confirmation
2062
+
2063
+ Present a summary to the user. Ask for confirmation and corrections:
2064
+
2065
+ ```
2066
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
2067
+ MindForge Codebase Analysis Complete
2068
+
2069
+ Stack:
2070
+ Runtime : Node.js 20 (inferred from .nvmrc)
2071
+ Framework : Next.js 14 (inferred from package.json)
2072
+ Database : PostgreSQL via Prisma (inferred from prisma/schema.prisma)
2073
+ Auth : NextAuth.js (inferred from package.json)
2074
+
2075
+ Architecture:
2076
+ Pattern : Feature-based modular (inferred from src/ structure)
2077
+ Entities : User, Organization, Project, Task (inferred from Prisma schema)
2078
+ API : REST API in src/app/api/ (24 route files found)
2079
+
2080
+ Quality baseline:
2081
+ Tests : Vitest, ~340 test files, ~67% coverage (inferred from coverage report)
2082
+ Linting : ESLint configured, strict TypeScript
2083
+ CI/CD : GitHub Actions (4 workflows)
2084
+
2085
+ Conventions: see .mindforge/org/CONVENTIONS.md (DRAFT — needs review)
2086
+
2087
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
2088
+
2089
+ Does this look correct? (yes / correct [field]: [value] / no)
2090
+ ```
2091
+
2092
+ Wait for user confirmation. Apply any corrections the user provides.
2093
+
2094
+ ## Step 4 — Write PROJECT.md and STATE.md
2095
+
2096
+ After confirmation, write:
2097
+
2098
+ `.planning/PROJECT.md` — populated with confirmed findings
2099
+ `.planning/STATE.md` — status: "Codebase mapped. Ready to plan first phase."
2100
+ `.planning/HANDOFF.json` — updated with onboarding completion
2101
+
2102
+ ## Step 5 — Clean up and report
2103
+
2104
+ ```bash
2105
+ rm -rf .planning/map-temp/
2106
+ ```
2107
+
2108
+ Report to user:
2109
+ "✅ Codebase mapped.
2110
+
2111
+ Files created:
2112
+ .planning/ARCHITECTURE.md
2113
+ .planning/PROJECT.md
2114
+ .mindforge/org/CONVENTIONS.md (DRAFT — please review)
2115
+ .planning/STATE.md
2116
+
2117
+ Review .mindforge/org/CONVENTIONS.md and mark each section as [CONFIRMED].
2118
+ Then run /mindforge:plan-phase 1 to begin your first phase."
2119
+
2120
+ Write AUDIT entry:
2121
+ ```json
2122
+ {
2123
+ "event": "codebase_mapped",
2124
+ "files_analysed": [N],
2125
+ "entities_found": [N],
2126
+ "api_routes_found": [N],
2127
+ "conventions_confidence": "medium",
2128
+ "requires_human_review": [".mindforge/org/CONVENTIONS.md"]
2129
+ }
2130
+ ```
2131
+ ```
2132
+
2133
+ **Commit:**
2134
+ ```bash
2135
+ cp .claude/commands/mindforge/map-codebase.md .agent/mindforge/map-codebase.md
2136
+ git add .claude/commands/mindforge/map-codebase.md .agent/mindforge/map-codebase.md
2137
+ git commit -m "feat(commands): add /mindforge:map-codebase brownfield onboarding command"
2138
+ ```
2139
+
2140
+ ---
2141
+
2142
+ ## TASK 10 — Write `/mindforge:discuss-phase` command
2143
+
2144
+ ### `.claude/commands/mindforge/discuss-phase.md`
2145
+
2146
+ ```markdown
2147
+ # MindForge — Discuss Phase Command
2148
+ # Usage: /mindforge:discuss-phase [N] [--batch] [--auto]
2149
+ # Captures implementation decisions before planning begins.
2150
+ # Run this BEFORE /mindforge:plan-phase for complex phases.
2151
+
2152
+ ## Purpose
2153
+ Planning without discussion produces generic plans.
2154
+ Discussion captures YOUR decisions — layout preferences, library choices,
2155
+ UX specifics, edge cases you've already thought through — so the planner
2156
+ builds what you actually want, not what seems reasonable.
2157
+
2158
+ ## When to use
2159
+ - Any phase with UI/UX components (visual decisions need capturing)
2160
+ - Any phase with multiple valid implementation approaches
2161
+ - Any phase where you already have opinions on the approach
2162
+ - Any phase touching external services (your preferences on APIs matter)
2163
+ - Skip for trivial phases (e.g., "add one field to an existing form")
2164
+
2165
+ ## Step 1 — Analyse the phase scope
2166
+
2167
+ Read:
2168
+ - ROADMAP.md for the phase description
2169
+ - REQUIREMENTS.md for the requirements in this phase
2170
+ - ARCHITECTURE.md for relevant architectural context
2171
+
2172
+ Identify the phase's primary domain:
2173
+ - **Visual/UI** → ask about layout, interactions, states, empty states, animations
2174
+ - **API/Backend** → ask about response format, error handling, auth approach, versioning
2175
+ - **Data/Database** → ask about schema design, migration strategy, data volume expectations
2176
+ - **Integration** → ask about third-party API choices, error recovery, retry strategy
2177
+ - **Infrastructure** → ask about deployment strategy, scaling approach, observability
2178
+
2179
+ ## Step 2 — Structured discussion
2180
+
2181
+ Ask questions ONE AT A TIME. Wait for the full answer before asking the next.
2182
+ Do not batch questions (unless `--batch` flag is provided).
2183
+
2184
+ ### Visual/UI phases — ask about:
2185
+ 1. "Walk me through what a user sees on this screen from top to bottom."
2186
+ 2. "What does the empty state look like? (nothing loaded yet / no results / error)"
2187
+ 3. "Any animations or transitions you're picturing? Or keep it static?"
2188
+ 4. "On mobile — stacks vertically or anything different?"
2189
+ 5. "Any edge cases? (very long text, images that fail to load, loading states)"
2190
+
2191
+ ### API/Backend phases — ask about:
2192
+ 1. "What's the intended consumer? Internal frontend / external developers / both?"
2193
+ 2. "For errors — do you want detailed error objects with field-level info or simple messages?"
2194
+ 3. "Rate limiting needed on any of these endpoints?"
2195
+ 4. "Any background processing involved, or all synchronous?"
2196
+ 5. "Versioning approach? /v1/ prefix or header-based?"
2197
+
2198
+ ### Data/Database phases — ask about:
2199
+ 1. "What's the expected data volume? Thousands / millions / billions of rows?"
2200
+ 2. "Any fields that need full-text search vs. exact match?"
2201
+ 3. "Soft delete or hard delete for user-facing records?"
2202
+ 4. "Any fields that change frequently vs. infrequently? (affects indexing strategy)"
2203
+ 5. "Data retention requirements? When can records be deleted?"
2204
+
2205
+ ### Integration phases — ask about:
2206
+ 1. "Have you already chosen the third-party service / API? If so, which?"
2207
+ 2. "What should happen if the third-party service is down? Queue / fail / fallback?"
2208
+ 3. "Webhooks or polling for receiving updates?"
2209
+ 4. "Any rate limits you know about on their end?"
2210
+ 5. "Testing approach? Do they have a sandbox environment?"
2211
+
2212
+ ## --batch mode
2213
+ If `--batch` flag is provided: group related questions and present them together.
2214
+ Appropriate when the user wants faster intake and is familiar with MindForge.
2215
+
2216
+ Example batch:
2217
+ ```
2218
+ Visual decisions for Phase 2:
2219
+ 1. Layout: card grid / table / list?
2220
+ 2. Empty state: illustration / simple message / hide section?
2221
+ 3. Loading: skeleton / spinner / none?
2222
+ 4. Mobile: same layout / stacked / hidden?
2223
+ Answer 1-4:
2224
+ ```
2225
+
2226
+ ## --auto mode
2227
+ If `--auto` flag is provided: skip the discussion entirely.
2228
+ The planner will make reasonable defaults for all decisions.
2229
+ Use when: the phase is straightforward and you trust the planner's judgment.
2230
+ Warn: "Skipping discussion. Planner will make implementation decisions.
2231
+ Results may not match your vision exactly."
2232
+
2233
+ ## Step 3 — Write CONTEXT.md
2234
+
2235
+ After discussion, write `.planning/phases/[N]/CONTEXT.md`:
2236
+
2237
+ ```markdown
2238
+ # Phase [N] Implementation Context
2239
+ # Captured: [ISO-8601]
2240
+ # Discussion mode: [interactive / batch / auto]
2241
+
2242
+ ## Phase description
2243
+ [From ROADMAP.md]
2244
+
2245
+ ## Implementation decisions (captured from discussion)
2246
+
2247
+ ### [Domain: Visual / API / Data / Integration / etc.]
2248
+
2249
+ **Decision:** [What was decided]
2250
+ **Rationale:** [Why — from user's words]
2251
+ **Implications for planning:**
2252
+ - [What the planner should do because of this decision]
2253
+ - [Specific library or pattern to use]
2254
+ - [What to avoid]
2255
+
2256
+ [Repeat for each significant decision]
2257
+
2258
+ ## Open questions (unresolved during discussion)
2259
+ - [Question 1]: [Status — decide during planning / decide during execution]
2260
+
2261
+ ## User's explicit preferences
2262
+ [Verbatim or near-verbatim quotes from the discussion that capture specific intent]
2263
+
2264
+ ## Defaults accepted (decisions the user deferred to the planner)
2265
+ - [Area]: planner's choice
2266
+ ```
2267
+
2268
+ ## Step 4 — Confirm and guide
2269
+
2270
+ Show the user a summary of what was captured:
2271
+
2272
+ "✅ Phase [N] discussion complete. [N] decisions captured.
2273
+
2274
+ Key decisions:
2275
+ - [Decision 1 summary]
2276
+ - [Decision 2 summary]
2277
+ - [Decision 3 summary]
2278
+
2279
+ See full context: .planning/phases/[N]/CONTEXT.md
2280
+
2281
+ Next step: Run /mindforge:plan-phase [N] to create implementation plans
2282
+ using these decisions."
2283
+ ```
2284
+
2285
+ **Commit:**
2286
+ ```bash
2287
+ cp .claude/commands/mindforge/discuss-phase.md .agent/mindforge/discuss-phase.md
2288
+ git add .claude/commands/mindforge/discuss-phase.md .agent/mindforge/discuss-phase.md
2289
+ git commit -m "feat(commands): add /mindforge:discuss-phase pre-planning discussion command"
2290
+ ```
2291
+
2292
+ ---
2293
+
2294
+ ## TASK 11 — Update CLAUDE.md for Day 3 capabilities
2295
+
2296
+ Add the following sections to `.claude/CLAUDE.md` (and mirror to `.agent/CLAUDE.md`):
2297
+
2298
+ ```markdown
2299
+ ---
2300
+
2301
+ ## SKILLS PLATFORM (Day 3)
2302
+
2303
+ ### Skills loading is now multi-tier
2304
+ The skills engine has three tiers: Core (Tier 1) → Org (Tier 2) → Project (Tier 3).
2305
+ Higher tiers override lower tiers when skill names conflict.
2306
+ Load skills using the full protocol in `.mindforge/engine/skills/loader.md`.
2307
+
2308
+ ### Skills registry
2309
+ All installed skills are registered in `.mindforge/org/skills/MANIFEST.md`.
2310
+ Run `/mindforge:skills validate` if you suspect a skill is misconfigured.
2311
+
2312
+ ### Context budget with multiple skills
2313
+ If more than 3 skills are loaded simultaneously:
2314
+ Inject the full content of the top 3 most relevant skills.
2315
+ Summarise skills 4+ to: trigger keywords + mandatory actions list + output format.
2316
+ Never silently exceed the 30K token context budget for skills.
2317
+
2318
+ ### Persona overrides
2319
+ Before loading any persona, check:
2320
+ `.mindforge/personas/overrides/[persona-name].md` (project override)
2321
+ `.planning/phases/[N]/persona-overrides/[persona-name].md` (phase override)
2322
+ Merge override with base persona: additive sections stack, override sections replace.
2323
+
2324
+ ### New commands available
2325
+ - `/mindforge:skills` — manage the skills registry
2326
+ - `/mindforge:review` — code review using code-quality + security skills
2327
+ - `/mindforge:security-scan` — standalone security scan
2328
+ - `/mindforge:map-codebase` — brownfield codebase onboarding
2329
+ - `/mindforge:discuss-phase` — pre-planning implementation discussion
2330
+
2331
+ ### Pre-planning discussion
2332
+ For complex phases: run `/mindforge:discuss-phase [N]` before `/mindforge:plan-phase [N]`.
2333
+ The CONTEXT.md it produces makes plans dramatically more accurate.
2334
+ Skip for trivial phases. Use `--auto` when in a hurry.
2335
+
2336
+ ---
2337
+ ```
2338
+
2339
+ **Commit:**
2340
+ ```bash
2341
+ git add .claude/CLAUDE.md .agent/CLAUDE.md
2342
+ git commit -m "feat(core): update CLAUDE.md with Day 3 skills platform and commands"
2343
+ ```
2344
+
2345
+ ---
2346
+
2347
+ ## TASK 12 — Write Day 3 test suite and authoring guide
2348
+
2349
+ ### `tests/skills-platform.test.js`
2350
+
2351
+ ```javascript
2352
+ /**
2353
+ * MindForge Skills Platform Tests
2354
+ * Run: node tests/skills-platform.test.js
2355
+ */
2356
+
2357
+ const fs = require('fs');
2358
+ const path = require('path');
2359
+ const assert = require('assert');
2360
+
2361
+ let passed = 0;
2362
+ let failed = 0;
2363
+
2364
+ function test(name, fn) {
2365
+ try {
2366
+ fn();
2367
+ console.log(` ✅ ${name}`);
2368
+ passed++;
2369
+ } catch (err) {
2370
+ console.error(` ❌ ${name}`);
2371
+ console.error(` ${err.message}`);
2372
+ failed++;
2373
+ }
2374
+ }
2375
+
2376
+ // ── Skill frontmatter parser ──────────────────────────────────────────────────
2377
+ function parseSkillFrontmatter(filePath) {
2378
+ const content = fs.readFileSync(filePath, 'utf8');
2379
+ if (!content.startsWith('---')) {
2380
+ throw new Error(`${filePath}: missing frontmatter (must start with ---)`);
2381
+ }
2382
+ const end = content.indexOf('---', 3);
2383
+ if (end === -1) throw new Error(`${filePath}: unclosed frontmatter`);
2384
+ const fm = content.slice(3, end).trim();
2385
+
2386
+ const result = {};
2387
+ fm.split('\n').forEach(line => {
2388
+ const colon = line.indexOf(':');
2389
+ if (colon === -1) return;
2390
+ const key = line.slice(0, colon).trim();
2391
+ const val = line.slice(colon + 1).trim();
2392
+ result[key] = val;
2393
+ });
2394
+ return result;
2395
+ }
2396
+
2397
+ // ── Semver validator ──────────────────────────────────────────────────────────
2398
+ function isValidSemver(version) {
2399
+ return /^\d+\.\d+\.\d+$/.test(version);
2400
+ }
2401
+
2402
+ // ── Skills directory scanner ──────────────────────────────────────────────────
2403
+ function getAllSkillPaths() {
2404
+ const skillsDir = '.mindforge/skills';
2405
+ if (!fs.existsSync(skillsDir)) return [];
2406
+ return fs.readdirSync(skillsDir)
2407
+ .map(dir => path.join(skillsDir, dir, 'SKILL.md'))
2408
+ .filter(p => fs.existsSync(p));
2409
+ }
2410
+
2411
+ // ── Manifest parser ───────────────────────────────────────────────────────────
2412
+ function parseManifest() {
2413
+ const manifestPath = '.mindforge/org/skills/MANIFEST.md';
2414
+ if (!fs.existsSync(manifestPath)) return { skills: [] };
2415
+ const content = fs.readFileSync(manifestPath, 'utf8');
2416
+ const rows = content.match(/\|\s+(\S+)\s+\|\s+(\d+\.\d+\.\d+)\s+\|\s+(\w+)\s+\|\s+(\d+\.\d+\.\d+)\s+\|/g) || [];
2417
+ return {
2418
+ skills: rows.map(row => {
2419
+ const parts = row.split('|').map(p => p.trim()).filter(Boolean);
2420
+ return { name: parts[0], version: parts[1], status: parts[2] };
2421
+ })
2422
+ };
2423
+ }
2424
+
2425
+ // ── Tests ─────────────────────────────────────────────────────────────────────
2426
+
2427
+ console.log('\nMindForge Day 3 — Skills Platform Tests\n');
2428
+
2429
+ console.log('Skills directory structure:');
2430
+
2431
+ test('skills directory exists', () => {
2432
+ assert.ok(fs.existsSync('.mindforge/skills'), 'Missing .mindforge/skills/');
2433
+ });
2434
+
2435
+ test('all 10 skill directories exist', () => {
2436
+ const required = [
2437
+ 'security-review', 'code-quality', 'api-design', 'testing-standards',
2438
+ 'documentation', 'performance', 'accessibility', 'data-privacy',
2439
+ 'incident-response', 'database-patterns'
2440
+ ];
2441
+ required.forEach(skill => {
2442
+ const p = `.mindforge/skills/${skill}/SKILL.md`;
2443
+ assert.ok(fs.existsSync(p), `Missing: ${p}`);
2444
+ });
2445
+ });
2446
+
2447
+ test('engine skills directory has all 4 engine files', () => {
2448
+ const required = ['registry.md', 'loader.md', 'versioning.md', 'conflict-resolver.md'];
2449
+ required.forEach(f => {
2450
+ const p = `.mindforge/engine/skills/${f}`;
2451
+ assert.ok(fs.existsSync(p), `Missing: ${p}`);
2452
+ });
2453
+ });
2454
+
2455
+ console.log('\nSkill frontmatter validation:');
2456
+
2457
+ const skillPaths = getAllSkillPaths();
2458
+ test(`found ${skillPaths.length} skill files to validate`, () => {
2459
+ assert.ok(skillPaths.length >= 10, `Expected >= 10 skill files, found ${skillPaths.length}`);
2460
+ });
2461
+
2462
+ skillPaths.forEach(skillPath => {
2463
+ const skillName = skillPath.split('/').slice(-2)[0];
2464
+
2465
+ test(`${skillName}: has valid frontmatter`, () => {
2466
+ const fm = parseSkillFrontmatter(skillPath);
2467
+ assert.ok(fm.name, 'Missing name field');
2468
+ assert.ok(fm.version, 'Missing version field');
2469
+ assert.ok(fm.status, 'Missing status field');
2470
+ assert.ok(fm.triggers, 'Missing triggers field');
2471
+ });
2472
+
2473
+ test(`${skillName}: name matches directory`, () => {
2474
+ const fm = parseSkillFrontmatter(skillPath);
2475
+ assert.strictEqual(fm.name, skillName, `Skill name "${fm.name}" doesn't match directory "${skillName}"`);
2476
+ });
2477
+
2478
+ test(`${skillName}: version is valid semver`, () => {
2479
+ const fm = parseSkillFrontmatter(skillPath);
2480
+ assert.ok(isValidSemver(fm.version), `Invalid semver: "${fm.version}"`);
2481
+ });
2482
+
2483
+ test(`${skillName}: has at least 5 trigger keywords`, () => {
2484
+ const fm = parseSkillFrontmatter(skillPath);
2485
+ const triggers = fm.triggers.split(',').map(t => t.trim()).filter(Boolean);
2486
+ assert.ok(triggers.length >= 5, `Too few triggers: ${triggers.length} (min 5)`);
2487
+ });
2488
+
2489
+ test(`${skillName}: status is a valid value`, () => {
2490
+ const fm = parseSkillFrontmatter(skillPath);
2491
+ const validStatuses = ['stable', 'beta', 'alpha', 'deprecated'];
2492
+ assert.ok(validStatuses.includes(fm.status), `Invalid status: "${fm.status}"`);
2493
+ });
2494
+
2495
+ test(`${skillName}: has mandatory actions section`, () => {
2496
+ const content = fs.readFileSync(skillPath, 'utf8');
2497
+ assert.ok(
2498
+ content.includes('## Mandatory actions') || content.includes('mandatory actions'),
2499
+ 'Missing mandatory actions section'
2500
+ );
2501
+ });
2502
+
2503
+ test(`${skillName}: has self-check or checklist section`, () => {
2504
+ const content = fs.readFileSync(skillPath, 'utf8');
2505
+ assert.ok(
2506
+ content.includes('checklist') || content.includes('self-check') || content.includes('- [ ]'),
2507
+ 'Missing checklist or self-check section'
2508
+ );
2509
+ });
2510
+ });
2511
+
2512
+ console.log('\nManifest validation:');
2513
+
2514
+ test('MANIFEST.md exists', () => {
2515
+ assert.ok(fs.existsSync('.mindforge/org/skills/MANIFEST.md'), 'Missing MANIFEST.md');
2516
+ });
2517
+
2518
+ test('MANIFEST.md registers all 10 core skills', () => {
2519
+ const content = fs.readFileSync('.mindforge/org/skills/MANIFEST.md', 'utf8');
2520
+ const requiredSkills = [
2521
+ 'security-review', 'code-quality', 'api-design', 'testing-standards',
2522
+ 'documentation', 'performance', 'accessibility', 'data-privacy',
2523
+ 'incident-response', 'database-patterns'
2524
+ ];
2525
+ requiredSkills.forEach(skill => {
2526
+ assert.ok(content.includes(skill), `MANIFEST.md missing skill: ${skill}`);
2527
+ });
2528
+ });
2529
+
2530
+ test('MANIFEST.md has schema version header', () => {
2531
+ const content = fs.readFileSync('.mindforge/org/skills/MANIFEST.md', 'utf8');
2532
+ assert.ok(content.includes('Schema version') || content.includes('schema version:'), 'Missing schema version');
2533
+ });
2534
+
2535
+ console.log('\nTrigger keyword uniqueness (within Tier 1):');
2536
+
2537
+ test('no duplicate triggers between Tier 1 skills at exact match', () => {
2538
+ const triggerMap = {};
2539
+ const conflicts = [];
2540
+
2541
+ getAllSkillPaths().forEach(skillPath => {
2542
+ const fm = parseSkillFrontmatter(skillPath);
2543
+ const skillName = fm.name;
2544
+ const triggers = fm.triggers.split(',').map(t => t.trim().toLowerCase()).filter(Boolean);
2545
+
2546
+ triggers.forEach(trigger => {
2547
+ if (triggerMap[trigger] && triggerMap[trigger] !== skillName) {
2548
+ conflicts.push(`"${trigger}": ${triggerMap[trigger]} vs ${skillName}`);
2549
+ } else {
2550
+ triggerMap[trigger] = skillName;
2551
+ }
2552
+ });
2553
+ });
2554
+
2555
+ // Conflicts are allowed (Type 1 in conflict-resolver.md) but should be minimal
2556
+ // Flag if more than 5 conflicts exist (suggests poor trigger hygiene)
2557
+ assert.ok(
2558
+ conflicts.length <= 5,
2559
+ `Too many trigger conflicts (${conflicts.length} > 5): ${conflicts.slice(0, 3).join(', ')}`
2560
+ );
2561
+ });
2562
+
2563
+ console.log('\nPersona override system:');
2564
+
2565
+ test('personas/overrides directory exists', () => {
2566
+ assert.ok(fs.existsSync('.mindforge/personas/overrides'), 'Missing personas/overrides directory');
2567
+ });
2568
+
2569
+ test('personas/overrides/README.md exists and has content', () => {
2570
+ const p = '.mindforge/personas/overrides/README.md';
2571
+ assert.ok(fs.existsSync(p), 'Missing overrides README.md');
2572
+ const content = fs.readFileSync(p, 'utf8');
2573
+ assert.ok(content.length > 200, 'README.md too short');
2574
+ assert.ok(content.includes('override'), 'README.md should explain overrides');
2575
+ });
2576
+
2577
+ console.log('\nNew commands (15 total):');
2578
+
2579
+ const allCommands = [
2580
+ 'help', 'init-project', 'plan-phase', 'execute-phase', 'verify-phase', 'ship', // Day 1
2581
+ 'next', 'quick', 'status', 'debug', // Day 2
2582
+ 'skills', 'review', 'security-scan', 'map-codebase', 'discuss-phase' // Day 3
2583
+ ];
2584
+
2585
+ test('all 15 commands exist in .claude/commands/mindforge/', () => {
2586
+ allCommands.forEach(cmd => {
2587
+ const p = `.claude/commands/mindforge/${cmd}.md`;
2588
+ assert.ok(fs.existsSync(p), `Missing command: ${p}`);
2589
+ });
2590
+ });
2591
+
2592
+ test('all 15 commands mirrored to .agent/mindforge/', () => {
2593
+ allCommands.forEach(cmd => {
2594
+ const p = `.agent/mindforge/${cmd}.md`;
2595
+ assert.ok(fs.existsSync(p), `Missing mirrored command: ${p}`);
2596
+ });
2597
+ });
2598
+
2599
+ test('command files are not empty', () => {
2600
+ allCommands.forEach(cmd => {
2601
+ const p = `.claude/commands/mindforge/${cmd}.md`;
2602
+ if (fs.existsSync(p)) {
2603
+ const size = fs.statSync(p).size;
2604
+ assert.ok(size > 200, `Command file too small (${size} bytes): ${cmd}.md`);
2605
+ }
2606
+ });
2607
+ });
2608
+
2609
+ // ── Results ───────────────────────────────────────────────────────────────────
2610
+ console.log(`\n${'─'.repeat(50)}`);
2611
+ console.log(`Results: ${passed} passed, ${failed} failed`);
2612
+
2613
+ if (failed > 0) {
2614
+ console.error(`\n❌ ${failed} test(s) failed.\n`);
2615
+ process.exit(1);
2616
+ } else {
2617
+ console.log(`\n✅ All skills platform tests passed.\n`);
2618
+ }
2619
+ ```
2620
+
2621
+ ---
2622
+
2623
+ ### `docs/skills-authoring-guide.md`
2624
+
2625
+ ```markdown
2626
+ # MindForge Skills Authoring Guide
2627
+
2628
+ ## What is a skill?
2629
+ A skill is a self-contained folder containing a `SKILL.md` file that gives
2630
+ the MindForge agent domain-specific expertise for a specific type of task.
2631
+
2632
+ Skills are loaded just-in-time: the agent discovers them by matching trigger
2633
+ keywords against the task description. They inject the right knowledge at the
2634
+ right moment without cluttering the context with irrelevant information.
2635
+
2636
+ ## When to write a skill
2637
+ Write a new skill when:
2638
+ - A specific domain requires knowledge beyond the agent's defaults
2639
+ - The same guidance needs to be applied consistently across many tasks
2640
+ - Your team has standards that aren't captured in CONVENTIONS.md
2641
+ - An existing core skill doesn't match your organisation's approach
2642
+
2643
+ ## Skill file structure
2644
+
2645
+ ```
2646
+ .mindforge/skills/[skill-name]/
2647
+ SKILL.md ← required
2648
+ examples/ ← optional: sample inputs and outputs
2649
+ resources/ ← optional: reference documents the skill uses
2650
+ scripts/ ← optional: helper scripts the skill can run
2651
+ ```
2652
+
2653
+ ## SKILL.md template
2654
+
2655
+ ```markdown
2656
+ ---
2657
+ name: [skill-name-in-kebab-case]
2658
+ version: 1.0.0
2659
+ min_mindforge_version: 0.1.0
2660
+ status: stable | beta | alpha
2661
+ triggers: [comma-separated list of trigger keywords]
2662
+ mutually_exclusive_with: # optional: skill names that conflict with this one
2663
+ breaking_changes:
2664
+ # Record breaking changes here when bumping MAJOR version
2665
+ changelog:
2666
+ - "1.0.0: Initial release"
2667
+ ---
2668
+
2669
+ # Skill — [Human-readable skill name]
2670
+
2671
+ ## When this skill activates
2672
+ [One paragraph: what task types trigger this skill, and why it helps]
2673
+
2674
+ ## Mandatory actions when this skill is active
2675
+
2676
+ ### Before writing any code / Before starting any task
2677
+ [Steps the agent MUST take before beginning — written as an ordered list]
2678
+
2679
+ ### During [implementation / review / analysis]
2680
+ [Standards and patterns the agent must follow — be specific]
2681
+
2682
+ ### After [implementation / review / analysis]
2683
+ [Verification steps, output requirements — be specific]
2684
+
2685
+ ## [Domain-specific section 1]
2686
+ [Detailed guidance, code examples, patterns]
2687
+
2688
+ ## [Domain-specific section 2]
2689
+ [Detailed guidance, code examples, patterns]
2690
+
2691
+ ## Self-check before task completion
2692
+ - [ ] [Checkable item 1]
2693
+ - [ ] [Checkable item 2]
2694
+ - [ ] [Checkable item 3]
2695
+
2696
+ ## Output
2697
+ [What files or artifacts this skill produces, with exact paths]
2698
+ ```
2699
+
2700
+ ## Writing good trigger keywords
2701
+ - Specific beats generic: `argon2` beats `hash`
2702
+ - Include common misspellings and abbreviations: `optimise, optimize`
2703
+ - Include acronyms and their expansions: `a11y, accessibility, WCAG, wcag`
2704
+ - Include library names: `Prisma, Drizzle, SQLAlchemy` for database-patterns
2705
+ - Aim for 10-30 triggers per skill
2706
+ - Avoid single-letter words and extremely common words (the, be, is, to)
2707
+
2708
+ ## Registering your skill
2709
+ After creating SKILL.md:
2710
+ ```bash
2711
+ /mindforge:skills add .mindforge/skills/[your-skill-name]
2712
+ # Choose tier: 2 (org) or 3 (project)
2713
+ # Commit the manifest update
2714
+ ```
2715
+
2716
+ ## Tier guidance
2717
+
2718
+ | Tier | Use when | Location |
2719
+ |---|---|---|
2720
+ | 1 (Core) | Universal best practices — all projects | `.mindforge/skills/` |
2721
+ | 2 (Org) | Your org's standards — all projects | `.mindforge/org/skills/` or separate repo |
2722
+ | 3 (Project) | This project specifically | `.mindforge/skills/project/` |
2723
+
2724
+ ## Version your skill
2725
+ Every change to mandatory actions or trigger keywords = MINOR version bump.
2726
+ Every removal of triggers or outputs = MAJOR version bump.
2727
+ Typo fixes = PATCH version bump.
2728
+
2729
+ Update both the SKILL.md frontmatter AND the MANIFEST.md entry.
2730
+ ```
2731
+
2732
+ **Commit:**
2733
+ ```bash
2734
+ git add tests/skills-platform.test.js docs/skills-authoring-guide.md \
2735
+ docs/persona-customisation.md
2736
+ git commit -m "test(day3): add skills platform test suite and authoring documentation"
2737
+ ```
2738
+
2739
+ ---
2740
+
2741
+ ## TASK 13 — Run all tests and verify Day 3 is complete
2742
+
2743
+ ```bash
2744
+ # Full test battery — all must pass
2745
+ node tests/install.test.js && echo "✅ install"
2746
+ node tests/wave-engine.test.js && echo "✅ wave-engine"
2747
+ node tests/audit.test.js && echo "✅ audit"
2748
+ node tests/compaction.test.js && echo "✅ compaction"
2749
+ node tests/skills-platform.test.js && echo "✅ skills-platform"
2750
+ ```
2751
+
2752
+ **Final Day 3 commit:**
2753
+ ```bash
2754
+ git add .
2755
+ git commit -m "feat(day3): complete Day 3 MindForge skills platform — all components built"
2756
+ git push origin feat/mindforge-skills-platform
2757
+ ```
2758
+
2759
+ ---
2760
+
2761
+ ## DAY 3 VERIFY — complete before pushing
2762
+
2763
+ ```bash
2764
+ # 1. All 10 skill packs exist with SKILL.md
2765
+ ls .mindforge/skills/ | wc -l # Expected: 10
2766
+ find .mindforge/skills -name "SKILL.md" | wc -l # Expected: 10
2767
+
2768
+ # 2. All 4 engine files present
2769
+ ls .mindforge/engine/skills/ # Expected: 4 files
2770
+
2771
+ # 3. All 15 commands in both runtimes
2772
+ ls .claude/commands/mindforge/ | wc -l # Expected: 15
2773
+ ls .agent/mindforge/ | wc -l # Expected: 15
2774
+ diff <(ls .claude/commands/mindforge/ | sort) <(ls .agent/mindforge/ | sort)
2775
+ # Expected: no output
2776
+
2777
+ # 4. MANIFEST.md has all 10 skills
2778
+ grep -c "stable" .mindforge/org/skills/MANIFEST.md # Expected: >= 10
2779
+
2780
+ # 5. All tests pass
2781
+ node tests/skills-platform.test.js
2782
+
2783
+ # 6. No secrets
2784
+ grep -rE "(password|api_key|secret)\s*=\s*['\"][^'\"]{8,}" \
2785
+ --include="*.md" --include="*.js" --include="*.json" \
2786
+ --exclude-dir=node_modules --exclude-dir=.git . 2>/dev/null \
2787
+ | grep -v "placeholder\|example\|template"
2788
+ # Expected: no output
2789
+
2790
+ # 7. Git log clean
2791
+ git log --oneline | head -20
2792
+ # Expected: 13 clean commits from Day 3
2793
+ ```
2794
+
2795
+ ---
2796
+
2797
+ **Branch:** `feat/mindforge-skills-platform`
2798
+ **Day 3 implementation complete. Proceed to DAY3-REVIEW.md.**