@istmx/skills 2.1.1 → 3.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 (744) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/CODE_OF_CONDUCT.md +47 -47
  3. package/LICENSE +30 -30
  4. package/README.md +80 -164
  5. package/bin/cli.js +143 -210
  6. package/istm-workflow/istm-audit/SKILL.md +108 -108
  7. package/istm-workflow/istm-audit/agent-prompt.md +393 -393
  8. package/istm-workflow/istm-audit/agents/openai.yaml +7 -7
  9. package/istm-workflow/istm-audit/modes/area.md +19 -19
  10. package/istm-workflow/istm-audit/modes/gapfill.md +12 -12
  11. package/istm-workflow/istm-audit/modes/greenfield.md +24 -24
  12. package/istm-workflow/istm-audit/modes/tool-skills.md +39 -39
  13. package/istm-workflow/istm-audit/modes/whole-repo.md +5 -5
  14. package/istm-workflow/istm-audit/patterns/clean-architecture.md +15 -15
  15. package/istm-workflow/istm-audit/patterns/domain-driven.md +16 -16
  16. package/istm-workflow/istm-audit/patterns/functional.md +16 -16
  17. package/istm-workflow/istm-audit/patterns/solid-oop.md +17 -17
  18. package/istm-workflow/istm-autoplan/SKILL.md +1905 -1905
  19. package/istm-workflow/istm-autoplan/SKILL.md.tmpl +923 -923
  20. package/istm-workflow/istm-check/SKILL.md +52 -52
  21. package/istm-workflow/istm-check/agents/openai.yaml +7 -7
  22. package/istm-workflow/istm-check/modes/review.md +156 -156
  23. package/istm-workflow/istm-check/modes/verify.md +197 -197
  24. package/istm-workflow/istm-check/review-agent-prompt.md +57 -57
  25. package/istm-workflow/istm-check/review-guide.md +133 -133
  26. package/istm-workflow/istm-craft/SKILL.md +52 -52
  27. package/istm-workflow/istm-craft/agent-modes/architecture.md +73 -73
  28. package/istm-workflow/istm-craft/agent-modes/cross-cutting.md +65 -65
  29. package/istm-workflow/istm-craft/agent-modes/enhancement.md +45 -45
  30. package/istm-workflow/istm-craft/agent-modes/feature.md +85 -85
  31. package/istm-workflow/istm-craft/agent-prompt.md +249 -249
  32. package/istm-workflow/istm-craft/agents/openai.yaml +7 -7
  33. package/istm-workflow/istm-craft/internal/after-subagent.md +90 -90
  34. package/istm-workflow/istm-craft/internal/design-conversation.md +140 -140
  35. package/istm-workflow/istm-craft/internal/tool-discovery.md +58 -58
  36. package/istm-workflow/istm-craft/spec-template.md +278 -278
  37. package/istm-workflow/istm-cso/ACKNOWLEDGEMENTS.md +14 -14
  38. package/istm-workflow/istm-cso/SKILL.md +1313 -1313
  39. package/istm-workflow/istm-cso/SKILL.md.tmpl +407 -407
  40. package/istm-workflow/istm-cso/sections/audit-phases.md +253 -253
  41. package/istm-workflow/istm-cso/sections/audit-phases.md.tmpl +251 -251
  42. package/istm-workflow/istm-cso/sections/manifest.json +14 -14
  43. package/istm-workflow/istm-debt/SKILL.md +44 -44
  44. package/istm-workflow/istm-debug/SKILL.md +111 -111
  45. package/istm-workflow/istm-debug/agents/openai.yaml +7 -7
  46. package/istm-workflow/istm-design-review/SKILL.md +2053 -2053
  47. package/istm-workflow/istm-design-review/SKILL.md.tmpl +312 -312
  48. package/istm-workflow/istm-develop/SKILL.md +165 -165
  49. package/istm-workflow/istm-develop/agents/openai.yaml +7 -7
  50. package/istm-workflow/istm-develop/checklist.md +95 -95
  51. package/istm-workflow/istm-develop/flow/build.md +133 -133
  52. package/istm-workflow/istm-develop/flow/git.md +34 -34
  53. package/istm-workflow/istm-develop/logical-guide.md +99 -99
  54. package/istm-workflow/istm-develop/ui/existing.md +23 -23
  55. package/istm-workflow/istm-develop/ui/generate.md +131 -131
  56. package/istm-workflow/istm-develop/ui/image.md +41 -41
  57. package/istm-workflow/istm-develop/ui/implementation.md +281 -281
  58. package/istm-workflow/istm-develop/ui/mcp.md +11 -11
  59. package/istm-workflow/istm-develop/ui-guide.md +164 -164
  60. package/istm-workflow/istm-document/SKILL.md +123 -123
  61. package/istm-workflow/istm-document/agent-prompt.md +57 -57
  62. package/istm-workflow/istm-document/agents/openai.yaml +7 -7
  63. package/istm-workflow/istm-document/templates/changelog.md +54 -54
  64. package/istm-workflow/istm-document/templates/postmortem.md +58 -58
  65. package/istm-workflow/istm-document/templates/pr.md +43 -43
  66. package/istm-workflow/istm-document/templates/release-note.md +41 -41
  67. package/istm-workflow/istm-eng-review/SKILL.md +1112 -1112
  68. package/istm-workflow/istm-eng-review/SKILL.md.tmpl +163 -163
  69. package/istm-workflow/istm-eng-review/sections/manifest.json +14 -14
  70. package/istm-workflow/istm-eng-review/sections/review-sections.md +942 -942
  71. package/istm-workflow/istm-eng-review/sections/review-sections.md.tmpl +225 -225
  72. package/istm-workflow/istm-gain/SKILL.md +50 -50
  73. package/istm-workflow/istm-health/SKILL.md +1104 -1104
  74. package/istm-workflow/istm-health/SKILL.md.tmpl +320 -320
  75. package/istm-workflow/istm-qa/BROWSER.md +1468 -1468
  76. package/istm-workflow/istm-qa/SKILL.md +1743 -1743
  77. package/istm-workflow/istm-qa/SKILL.md.tmpl +354 -354
  78. package/istm-workflow/istm-qa/references/issue-taxonomy.md +85 -85
  79. package/istm-workflow/istm-qa/templates/qa-report-template.md +126 -126
  80. package/istm-workflow/istm-release/SKILL.md +989 -989
  81. package/istm-workflow/istm-release/SKILL.md.tmpl +160 -160
  82. package/istm-workflow/istm-release/sections/manifest.json +14 -14
  83. package/istm-workflow/istm-release/sections/release-body.md +547 -547
  84. package/istm-workflow/istm-release/sections/release-body.md.tmpl +420 -420
  85. package/istm-workflow/istm-review/SKILL.md +57 -57
  86. package/istm-workflow/istm-scope/SKILL.md +100 -100
  87. package/istm-workflow/istm-scope/agents/openai.yaml +7 -7
  88. package/istm-workflow/istm-scope/approaches/facade.md +33 -33
  89. package/istm-workflow/istm-scope/approaches/journey.md +31 -31
  90. package/istm-workflow/istm-scope/approaches/skateboard.md +33 -33
  91. package/istm-workflow/istm-scope/approaches/tracer-bullet.md +34 -34
  92. package/istm-workflow/istm-scope/modes/add.md +14 -14
  93. package/istm-workflow/istm-scope/modes/plan-brownfield.md +11 -11
  94. package/istm-workflow/istm-scope/modes/plan-greenfield.md +20 -20
  95. package/istm-workflow/istm-scope/modes/plan-monorepo.md +8 -8
  96. package/istm-workflow/istm-scope/modes/plan.md +120 -120
  97. package/istm-workflow/istm-scope/modes/replan.md +13 -13
  98. package/istm-workflow/istm-scope/scope-template.md +148 -148
  99. package/istm-workflow/istm-ship/SKILL.md +1504 -1504
  100. package/istm-workflow/istm-ship/SKILL.md.tmpl +582 -582
  101. package/istm-workflow/istm-ship/sections/adversarial.md +218 -218
  102. package/istm-workflow/istm-ship/sections/adversarial.md.tmpl +19 -19
  103. package/istm-workflow/istm-ship/sections/apple-release.md +58 -58
  104. package/istm-workflow/istm-ship/sections/apple-release.md.tmpl +56 -56
  105. package/istm-workflow/istm-ship/sections/changelog.md +45 -45
  106. package/istm-workflow/istm-ship/sections/changelog.md.tmpl +3 -3
  107. package/istm-workflow/istm-ship/sections/greptile.md +51 -51
  108. package/istm-workflow/istm-ship/sections/greptile.md.tmpl +49 -49
  109. package/istm-workflow/istm-ship/sections/manifest.json +62 -62
  110. package/istm-workflow/istm-ship/sections/plan-completion.md +329 -329
  111. package/istm-workflow/istm-ship/sections/plan-completion.md.tmpl +31 -31
  112. package/istm-workflow/istm-ship/sections/pr-body.md +209 -209
  113. package/istm-workflow/istm-ship/sections/pr-body.md.tmpl +207 -207
  114. package/istm-workflow/istm-ship/sections/review-army.md +406 -406
  115. package/istm-workflow/istm-ship/sections/review-army.md.tmpl +56 -56
  116. package/istm-workflow/istm-ship/sections/test-coverage.md +264 -264
  117. package/istm-workflow/istm-ship/sections/test-coverage.md.tmpl +23 -23
  118. package/istm-workflow/istm-ship/sections/tests.md +403 -403
  119. package/istm-workflow/istm-ship/sections/tests.md.tmpl +116 -116
  120. package/istm-workflow/istm-sync/SKILL.md +178 -178
  121. package/istm-workflow/istm-sync/agent-prompt.md +229 -229
  122. package/istm-workflow/istm-sync/agents/openai.yaml +7 -7
  123. package/istm-workflow/istm-test/SKILL.md +233 -233
  124. package/istm-workflow/istm-test/agent-prompt.md +62 -62
  125. package/istm-workflow/istm-test/agents/openai.yaml +7 -7
  126. package/istm-workflow/istm-test/modes/setup.md +97 -97
  127. package/istm-workflow/istm-test/writing-guide.md +196 -196
  128. package/istmx-architecture/SKILL.md +124 -0
  129. package/istmx-architecture/references/boundary-audits.md +33 -0
  130. package/istmx-architecture/references/clean-architecture-full.md +394 -0
  131. package/istmx-architecture/references/comments-as-design.md +387 -0
  132. package/istmx-architecture/references/complexity-symptoms.md +209 -0
  133. package/istmx-architecture/references/deep-modules.md +347 -0
  134. package/istmx-architecture/references/general-vs-special.md +342 -0
  135. package/istmx-architecture/references/information-hiding.md +336 -0
  136. package/istmx-architecture/references/reverse-engineering.md +25 -0
  137. package/istmx-architecture/references/software-design-philosophy.md +199 -0
  138. package/istmx-architecture/references/strategic-programming.md +269 -0
  139. package/{istm-architecture/templates/agents.md → istmx-architecture/templates/AGENTS.md} +247 -248
  140. package/{istm-architecture → istmx-architecture}/templates/architecture.md +110 -110
  141. package/istmx-architecture/templates/progress.md +29 -0
  142. package/{istm-architecture → istmx-architecture}/templates/project-overview.md +215 -215
  143. package/istmx-backend-patterns/SKILL.md +143 -0
  144. package/istmx-backend-patterns/references/api-and-database-patterns.md +22 -0
  145. package/istmx-backend-patterns/references/api-patterns.md +275 -0
  146. package/istmx-backend-patterns/references/code-examples.md +97 -0
  147. package/istmx-backend-patterns/references/database-patterns.md +269 -0
  148. package/istmx-backend-patterns/references/distributed-patterns.md +327 -0
  149. package/istmx-backend-patterns/references/distributed-resilience.md +21 -0
  150. package/istmx-backend-patterns/references/failure-analysis.md +150 -0
  151. package/istmx-backend-patterns/references/infrastructure.md +74 -0
  152. package/istmx-backend-patterns/references/scaling-patterns.md +362 -0
  153. package/istmx-backend-patterns/scripts/analyze_schema.py +304 -0
  154. package/istmx-backend-patterns/scripts/capacity_calculator.py +238 -0
  155. package/istmx-backend-patterns/scripts/check_api_health.sh +135 -0
  156. package/istmx-backend-patterns/templates/adr.md +19 -0
  157. package/istmx-brainstorming/SKILL.md +325 -0
  158. package/istmx-brainstorming/builder-check-prompt.md +23 -0
  159. package/istmx-clean-code/SKILL.md +248 -0
  160. package/istmx-clean-code/references/code-smells-and-refactorings.md +42 -0
  161. package/istmx-clean-code/references/code-smells.md +494 -0
  162. package/istmx-clean-code/references/comments-formatting.md +405 -0
  163. package/istmx-clean-code/references/deep-modules-and-boundaries.md +29 -0
  164. package/istmx-clean-code/references/error-handling.md +357 -0
  165. package/istmx-clean-code/references/functions-and-methods.md +373 -0
  166. package/istmx-clean-code/references/kent-beck-simple-design.md +687 -0
  167. package/istmx-clean-code/references/naming-conventions.md +280 -0
  168. package/istmx-clean-code/references/testing-principles.md +353 -0
  169. package/istmx-clean-code/references/typescript-and-backend-examples.md +82 -0
  170. package/istmx-code-review/SKILL.md +201 -0
  171. package/istmx-code-review/code-reviewer.md +198 -0
  172. package/istmx-code-review/references/architecture-decisions.md +321 -0
  173. package/istmx-code-review/references/code-examples.md +95 -0
  174. package/istmx-code-review/references/code-review.md +173 -0
  175. package/istmx-code-review/references/debugging-strategies.md +485 -0
  176. package/istmx-code-review/references/design-docs.md +161 -0
  177. package/istmx-code-review/references/performance-profiling.md +484 -0
  178. package/istmx-code-review/references/production-patterns.md +317 -0
  179. package/istmx-code-review/references/receiving-code-review.md +205 -0
  180. package/istmx-code-review/references/requesting-code-review.md +95 -0
  181. package/istmx-code-review/references/team-patterns.md +374 -0
  182. package/istmx-code-review/scripts/review_checklist.py +312 -0
  183. package/istmx-ddd/SKILL.md +208 -0
  184. package/istmx-ddd/references/bounded-contexts.md +203 -0
  185. package/istmx-ddd/references/building-blocks.md +234 -0
  186. package/istmx-ddd/references/domain-events.md +264 -0
  187. package/istmx-ddd/references/repositories-factories.md +353 -0
  188. package/istmx-ddd/references/strategic-design.md +251 -0
  189. package/istmx-ddd/references/ubiquitous-language.md +202 -0
  190. package/istmx-ddia-systems/SKILL.md +252 -0
  191. package/istmx-ddia-systems/references/anti-patterns.md +279 -0
  192. package/istmx-ddia-systems/references/batch-stream.md +342 -0
  193. package/istmx-ddia-systems/references/capacity-planning.md +285 -0
  194. package/istmx-ddia-systems/references/chaos-engineering.md +0 -0
  195. package/istmx-ddia-systems/references/data-models.md +0 -0
  196. package/istmx-ddia-systems/references/deployment-strategies.md +0 -0
  197. package/istmx-ddia-systems/references/fault-tolerance.md +0 -0
  198. package/istmx-ddia-systems/references/observability.md +313 -0
  199. package/istmx-ddia-systems/references/partitioning.md +0 -0
  200. package/istmx-ddia-systems/references/replication.md +0 -0
  201. package/istmx-ddia-systems/references/stability-patterns.md +369 -0
  202. package/istmx-ddia-systems/references/storage-engines.md +289 -0
  203. package/istmx-ddia-systems/references/transactions.md +267 -0
  204. package/istmx-devops/SKILL.md +204 -0
  205. package/istmx-devops/references/cicd-pipeline.md +74 -0
  206. package/istmx-devops/references/deployment-rollbacks.md +29 -0
  207. package/istmx-devops/references/docker.md +199 -0
  208. package/istmx-devops/references/incident-triage.md +30 -0
  209. package/istmx-devops/references/infrastructure.md +129 -0
  210. package/istmx-devops/references/kubernetes.md +346 -0
  211. package/istmx-devops/references/observability.md +331 -0
  212. package/istmx-devops/scripts/analyze_deployment_risk.py +74 -0
  213. package/istmx-devops/scripts/check_services.sh +172 -0
  214. package/istmx-devops/scripts/validate_dockerfile.sh +213 -0
  215. package/istmx-diagnose-agent/SKILL.md +147 -0
  216. package/istmx-diagnose-agent/prompts/analyst-common.md +38 -0
  217. package/istmx-diagnose-agent/prompts/cost-and-time.md +28 -0
  218. package/istmx-diagnose-agent/prompts/plan-adherence.md +29 -0
  219. package/istmx-diagnose-agent/prompts/quality-evidence.md +26 -0
  220. package/istmx-diagnose-agent/prompts/repeated-work.md +30 -0
  221. package/istmx-diagnose-agent/prompts/request-conflicts.md +20 -0
  222. package/istmx-diagnose-agent/prompts/scrub-audit.md +33 -0
  223. package/istmx-diagnose-agent/prompts/scrub.md +29 -0
  224. package/istmx-diagnose-agent/prompts/similar-session.md +38 -0
  225. package/istmx-diagnose-agent/prompts/skill-timeline.md +30 -0
  226. package/istmx-diagnose-agent/prompts/stumbles.md +28 -0
  227. package/istmx-diagnose-agent/references/context-safety.md +22 -0
  228. package/istmx-diagnose-agent/references/github-issues.md +47 -0
  229. package/istmx-diagnose-agent/references/redaction-policy.md +34 -0
  230. package/istmx-diagnose-agent/references/session-discovery.md +31 -0
  231. package/istmx-diagnose-agent/templates/bundle-README.md +77 -0
  232. package/istmx-diagnose-agent/templates/case.md +64 -0
  233. package/istmx-diagnose-agent/templates/issue.md +70 -0
  234. package/istmx-diagnose-agent/templates/report.md +82 -0
  235. package/istmx-harness-audit/SKILL.md +193 -0
  236. package/istmx-harness-audit/references/harness-checklist.md +18 -0
  237. package/istmx-harness-audit/references/remediation-workflow.md +242 -0
  238. package/istmx-harness-audit/references/stations-and-checks.md +131 -0
  239. package/istmx-legacy-code/SKILL.md +219 -0
  240. package/istmx-legacy-code/references/case-studies.md +238 -0
  241. package/istmx-legacy-code/references/change-algorithm.md +178 -0
  242. package/istmx-legacy-code/references/characterization-tests.md +210 -0
  243. package/istmx-legacy-code/references/dependency-breaking.md +306 -0
  244. package/istmx-legacy-code/references/seams.md +176 -0
  245. package/istmx-ml-engineering/SKILL.md +167 -0
  246. package/istmx-ml-engineering/references/classical-ml.md +645 -0
  247. package/istmx-ml-engineering/references/dataset-triage.md +23 -0
  248. package/istmx-ml-engineering/references/deployment.md +504 -0
  249. package/istmx-ml-engineering/references/evaluation-playbook.md +23 -0
  250. package/istmx-ml-engineering/references/fine-tuning.md +510 -0
  251. package/istmx-ml-engineering/references/rag-patterns.md +499 -0
  252. package/istmx-ml-engineering/references/transformers-patterns.md +570 -0
  253. package/istmx-ml-engineering/scripts/analyze_dataset.py +380 -0
  254. package/istmx-ml-engineering/scripts/estimate_gpu_memory.py +308 -0
  255. package/istmx-ml-engineering/scripts/summarize_eval.py +71 -0
  256. package/istmx-multi-agent/SKILL.md +383 -0
  257. package/istmx-multi-agent/references/batching.md +11 -0
  258. package/istmx-multi-agent/references/cannot-verify.md +10 -0
  259. package/istmx-multi-agent/references/dispatching-parallel-agents.md +167 -0
  260. package/istmx-multi-agent/references/final-review.md +49 -0
  261. package/istmx-multi-agent/references/finishing-a-development-branch.md +225 -0
  262. package/istmx-multi-agent/references/fix-loop.md +77 -0
  263. package/istmx-multi-agent/references/handling-reports.md +15 -0
  264. package/istmx-multi-agent/references/orchestration-and-handoffs.md +17 -0
  265. package/istmx-multi-agent/references/preflight.md +26 -0
  266. package/istmx-multi-agent/references/resuming.md +12 -0
  267. package/istmx-multi-agent/references/using-git-worktrees.md +167 -0
  268. package/istmx-multi-agent/scripts/review-package +64 -0
  269. package/istmx-multi-agent/scripts/sdd-repo +54 -0
  270. package/istmx-multi-agent/scripts/sdd-workspace +110 -0
  271. package/istmx-multi-agent/scripts/task-brief +108 -0
  272. package/istmx-multi-agent/templates/implementer-prompt.md +154 -0
  273. package/istmx-multi-agent/templates/progress-ledger.md +13 -0
  274. package/istmx-multi-agent/templates/re-review-prompt.md +116 -0
  275. package/istmx-multi-agent/templates/review-verdict.md +18 -0
  276. package/istmx-multi-agent/templates/task-reviewer-prompt.md +209 -0
  277. package/istmx-multi-agent/templates/worker-brief.md +27 -0
  278. package/istmx-planning/SKILL.md +222 -0
  279. package/istmx-planning/references/executing-plans.md +323 -0
  280. package/istmx-planning/scripts/task-done +55 -0
  281. package/istmx-planning/scripts/task-start +32 -0
  282. package/istmx-postgres-design/SKILL.md +138 -0
  283. package/istmx-postgres-design/references/sql-optimization-patterns.md +214 -0
  284. package/istmx-pragmatic-eng/SKILL.md +237 -0
  285. package/istmx-pragmatic-eng/references/broken-windows.md +257 -0
  286. package/istmx-pragmatic-eng/references/contracts-assertions.md +387 -0
  287. package/istmx-pragmatic-eng/references/dry-orthogonality.md +264 -0
  288. package/istmx-pragmatic-eng/references/estimation-portfolio.md +326 -0
  289. package/istmx-pragmatic-eng/references/reversibility.md +343 -0
  290. package/istmx-pragmatic-eng/references/tracer-bullets.md +280 -0
  291. package/istmx-refactoring/SKILL.md +226 -0
  292. package/istmx-refactoring/references/composing-methods.md +399 -0
  293. package/istmx-refactoring/references/moving-features.md +389 -0
  294. package/istmx-refactoring/references/organizing-data.md +433 -0
  295. package/istmx-refactoring/references/refactoring-workflow.md +373 -0
  296. package/istmx-refactoring/references/simplifying-conditionals.md +385 -0
  297. package/istmx-refactoring/references/smell-catalog.md +347 -0
  298. package/istmx-security-audit/SKILL.md +263 -0
  299. package/istmx-security-audit/references/auth-and-api-hardening.md +20 -0
  300. package/istmx-security-audit/references/auth-patterns.md +15 -0
  301. package/istmx-security-audit/references/compliance-checklists.md +10 -0
  302. package/istmx-security-audit/references/incident-response.md +11 -0
  303. package/istmx-security-audit/references/security-headers.md +12 -0
  304. package/istmx-security-audit/references/stride-and-threat-modeling.md +17 -0
  305. package/istmx-security-audit/references/vulnerability-patterns.md +14 -0
  306. package/istmx-security-audit/scripts/audit_auth_surface.py +69 -0
  307. package/istmx-security-audit/scripts/check_security_headers.sh +130 -0
  308. package/istmx-security-audit/scripts/scan_secrets.sh +182 -0
  309. package/istmx-system-design/SKILL.md +223 -0
  310. package/istmx-system-design/references/building-blocks.md +272 -0
  311. package/istmx-system-design/references/code-examples.md +95 -0
  312. package/istmx-system-design/references/common-designs.md +257 -0
  313. package/istmx-system-design/references/database-scaling.md +295 -0
  314. package/istmx-system-design/references/estimation-numbers.md +250 -0
  315. package/istmx-system-design/references/four-step-process.md +286 -0
  316. package/istmx-system-design/references/reliability-operations.md +373 -0
  317. package/istmx-system-design/references/worked-examples.md +174 -0
  318. package/istmx-tdd-verify/SKILL.md +364 -0
  319. package/istmx-tdd-verify/references/anti-tautological-tests.md +21 -0
  320. package/istmx-tdd-verify/references/characterization-and-seams.md +21 -0
  321. package/istmx-tdd-verify/references/condition-based-waiting.md +115 -0
  322. package/istmx-tdd-verify/references/defense-in-depth.md +122 -0
  323. package/istmx-tdd-verify/references/root-cause-and-defense-in-depth.md +26 -0
  324. package/istmx-tdd-verify/references/root-cause-tracing.md +169 -0
  325. package/istmx-tdd-verify/references/systematic-debugging.md +283 -0
  326. package/istmx-tdd-verify/references/verification-before-completion.md +120 -0
  327. package/istmx-tdd-verify/references/working-with-legacy-code.md +206 -0
  328. package/istmx-tdd-verify/references/writing-good-tests.md +198 -0
  329. package/istmx-tdd-verify/scripts/find-polluter.sh +72 -0
  330. package/istmx-team-topologies/SKILL.md +217 -0
  331. package/istmx-team-topologies/references/case-studies.md +158 -0
  332. package/istmx-team-topologies/references/cognitive-load.md +148 -0
  333. package/istmx-team-topologies/references/fracture-planes.md +97 -0
  334. package/istmx-team-topologies/references/interaction-modes.md +137 -0
  335. package/istmx-team-topologies/references/team-types.md +145 -0
  336. package/istmx-tech-docs/SKILL.md +246 -0
  337. package/istmx-tech-docs/references/api-reference.md +431 -0
  338. package/istmx-tech-docs/references/audit-checklist.md +287 -0
  339. package/istmx-tech-docs/references/document-types.md +212 -0
  340. package/istmx-tech-docs/references/procedures-and-code.md +249 -0
  341. package/istmx-tech-docs/references/release-notes.md +424 -0
  342. package/istmx-tech-docs/references/structure-and-formatting.md +330 -0
  343. package/istmx-tech-docs/references/voice-and-words.md +296 -0
  344. package/package.json +127 -127
  345. package/RELEASE_v2.1.0.md +0 -68
  346. package/context/conversation_transcript.md +0 -786
  347. package/context/progress.md +0 -129
  348. package/istm/SKILL.md +0 -74
  349. package/istm-animate/SKILL.md +0 -65
  350. package/istm-animate/animations/animation_utils.md +0 -280
  351. package/istm-animate/animations/animations.md +0 -220
  352. package/istm-animate/animations/core_motion.md +0 -250
  353. package/istm-animate/animations/examples/README.md +0 -29
  354. package/istm-animate/animations/examples/nuxt/app/app.vue +0 -3
  355. package/istm-animate/animations/examples/nuxt/app/composables/useGSAP.ts +0 -91
  356. package/istm-animate/animations/examples/nuxt/app/pages/index.vue +0 -55
  357. package/istm-animate/animations/examples/nuxt/nuxt.config.ts +0 -4
  358. package/istm-animate/animations/examples/nuxt/package.json +0 -18
  359. package/istm-animate/animations/examples/react/App.jsx +0 -46
  360. package/istm-animate/animations/examples/react/index.html +0 -12
  361. package/istm-animate/animations/examples/react/main.jsx +0 -9
  362. package/istm-animate/animations/examples/react/package.json +0 -21
  363. package/istm-animate/animations/examples/react/vite.config.js +0 -7
  364. package/istm-animate/animations/examples/vanilla/index.html +0 -33
  365. package/istm-animate/animations/examples/vanilla/main.js +0 -36
  366. package/istm-animate/animations/examples/vue/app.vue +0 -47
  367. package/istm-animate/animations/examples/vue/index.html +0 -15
  368. package/istm-animate/animations/examples/vue/main.js +0 -9
  369. package/istm-animate/animations/examples/vue/package.json +0 -19
  370. package/istm-animate/animations/examples/vue/vite.config.js +0 -7
  371. package/istm-animate/animations/framework_motion.md +0 -262
  372. package/istm-animate/animations/motion.csv +0 -17
  373. package/istm-animate/animations/motion.md +0 -11
  374. package/istm-animate/animations/motion_catalog.json +0 -226
  375. package/istm-animate/animations/motion_performance.md +0 -75
  376. package/istm-animate/animations/motion_plugins.md +0 -429
  377. package/istm-animate/animations/react_animations.md +0 -132
  378. package/istm-animate/animations/scroll_trigger_effects.md +0 -291
  379. package/istm-animate/animations/timeline_sequencing.md +0 -103
  380. package/istm-animate/core/motion-principles/SKILL.md +0 -284
  381. package/istm-animate/core/motion-principles/references/designers.md +0 -127
  382. package/istm-animate/core/motion-principles/references/easing-guide.md +0 -231
  383. package/istm-animate/core/motion-principles/references/enter-exit-recipes.md +0 -466
  384. package/istm-animate/frameworks/canvas-generative/SKILL.md +0 -325
  385. package/istm-animate/frameworks/canvas-generative/references/algorithms.md +0 -925
  386. package/istm-animate/frameworks/css-native/SKILL.md +0 -319
  387. package/istm-animate/frameworks/css-native/references/modern-css.md +0 -465
  388. package/istm-animate/frameworks/framer-motion/SKILL.md +0 -187
  389. package/istm-animate/frameworks/framer-motion/references/api.md +0 -312
  390. package/istm-animate/frameworks/gsap/SKILL.md +0 -188
  391. package/istm-animate/frameworks/gsap/references/core.md +0 -218
  392. package/istm-animate/frameworks/gsap/references/plugins.md +0 -371
  393. package/istm-animate/frameworks/gsap/references/scrolltrigger.md +0 -325
  394. package/istm-animate/frameworks/gsap/references/timeline.md +0 -218
  395. package/istm-animate/frameworks/threejs-r3f/SKILL.md +0 -243
  396. package/istm-animate/frameworks/threejs-r3f/references/scene-setup.md +0 -392
  397. package/istm-animate/frameworks/threejs-r3f/references/shaders.md +0 -446
  398. package/istm-animate/mobile/android/compose-graphics/SKILL.md +0 -503
  399. package/istm-animate/mobile/android/compose-graphics/references/agsl-recipes.md +0 -356
  400. package/istm-animate/mobile/android/compose-graphics/references/canvas-generative.md +0 -282
  401. package/istm-animate/mobile/android/compose-graphics/references/m3-expressive-deep.md +0 -303
  402. package/istm-animate/mobile/android/compose-motion/SKILL.md +0 -359
  403. package/istm-animate/mobile/android/compose-motion/references/gestures-compose.md +0 -273
  404. package/istm-animate/mobile/android/compose-motion/references/recomposition-and-anim.md +0 -196
  405. package/istm-animate/mobile/android/compose-motion/references/shared-transitions.md +0 -281
  406. package/istm-animate/mobile/android/compose-multiplatform/SKILL.md +0 -311
  407. package/istm-animate/mobile/android/compose-multiplatform/references/cmp-interop.md +0 -288
  408. package/istm-animate/mobile/android/compose-multiplatform/references/cmp-platform-quirks.md +0 -156
  409. package/istm-animate/mobile/apple/swiftui-graphics/SKILL.md +0 -408
  410. package/istm-animate/mobile/apple/swiftui-graphics/references/canvas-swiftui.md +0 -239
  411. package/istm-animate/mobile/apple/swiftui-graphics/references/liquid-glass-deep.md +0 -252
  412. package/istm-animate/mobile/apple/swiftui-graphics/references/metal-recipes.md +0 -382
  413. package/istm-animate/mobile/apple/swiftui-motion/SKILL.md +0 -379
  414. package/istm-animate/mobile/apple/swiftui-motion/references/gestures-swiftui.md +0 -336
  415. package/istm-animate/mobile/apple/swiftui-motion/references/phase-keyframe-deep.md +0 -231
  416. package/istm-animate/mobile/apple/swiftui-motion/references/springs-cheatsheet.md +0 -129
  417. package/istm-animate/references/animate.md +0 -199
  418. package/istm-animate/references/audit.md +0 -115
  419. package/istm-animate/references/design-engineering.md +0 -674
  420. package/istm-animate/references/improve.md +0 -101
  421. package/istm-animate/references/opportunities.md +0 -132
  422. package/istm-animate/references/plan-template.md +0 -73
  423. package/istm-animate/references/recipes.md +0 -324
  424. package/istm-animate/references/review.md +0 -112
  425. package/istm-animate/references/standards.md +0 -187
  426. package/istm-animate/references/vocabulary.md +0 -173
  427. package/istm-architecture/SKILL.md +0 -174
  428. package/istm-architecture/frameworks/angular.csv +0 -51
  429. package/istm-architecture/frameworks/astro.csv +0 -54
  430. package/istm-architecture/frameworks/avalonia.csv +0 -57
  431. package/istm-architecture/frameworks/flutter.csv +0 -53
  432. package/istm-architecture/frameworks/javafx.csv +0 -76
  433. package/istm-architecture/frameworks/jetpack-compose.csv +0 -53
  434. package/istm-architecture/frameworks/laravel.csv +0 -51
  435. package/istm-architecture/frameworks/nextjs.csv +0 -53
  436. package/istm-architecture/frameworks/nuxtjs.csv +0 -59
  437. package/istm-architecture/frameworks/react-native.csv +0 -52
  438. package/istm-architecture/frameworks/react.csv +0 -54
  439. package/istm-architecture/frameworks/svelte.csv +0 -54
  440. package/istm-architecture/frameworks/swiftui.csv +0 -51
  441. package/istm-architecture/frameworks/uwp.csv +0 -56
  442. package/istm-architecture/frameworks/vue.csv +0 -50
  443. package/istm-architecture/frameworks/winui.csv +0 -60
  444. package/istm-architecture/frameworks/wpf.csv +0 -57
  445. package/istm-architecture/templates/design.md +0 -138
  446. package/istm-awwward-designer/SKILL.md +0 -75
  447. package/istm-awwward-designer/libraries/threejs.csv +0 -54
  448. package/istm-awwward-designer/references/accessibility.md +0 -774
  449. package/istm-awwward-designer/references/anim-anti-patterns.md +0 -576
  450. package/istm-awwward-designer/references/animation-map.md +0 -166
  451. package/istm-awwward-designer/references/animation-standards.md +0 -86
  452. package/istm-awwward-designer/references/anti-patterns.md +0 -191
  453. package/istm-awwward-designer/references/color-systems.md +0 -604
  454. package/istm-awwward-designer/references/css-performance.md +0 -477
  455. package/istm-awwward-designer/references/descender-safety.md +0 -490
  456. package/istm-awwward-designer/references/design-audit.md +0 -93
  457. package/istm-awwward-designer/references/font-loading.md +0 -378
  458. package/istm-awwward-designer/references/image-optimization.md +0 -440
  459. package/istm-awwward-designer/references/invention-gate.md +0 -356
  460. package/istm-awwward-designer/references/micro-interactions.md +0 -825
  461. package/istm-awwward-designer/references/page-transitions.md +0 -365
  462. package/istm-awwward-designer/references/performance-standards.md +0 -79
  463. package/istm-awwward-designer/references/quality-gate.md +0 -103
  464. package/istm-awwward-designer/references/responsive-design.md +0 -778
  465. package/istm-awwward-designer/references/scoring-guide.md +0 -201
  466. package/istm-awwward-designer/references/scroll-patterns.md +0 -668
  467. package/istm-awwward-designer/references/stitch-brief.md +0 -124
  468. package/istm-awwward-designer/references/tech-stack.md +0 -204
  469. package/istm-awwward-designer/references/technical-audit.md +0 -133
  470. package/istm-awwward-designer/references/technique-families.md +0 -293
  471. package/istm-awwward-designer/references/testing.md +0 -535
  472. package/istm-awwward-designer/references/text-animation.md +0 -585
  473. package/istm-awwward-designer/references/typography.md +0 -504
  474. package/istm-awwward-designer/references/usability-audit.md +0 -108
  475. package/istm-awwward-designer/references/visual-standards.md +0 -97
  476. package/istm-design/SKILL.md +0 -85
  477. package/istm-design/anti-laziness/architectural-patterns.md +0 -55
  478. package/istm-design/anti-laziness/parameter-tuning.md +0 -44
  479. package/istm-design/anti-laziness/prompt-engineering.md +0 -52
  480. package/istm-design/anti-laziness/reference-prompts.md +0 -79
  481. package/istm-design/archetypes/brandkit/SKILL.md +0 -798
  482. package/istm-design/archetypes/brutalist/SKILL.md +0 -92
  483. package/istm-design/archetypes/minimalist/SKILL.md +0 -85
  484. package/istm-design/archetypes/soft/SKILL.md +0 -98
  485. package/istm-design/colors/color_theory.md +0 -293
  486. package/istm-design/colors/colors.csv +0 -193
  487. package/istm-design/colors/colors_catalog.json +0 -4034
  488. package/istm-design/colors/palette.json +0 -21
  489. package/istm-design/core/design-audit/SKILL.md +0 -248
  490. package/istm-design/core/desktop-principles/SKILL.md +0 -363
  491. package/istm-design/core/desktop-principles/references/keyboard-patterns.md +0 -137
  492. package/istm-design/core/desktop-principles/references/multi-window.md +0 -105
  493. package/istm-design/core/mobile-principles/SKILL.md +0 -289
  494. package/istm-design/core/mobile-principles/references/accessibility-mobile.md +0 -175
  495. package/istm-design/core/mobile-principles/references/gestures-deep.md +0 -220
  496. package/istm-design/core/ui-ux-pro-max/SKILL.md +0 -392
  497. package/istm-design/core/ui-ux-pro-max/UPSTREAM.md +0 -23
  498. package/istm-design/core/ui-ux-pro-max/data/app-interface.csv +0 -31
  499. package/istm-design/core/ui-ux-pro-max/data/charts.csv +0 -26
  500. package/istm-design/core/ui-ux-pro-max/data/colors.csv +0 -193
  501. package/istm-design/core/ui-ux-pro-max/data/google-fonts.csv +0 -1924
  502. package/istm-design/core/ui-ux-pro-max/data/icons.csv +0 -106
  503. package/istm-design/core/ui-ux-pro-max/data/landing.csv +0 -35
  504. package/istm-design/core/ui-ux-pro-max/data/motion.csv +0 -17
  505. package/istm-design/core/ui-ux-pro-max/data/products.csv +0 -193
  506. package/istm-design/core/ui-ux-pro-max/data/react-performance.csv +0 -45
  507. package/istm-design/core/ui-ux-pro-max/data/stacks/angular.csv +0 -51
  508. package/istm-design/core/ui-ux-pro-max/data/stacks/astro.csv +0 -54
  509. package/istm-design/core/ui-ux-pro-max/data/stacks/avalonia.csv +0 -57
  510. package/istm-design/core/ui-ux-pro-max/data/stacks/flutter.csv +0 -53
  511. package/istm-design/core/ui-ux-pro-max/data/stacks/html-tailwind.csv +0 -56
  512. package/istm-design/core/ui-ux-pro-max/data/stacks/javafx.csv +0 -76
  513. package/istm-design/core/ui-ux-pro-max/data/stacks/jetpack-compose.csv +0 -53
  514. package/istm-design/core/ui-ux-pro-max/data/stacks/laravel.csv +0 -51
  515. package/istm-design/core/ui-ux-pro-max/data/stacks/nextjs.csv +0 -53
  516. package/istm-design/core/ui-ux-pro-max/data/stacks/nuxt-ui.csv +0 -71
  517. package/istm-design/core/ui-ux-pro-max/data/stacks/nuxtjs.csv +0 -59
  518. package/istm-design/core/ui-ux-pro-max/data/stacks/react-native.csv +0 -52
  519. package/istm-design/core/ui-ux-pro-max/data/stacks/react.csv +0 -54
  520. package/istm-design/core/ui-ux-pro-max/data/stacks/shadcn.csv +0 -61
  521. package/istm-design/core/ui-ux-pro-max/data/stacks/svelte.csv +0 -54
  522. package/istm-design/core/ui-ux-pro-max/data/stacks/swiftui.csv +0 -51
  523. package/istm-design/core/ui-ux-pro-max/data/stacks/threejs.csv +0 -54
  524. package/istm-design/core/ui-ux-pro-max/data/stacks/uno.csv +0 -60
  525. package/istm-design/core/ui-ux-pro-max/data/stacks/uwp.csv +0 -56
  526. package/istm-design/core/ui-ux-pro-max/data/stacks/vue.csv +0 -50
  527. package/istm-design/core/ui-ux-pro-max/data/stacks/winui.csv +0 -60
  528. package/istm-design/core/ui-ux-pro-max/data/stacks/wpf.csv +0 -57
  529. package/istm-design/core/ui-ux-pro-max/data/styles.csv +0 -85
  530. package/istm-design/core/ui-ux-pro-max/data/typography.csv +0 -75
  531. package/istm-design/core/ui-ux-pro-max/data/ui-reasoning.csv +0 -162
  532. package/istm-design/core/ui-ux-pro-max/data/ux-guidelines.csv +0 -100
  533. package/istm-design/core/ui-ux-pro-max/references/pro-rules.md +0 -109
  534. package/istm-design/core/ui-ux-pro-max/references/quick-reference.md +0 -240
  535. package/istm-design/core/ui-ux-pro-max/scripts/core.py +0 -464
  536. package/istm-design/core/ui-ux-pro-max/scripts/design_system.py +0 -1371
  537. package/istm-design/core/ui-ux-pro-max/scripts/search.py +0 -162
  538. package/istm-design/core/ui-ux-pro-max/scripts/tests/test_core.py +0 -134
  539. package/istm-design/core/ui-ux-pro-max/scripts/validate_data.py +0 -114
  540. package/istm-design/image-to-code/SKILL.md +0 -1228
  541. package/istm-design/imagegen/SKILL.md +0 -987
  542. package/istm-design/presets/airbnb/DESIGN.md +0 -545
  543. package/istm-design/presets/airbnb/README.md +0 -5
  544. package/istm-design/presets/airtable/DESIGN.md +0 -554
  545. package/istm-design/presets/airtable/README.md +0 -5
  546. package/istm-design/presets/apple/DESIGN.md +0 -562
  547. package/istm-design/presets/apple/README.md +0 -5
  548. package/istm-design/presets/binance/DESIGN.md +0 -634
  549. package/istm-design/presets/binance/README.md +0 -5
  550. package/istm-design/presets/bmw/DESIGN.md +0 -544
  551. package/istm-design/presets/bmw/README.md +0 -5
  552. package/istm-design/presets/bmw-m/DESIGN.md +0 -503
  553. package/istm-design/presets/bmw-m/README.md +0 -5
  554. package/istm-design/presets/bugatti/DESIGN.md +0 -454
  555. package/istm-design/presets/bugatti/README.md +0 -5
  556. package/istm-design/presets/cal/DESIGN.md +0 -542
  557. package/istm-design/presets/cal/README.md +0 -5
  558. package/istm-design/presets/catalog.md +0 -127
  559. package/istm-design/presets/claude/DESIGN.md +0 -589
  560. package/istm-design/presets/claude/README.md +0 -5
  561. package/istm-design/presets/clay/DESIGN.md +0 -541
  562. package/istm-design/presets/clay/README.md +0 -5
  563. package/istm-design/presets/clickhouse/DESIGN.md +0 -544
  564. package/istm-design/presets/clickhouse/README.md +0 -5
  565. package/istm-design/presets/cohere/DESIGN.md +0 -451
  566. package/istm-design/presets/cohere/README.md +0 -5
  567. package/istm-design/presets/coinbase/DESIGN.md +0 -570
  568. package/istm-design/presets/coinbase/README.md +0 -5
  569. package/istm-design/presets/composio/DESIGN.md +0 -506
  570. package/istm-design/presets/composio/README.md +0 -5
  571. package/istm-design/presets/cursor/DESIGN.md +0 -537
  572. package/istm-design/presets/cursor/README.md +0 -5
  573. package/istm-design/presets/dell-1996/DESIGN.md +0 -632
  574. package/istm-design/presets/dell-1996/README.md +0 -5
  575. package/istm-design/presets/elevenlabs/DESIGN.md +0 -504
  576. package/istm-design/presets/elevenlabs/README.md +0 -5
  577. package/istm-design/presets/expo/DESIGN.md +0 -526
  578. package/istm-design/presets/expo/README.md +0 -5
  579. package/istm-design/presets/ferrari/DESIGN.md +0 -531
  580. package/istm-design/presets/ferrari/README.md +0 -5
  581. package/istm-design/presets/figma/DESIGN.md +0 -578
  582. package/istm-design/presets/figma/README.md +0 -5
  583. package/istm-design/presets/framer/DESIGN.md +0 -544
  584. package/istm-design/presets/framer/README.md +0 -5
  585. package/istm-design/presets/hashicorp/DESIGN.md +0 -575
  586. package/istm-design/presets/hashicorp/README.md +0 -5
  587. package/istm-design/presets/hp/DESIGN.md +0 -670
  588. package/istm-design/presets/hp/README.md +0 -5
  589. package/istm-design/presets/ibm/DESIGN.md +0 -550
  590. package/istm-design/presets/ibm/README.md +0 -5
  591. package/istm-design/presets/intercom/DESIGN.md +0 -546
  592. package/istm-design/presets/intercom/README.md +0 -5
  593. package/istm-design/presets/kraken/DESIGN.md +0 -125
  594. package/istm-design/presets/kraken/README.md +0 -5
  595. package/istm-design/presets/lamborghini/DESIGN.md +0 -288
  596. package/istm-design/presets/lamborghini/README.md +0 -5
  597. package/istm-design/presets/linear/DESIGN.md +0 -548
  598. package/istm-design/presets/linear/README.md +0 -5
  599. package/istm-design/presets/lovable/DESIGN.md +0 -298
  600. package/istm-design/presets/lovable/README.md +0 -5
  601. package/istm-design/presets/mastercard/DESIGN.md +0 -365
  602. package/istm-design/presets/mastercard/README.md +0 -5
  603. package/istm-design/presets/meta/DESIGN.md +0 -683
  604. package/istm-design/presets/meta/README.md +0 -5
  605. package/istm-design/presets/minimax/DESIGN.md +0 -746
  606. package/istm-design/presets/minimax/README.md +0 -5
  607. package/istm-design/presets/mintlify/DESIGN.md +0 -852
  608. package/istm-design/presets/mintlify/README.md +0 -5
  609. package/istm-design/presets/miro/DESIGN.md +0 -825
  610. package/istm-design/presets/miro/README.md +0 -5
  611. package/istm-design/presets/mistral/DESIGN.md +0 -773
  612. package/istm-design/presets/mistral/README.md +0 -5
  613. package/istm-design/presets/mongodb/DESIGN.md +0 -767
  614. package/istm-design/presets/mongodb/README.md +0 -5
  615. package/istm-design/presets/nike/DESIGN.md +0 -575
  616. package/istm-design/presets/nike/README.md +0 -5
  617. package/istm-design/presets/nintendo-2001/DESIGN.md +0 -649
  618. package/istm-design/presets/nintendo-2001/README.md +0 -5
  619. package/istm-design/presets/notion/DESIGN.md +0 -821
  620. package/istm-design/presets/notion/README.md +0 -5
  621. package/istm-design/presets/nvidia/DESIGN.md +0 -640
  622. package/istm-design/presets/nvidia/README.md +0 -5
  623. package/istm-design/presets/ollama/DESIGN.md +0 -539
  624. package/istm-design/presets/ollama/README.md +0 -5
  625. package/istm-design/presets/opencode/DESIGN.md +0 -521
  626. package/istm-design/presets/opencode/README.md +0 -5
  627. package/istm-design/presets/pinterest/DESIGN.md +0 -597
  628. package/istm-design/presets/pinterest/README.md +0 -5
  629. package/istm-design/presets/playstation/DESIGN.md +0 -661
  630. package/istm-design/presets/playstation/README.md +0 -5
  631. package/istm-design/presets/posthog/DESIGN.md +0 -690
  632. package/istm-design/presets/posthog/README.md +0 -5
  633. package/istm-design/presets/raycast/DESIGN.md +0 -669
  634. package/istm-design/presets/raycast/README.md +0 -5
  635. package/istm-design/presets/renault/DESIGN.md +0 -589
  636. package/istm-design/presets/renault/README.md +0 -5
  637. package/istm-design/presets/replicate/DESIGN.md +0 -616
  638. package/istm-design/presets/replicate/README.md +0 -5
  639. package/istm-design/presets/resend/DESIGN.md +0 -585
  640. package/istm-design/presets/resend/README.md +0 -5
  641. package/istm-design/presets/revolut/DESIGN.md +0 -636
  642. package/istm-design/presets/revolut/README.md +0 -5
  643. package/istm-design/presets/runwayml/DESIGN.md +0 -244
  644. package/istm-design/presets/runwayml/README.md +0 -5
  645. package/istm-design/presets/sanity/DESIGN.md +0 -357
  646. package/istm-design/presets/sanity/README.md +0 -5
  647. package/istm-design/presets/sentry/DESIGN.md +0 -551
  648. package/istm-design/presets/sentry/README.md +0 -5
  649. package/istm-design/presets/shopify/DESIGN.md +0 -516
  650. package/istm-design/presets/shopify/README.md +0 -5
  651. package/istm-design/presets/slack/DESIGN.md +0 -482
  652. package/istm-design/presets/spacex/DESIGN.md +0 -363
  653. package/istm-design/presets/spacex/README.md +0 -5
  654. package/istm-design/presets/spotify/DESIGN.md +0 -246
  655. package/istm-design/presets/spotify/README.md +0 -5
  656. package/istm-design/presets/starbucks/DESIGN.md +0 -580
  657. package/istm-design/presets/starbucks/README.md +0 -5
  658. package/istm-design/presets/stripe/DESIGN.md +0 -487
  659. package/istm-design/presets/stripe/README.md +0 -5
  660. package/istm-design/presets/supabase/DESIGN.md +0 -462
  661. package/istm-design/presets/supabase/README.md +0 -5
  662. package/istm-design/presets/superhuman/DESIGN.md +0 -448
  663. package/istm-design/presets/superhuman/README.md +0 -5
  664. package/istm-design/presets/tesla/DESIGN.md +0 -286
  665. package/istm-design/presets/tesla/README.md +0 -5
  666. package/istm-design/presets/theverge/DESIGN.md +0 -339
  667. package/istm-design/presets/theverge/README.md +0 -5
  668. package/istm-design/presets/together/DESIGN.md +0 -633
  669. package/istm-design/presets/together/README.md +0 -5
  670. package/istm-design/presets/uber/DESIGN.md +0 -636
  671. package/istm-design/presets/uber/README.md +0 -5
  672. package/istm-design/presets/vercel/DESIGN.md +0 -736
  673. package/istm-design/presets/vercel/README.md +0 -5
  674. package/istm-design/presets/vodafone/DESIGN.md +0 -538
  675. package/istm-design/presets/vodafone/README.md +0 -5
  676. package/istm-design/presets/voltagent/DESIGN.md +0 -521
  677. package/istm-design/presets/voltagent/README.md +0 -5
  678. package/istm-design/presets/warp/DESIGN.md +0 -526
  679. package/istm-design/presets/warp/README.md +0 -5
  680. package/istm-design/presets/webflow/DESIGN.md +0 -588
  681. package/istm-design/presets/webflow/README.md +0 -5
  682. package/istm-design/presets/wired/DESIGN.md +0 -497
  683. package/istm-design/presets/wired/README.md +0 -5
  684. package/istm-design/presets/wise/DESIGN.md +0 -544
  685. package/istm-design/presets/wise/README.md +0 -5
  686. package/istm-design/presets/xai/DESIGN.md +0 -465
  687. package/istm-design/presets/xai/README.md +0 -5
  688. package/istm-design/presets/zapier/DESIGN.md +0 -537
  689. package/istm-design/presets/zapier/README.md +0 -5
  690. package/istm-design/references/apple-design.md +0 -282
  691. package/istm-design/references/generation-guide.md +0 -209
  692. package/istm-design/references/pick-ui-library.md +0 -77
  693. package/istm-design/references/picker.md +0 -197
  694. package/istm-design/references/prototype.md +0 -90
  695. package/istm-design/references/schema.md +0 -366
  696. package/istm-design/semantic-design/DESIGN.md +0 -121
  697. package/istm-design/semantic-design/SKILL.md +0 -184
  698. package/istm-design/styles/design_system.md +0 -288
  699. package/istm-design/styles/html-tailwind.csv +0 -56
  700. package/istm-design/styles/nuxt-ui.csv +0 -71
  701. package/istm-design/styles/product_design.md +0 -55
  702. package/istm-design/styles/shadcn.csv +0 -61
  703. package/istm-design/styles/style.md +0 -12
  704. package/istm-design/styles/styles.csv +0 -85
  705. package/istm-design/styles/styles_catalog.json +0 -2018
  706. package/istm-design/styles/ui-reasoning.csv +0 -162
  707. package/istm-design/styles/uno.csv +0 -60
  708. package/istm-design/typography/font_and_font.md +0 -10
  709. package/istm-design/typography/google-fonts.csv +0 -1924
  710. package/istm-design/typography/sans_serif_fonts.md +0 -112
  711. package/istm-design/typography/typography.csv +0 -75
  712. package/istm-design/typography/typography_catalog.json +0 -964
  713. package/istm-design/ux/app-interface.csv +0 -31
  714. package/istm-design/ux/charts.csv +0 -26
  715. package/istm-design/ux/icons.csv +0 -106
  716. package/istm-design/ux/landing.csv +0 -35
  717. package/istm-design/ux/products.csv +0 -193
  718. package/istm-design/ux/react-performance.csv +0 -45
  719. package/istm-design/ux/responsive_rules.md +0 -62
  720. package/istm-design/ux/storytelling.md +0 -47
  721. package/istm-design/ux/ux-guidelines.csv +0 -100
  722. package/istm-design/ux/ux_guidelines.json +0 -1190
  723. package/istm-system-design/SKILL.md +0 -95
  724. package/istm-system-design/principles/01-architecture-patterns.md +0 -24
  725. package/istm-system-design/principles/02-database-selection.md +0 -32
  726. package/istm-system-design/principles/03-api-design.md +0 -25
  727. package/istm-system-design/principles/04-authentication-security.md +0 -23
  728. package/istm-system-design/principles/05-caching-performance.md +0 -21
  729. package/istm-system-design/principles/06-asynchronous-processing.md +0 -17
  730. package/istm-system-design/principles/07-infrastructure-deployment.md +0 -22
  731. package/istm-system-design/principles/08-low-level-design.md +0 -35
  732. package/istm-system-design/principles/09-state-management.md +0 -14
  733. package/istm-system-design/principles/10-error-handling-and-logging.md +0 -26
  734. package/istm-system-design/principles/11-testing-strategy.md +0 -18
  735. package/istm-system-design/principles/12-seo-and-web-vitals.md +0 -18
  736. package/istm-system-design/stacks/SETUP.md +0 -82
  737. package/istm-system-design/stacks/STACK.md +0 -67
  738. package/istm-system-design/stacks/WORKFLOW.md +0 -84
  739. package/istm-system-design/templates/api-route.ts.template +0 -32
  740. package/istm-system-design/templates/migrations.md.template +0 -30
  741. package/istm-system-design/templates/schema.drizzle.ts.template +0 -17
  742. package/istm-system-design/templates/schema.prisma.template +0 -28
  743. package/istm-system-design/templates/trpc-router.ts.template +0 -22
  744. package/istm-system-design/templates/zod-validators.ts.template +0 -14
