self-evolve-framework 1.0.8 → 1.1.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 (122) hide show
  1. package/bin/cli.js +66 -24
  2. package/package.json +1 -1
  3. package/template/rules/CodeGraph.mdc +23 -0
  4. package/template/rules/Svelte_5.mdc +167 -0
  5. package/template/rules/Svelte_Flow.mdc +176 -0
  6. package/template/rules/Tailwind_CSS_v4.mdc +187 -0
  7. package/template/rules/Tauri.mdc +145 -0
  8. package/template/rules/app-error-pattern.mdc +65 -0
  9. package/template/rules/invoke-safe-pattern.mdc +53 -0
  10. package/template/rules/js.mdc +10 -0
  11. package/template/rules/powershell.mdc +9 -0
  12. package/template/rules//346/227/245/345/277/227.mdc +15 -0
  13. package/template/rules//350/257/267/346/261/202.mdc +49 -0
  14. package/template/skills/caveman/SKILL.md +49 -0
  15. package/template/skills/check/SKILL.md +393 -0
  16. package/template/skills/check/agents/reviewer-architecture.md +39 -0
  17. package/template/skills/check/agents/reviewer-security.md +39 -0
  18. package/template/skills/check/references/persona-catalog.md +56 -0
  19. package/template/skills/check/references/project-context.md +120 -0
  20. package/template/skills/check/references/public-reply.md +14 -0
  21. package/template/skills/check/scripts/audit_signals.py +666 -0
  22. package/template/skills/check/scripts/run-tests.sh +19 -0
  23. package/template/skills/design/SKILL.md +173 -0
  24. package/template/skills/design/references/design-aesthetic-quality.md +67 -0
  25. package/template/skills/design/references/design-data-viz.md +34 -0
  26. package/template/skills/design/references/design-reference.md +295 -0
  27. package/template/skills/design/references/design-tokens.md +45 -0
  28. package/template/skills/design/references/design-traps.md +43 -0
  29. package/template/skills/design-an-interface/SKILL.md +94 -0
  30. package/template/skills/diagnose/SKILL.md +117 -0
  31. package/template/skills/diagnose/scripts/hitl-loop.template.sh +41 -0
  32. package/template/skills/edit-article/SKILL.md +14 -0
  33. package/template/skills/git-guardrails-claude-code/SKILL.md +95 -0
  34. package/template/skills/git-guardrails-claude-code/scripts/block-dangerous-git.sh +25 -0
  35. package/template/skills/grill-me/SKILL.md +10 -0
  36. package/template/skills/grill-with-docs/ADR-FORMAT.md +47 -0
  37. package/template/skills/grill-with-docs/CONTEXT-FORMAT.md +60 -0
  38. package/template/skills/grill-with-docs/SKILL.md +88 -0
  39. package/template/skills/handoff/SKILL.md +15 -0
  40. package/template/skills/health/SKILL.md +260 -0
  41. package/template/skills/health/agents/inspector-context.md +119 -0
  42. package/template/skills/health/agents/inspector-control.md +84 -0
  43. package/template/skills/health/agents/inspector-maintainability.md +55 -0
  44. package/template/skills/health/scripts/check-agent-context.sh +5 -0
  45. package/template/skills/health/scripts/check-doc-refs.sh +8 -0
  46. package/template/skills/health/scripts/check-maintainability.sh +8 -0
  47. package/template/skills/health/scripts/check-verifier-output.sh +5 -0
  48. package/template/skills/health/scripts/check_agent_context.py +444 -0
  49. package/template/skills/health/scripts/check_doc_refs.py +110 -0
  50. package/template/skills/health/scripts/check_maintainability.py +635 -0
  51. package/template/skills/health/scripts/check_verifier_output.py +116 -0
  52. package/template/skills/health/scripts/collect-data.sh +751 -0
  53. package/template/skills/hunt/SKILL.md +232 -0
  54. package/template/skills/hunt/references/failure-patterns.md +138 -0
  55. package/template/skills/hunt/references/ime-unicode.md +58 -0
  56. package/template/skills/hunt/references/logging-techniques.md +72 -0
  57. package/template/skills/hunt/references/rendering-debug.md +34 -0
  58. package/template/skills/improve-codebase-architecture/DEEPENING.md +37 -0
  59. package/template/skills/improve-codebase-architecture/HTML-REPORT.md +123 -0
  60. package/template/skills/improve-codebase-architecture/INTERFACE-DESIGN.md +44 -0
  61. package/template/skills/improve-codebase-architecture/LANGUAGE.md +53 -0
  62. package/template/skills/improve-codebase-architecture/SKILL.md +81 -0
  63. package/template/skills/learn/SKILL.md +140 -0
  64. package/template/skills/migrate-to-shoehorn/SKILL.md +118 -0
  65. package/template/skills/obsidian-vault/SKILL.md +59 -0
  66. package/template/skills/prototype/LOGIC.md +79 -0
  67. package/template/skills/prototype/SKILL.md +30 -0
  68. package/template/skills/prototype/UI.md +112 -0
  69. package/template/skills/qa/SKILL.md +130 -0
  70. package/template/skills/read/SKILL.md +141 -0
  71. package/template/skills/read/references/read-methods.md +129 -0
  72. package/template/skills/read/scripts/fetch.sh +106 -0
  73. package/template/skills/read/scripts/fetch_feishu.py +251 -0
  74. package/template/skills/read/scripts/fetch_local.py +218 -0
  75. package/template/skills/read/scripts/fetch_weixin.py +107 -0
  76. package/template/skills/request-refactor-plan/SKILL.md +68 -0
  77. package/template/skills/review/SKILL.md +78 -0
  78. package/template/skills/rust-auto-fix/SKILL.md +94 -0
  79. package/template/skills/scaffold-exercises/SKILL.md +106 -0
  80. package/template/skills/sdd-dev/SKILL.md +114 -0
  81. package/template/skills/setup-matt-pocock-skills/SKILL.md +121 -0
  82. package/template/skills/setup-matt-pocock-skills/domain.md +51 -0
  83. package/template/skills/setup-matt-pocock-skills/issue-tracker-github.md +22 -0
  84. package/template/skills/setup-matt-pocock-skills/issue-tracker-gitlab.md +23 -0
  85. package/template/skills/setup-matt-pocock-skills/issue-tracker-local.md +19 -0
  86. package/template/skills/setup-matt-pocock-skills/triage-labels.md +15 -0
  87. package/template/skills/setup-pre-commit/SKILL.md +91 -0
  88. package/template/skills/svelte-warnings-fix/SKILL.md +94 -0
  89. package/template/skills/tauri-nsis-installer-icon/SKILL.md +92 -0
  90. package/template/skills/tauri-nsis-installer-icon/references/tauri-nsis-schema.md +71 -0
  91. package/template/skills/tb/SKILL.md +62 -0
  92. package/template/skills/tdd/SKILL.md +109 -0
  93. package/template/skills/tdd/deep-modules.md +33 -0
  94. package/template/skills/tdd/interface-design.md +31 -0
  95. package/template/skills/tdd/mocking.md +59 -0
  96. package/template/skills/tdd/refactoring.md +10 -0
  97. package/template/skills/tdd/tests.md +61 -0
  98. package/template/skills/teach/GLOSSARY-FORMAT.md +35 -0
  99. package/template/skills/teach/LEARNING-RECORD-FORMAT.md +46 -0
  100. package/template/skills/teach/MISSION-FORMAT.md +31 -0
  101. package/template/skills/teach/RESOURCES-FORMAT.md +32 -0
  102. package/template/skills/teach/SKILL.md +91 -0
  103. package/template/skills/think/SKILL.md +184 -0
  104. package/template/skills/to-issues/SKILL.md +83 -0
  105. package/template/skills/to-prd/SKILL.md +74 -0
  106. package/template/skills/triage/AGENT-BRIEF.md +168 -0
  107. package/template/skills/triage/OUT-OF-SCOPE.md +101 -0
  108. package/template/skills/triage/SKILL.md +103 -0
  109. package/template/skills/ubiquitous-language/SKILL.md +93 -0
  110. package/template/skills/ver/SKILL.md +62 -0
  111. package/template/skills/write/SKILL.md +209 -0
  112. package/template/skills/write/references/write-en.md +199 -0
  113. package/template/skills/write/references/write-product-localization.md +43 -0
  114. package/template/skills/write/references/write-zh-bilingual.md +59 -0
  115. package/template/skills/write/references/write-zh-prose.md +50 -0
  116. package/template/skills/write/references/write-zh-release-notes.md +40 -0
  117. package/template/skills/write/references/write-zh.md +721 -0
  118. package/template/skills/write-a-skill/SKILL.md +117 -0
  119. package/template/skills/writing-beats/SKILL.md +52 -0
  120. package/template/skills/writing-fragments/SKILL.md +75 -0
  121. package/template/skills/writing-shape/SKILL.md +64 -0
  122. package/template/skills/zoom-out/SKILL.md +7 -0