@@ -0,0 +1,131 @@
1
+ # Six Factory Stations, 30 Checks & Autonomy Ladder Scoring
2
+
3
+ This reference documents the complete inspection rubric behind `@istmx/skills` and the `harness-audit` skill. Use it when running an audit manually (without shell access to `npx`), when interpreting a specific check ID in a JSON/HTML report, or when explaining why a repository's Autonomy Level was capped.
4
+
5
+ ---
6
+
7
+ ## 1. The Three Axes and Why Stations Matter
8
+
9
+ Most team debates about "AI maturity" stall because people mix three different units:
10
+
11
+ 1. **Maturity (Autonomy Ladder, Level 0–5)** — *Who reads what before a change merges?* Measured **per loop** (a repeatable class of change such as dependency bumps, bug fixes, or feature work in a service), never averaged into a vanity number like "Level 3.4".
12
+ 2. **Risk Class (`low`, `medium`, `high`, `critical`)** — *How costly is a wrong answer on this specific diff?* Risk class caps what any loop may do. Authentication, money movement, schema migrations, secrets, tests, and CI workflows stay human-read even when a repository supports Level 4 or Level 5 loops elsewhere.
13
+ 3. **Capability (Six Factory Stations)** — *What concrete machinery exists in the repository to steer, constrain, verify, and ship agent work?* This is what `harness-audit` measures deterministically on disk.
14
+
15
+ | # | Station | Weight | Decision It Owns | Symptom When Missing |
16
+ | --- | --- | --- | --- | --- |
17
+ | 1 | **Intent** (`intent`) | 20% | What the agent knows before it starts | Plausible code solving the wrong problem or violating local conventions |
18
+ | 2 | **Harness** (`harness`) | 18% | What the agent may run, read, and reach | Constant approval friction, broken MCP startups, or leaked secrets / prod touches |
19
+ | 3 | **Loop** (`loop`) | 18% | How fast the agent verifies and when it stops | Runs that finish by declaring victory without proof, or burn retries on env drift |
20
+ | 4 | **Graph** (`graph`) | 10% | How multiple agents run without colliding | Parallel runs overwriting files, fighting over port 3000, or corrupting local DBs |
21
+ | 5 | **Verification** (`verification`) | 20% | What counts as proof the agent cannot fake | Green builds built on `.skip()`, `@ts-ignore`, or tests the agent softened |
22
+ | 6 | **Release** (`release`) | 14% | How verified work leaves the repository safely | Review queues choking on diffs nobody can explain a week after merge |
23
+
24
+ ---
25
+
26
+ ## 2. Complete Catalog of the 30 Deterministic Checks
27
+
28
+ Each check evaluates observable files on disk and assigns one of four statuses:
29
+
30
+ - `pass` (100% of check weight) — artifact present and free of known failure modes.
31
+ - `warn` (50% of check weight) — partially present or carrying non-critical friction.
32
+ - `fail` (0% of check weight) — missing critical foundation or active defect found.
33
+ - `info` (excluded from station denominator) — neutral observation when a check does not apply to the repository's shape (for example, zero MCP files or a pure CLI library without browser E2E).
34
+
35
+ ### Station 1 — Intent (`intent`, 20% of overall score)
36
+
37
+ | Check ID | Weight | What It Inspects | Pass / Warn / Fail Criteria |
38
+ | --- | --- | --- | --- |
39
+ | `intent.instructions-file` | 30 | `AGENTS.md`, `CLAUDE.md`, `.cursor/rules/*.mdc`, `.claude/rules/*.md`, `.github/copilot-instructions.md`, `.cursorrules`, `.cursor/rules/*.md` | **Pass** when a supported canonical file exists with no undocumented `.cursorrules` or ignored `.cursor/rules/*.md`. **Warn** if legacy/ignored files coexist. **Fail** if none exist. |
40
+ | `intent.single-source` | 20 | Relationship between `AGENTS.md` and `CLAUDE.md` | **Pass** with a single `AGENTS.md`, OR `AGENTS.md` + thin `CLAUDE.md` (≤ 45 lines) containing a bare `@AGENTS.md` line outside backticks and code fences. **Fail** on policy-by-duplication (`CLAUDE.md` > 35 lines without bare `@AGENTS.md`) or backticked `` `@AGENTS.md` `` (which Claude Code silently ignores). **Warn** if only `CLAUDE.md` exists (invisible to Codex/Cursor). |
41
+ | `intent.instruction-budget` | 20 | Line count, byte size, and filler phrases in root brief | **Pass** at 5–150 lines, ≤ 32 KiB, and ≤ 1 filler phrase. **Warn** at 151–350 lines or ≥ 2 generic boilerplate hits ("write clean code", "follow best practices", "ensure high quality"). **Fail** at > 350 lines, < 5 lines, or > 32 KiB (Codex's default `project_doc_max_bytes` truncation boundary). |
42
+ | `intent.scoped-rules` | 15 | `.claude/rules/*.md` (`paths:` frontmatter), `.cursor/rules/*.mdc` (`globs:`), nested `*/AGENTS.md` | **Pass** when path-scoped rules exist and `.claude/rules/*.md` carry `paths:`. **Warn** in monorepos or ≥ 40-source-file repos with none, or when all `.claude/rules/*.md` omit `paths:` (loading unconditionally on every turn). **Info** in small single repos. |
43
+ | `intent.skills-and-specs` | 15 | Project skills (`{.claude,.agents,.cursor}/skills/*/SKILL.md`), PR/issue templates, and spec/standards docs (`TESTING.md`, `CODING_STANDARDS.md`, `DESIGN.md`, `ARCHITECTURE.md`, `docs/adr/`, `docs/specs/`) | **Pass** when ≥ 2 of the 3 categories exist. **Warn** when 1 exists. **Fail** when 0 exist. |
44
+
45
+ ### Station 2 — Harness (`harness`, 18% of overall score)
46
+
47
+ | Check ID | Weight | What It Inspects | Pass / Warn / Fail Criteria |
48
+ | --- | --- | --- | --- |
49
+ | `harness.permissions-policy` | 25 | `.claude/settings.json` (`permissions.allow`, `permissions.deny`, `defaultMode`, `sandbox`), `.codex/config.toml` (`approval_policy`, `sandbox_mode`, `default_permissions`), `.cursor/cli.json` | **Critical Fail** if `.codex/config.toml` sets retired `approval_policy = "untrusted"` (removed in Codex 0.149.0 — fails at startup), or if repo config enables `bypassPermissions` / `--dangerously-skip-permissions` / `dangerously-bypass-approvals-and-sandbox`. **Pass** when versioned allow + deny or sandbox/Codex policy exists cleanly. **Warn** if allow-only with no deny/sandbox. **Fail** if no policy exists. |
50
+ | `harness.hooks` | 20 | `.claude/settings.json` `hooks`, `.cursor/hooks.json`, `.husky/`, `lefthook.yml`, `.pre-commit-config.yaml`, `.githooks/` | **Fail** if a Claude Code `Stop` hook does not check `stop_hook_active` (inline or in its referenced script), risking an infinite blocking loop on failing suites. **Pass** if valid agent hooks or git hooks exist. **Warn** if neither exists. |
51
+ | `harness.mcp-hygiene` | 20 | `.mcp.json`, `.cursor/mcp.json`, `.codex/config.toml` `[mcp_servers.*]`, and misplaced `.claude/mcp.json` | **Info** when no project MCP configs exist (zero false positives). **Critical Fail** if any config references archived/non-existent npm packages (`@modelcontextprotocol/server-postgres`, `-sqlite`, `-mysql`, `-slack`, `-git`, `-jira`, `-puppeteer`, `-github`) or embeds hardcoded `Authorization: Bearer` tokens or plaintext secrets in `env`/`headers`. **Warn** for deprecated `/sse` endpoints (prefer Streamable HTTP `type: "http"`), misplaced `.claude/mcp.json`, or `.cursor/mcp.json` stdio entries missing `type: "stdio"`. **Pass** if clean. |
52
+ | `harness.secret-hygiene` | 20 | `.gitignore` patterns, `.env.example`/`.dev.vars.example`, tracked config/script credential scan, CI secret scanner (`gitleaks`, `trufflehog`, `secretlint`) | **Critical Fail** if tracked config/script files contain real-looking API keys, tokens, or private keys (`sk-ant-`, `sk-proj-`, `ghp_`, `github_pat_`, `AKIA...`, `xox...`, `polar_oat_`, `polar_whs_`, `re_...`, `BEGIN PRIVATE KEY`). **Fail** if `.gitignore` omits `.env` (or `.dev.vars` in Cloudflare repos). **Warn** if `.env.local` or `*.pem`/`*.key` are omitted. **Pass** when covered and clean. |
53
+ | `harness.sandbox-readiness` | 15 | `.devcontainer/`, `Dockerfile`/`docker-compose*`, `flake.nix`/`shell.nix`, tool sandbox config, production/shared-resource boundary notes in root brief | **Pass** when ≥ 2 signals exist (e.g., container/tool sandbox plus explicit production boundary rules). **Warn** when 1 exists. **Fail** when 0 exist. |
54
+
55
+ ### Station 3 — Loop (`loop`, 18% of overall score)
56
+
57
+ | Check ID | Weight | What It Inspects | Pass / Warn / Fail Criteria |
58
+ | --- | --- | --- | --- |
59
+ | `loop.stack-detection` | 10 | Standard manifests (`package.json`, `pyproject.toml`, `go.mod`, `Cargo.toml`, `pom.xml`, `build.gradle*`, `Gemfile`, `composer.json`, `*.csproj`) | **Pass** when stack and package manager are deterministically detectable; **Warn** otherwise. |
60
+ | `loop.single-command-verify` | 30 | Scripts/targets (`check`, `verify`, `ci`, `test`, `lint`, `typecheck`, `build`) in `package.json`, `Makefile`, `justfile`, and whether `AGENTS.md`/`CLAUDE.md` documents runnable verify commands | **Pass** when a unified `check`/`verify` command (or `test` + `lint`/`typecheck` + `build`) exists and is documented in the root brief. **Warn** if partial or undocumented in the brief. **Fail** if missing. |
61
+ | `loop.static-types` | 25 | `tsconfig.json` (`strict: true` or strict `extends`), Python `mypy`/`pyright`/`basedpyright`/`ty`, PHPStan/Psalm, Sorbet/Steep, native Go/Rust/Java/Kotlin/C#/Swift | **Pass** on strict typechecking or statically typed native languages. **Warn** on non-strict `tsconfig.json` or untyped Python/PHP/Ruby. **Fail** on untyped JS without TypeScript. **Info** when no app language is present. |
62
+ | `loop.formatter-linter` | 20 | `Biome`, `oxlint`, `dprint`, `ESLint`, `Prettier`, `vite-plus`, `Ruff`, `Black`, `golangci-lint`, `rustfmt`/`clippy`, `RuboCop`, `gofmt`/`go vet` | **Pass** when deterministic formatting/linting is configured. **Fail** when absent. |
63
+ | `loop.lockfile-reproducibility` | 15 | Committed lockfile (`package-lock.json`, `pnpm-lock.yaml`, `yarn.lock`, `bun.lock`, `uv.lock`, `poetry.lock`, `Cargo.lock`, `go.sum`, etc.) AND runtime pin (`.node-version`, `.nvmrc`, `engines.node`, `.python-version`, `rust-toolchain.toml`, `.tool-versions`, `mise.toml`, `go.mod`) | **Pass** when both lockfile and runtime pin exist. **Warn** when only one exists. **Fail** when neither exists. |
64
+
65
+ ### Station 4 — Graph (`graph`, 10% of overall score)
66
+
67
+ | Check ID | Weight | What It Inspects | Pass / Warn / Fail Criteria |
68
+ | --- | --- | --- | --- |
69
+ | `graph.worktree-isolation` | 35 | Worktree scripts (`bin/wt`, `scripts/wt*`), `.worktreeinclude`, package scripts, or worktree guidance in root brief | **Pass** with committed worktree tooling/config. **Warn** if only prose-documented. **Fail** if absent. |
70
+ | `graph.port-and-state-isolation` | 35 | Configurable `PORT` variables in `.env.example`/`.wt-env` and ephemeral local state (Miniflare, Docker, SQLite, Testcontainers, `tmpdir`) | **Pass** when ports and/or ephemeral state are isolated. **Info** for pure CLI/libraries without dev server ports. **Warn** for web/API apps with hardcoded shared ports/state. |
71
+ | `graph.subagent-definitions` | 20 | `.claude/agents/*.md`, `.cursor/agents/*.md`, `.codex/agents/*.md`, `.factory/`, `loops.yaml`, `docs/agents/` | **Pass** when versioned agent/loop specs exist. **Warn** if only agent workflow docs exist. **Info** otherwise (optional below Level 4). |
72
+ | `graph.workspace-boundaries` | 10 | `pnpm-workspace.yaml`, `package.json` `workspaces`, `Cargo.toml` `[workspace]`, `turbo.json`, `nx.json`, `go.work`, `ARCHITECTURE.md`, or module boundary table in `AGENTS.md` | **Pass** when explicit boundaries exist. **Fail** in a monorepo without them. **Warn** in a single repo without them. |
73
+
74
+ ### Station 5 — Verification (`verification`, 20% of overall score)
75
+
76
+ | Check ID | Weight | What It Inspects | Pass / Warn / Fail Criteria |
77
+ | --- | --- | --- | --- |
78
+ | `verification.unit-tests` | 25 | Test file count vs source file count across JS/TS, Python, Go, Rust, Java, Ruby, PHP, C# conventions | **Pass** at ≥ 3 test files with ≥ 12% ratio (or ≥ 15 test files, or ≥ 2 tests in tiny ≤ 10-file repos). **Warn** if minimal (1–2 files). **Fail** if 0 test files. |
79
+ | `verification.e2e-tests` | 15 | Playwright, Cypress, Cloudflare Workers Vitest pool, Supertest/httpx, `e2e/` or `integration/` suites | **Pass** when present. **Warn** on web/API frameworks without any E2E/runtime contract suite. **Info** on pure libraries/CLIs. |
80
+ | `verification.oracle-protection` | 20 | `CODEOWNERS` covering `tests/`, `.github/`, or rule files; `.claude/settings.json` edit deny rules on tests/CI; CI protected-path guards | **Pass** when tests or CI paths are explicitly protected. **Warn** if `CODEOWNERS` exists but does not cover tests/CI. **Fail** when unprotected. |
81
+ | `verification.test-quality-scan` | 20 | Static scan of up to 150 test files and 250 source files for `.only()`, excessive `.skip()`, empty test blocks, constant-to-constant tautologies (`expect(true).toBe(true)`, `assert True`), and `@ts-ignore`/`@ts-nocheck`/`eslint-disable` sprawl | **Fail** on zero tests, any `.only()`, any constant tautology, ≥ 2 empty test blocks, or ≥ 15 `@ts-ignore`/`@ts-nocheck` directives. **Warn** on ≥ 5 skipped tests, 1 empty test, ≥ 5 `@ts-ignore`, or suppression density > 35%. **Pass** when clean. |
82
+ | `verification.automated-pr-review` | 10 | `.cursor/BUGBOT.md`, `.coderabbit.yaml`, `claude-code-action` / `codex-action` review workflows, Danger/reviewdog | **Pass** when configured; **Warn** when absent. |
83
+ | `verification.fitness-functions` | 10 | Lighthouse CI, `dependency-cruiser`, `size-limit`, Stryker mutation config, coverage thresholds, SEO/link/budget audit scripts | **Pass** when ≥ 1 automated fitness function exists; **Warn** when none exist. |
84
+
85
+ ### Station 6 — Release (`release`, 14% of overall score)
86
+
87
+ | Check ID | Weight | What It Inspects | Pass / Warn / Fail Criteria |
88
+ | --- | --- | --- | --- |
89
+ | `release.ci-pipeline` | 35 | `.github/workflows/*.yml`, `.gitlab-ci.yml`, `.circleci/config.yml`, Azure/Buildkite/Jenkins checking PR trigger + tests + lint/typecheck | **Pass** when CI runs on `pull_request`/`merge_request` with tests AND lint or typecheck. **Warn** when partial (e.g., push-only or missing tests). **Fail** when absent. |
90
+ | `release.evidence-pr-template` | 20 | `.github/pull_request_template.md` / `PULL_REQUEST_TEMPLATE/*.md` / GitLab MR templates for checklist + verification/evidence/risk terms | **Pass** with both checklist items and verification/risk prompts. **Warn** if template exists without checklist/evidence cues. **Fail** if missing. |
91
+ | `release.dependency-automation` | 15 | `renovate.json`, `.renovaterc*`, `.github/dependabot.yml` | **Pass** when configured; **Warn** when absent. |
92
+ | `release.observability-and-safety` | 15 | Sentry, OpenTelemetry, PostHog, Pino/Winston/structlog, Drizzle/Prisma/Alembic `migrations/`, healthcheck endpoints, `CHANGELOG.md` | **Pass** when present. **Warn** on deployed apps without telemetry or migration discipline. **Info** on small libraries/CLIs. |
93
+ | `release.deploy-safety` | 15 | Deploy workflows gated with `needs:` / `environment:` / branch condition, and/or `.claude/settings.json` denying local agent deploy/prod commands | **Pass** when deploy workflows are gated or local deploys are denied. **Warn** when an ungated deploy workflow exists. **Info** when no deploy workflow exists. |
94
+
95
+ ---
96
+
97
+ ## 3. Scoring Math and Honest Gating Caps
98
+
99
+ 1. **Per-station score (0–100):** `round((sum(pass weights) + 0.5 * sum(warn weights)) / sum(non-info weights) * 100)`.
100
+ 2. **Overall score (0–100):** Weighted average of the 6 stations (`0.20*Intent + 0.18*Harness + 0.18*Loop + 0.10*Graph + 0.20*Verification + 0.14*Release`).
101
+ 3. **Raw Autonomy Level:** `<25 → L0`, `25–44 → L1`, `45–62 → L2`, `63–77 → L3`, `78–89 → L4`, `90–100 → L5`.
102
+ 4. **Gating Caps (applied after raw level, always reported explicitly):**
103
+ - **Cap to L1:** `intent.instructions-file === fail` AND `loop.single-command-verify === fail`.
104
+ - **Cap to L2 (verification/CI):** `verification.unit-tests === fail` OR `release.ci-pipeline === fail`.
105
+ - **Cap to L2 (harness security/config):** Hardcoded secret found (`harness.secret-hygiene` or `harness.mcp-hygiene`) OR critical permission error (retired Codex `approval_policy = "untrusted"` or `bypassPermissions`).
106
+ - **Cap to L3:** `verification.score < 70` OR `loop.score < 70` OR `release.ci-pipeline !== pass` OR `verification.test-quality-scan === fail`.
107
+ - **Cap to L4:** `verification.oracle-protection !== pass` OR `graph.score < 70` OR `harness.score < 75` OR `verification.score < 85` OR `release.score < 80`.
108
+
109
+ ---
110
+
111
+ ## 4. Qualitative Audit Pass (What Static Checks Cannot See)
112
+
113
+ After the 30 deterministic checks, inspect three qualitative dimensions that require engineering judgment (this is what `--deep` automates or what you perform directly during a skill-driven audit):
114
+
115
+ 1. **Instruction contradiction & staleness:** Read `AGENTS.md` alongside `package.json`/`Makefile` and CI workflows. Do documented commands still exist and match CI? Are there stale references to removed directories, old package managers, or retired flags?
116
+ 2. **Real test strength vs mock theater:** Open 2–3 representative test files. Do tests call real business logic and pin hand-computed outputs, or do they mock the module under test and assert that the mock was called with the arguments the test just constructed? Would breaking an `if` condition or off-by-one boundary actually make a test go red?
117
+ 3. **Architectural legibility:** Can a fresh agent locate the entry points, data layer, auth boundary, and side-effecting boundaries in under three file reads? If critical runtime constraints (like Cloudflare D1 rejecting `Date` bindings or generated files overwritten on build) live only in Slack or tribal memory, record them as missing invariants for `AGENTS.md` or scoped rules.
118
+
119
+ ---
120
+
121
+ ## 5. Org & Workflow Dimensions Invisible on Disk
122
+
123
+ A clean repository does not guarantee clean delivery if the team process breaks around it. When auditing for a Tech Lead or CTO (or running `--interview --role dev|lead|cto`), evaluate seven organizational dimensions:
124
+
125
+ 1. **Daily adoption consistency:** Shared team harness vs isolated personal prompts.
126
+ 2. **PR review queue health:** Evidence-bundle review for low/medium risk vs drowning in line-by-line diffs or rubber-stamping.
127
+ 3. **Spec-first discipline:** Acceptance criteria and stop conditions committed before generation vs one-line prompts.
128
+ 4. **Paired metrics (throughput + stability):** Tracking AI spend/velocity alongside change failure rate, revert rate, and review wait (guarding against DORA/Faros acceleration whiplash).
129
+ 5. **Incident-to-harness feedback loop:** Every agent-caused bug adds a regression test, lint rule, or harness constraint.
130
+ 6. **Senior/Staff ownership:** Senior engineers designing invariants and oracles instead of burning out cleaning up unchecked diffs.
131
+ 7. **Enforced risk boundaries:** Explicit escalation rules for auth, payments, migrations, secrets, and CI/tests backed by `CODEOWNERS` and branch protection.
@@ -0,0 +1,219 @@
1
+ ---
2
+ name: istmx-legacy-code
3
+ description: 'Safely change and test untested codebases using Feathers'' "Working Effectively with Legacy Code". Use when the user mentions "legacy code", "no tests", "untested codebase", "how do I test this", "seams", "characterization tests", "golden master", "sprout method", "afraid to change this code", "monster method", "dependency breaking", or "inherited a messy codebase". Also trigger when changing code without tests safely, getting a class under test when constructors, statics, or singletons block it, adding features to tangled modules, or planning incremental test coverage for an old codebase. Covers the legacy-code change algorithm, seams, characterization tests, sprout/wrap, and dependency-breaking techniques. For refactoring code that already has tests, see refactoring-patterns. For day-to-day code quality, see clean-code.'
4
+ license: MIT
5
+ metadata:
6
+ author: istmx
7
+ version: "1.2.0"
8
+ ---
9
+
10
+ <!-- @istmx/skills | istmx-legacy-code -->
11
+
12
+ ## Package File Map (`@istmx/skills`)
13
+
14
+ | File | Role |
15
+ |---|---|
16
+ | `references/case-studies.md` | References module for `istmx-legacy-code` |
17
+ | `references/change-algorithm.md` | References module for `istmx-legacy-code` |
18
+ | `references/characterization-tests.md` | References module for `istmx-legacy-code` |
19
+ | `references/dependency-breaking.md` | References module for `istmx-legacy-code` |
20
+ | `references/seams.md` | References module for `istmx-legacy-code` |
21
+
22
+
23
+ # Working Effectively with Legacy Code
24
+
25
+ A field manual for changing code that has no tests, distilled from Michael C. Feathers' *Working Effectively with Legacy Code*. Use it to get untestable classes into a harness, pin down current behavior with characterization tests, and make changes one safe, verifiable step at a time — without resorting to a rewrite.
26
+
27
+ ## Core Principle
28
+
29
+ **Legacy code is simply code without tests.** Not old code, not ugly code — untested code: without tests you cannot know whether a change preserves behavior, so every edit is a gamble. The craft is breaking dependencies just enough to get tests in place before changing anything — cover and modify, never edit and pray.
30
+
31
+ ## Scoring
32
+
33
+ **Goal: 10/10.** Rate changes to untested code 0-10 against the principles below. Report the current score and the specific steps needed to reach 10/10.
34
+
35
+ - **9-10:** Change points covered by characterization tests before any edit; behavior changes and refactoring shipped as separate verified steps; dependencies broken with the least invasive technique
36
+ - **7-8:** Tests at most change points, but occasional mixed refactor-plus-behavior commits or heavier dependency surgery than needed
37
+ - **5-6:** Some characterization tests, yet key paths still changed on faith; sprouted code accumulating with no payback plan
38
+ - **3-4:** Edit-and-pray with manual verification; tests written after the change, asserting whatever the new code happens to do
39
+ - **0-2:** Untested edits straight into tangled code, refactoring and behavior change mixed in one commit, rewrite proposed instead of tests
40
+
41
+ ## Framework
42
+
43
+ ### 1. The Legacy Code Dilemma and Change Algorithm
44
+
45
+ **Core concept:** The dilemma: to change code safely we need tests, but to get tests in place we have to change code. The way out is a fixed sequence — identify change points, find test points, break dependencies, write tests, then make changes and refactor — where the pre-test edits are conservative and mechanical, and the real change happens only inside the safety net.
46
+
47
+ **Why it works:** Edit-and-pray substitutes care for feedback, and care doesn't scale to code you don't fully understand. Cover-and-modify clamps existing behavior in a vise of tests, so any unintended change announces itself immediately on your machine instead of later in production.
48
+
49
+ **Key insights:**
50
+ - There are two reasons to change code — changing behavior (feature, bug fix) and improving structure (refactoring) — and mixing them in one step makes failures undiagnosable
51
+ - Test points are rarely the change points: effects propagate, so you often test where the change's effects surface, not where the edit happens
52
+ - Dependency-breaking edits made before tests exist must preserve signatures exactly and lean on the compiler to find every affected site
53
+ - Coverage grows along the paths you actually change — that beats any dedicated "testing project" that never gets funded
54
+ - "Programming is the art of doing one thing at a time": each step of the algorithm is separately verifiable
55
+
56
+ **Applications:**
57
+
58
+ | Context | Application | Example |
59
+ |---------|-------------|---------|
60
+ | Bug fix in an untested module | Run the five steps before touching the bug | Pin `parseInvoice()` with tests, then fix the rounding error |
61
+ | PR mixing cleanup and a feature | Split into structure-only and behavior-only commits | Extract and rename first, tests green, then add the discount rule |
62
+ | "It's just a one-line change" | Find the nearest test point first | One pin test at the public method that calls the private one you edit |
63
+
64
+ See [references/change-algorithm.md](references/change-algorithm.md) when running the five steps on a real change — the algorithm as a working procedure with change-point/test-point checklists and triage for "no time" situations.
65
+
66
+ ### 2. Seams: Where to Pry Code Apart
67
+
68
+ **Core concept:** A seam is a place where you can alter behavior in your program without editing in that place. Every seam has an enabling point — where you decide which behavior runs. Getting legacy code under test is largely a hunt for seams: spots where a test can substitute a slow, global, or external dependency while the production source stays untouched.
69
+
70
+ **Why it works:** If you must edit code to test it, you risk changing the very behavior you are trying to pin down. Seams move the substitution to a distance — a subclass, an import, a build flag — so the code under test runs exactly as in production while the test controls its dependencies from the enabling point.
71
+
72
+ **Key insights:**
73
+ - Object seams are the default in OO code: every overridable call is a seam, and its enabling point is wherever the object is created or passed in
74
+ - Link and import seams swap implementations at build or load time — `jest.mock` and `unittest.mock.patch` are link seams in modern clothing
75
+ - Preprocessing seams (C/C++ macros) are the bluntest instrument; reach for them last
76
+ - `new Database()` inside a method body is a seam that never got built — constructors doing real work, globals, statics, and hard-wired I/O are where seams die
77
+ - A seam without a reachable enabling point is useless: if the test can't make the decision, keep hunting
78
+ - Dynamic languages make nearly every name lookup a seam — cheap, but patching internals couples tests to file layout
79
+
80
+ **Applications:**
81
+
82
+ | Context | Application | Example |
83
+ |---------|-------------|---------|
84
+ | Class constructs its own DB client | Object seam via constructor parameter | `constructor(db: Db = new ProdDb())` — tests pass a fake |
85
+ | Module calls a top-level `send_email()` | Import/link seam | `mocker.patch("billing.send_email")` or `jest.mock("./mailer")` |
86
+ | Logic reads the wall clock directly | Seam at the clock | Inject a `now()` provider; tests freeze time |
87
+
88
+ See [references/seams.md](references/seams.md) when hunting a seam in a specific stack — the seam catalog with code, enabling points, and seams in modern tooling (DI containers, jest.mock, pytest monkeypatch, clock and config seams).
89
+
90
+ ### 3. Characterization Tests
91
+
92
+ **Core concept:** A characterization test documents what the code actually does right now — not what the spec, the comments, or anyone's memory says it should do. Write a probe you know will fail, let the failure message reveal the real behavior, then change the assertion to pin that behavior in place.
93
+
94
+ **Why it works:** In legacy systems the actual behavior is the de facto spec: callers, reports, and customers may depend on it, quirks included. Tests written from imagined requirements fail for reasons that tell you nothing, while characterization tests fail during refactoring precisely when — and where — you changed existing behavior.
95
+
96
+ **Key insights:**
97
+ - The recipe: call the code in a harness, assert something absurd (`expect(total).toBe(-1)`), read the failure, pin the observed value
98
+ - Sensing and separation are the two reasons to break dependencies: separation gets code into a harness, sensing lets assertions see what it computed
99
+ - For complex output (reports, generated files, large JSON) use a golden master: capture the full output once, diff against it forever
100
+ - Snapshot tests are golden masters — review the first snapshot like code and normalize volatile data, or you are pinning noise
101
+ - Found a bug while characterizing? Pin it with a comment and a ticket — downstream code may depend on the wrong behavior; fix it later as a deliberate, separate change
102
+ - Characterize the branches your change will touch, not the whole system — coverage follows change
103
+
104
+ **Applications:**
105
+
106
+ | Context | Application | Example |
107
+ |---------|-------------|---------|
108
+ | Refactoring a tax calculator | Pin outputs for representative inputs | Run 20 cases through, assert each recorded result |
109
+ | Legacy report generator | Golden master diff | Generate the report, compare to a checked-in master file |
110
+ | Off-by-one found while pinning | Pin the wrong value, document it | `assert days == 30 # BUG? expected 31 — TICKET-482` |
111
+
112
+ See [references/characterization-tests.md](references/characterization-tests.md) when writing your first probe through to a pinned suite — golden masters, snapshot tests done right, and a worked before/after refactor.
113
+
114
+ ### 4. Sprout and Wrap: Changing Without Tests First
115
+
116
+ **Core concept:** When you genuinely cannot get the area under test today, don't weave new logic into the untested mass. Sprout Method or Sprout Class: write the new behavior as fresh, fully tested code and call it from a single line in the legacy spot. Wrap Method or Wrap Class: rename the old code aside and add behavior before or after the call to it, decorator-style.
117
+
118
+ **Why it works:** New code in a fresh method or class can be test-driven even when its host can't be instantiated in a harness — testability no longer waits on getting the host into a harness. The untested host changes by exactly one call site, so the unverified blast radius is a single line instead of the whole method.
119
+
120
+ **Key insights:**
121
+ - Sprout Method when new logic plugs in at one point; Sprout Class when the host class won't even instantiate in a test harness
122
+ - Wrap Method suits behavior that surrounds the old code (logging, notification, metering) rather than mixes with it: rename `pay()` to `rawPay()`, recreate `pay()` as the wrapper
123
+ - Wrap Class is the Decorator pattern — use it when several call sites need the added behavior or the class is already bloated
124
+ - Be honest about the trade-off: the host stays untested; you have added good code to a bad neighborhood
125
+ - Track sprouts as debt and pay them back — cover the host the next time a change lands there
126
+ - Sprouting is a tactical move inside the change algorithm, not a permanent substitute for getting code under test
127
+
128
+ **Applications:**
129
+
130
+ | Context | Application | Example |
131
+ |---------|-------------|---------|
132
+ | Late-fee rule in a 400-line `process()` | Sprout Method, one call line | `total += lateFee(order)` — `lateFee()` written test-first |
133
+ | Audit logging around legacy `pay()` | Wrap Method | New `pay()` logs, calls `rawPay()`, logs again |
134
+ | New validation, class won't instantiate | Sprout Class | `new OrderValidator().validate(data)` called from legacy code |
135
+
136
+ ### 5. Dependency-Breaking Techniques
137
+
138
+ **Core concept:** A catalog of mechanical, low-risk moves that sever whatever blocks instantiation or sensing: Extract Interface, Parameterize Constructor, Parameterize Method, Extract and Override Factory Method or Getter, Introduce Instance Delegator, Adapt Parameter, Break Out Method Object, Subclass and Override Method. Because they run before tests exist, always pick the least invasive technique that unblocks you.
139
+
140
+ **Why it works:** Code resists testing for a small set of recurring reasons — constructors doing real work, statics and singletons, parameters you can't construct, monster methods. Each blocker has a named, practiced counter-move, so you execute a known maneuver instead of improvising surgery on code that has no safety net.
141
+
142
+ **Key insights:**
143
+ - Parameterize Constructor with a production default is the workhorse: existing callers compile untouched while tests inject fakes
144
+ - Extract Interface is the safest move in the book — introducing an interface can't change behavior, only loosen a type
145
+ - Subclass and Override Method underlies half the catalog: a testing subclass that stubs the dangerous parts is a legitimate tool, not a hack
146
+ - For statics and singletons, Introduce Instance Delegator hands callers an instance they can swap; a static setter can supersede a singleton in tests
147
+ - Adapt Parameter beats fighting unfakeable framework types — wrap `HttpServletRequest` in your own narrow interface and test against that
148
+ - Dynamic languages have cheaper seams: `unittest.mock.patch` or `jest.mock` can stand in for several techniques, but parameterizing leaves better design behind
149
+
150
+ **Applications:**
151
+
152
+ | Context | Application | Example |
153
+ |---------|-------------|---------|
154
+ | Constructor opens a DB connection | Parameterize Constructor | `def __init__(self, conn=None): self.conn = conn or connect()` |
155
+ | Static `Billing.charge()` called everywhere | Introduce Instance Delegator | Instance `charge()` delegates to the static; tests override it |
156
+ | 900-line method hoarding locals | Break Out Method Object | `new RateCalculation(order, rates).run()` — locals become fields |
157
+
158
+ See [references/dependency-breaking.md](references/dependency-breaking.md) when a specific blocker stops instantiation or sensing — before/after code for each technique plus a decision table mapping blockers to the right move.
159
+
160
+ ### 6. Untangling and Understanding
161
+
162
+ **Core concept:** Before changing code you don't understand, invest in cheap comprehension: effect sketches trace what a change can affect, feature sketches show how methods and fields cluster inside a god class, scratch refactoring means refactoring recklessly to learn and then throwing the edits away, and telling the story of the system forces a simplifying summary. The payoff is finding pinch points — narrow places where a few tests cover wide behavior.
163
+
164
+ **Why it works:** In legacy code the bottleneck is comprehension, not typing. An effect sketch turns "what could this break?" from anxiety into a finite list, and a pinch point lets a handful of tests act as a vise over an entire cluster of methods — often revealing where a hidden class boundary wants to be drawn.
165
+
166
+ **Key insights:**
167
+ - Effect sketch: a bubble per variable or method, an arrow per "affects" — trace forward from your change point to every place behavior can leak out
168
+ - A pinch point is a narrowing in the effect sketch; test there and everything upstream of it is covered
169
+ - Scratch refactoring is refactoring as a reading technique: extract, rename, and simplify for an hour, then revert — the insight survives the checkout
170
+ - Monster method strategy: golden-master it at a pinch point, Break Out Method Object, then refactor inside the new class
171
+ - God class strategy: feature-sketch the clusters, then extract along the natural boundaries between them
172
+ - Triage when there's no time: a spot changing once gets a sprout or wrap; the same spot changing again has earned its tests
173
+
174
+ **Applications:**
175
+
176
+ | Context | Application | Example |
177
+ |---------|-------------|---------|
178
+ | "What breaks if I change this field?" | Effect sketch from the field outward | Three readers found; two pinch-point tests cover them |
179
+ | Feature due in a 5,000-line class | Pinch-point tests, then sprout | Cover `postInvoice()`, sprout the new rule as a class |
180
+ | Code nobody on the team understands | Scratch refactor on a branch | Extract and rename to learn, revert, plan the real moves |
181
+
182
+ See [references/case-studies.md](references/case-studies.md) when you want a full worked walkthrough — three scenarios: a feature in an untested 800-line service, a singleton-ridden module brought under test, and a monster method tamed before a bug fix.
183
+
184
+ ## Common Mistakes
185
+
186
+ | Mistake | Why It Fails | Fix |
187
+ |---------|-------------|-----|
188
+ | Refactoring and changing behavior in one step | When something breaks, you can't tell which edit did it | Separate commits; tests green between each step |
189
+ | Writing "should" tests on legacy code | Imagined specs fail noisily and you "fix" load-bearing behavior | Characterize what the code does; file bugs separately |
190
+ | Mocking everything in sight | Tests pin the implementation, so every refactor breaks them | Fake only what blocks instantiation or sensing |
191
+ | Big-bang rewrite instead of incremental coverage | The old system keeps moving; rewrites ship late and miss years of edge cases | Cover and modify piece by piece |
192
+ | Silently fixing bugs found while characterizing | Callers and reports may depend on the wrong behavior | Pin it, document it, fix it as a separate deliberate change |
193
+ | Invasive cleanup before any tests exist | Every manual edit risks behavior with no net underneath | Least invasive technique; preserve signatures; lean on the compiler |
194
+ | Sprouting forever without payback | The host stays untested and sprouts ossify into the next legacy layer | Track sprout debt; cover hot spots on the next touch |
195
+ | Waiting for a dedicated "testing project" | That project never gets funded; coverage never appears | Grow coverage along every change you ship |
196
+
197
+ ## Quick Diagnostic
198
+
199
+ | Question | If No | Action |
200
+ |----------|-------|--------|
201
+ | Do tests cover the code you're about to change? | You're editing and praying | Run the change algorithm; pin behavior before editing |
202
+ | Can you construct the class in a test harness? | Dependencies block separation | Parameterize Constructor, Extract Interface, or Sprout Class |
203
+ | Can a test sense the effect of your change? | Effects are invisible to assertions | Find a sensing point; Extract and Override Getter |
204
+ | Is this commit behavior-only or structure-only? | Mixed | Split it; run the tests between the two |
205
+ | Do you know everything this change can affect? | Unknown blast radius | Draw an effect sketch; test at the pinch points |
206
+ | Do your assertions state observed behavior? | Testing wishes | Probe, read the failure, pin the actual value |
207
+ | Is the seam you chose the cheapest one available? | Needless surgery | Prefer constructor parameters and import seams first |
208
+ | Will the code be better covered after this change? | The next change costs as much as this one | Leave at least one pin test at the nearest test point |
209
+
210
+ ## Further Reading
211
+
212
+ - [*"Working Effectively with Legacy Code"*](https://www.amazon.com/Working-Effectively-Legacy-Michael-Feathers/dp/0131177052?tag=wondelai00-20) by Michael C. Feathers
213
+ - [*"Refactoring: Improving the Design of Existing Code"*](https://www.amazon.com/Refactoring-Improving-Existing-Addison-Wesley-Signature/dp/0134757599?tag=wondelai00-20) by Martin Fowler
214
+ - [*"Tidy First?: A Personal Exercise in Empirical Software Design"*](https://www.amazon.com/Tidy-First-Personal-Exercise-Empirical/dp/1098151240?tag=wondelai00-20) by Kent Beck
215
+ - [*"Kill It with Fire: Manage Aging Computer Systems (and Future Proof Modern Ones)"*](https://www.amazon.com/Kill-Fire-Manage-Computer-Systems/dp/1718501188?tag=wondelai00-20) by Marianne Bellotti
216
+
217
+ ## About the Author
218
+
219
+ **Michael C. Feathers** is the founder of R7K Research & Conveyance, a consultancy focused on software design and the rehabilitation of aging systems. A long-time consultant and conference speaker on legacy code, he wrote *Working Effectively with Legacy Code* (2004) and gave the field its working definition: legacy code is simply code without tests.
@@ -0,0 +1,238 @@
1
+ # Case Studies: Legacy Code Techniques in Practice
2
+
3
+ ## Table of Contents
4
+
5
+ - [Case Study 1: Adding a Feature to an Untested 800-Line Service Class](#case-study-1-adding-a-feature-to-an-untested-800-line-service-class)
6
+ - [Case Study 2: Getting a Singleton-Ridden Module Under Test](#case-study-2-getting-a-singleton-ridden-module-under-test)
7
+ - [Case Study 3: Taming a Monster Method Before a Bug Fix](#case-study-3-taming-a-monster-method-before-a-bug-fix)
8
+ - [Key Takeaways](#key-takeaways)
9
+
10
+ ## Case Study 1: Adding a Feature to an Untested 800-Line Service Class
11
+
12
+ ### Context
13
+
14
+ A six-year-old e-commerce backend in TypeScript. `OrderService` is 800 lines and handles order creation, payment capture, stock reservation, confirmation emails, and refunds. It has zero tests. The new requirement: a loyalty points program — one point per 10 EUR on paid orders, points redeemable as a discount at checkout.
15
+
16
+ The team's previous attempt to "just add" a small feature to this class caused a refund regression that took down order processing for an afternoon. Since then, nobody volunteers to touch the file.
17
+
18
+ ### The Problems
19
+
20
+ - The constructor connects to Postgres and Redis and instantiates a `StripeClient` — `new OrderService()` in a test harness opens real connections or crashes
21
+ - `placeOrder()` is 190 lines and is the change point; its effects scatter across DB writes, a stock decrement, an email, and the returned `OrderResult`
22
+ - Emails go through `Mailer.getInstance()`, a singleton that talks to SMTP from anywhere
23
+
24
+ ### Step by Step
25
+
26
+ **1. Identify change points.** Points are awarded when an order transitions to `paid` — inside `placeOrder()`, after payment capture. Redemption applies in `applyDiscounts()`. Two change points, both inside the scary file.
27
+
28
+ **2. Find test points.** `placeOrder()` returns an `OrderResult` and calls the gateway and repositories — sensing is possible if those collaborators can be substituted. It is also a pinch point: payment, stock, and email logic all funnel through it, so tests here cover wide behavior cheaply.
29
+
30
+ **3. Break dependencies — three commits, each provably behavior-free.**
31
+
32
+ Commit 1, Parameterize Constructor with production defaults so no caller changes:
33
+
34
+ ```typescript
35
+ constructor(
36
+ private db: OrderRepo = new PgOrderRepo(pool),
37
+ private stock: StockRepo = new RedisStockRepo(redis),
38
+ private gateway: PaymentGateway = new StripeClient(env.STRIPE_KEY),
39
+ private mailer: ReceiptSender = Mailer.getInstance(),
40
+ ) {}
41
+ ```
42
+
43
+ Commit 2, Extract Interface on the gateway — `PaymentGateway` declares the three methods `OrderService` actually calls, not Stripe's full surface.
44
+
45
+ Commit 3, replace direct `Mailer.getInstance()` calls inside methods with the injected `this.mailer`. A grep confirms every send site routes through the field.
46
+
47
+ **4. Write characterization tests.** Nine pin tests against `placeOrder()`: happy path, declined card, out-of-stock, coupon applied, free order, three quantity boundaries, malformed address. One genuine surprise: on a declined card, stock is decremented and *never restored*. The team pins it as-is with a `BUG?` comment and files a ticket — fixing it now would be an unreviewed behavior change hiding inside the safety-net step.
48
+
49
+ **5. Make the change.** The loyalty logic is not woven into `placeOrder()`'s 190 lines. It is a Sprout Class — `LoyaltyLedger`, written test-first in isolation with seven specification tests — and the legacy file gains exactly two lines:
50
+
51
+ ```typescript
52
+ // in placeOrder(), after capture succeeds:
53
+ await this.loyalty.award(order.customerId, pointsFor(order.totalCents));
54
+
55
+ // in applyDiscounts():
56
+ discount += await this.loyalty.redeem(order.customerId, requestedPoints);
57
+ ```
58
+
59
+ ### Outcome
60
+
61
+ | Measure | Before | After |
62
+ |---------|--------|-------|
63
+ | Tests touching `OrderService` paths | 0 | 16 (9 pins + 7 loyalty specs) |
64
+ | Time spent | — | 2.5 days (vs. 1 day estimated for "just add it") |
65
+ | Regressions shipped | the historical norm | 0 |
66
+ | Known stock bug | invisible | pinned, ticketed, fixed deliberately the next sprint |
67
+ | Next feature in the same area | feared | shipped in half a day on top of the pins |
68
+
69
+ ### Lessons Learned
70
+
71
+ 1. **The fear was a dependency problem, not a complexity problem.** Three mechanical commits made an "untouchable" class testable; the 800 lines were never the real obstacle.
72
+ 2. **The sprout kept the new logic clean.** `LoyaltyLedger` was born fully tested and never inherited the host's mess; the host gained call lines, not branches.
73
+ 3. **The pinned bug paid for the whole exercise.** Edit-and-pray would have either shipped past the stock bug again or "fixed" it silently and broken the warehouse reconciliation that had quietly compensated for it.
74
+
75
+ ## Case Study 2: Getting a Singleton-Ridden Module Under Test
76
+
77
+ ### Context
78
+
79
+ A Python/Flask pricing service, eight years old. `pricing.py` computes quotes and is due for a VAT rule change with a legal deadline. Functions reach for `Config.instance()` and `FeatureFlags.instance()` at call time, and the module constructs its database client at import time:
80
+
81
+ ```python
82
+ # pricing.py (top of file)
83
+ db = Database(Config.instance().dsn) # runs on import
84
+
85
+ def quote_price(items, country):
86
+ cfg = Config.instance()
87
+ flags = FeatureFlags.instance()
88
+ rate = db.vat_rate(country)
89
+ ...
90
+ ```
91
+
92
+ Importing `pricing` in a test process connects to the production replica. There are no tests, and the team has been verifying pricing changes by deploying to staging and eyeballing quotes.
93
+
94
+ ### The Problems
95
+
96
+ - Import-time side effects: the module cannot even be loaded in a harness safely
97
+ - Singletons are read deep inside functions — no parameters to substitute, no visible seams
98
+ - Quote logic branches on feature flags, dates, and country tables, so manual verification misses combinations
99
+
100
+ ### Step by Step
101
+
102
+ **1. Kill the import-time work first.** Wrap the module-level client in a lazy accessor — a mechanical, signature-shaped change:
103
+
104
+ ```python
105
+ _db = None
106
+
107
+ def get_db():
108
+ global _db
109
+ if _db is None:
110
+ _db = Database(Config.instance().dsn)
111
+ return _db
112
+ ```
113
+
114
+ Every `db.` becomes `get_db().` — a find-and-replace verified by grep, committed as "no behavior change." The module now imports cleanly; nothing connects until first use.
115
+
116
+ **2. Introduce Static Setter on the singletons** for test control, with hygiene built in:
117
+
118
+ ```python
119
+ class Config:
120
+ _instance = None
121
+
122
+ @classmethod
123
+ def instance(cls):
124
+ if cls._instance is None:
125
+ cls._instance = cls._load()
126
+ return cls._instance
127
+
128
+ @classmethod
129
+ def set_instance(cls, fake):
130
+ cls._instance = fake
131
+ ```
132
+
133
+ ```python
134
+ # conftest.py
135
+ @pytest.fixture(autouse=True)
136
+ def reset_singletons():
137
+ yield
138
+ Config.set_instance(None)
139
+ FeatureFlags.set_instance(None)
140
+ ```
141
+
142
+ The autouse reset matters as much as the setter: without it, one test's fake config bleeds into the next, and test order starts to matter.
143
+
144
+ **3. Parameterize the function under change.** The VAT work lands in `quote_price`, so that function gets real seams while the rest of the module keeps its singletons for now:
145
+
146
+ ```python
147
+ def quote_price(items, country, *, config=None, flags=None, db=None):
148
+ config = config or Config.instance()
149
+ flags = flags or FeatureFlags.instance()
150
+ db = db or get_db()
151
+ ...
152
+ ```
153
+
154
+ Production callers are untouched; tests pass plain fakes with no patching.
155
+
156
+ **4. Characterize.** Fourteen pin tests across countries, flag combinations, and date boundaries, with `freezegun` freezing the clock for date-dependent rates. One surprise pinned: an obsolete flag still silently zeroes VAT for one legacy country path — ticketed, not fixed.
157
+
158
+ **5. Make the VAT change** as a behavior-only commit: two new assertions flipped from observed-old to specified-new values, implementation follows, everything else stays green.
159
+
160
+ ### Outcome
161
+
162
+ | Measure | Before | After |
163
+ |---------|--------|-------|
164
+ | Tests on `pricing.py` | 0 | 14 pins + 5 VAT specs |
165
+ | Importing the module in tests | connects to prod replica | side-effect free |
166
+ | `mock.patch` lines per test | n/a (no tests) | 0 — fakes passed as parameters |
167
+ | VAT change verification | deploy to staging and eyeball | red-green on the pinned suite |
168
+ | Regression from the VAT change | historically likely | none |
169
+
170
+ ### Lessons Learned
171
+
172
+ 1. **In Python legacy, import-time side effects are the first enemy.** Nothing else is fixable until the module loads cleanly; the lazy accessor is a five-minute cure.
173
+ 2. **The static setter is scaffolding, not the destination.** It bought testability in an hour; the parameterized `quote_price` is the pattern the module migrates toward function by function.
174
+ 3. **Autouse resets make global-state seams survivable.** The fixture cost two lines and prevented the flaky, order-dependent suite that usually follows singleton setters.
175
+
176
+ ## Case Study 3: Taming a Monster Method Before a Bug Fix
177
+
178
+ ### Context
179
+
180
+ A Java billing system generates customer statements. `generateStatement()` is roughly 700 lines: balance forward, payments, late-payment interest, taxes, formatting — about forty local variables, nesting nine levels deep. A confirmed bug: when a partial payment lands inside the grace period, late interest is applied twice. Finance wants the fix this week. The fix "looks like one line," but everyone who has touched this method has broken a different statement scenario.
181
+
182
+ ### Step by Step
183
+
184
+ **1. Find the test point — the method's return value is a gift.** `generateStatement()` returns the full statement as a `String`: ideal golden-master material. The team builds twelve input fixtures from anonymized production accounts covering the payment patterns that matter (on-time, late, partial-in-grace, multiple partials, zero balance, credit balance), captures the outputs, reviews them line by line, and checks them in as masters. Dates and statement IDs are normalized before comparison.
185
+
186
+ **2. Break Out Method Object.** Extracting pieces directly from the method is hopeless — every fragment touches a dozen locals. Instead, the whole body moves verbatim into a new class where locals become fields:
187
+
188
+ ```java
189
+ class StatementRun {
190
+ private final Account account;
191
+ private final LocalDate asOf;
192
+ private BigDecimal balance; // was a local
193
+ private BigDecimal interest; // was a local
194
+ // ... the other forty, now fields
195
+
196
+ StatementRun(Account account, LocalDate asOf) { ... }
197
+
198
+ String run() {
199
+ // 700 lines moved verbatim
200
+ }
201
+ }
202
+
203
+ String generateStatement(Account account, LocalDate asOf) {
204
+ return new StatementRun(account, asOf).run();
205
+ }
206
+ ```
207
+
208
+ Masters rerun: all green. The move was pure structure.
209
+
210
+ **3. Extract inside the new class, masters after every step.** With locals as fields, extraction is suddenly mechanical: `applyPayments()`, `interestFor(Period p)`, `renderLines()` — signatures copied exactly, one extraction per commit, golden masters green after each. Twenty minutes per move because verification is a test run, not an afternoon of manual statement-reading.
211
+
212
+ **4. Reproduce the bug as a unit test.** `interestFor()` is now directly callable. The failing test takes ten minutes to write and fails for exactly the reported reason: the grace-period branch adds interest that the partial-payment branch has already accrued.
213
+
214
+ **5. Fix the bug as a deliberate behavior change.** The fix is two lines, not one — the same double-application exists in a second branch for multi-payment months, which the unit test's sibling case exposes. Exactly one golden master diffs: the partial-in-grace fixture. The team reviews the diff hunk by hunk with finance, accepts the new master, and commits fix, flipped unit test, and regenerated master together.
215
+
216
+ ### Outcome
217
+
218
+ | Measure | Before | After |
219
+ |---------|--------|-------|
220
+ | Tests on statement generation | 0 | 12 golden masters + 6 unit tests on interest |
221
+ | The "one-line" fix | one line, fingers crossed | two lines, second site caught by tests |
222
+ | Verification of a statement change | manual reading of samples | seconds: rerun the masters |
223
+ | `generateStatement()` | 700-line monolith | thin delegate over a structured `StatementRun` |
224
+ | Time spent | — | 1.5 days, deadline met |
225
+
226
+ ### Lessons Learned
227
+
228
+ 1. **Golden masters made a 700-line method testable in hours, without understanding all of it.** Comprehension followed coverage, not the other way around.
229
+ 2. **Break Out Method Object created the room to work.** The monster wasn't forty unrelated locals; it was three clusters, visible the moment they became fields.
230
+ 3. **The fix everyone called "one line" was two.** The second site is precisely the kind of thing edit-and-pray misses and a pinned suite catches by construction.
231
+
232
+ ## Key Takeaways
233
+
234
+ 1. **Fear is a dependency problem.** In all three cases the team was afraid of files, but the actual obstacles were constructors, singletons, and missing seams — each removable with a named, mechanical technique.
235
+ 2. **Pin before you change, even when the pin records a bug.** Two of the three teams found real bugs while characterizing; both pinned first and fixed deliberately later, preserving behaviors other systems had silently grown to depend on.
236
+ 3. **New logic goes in new, tested code.** Sprouted classes and extracted methods were born clean; the legacy hosts gained call lines, not branches.
237
+ 4. **Scaffolding and destination are different things.** Testing subclasses, static setters, and golden masters bought tests *today*; parameterized constructors and adapted parameters are the design the code migrates toward.
238
+ 5. **Coverage arrives with change, not with permission.** None of these teams got a "testing sprint." They bought their safety nets inside ordinary feature and bug-fix work — which is the only budget that reliably exists.