@@ -0,0 +1,123 @@
1
+ # HTML Report Format
2
+
3
+ The architectural review is rendered as a single self-contained HTML file in the OS temp directory. Tailwind and Mermaid both come from CDNs. Mermaid handles graph-shaped diagrams reliably; hand-built divs and inline SVG handle the more editorial visuals (mass diagrams, cross-sections). Mix the two — don't lean on Mermaid for everything, it'll start to look generic.
4
+
5
+ ## Scaffold
6
+
7
+ ```html
8
+ <!doctype html>
9
+ <html lang="en">
10
+ <head>
11
+ <meta charset="utf-8" />
12
+ <title>Architecture review — {{repo name}}</title>
13
+ <script src="https://cdn.tailwindcss.com"></script>
14
+ <script type="module">
15
+ import mermaid from "https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs";
16
+ mermaid.initialize({ startOnLoad: true, theme: "neutral", securityLevel: "loose" });
17
+ </script>
18
+ <style>
19
+ /* small custom layer for things Tailwind doesn't cover cleanly:
20
+ dashed seam lines, hand-drawn-feeling arrow heads, etc. */
21
+ .seam { stroke-dasharray: 4 4; }
22
+ .leak { stroke: #dc2626; }
23
+ .deep { background: linear-gradient(135deg, #0f172a, #1e293b); }
24
+ </style>
25
+ </head>
26
+ <body class="bg-stone-50 text-slate-900 font-sans">
27
+ <main class="max-w-5xl mx-auto px-6 py-12 space-y-12">
28
+ <header>...</header>
29
+ <section id="candidates" class="space-y-10">...</section>
30
+ <section id="top-recommendation">...</section>
31
+ </main>
32
+ </body>
33
+ </html>
34
+ ```
35
+
36
+ ## Header
37
+
38
+ Repo name, date, and a compact legend: solid box = module, dashed line = seam, red arrow = leakage, thick dark box = deep module. No introduction paragraph — straight into the candidates.
39
+
40
+ ## Candidate card
41
+
42
+ The diagrams carry the weight. Prose is sparse, plain, and uses the glossary terms ([LANGUAGE.md](LANGUAGE.md)) without ceremony.
43
+
44
+ Each candidate is one `<article>`:
45
+
46
+ - **Title** — short, names the deepening (e.g. "Collapse the Order intake pipeline").
47
+ - **Badge row** — recommendation strength (`Strong` = emerald, `Worth exploring` = amber, `Speculative` = slate), plus a tag for the dependency category (`in-process`, `local-substitutable`, `ports & adapters`, `mock`).
48
+ - **Files** — monospaced list, `font-mono text-sm`.
49
+ - **Before / After diagram** — the centrepiece. Two columns, side by side. See patterns below.
50
+ - **Problem** — one sentence. What hurts.
51
+ - **Solution** — one sentence. What changes.
52
+ - **Wins** — bullets, ≤6 words each. e.g. "Tests hit one interface", "Pricing logic stops leaking", "Delete 4 shallow wrappers".
53
+ - **ADR callout** (if applicable) — one line in an amber-tinted box.
54
+
55
+ No paragraphs of explanation. If the diagram needs a paragraph to be understood, redraw the diagram.
56
+
57
+ ## Diagram patterns
58
+
59
+ Pick the pattern that fits the candidate. Mix them. Don't make every diagram look the same — variety is part of the point.
60
+
61
+ ### Mermaid graph (the workhorse for dependencies / call flow)
62
+
63
+ Use a Mermaid `flowchart` or `graph` when the point is "X calls Y calls Z, and look at the mess." Wrap it in a Tailwind-styled card so it doesn't feel parachuted in. Style with classDef to colour leakage edges red and the deep module dark. Sequence diagrams work well for "before: 6 round-trips; after: 1."
64
+
65
+ ```html
66
+ <div class="rounded-lg border border-slate-200 bg-white p-4">
67
+ <pre class="mermaid">
68
+ flowchart LR
69
+ A[OrderHandler] --> B[OrderValidator]
70
+ B --> C[OrderRepo]
71
+ C -.leak.-> D[PricingClient]
72
+ classDef leak stroke:#dc2626,stroke-width:2px;
73
+ class C,D leak
74
+ </pre>
75
+ </div>
76
+ ```
77
+
78
+ ### Hand-built boxes-and-arrows (when Mermaid's layout fights you)
79
+
80
+ Modules as `<div>`s with borders and labels. Arrows as inline SVG `<line>` or `<path>` elements positioned absolutely over a relative container. Reach for this when you want the "after" diagram to feel like one thick-bordered deep module with greyed-out internals — Mermaid won't render that with the right weight.
81
+
82
+ ### Cross-section (good for layered shallowness)
83
+
84
+ Stack horizontal bands (`h-12 border-l-4`) to show layers a call passes through. Before: 6 thin layers each doing nothing. After: 1 thick band labelled with the consolidated responsibility.
85
+
86
+ ### Mass diagram (good for "interface as wide as implementation")
87
+
88
+ Two rectangles per module — one for interface surface area, one for implementation. Before: interface rectangle is nearly as tall as the implementation rectangle (shallow). After: interface rectangle is short, implementation rectangle is tall (deep).
89
+
90
+ ### Call-graph collapse
91
+
92
+ Before: a tree of function calls rendered as nested boxes. After: the same tree collapsed into one box, with the now-internal calls shown faded inside it.
93
+
94
+ ## Style guidance
95
+
96
+ - Lean editorial, not corporate-dashboard. Generous whitespace. Serif optional for headings (`font-serif` works well with stone/slate).
97
+ - Colour sparingly: one accent (emerald or indigo) plus red for leakage and amber for warnings.
98
+ - Keep diagrams ~320px tall so before/after sits comfortably side by side without scrolling.
99
+ - Use `text-xs uppercase tracking-wider` for module labels inside diagrams — they should read as schematic, not as UI.
100
+ - The only scripts are the Tailwind CDN and the Mermaid ESM import. The report is otherwise static — no app code, no interactivity beyond Mermaid's own rendering.
101
+
102
+ ## Top recommendation section
103
+
104
+ One larger card. Candidate name, one sentence on why, anchor link to its card. That's it.
105
+
106
+ ## Tone
107
+
108
+ Plain English, concise — but the architectural nouns and verbs come straight from [LANGUAGE.md](LANGUAGE.md). Concision is not an excuse to drift.
109
+
110
+ **Use exactly:** module, interface, implementation, depth, deep, shallow, seam, adapter, leverage, locality.
111
+
112
+ **Never substitute:** component, service, unit (for module) · API, signature (for interface) · boundary (for seam) · layer, wrapper (for module, when you mean module).
113
+
114
+ **Phrasings that fit the style:**
115
+
116
+ - "Order intake module is shallow — interface nearly matches the implementation."
117
+ - "Pricing leaks across the seam."
118
+ - "Deepen: one interface, one place to test."
119
+ - "Two adapters justify the seam: HTTP in prod, in-memory in tests."
120
+
121
+ **Wins bullets** name the gain in glossary terms: *"locality: bugs concentrate in one module"*, *"leverage: one interface, N call sites"*, *"interface shrinks; implementation absorbs the wrappers"*. Don't write *"easier to maintain"* or *"cleaner code"* — those terms aren't in the glossary and don't earn their place.
122
+
123
+ No hedging, no throat-clearing, no "it's worth noting that…". If a sentence could be a bullet, make it a bullet. If a bullet could be cut, cut it. If a term isn't in [LANGUAGE.md](LANGUAGE.md), reach for one that is before inventing a new one.
@@ -0,0 +1,44 @@
1
+ # Interface Design
2
+
3
+ When the user wants to explore alternative interfaces for a chosen deepening candidate, use this parallel sub-agent pattern. Based on "Design It Twice" (Ousterhout) — your first idea is unlikely to be the best.
4
+
5
+ Uses the vocabulary in [LANGUAGE.md](LANGUAGE.md) — **module**, **interface**, **seam**, **adapter**, **leverage**.
6
+
7
+ ## Process
8
+
9
+ ### 1. Frame the problem space
10
+
11
+ Before spawning sub-agents, write a user-facing explanation of the problem space for the chosen candidate:
12
+
13
+ - The constraints any new interface would need to satisfy
14
+ - The dependencies it would rely on, and which category they fall into (see [DEEPENING.md](DEEPENING.md))
15
+ - A rough illustrative code sketch to ground the constraints — not a proposal, just a way to make the constraints concrete
16
+
17
+ Show this to the user, then immediately proceed to Step 2. The user reads and thinks while the sub-agents work in parallel.
18
+
19
+ ### 2. Spawn sub-agents
20
+
21
+ Spawn 3+ sub-agents in parallel using the Agent tool. Each must produce a **radically different** interface for the deepened module.
22
+
23
+ Prompt each sub-agent with a separate technical brief (file paths, coupling details, dependency category from [DEEPENING.md](DEEPENING.md), what sits behind the seam). The brief is independent of the user-facing problem-space explanation in Step 1. Give each agent a different design constraint:
24
+
25
+ - Agent 1: "Minimize the interface — aim for 1–3 entry points max. Maximise leverage per entry point."
26
+ - Agent 2: "Maximise flexibility — support many use cases and extension."
27
+ - Agent 3: "Optimise for the most common caller — make the default case trivial."
28
+ - Agent 4 (if applicable): "Design around ports & adapters for cross-seam dependencies."
29
+
30
+ Include both [LANGUAGE.md](LANGUAGE.md) vocabulary and CONTEXT.md vocabulary in the brief so each sub-agent names things consistently with the architecture language and the project's domain language.
31
+
32
+ Each sub-agent outputs:
33
+
34
+ 1. Interface (types, methods, params — plus invariants, ordering, error modes)
35
+ 2. Usage example showing how callers use it
36
+ 3. What the implementation hides behind the seam
37
+ 4. Dependency strategy and adapters (see [DEEPENING.md](DEEPENING.md))
38
+ 5. Trade-offs — where leverage is high, where it's thin
39
+
40
+ ### 3. Present and compare
41
+
42
+ Present designs sequentially so the user can absorb each one, then compare them in prose. Contrast by **depth** (leverage at the interface), **locality** (where change concentrates), and **seam placement**.
43
+
44
+ After comparing, give your own recommendation: which design you think is strongest and why. If elements from different designs would combine well, propose a hybrid. Be opinionated — the user wants a strong read, not a menu.
@@ -0,0 +1,53 @@
1
+ # Language
2
+
3
+ Shared vocabulary for every suggestion this skill makes. Use these terms exactly — don't substitute "component," "service," "API," or "boundary." Consistent language is the whole point.
4
+
5
+ ## Terms
6
+
7
+ **Module**
8
+ Anything with an interface and an implementation. Deliberately scale-agnostic — applies equally to a function, class, package, or tier-spanning slice.
9
+ _Avoid_: unit, component, service.
10
+
11
+ **Interface**
12
+ Everything a caller must know to use the module correctly. Includes the type signature, but also invariants, ordering constraints, error modes, required configuration, and performance characteristics.
13
+ _Avoid_: API, signature (too narrow — those refer only to the type-level surface).
14
+
15
+ **Implementation**
16
+ What's inside a module — its body of code. Distinct from **Adapter**: a thing can be a small adapter with a large implementation (a Postgres repo) or a large adapter with a small implementation (an in-memory fake). Reach for "adapter" when the seam is the topic; "implementation" otherwise.
17
+
18
+ **Depth**
19
+ Leverage at the interface — the amount of behaviour a caller (or test) can exercise per unit of interface they have to learn. A module is **deep** when a large amount of behaviour sits behind a small interface. A module is **shallow** when the interface is nearly as complex as the implementation.
20
+
21
+ **Seam** _(from Michael Feathers)_
22
+ A place where you can alter behaviour without editing in that place. The *location* at which a module's interface lives. Choosing where to put the seam is its own design decision, distinct from what goes behind it.
23
+ _Avoid_: boundary (overloaded with DDD's bounded context).
24
+
25
+ **Adapter**
26
+ A concrete thing that satisfies an interface at a seam. Describes *role* (what slot it fills), not substance (what's inside).
27
+
28
+ **Leverage**
29
+ What callers get from depth. More capability per unit of interface they have to learn. One implementation pays back across N call sites and M tests.
30
+
31
+ **Locality**
32
+ What maintainers get from depth. Change, bugs, knowledge, and verification concentrate at one place rather than spreading across callers. Fix once, fixed everywhere.
33
+
34
+ ## Principles
35
+
36
+ - **Depth is a property of the interface, not the implementation.** A deep module can be internally composed of small, mockable, swappable parts — they just aren't part of the interface. A module can have **internal seams** (private to its implementation, used by its own tests) as well as the **external seam** at its interface.
37
+ - **The deletion test.** Imagine deleting the module. If complexity vanishes, the module wasn't hiding anything (it was a pass-through). If complexity reappears across N callers, the module was earning its keep.
38
+ - **The interface is the test surface.** Callers and tests cross the same seam. If you want to test *past* the interface, the module is probably the wrong shape.
39
+ - **One adapter means a hypothetical seam. Two adapters means a real one.** Don't introduce a seam unless something actually varies across it.
40
+
41
+ ## Relationships
42
+
43
+ - A **Module** has exactly one **Interface** (the surface it presents to callers and tests).
44
+ - **Depth** is a property of a **Module**, measured against its **Interface**.
45
+ - A **Seam** is where a **Module**'s **Interface** lives.
46
+ - An **Adapter** sits at a **Seam** and satisfies the **Interface**.
47
+ - **Depth** produces **Leverage** for callers and **Locality** for maintainers.
48
+
49
+ ## Rejected framings
50
+
51
+ - **Depth as ratio of implementation-lines to interface-lines** (Ousterhout): rewards padding the implementation. We use depth-as-leverage instead.
52
+ - **"Interface" as the TypeScript `interface` keyword or a class's public methods**: too narrow — interface here includes every fact a caller must know.
53
+ - **"Boundary"**: overloaded with DDD's bounded context. Say **seam** or **interface**.
@@ -0,0 +1,81 @@
1
+ ---
2
+ name: improve-codebase-architecture
3
+ description: Find deepening opportunities in a codebase, informed by the domain language in CONTEXT.md and the decisions in docs/adr/. Use when the user wants to improve architecture, find refactoring opportunities, consolidate tightly-coupled modules, or make a codebase more testable and AI-navigable.
4
+ ---
5
+
6
+ # Improve Codebase Architecture
7
+
8
+ Surface architectural friction and propose **deepening opportunities** — refactors that turn shallow modules into deep ones. The aim is testability and AI-navigability.
9
+
10
+ ## Glossary
11
+
12
+ Use these terms exactly in every suggestion. Consistent language is the point — don't drift into "component," "service," "API," or "boundary." Full definitions in [LANGUAGE.md](LANGUAGE.md).
13
+
14
+ - **Module** — anything with an interface and an implementation (function, class, package, slice).
15
+ - **Interface** — everything a caller must know to use the module: types, invariants, error modes, ordering, config. Not just the type signature.
16
+ - **Implementation** — the code inside.
17
+ - **Depth** — leverage at the interface: a lot of behaviour behind a small interface. **Deep** = high leverage. **Shallow** = interface nearly as complex as the implementation.
18
+ - **Seam** — where an interface lives; a place behaviour can be altered without editing in place. (Use this, not "boundary.")
19
+ - **Adapter** — a concrete thing satisfying an interface at a seam.
20
+ - **Leverage** — what callers get from depth.
21
+ - **Locality** — what maintainers get from depth: change, bugs, knowledge concentrated in one place.
22
+
23
+ Key principles (see [LANGUAGE.md](LANGUAGE.md) for the full list):
24
+
25
+ - **Deletion test**: imagine deleting the module. If complexity vanishes, it was a pass-through. If complexity reappears across N callers, it was earning its keep.
26
+ - **The interface is the test surface.**
27
+ - **One adapter = hypothetical seam. Two adapters = real seam.**
28
+
29
+ This skill is _informed_ by the project's domain model. The domain language gives names to good seams; ADRs record decisions the skill should not re-litigate.
30
+
31
+ ## Process
32
+
33
+ ### 1. Explore
34
+
35
+ Read the project's domain glossary and any ADRs in the area you're touching first.
36
+
37
+ Then use the Agent tool with `subagent_type=Explore` to walk the codebase. Don't follow rigid heuristics — explore organically and note where you experience friction:
38
+
39
+ - Where does understanding one concept require bouncing between many small modules?
40
+ - Where are modules **shallow** — interface nearly as complex as the implementation?
41
+ - Where have pure functions been extracted just for testability, but the real bugs hide in how they're called (no **locality**)?
42
+ - Where do tightly-coupled modules leak across their seams?
43
+ - Which parts of the codebase are untested, or hard to test through their current interface?
44
+
45
+ Apply the **deletion test** to anything you suspect is shallow: would deleting it concentrate complexity, or just move it? A "yes, concentrates" is the signal you want.
46
+
47
+ ### 2. Present candidates as an HTML report
48
+
49
+ Write a self-contained HTML file to the OS temp directory so nothing lands in the repo. Resolve the temp dir from `$TMPDIR`, falling back to `/tmp` (or `%TEMP%` on Windows), and write to `<tmpdir>/architecture-review-<timestamp>.html` so each run gets a fresh file. Open it for the user — `xdg-open <path>` on Linux, `open <path>` on macOS, `start <path>` on Windows — and tell them the absolute path.
50
+
51
+ The report uses **Tailwind via CDN** for layout and styling, and **Mermaid via CDN** for diagrams where a graph/flow/sequence reliably communicates the structure. Mix Mermaid with hand-crafted CSS/SVG visuals — use Mermaid when relationships are graph-shaped (call graphs, dependencies, sequences), and hand-built divs/SVG when you want something more editorial (mass diagrams, cross-sections, collapse animations). Each candidate gets a **before/after visualisation**. Be visual.
52
+
53
+ For each candidate, the same template as before, but rendered as a card:
54
+
55
+ - **Files** — which files/modules are involved
56
+ - **Problem** — why the current architecture is causing friction
57
+ - **Solution** — plain English description of what would change
58
+ - **Benefits** — explained in terms of locality and leverage, and how tests would improve
59
+ - **Before / After diagram** — side-by-side, custom-drawn, illustrating the shallowness and the deepening
60
+ - **Recommendation strength** — one of `Strong`, `Worth exploring`, `Speculative`, rendered as a badge
61
+
62
+ End the report with a **Top recommendation** section: which candidate you'd tackle first and why.
63
+
64
+ **Use CONTEXT.md vocabulary for the domain, and [LANGUAGE.md](LANGUAGE.md) vocabulary for the architecture.** If `CONTEXT.md` defines "Order," talk about "the Order intake module" — not "the FooBarHandler," and not "the Order service."
65
+
66
+ **ADR conflicts**: if a candidate contradicts an existing ADR, only surface it when the friction is real enough to warrant revisiting the ADR. Mark it clearly in the card (e.g. a warning callout: _"contradicts ADR-0007 — but worth reopening because…"_). Don't list every theoretical refactor an ADR forbids.
67
+
68
+ See [HTML-REPORT.md](HTML-REPORT.md) for the full HTML scaffold, diagram patterns, and styling guidance.
69
+
70
+ Do NOT propose interfaces yet. After the file is written, ask the user: "Which of these would you like to explore?"
71
+
72
+ ### 3. Grilling loop
73
+
74
+ Once the user picks a candidate, drop into a grilling conversation. Walk the design tree with them — constraints, dependencies, the shape of the deepened module, what sits behind the seam, what tests survive.
75
+
76
+ Side effects happen inline as decisions crystallize:
77
+
78
+ - **Naming a deepened module after a concept not in `CONTEXT.md`?** Add the term to `CONTEXT.md` — same discipline as `/grill-with-docs` (see [CONTEXT-FORMAT.md](../grill-with-docs/CONTEXT-FORMAT.md)). Create the file lazily if it doesn't exist.
79
+ - **Sharpening a fuzzy term during the conversation?** Update `CONTEXT.md` right there.
80
+ - **User rejects the candidate with a load-bearing reason?** Offer an ADR, framed as: _"Want me to record this as an ADR so future architecture reviews don't re-suggest it?"_ Only offer when the reason would actually be needed by a future explorer to avoid re-suggesting the same thing — skip ephemeral reasons ("not worth it right now") and self-evident ones. See [ADR-FORMAT.md](../grill-with-docs/ADR-FORMAT.md).
81
+ - **Want to explore alternative interfaces for the deepened module?** See [INTERFACE-DESIGN.md](INTERFACE-DESIGN.md).
@@ -0,0 +1,140 @@
1
+ ---
2
+ name: learn
3
+ description: "Runs a six-phase research workflow that turns unfamiliar domains, source bundles, or collected material into publish-ready output. Use when users ask 学习一下/深入研究/研究一下/整理成文章/deep dive/compile sources or need one coherent reference from many inputs. Not for quick lookups or single-file reads."
4
+ when_to_use: "学习一下, 深入研究, 研究一下, 整理成文章, 把这批材料整理, 一站式参考, 一篇就够, 整理成长文, research, deep dive, help me understand, compile sources, unfamiliar domain"
5
+ dispatch_intent: "Deep research, unfamiliar domain, compile sources into output"
6
+ ---
7
+
8
+ # Learn: From Raw Materials to Published Output
9
+
10
+ Prefix your first line with 🥷 inline, not as its own paragraph.
11
+
12
+ **Update check (non-blocking).** Before starting, run `bash ../../scripts/check-update.sh` once; if it prints a line, relay it to the user, then continue. It runs at most once a day, only reads a public version file, sends no data, and fails silently.
13
+
14
+ Collect, organize, translate, explain, structure. Support the user's thinking; do not replace it.
15
+
16
+ ## Outcome Contract
17
+
18
+ - Outcome: unfamiliar material becomes a reliable mental model, reference, article, or notes set the user can use.
19
+ - Done when: primary sources are collected or supplied, contradictions are handled explicitly, and the final structure teaches the topic without hiding uncertainty.
20
+ - Evidence: source URLs or files, fetched content, notes from digestion, outline decisions, and self-review against the requested output.
21
+ - Output: research notes, outline, publish-ready draft, or canonical reference, matching the chosen mode.
22
+
23
+ **Boundary**: single URL that only needs fetching belongs in `/read`. A single URL that needs summary or analysis can use `/read` as the fetch step, but the final answer should satisfy the user's requested summary or analysis. `/learn` is for multi-source research that produces a new structured output.
24
+
25
+ ## Pre-check
26
+
27
+ Check whether `/read` and `/write` skills are installed (look for their SKILL.md in the skills directories). Warn if missing, do not block:
28
+ - `/read` missing -- Phase 1 fetch falls back to native `WebFetch` / `curl`; coverage on paywalled, JS-heavy, and Chinese-platform pages degrades.
29
+ - `/write` missing -- Phase 5 AI-pattern stripping falls back to manual scan. Phases 1-4 are unaffected.
30
+
31
+ ## Choose Mode
32
+
33
+ Ask the user to confirm the mode, using the environment's native question or approval mechanism if it has one:
34
+
35
+ | Mode | Goal | Entry | Exit |
36
+ |------|------|-------|------|
37
+ | **Deep Research** | Understand a domain well enough to write about it | Phase 1 | Phase 6: publish-ready draft |
38
+ | **Quick Reference** | Build a working mental model fast, no article planned | Phase 2 | Phase 2: notes only |
39
+ | **Write to Learn** | Already have materials, force understanding through writing | Phase 3 | Phase 6: publish-ready draft |
40
+ | **Canonical Article** | One article that covers a topic so thoroughly readers need nothing else | Phase 1 | Phase 6: single authoritative reference |
41
+
42
+ If unsure, suggest Quick Reference.
43
+
44
+ ## Canonical Article Mode
45
+
46
+ Activate when: "一篇就够", "一站式参考", "整理成长文", "目的是大家只需要看这篇就好了", or the user wants a single authoritative reference on a topic.
47
+
48
+ Goal: after reading the article, no one should need to search for anything else on this topic.
49
+
50
+ Additional requirements on top of standard Deep Research:
51
+ - Every major sub-topic must have its own section; nothing left as a footnote
52
+ - Include worked examples, not just principles
53
+ - Cover common mistakes and how to avoid them
54
+ - Add a "Further Reading" section with the 3-5 sources that go deepest; flag which ones are the best starting points
55
+ - Phase 6 self-review must confirm: "Could a reader implement/understand this from this article alone?"
56
+
57
+ ## Phase 1: Collect
58
+
59
+ Gather primary sources only: papers that introduced key ideas, official lab/product blogs, posts from builders, canonical "build it from scratch" repositories. Not summaries. Not explainers.
60
+
61
+ Three ordered steps per source -- no shortcuts, no merging:
62
+
63
+ 1. **Discover** -- use an installed search plugin (e.g., PipeLLM) to map the landscape, then deep-search the 2-3 most promising sub-topics. No plugin: use the environment's native web search. Output is a URL list; do not fetch content here.
64
+ 2. **Fetch** -- every URL goes through `/read` when available. `/read` owns the proxy cascade, paywall detection, and platform routing (WeChat, Feishu, PDF, GitHub). Native fetch tools and raw `curl` silently fail on JS-heavy or paywalled sites and skip all of that. If `/read` is missing (Pre-check warned), fall back to native fetch and accept reduced coverage.
65
+ 3. **File** -- tell `/read` the research project's source directory when one exists. If no directory was specified, let `/read` use a per-session temp directory and return the saved path. Move or index saved files into sub-topic directories after fetch returns. Move, don't refetch.
66
+
67
+ Target: 5-10 sources for a blog post, 15-20 for a deep technical survey.
68
+
69
+ ## Phase 2: Digest
70
+
71
+ Work through the materials. For each piece: read it fully, keep what is good, cut what is not. At the end of this phase, cut roughly half of what was collected.
72
+
73
+ For key claims, ask before including in the outline:
74
+ - Does this idea appear in at least two different contexts from the same source?
75
+ - Can this framework predict what the source would say about a new problem?
76
+ - Is this specific to this source, or would any expert in the field say the same thing?
77
+
78
+ Generic wisdom is not worth distilling. Passes two or three: belongs in the outline. Passes one: background material. Passes zero: cut it.
79
+
80
+ When two sources contradict on a factual claim, note both positions and the evidence each gives. Do not silently pick one.
81
+
82
+ ### Conversation Or Review Distillation
83
+
84
+ When the input is a recent conversation, project review, scorecard, or diagnostic report, treat it as raw material:
85
+
86
+ - Prefer already-distilled summaries, memory entries, and review outputs first; open raw transcripts only to verify a disputed detail or recover the exact source of a repeated pattern.
87
+ - Build a candidate matrix before editing durable guidance: source/project, repeated failure, transferable rule, target layer, evidence count, and redaction risk. Promote only candidates with cross-source support or a repeated failure in the same project family.
88
+ - Extract repeated workflow failures, invariants, and verifier surfaces.
89
+ - Drop dated line numbers, current-score framing, private paths, one-machine setup, and repo-specific commands unless the output is explicitly for that same repo.
90
+ - Map each durable lesson to its target layer: project docs, shared rules, skill references, or deterministic scripts.
91
+ - Prefer references or existing skill sections for adaptive workflow guidance; use scripts only for deterministic checks that can fail reliably without project-specific context.
92
+ - Keep evidence snippets only as notes for yourself; do not paste raw conversation history into the final artifact.
93
+
94
+ ## Phase 3: Outline
95
+
96
+ Write the outline for the article. For each section: note the source materials it draws from. If a section has no sources, either it does not belong or a source needs to be found first.
97
+
98
+ Do not start Phase 4 until the outline is solid.
99
+
100
+ ## Phase 4: Fill In
101
+
102
+ Work through the outline section by section. If a section is hard to write, the mental model is still weak there: return to Phase 2 for that sub-topic. The outline may change, and that is fine.
103
+
104
+ Stall signals (any one means the mental model is incomplete for this section):
105
+ - You have rewritten the opening sentence three or more times without settling
106
+ - The section relies on a single source and you cannot cross-check the claim
107
+ - You need a new source that was not collected in Phase 1
108
+ - The paragraph makes a claim you could not explain to someone out loud
109
+
110
+ When stalled: return to Phase 2 for that sub-topic, not for the whole article.
111
+
112
+ ## Phase 5: Refine
113
+
114
+ Pass the draft with a specific brief:
115
+ - Remove redundant and verbose passages without changing meaning or voice
116
+ - Flag places where the argument does not flow
117
+ - Identify gaps: concepts used before they are explained, claims needing sources
118
+
119
+ Do not summarize sections the user has not written. Do not draft new sections from scratch. Edits only.
120
+
121
+ Then strip AI patterns from the draft. If `/write` is installed, invoke it. If not, do it manually: scan for filler phrases, binary contrasts, dramatic fragmentation, and overused adverbs. Cut them without changing meaning.
122
+
123
+ ## Phase 6: Self-review and Publish Readiness
124
+
125
+ The user reads the entire article linearly before publishing. Not with AI. Mark everything that feels off, fix it, read again. Two passes minimum.
126
+
127
+ When it reads clean from start to finish, the draft is ready for the user to publish.
128
+
129
+ **After the user confirms the article is ready to publish, stop.** Do not upload, post, distribute, or perform any publish action unless explicitly asked.
130
+
131
+ ## Gotchas
132
+
133
+ | What happened | Rule |
134
+ |---------------|------|
135
+ | Collected 30 secondary explainers instead of primary sources | Phase 1 targets papers, official blogs, and repos by builders. Summaries are not sources. |
136
+ | Used native fetch tools or `curl` on URLs while `/read` was installed | Phase 1 fetch is not optional. `/read` owns the proxy cascade, paywall detection, and platform routing. Bypassing it silently loses coverage on paywalled, JS-heavy, or Chinese-platform pages. |
137
+ | Treated a convincing explainer as ground truth | Ask: does this appear in at least two different contexts from the same source? |
138
+ | Phase 2 wrote summaries instead of teaching the concept | Digest means building the mental model. Summarizing is not digesting. |
139
+ | AI offered to upload the article to a blog or social platform after the user said it was ready | Stop at confirmation. Publishing is the user's action, not yours. |
140
+ | Turned a project review into a generic Waza rule without filtering | Promote only repeated workflow behavior. Leave project-specific commands, paths, and safety constraints in that project |
@@ -0,0 +1,118 @@
1
+ ---
2
+ name: migrate-to-shoehorn
3
+ description: Migrate test files from `as` type assertions to @total-typescript/shoehorn. Use when user mentions shoehorn, wants to replace `as` in tests, or needs partial test data.
4
+ ---
5
+
6
+ # Migrate to Shoehorn
7
+
8
+ ## Why shoehorn?
9
+
10
+ `shoehorn` lets you pass partial data in tests while keeping TypeScript happy. It replaces `as` assertions with type-safe alternatives.
11
+
12
+ **Test code only.** Never use shoehorn in production code.
13
+
14
+ Problems with `as` in tests:
15
+
16
+ - Trained not to use it
17
+ - Must manually specify target type
18
+ - Double-as (`as unknown as Type`) for intentionally wrong data
19
+
20
+ ## Install
21
+
22
+ ```bash
23
+ npm i @total-typescript/shoehorn
24
+ ```
25
+
26
+ ## Migration patterns
27
+
28
+ ### Large objects with few needed properties
29
+
30
+ Before:
31
+
32
+ ```ts
33
+ type Request = {
34
+ body: { id: string };
35
+ headers: Record<string, string>;
36
+ cookies: Record<string, string>;
37
+ // ...20 more properties
38
+ };
39
+
40
+ it("gets user by id", () => {
41
+ // Only care about body.id but must fake entire Request
42
+ getUser({
43
+ body: { id: "123" },
44
+ headers: {},
45
+ cookies: {},
46
+ // ...fake all 20 properties
47
+ });
48
+ });
49
+ ```
50
+
51
+ After:
52
+
53
+ ```ts
54
+ import { fromPartial } from "@total-typescript/shoehorn";
55
+
56
+ it("gets user by id", () => {
57
+ getUser(
58
+ fromPartial({
59
+ body: { id: "123" },
60
+ }),
61
+ );
62
+ });
63
+ ```
64
+
65
+ ### `as Type` → `fromPartial()`
66
+
67
+ Before:
68
+
69
+ ```ts
70
+ getUser({ body: { id: "123" } } as Request);
71
+ ```
72
+
73
+ After:
74
+
75
+ ```ts
76
+ import { fromPartial } from "@total-typescript/shoehorn";
77
+
78
+ getUser(fromPartial({ body: { id: "123" } }));
79
+ ```
80
+
81
+ ### `as unknown as Type` → `fromAny()`
82
+
83
+ Before:
84
+
85
+ ```ts
86
+ getUser({ body: { id: 123 } } as unknown as Request); // wrong type on purpose
87
+ ```
88
+
89
+ After:
90
+
91
+ ```ts
92
+ import { fromAny } from "@total-typescript/shoehorn";
93
+
94
+ getUser(fromAny({ body: { id: 123 } }));
95
+ ```
96
+
97
+ ## When to use each
98
+
99
+ | Function | Use case |
100
+ | --------------- | -------------------------------------------------- |
101
+ | `fromPartial()` | Pass partial data that still type-checks |
102
+ | `fromAny()` | Pass intentionally wrong data (keeps autocomplete) |
103
+ | `fromExact()` | Force full object (swap with fromPartial later) |
104
+
105
+ ## Workflow
106
+
107
+ 1. **Gather requirements** - ask user:
108
+ - What test files have `as` assertions causing problems?
109
+ - Are they dealing with large objects where only some properties matter?
110
+ - Do they need to pass intentionally wrong data for error testing?
111
+
112
+ 2. **Install and migrate**:
113
+ - [ ] Install: `npm i @total-typescript/shoehorn`
114
+ - [ ] Find test files with `as` assertions: `grep -r " as [A-Z]" --include="*.test.ts" --include="*.spec.ts"`
115
+ - [ ] Replace `as Type` with `fromPartial()`
116
+ - [ ] Replace `as unknown as Type` with `fromAny()`
117
+ - [ ] Add imports from `@total-typescript/shoehorn`
118
+ - [ ] Run type check to verify
@@ -0,0 +1,59 @@
1
+ ---
2
+ name: obsidian-vault
3
+ description: Search, create, and manage notes in the Obsidian vault with wikilinks and index notes. Use when user wants to find, create, or organize notes in Obsidian.
4
+ ---
5
+
6
+ # Obsidian Vault
7
+
8
+ ## Vault location
9
+
10
+ `/mnt/d/Obsidian Vault/AI Research/`
11
+
12
+ Mostly flat at root level.
13
+
14
+ ## Naming conventions
15
+
16
+ - **Index notes**: aggregate related topics (e.g., `Ralph Wiggum Index.md`, `Skills Index.md`, `RAG Index.md`)
17
+ - **Title case** for all note names
18
+ - No folders for organization - use links and index notes instead
19
+
20
+ ## Linking
21
+
22
+ - Use Obsidian `[[wikilinks]]` syntax: `[[Note Title]]`
23
+ - Notes link to dependencies/related notes at the bottom
24
+ - Index notes are just lists of `[[wikilinks]]`
25
+
26
+ ## Workflows
27
+
28
+ ### Search for notes
29
+
30
+ ```bash
31
+ # Search by filename
32
+ find "/mnt/d/Obsidian Vault/AI Research/" -name "*.md" | grep -i "keyword"
33
+
34
+ # Search by content
35
+ grep -rl "keyword" "/mnt/d/Obsidian Vault/AI Research/" --include="*.md"
36
+ ```
37
+
38
+ Or use Grep/Glob tools directly on the vault path.
39
+
40
+ ### Create a new note
41
+
42
+ 1. Use **Title Case** for filename
43
+ 2. Write content as a unit of learning (per vault rules)
44
+ 3. Add `[[wikilinks]]` to related notes at the bottom
45
+ 4. If part of a numbered sequence, use the hierarchical numbering scheme
46
+
47
+ ### Find related notes
48
+
49
+ Search for `[[Note Title]]` across the vault to find backlinks:
50
+
51
+ ```bash
52
+ grep -rl "\\[\\[Note Title\\]\\]" "/mnt/d/Obsidian Vault/AI Research/"
53
+ ```
54
+
55
+ ### Find index notes
56
+
57
+ ```bash
58
+ find "/mnt/d/Obsidian Vault/AI Research/" -name "*Index*"
59
+ ```