How to deepen a cluster of shallow modules safely, given its dependencies. Assumes the vocabulary in SKILL.md: module, interface, seam, adapter.
如何考量其相依,安全地把一群淺模組深化。假定使用 SKILL.md 中的詞彙——模組、介面、接縫、轉接器。
When assessing a candidate for deepening, classify its dependencies. The category determines how the deepened module is tested across its seam.
評估一個深化候選時,分類它的相依。分類決定深化後的模組要如何跨接縫測試。
Pure computation, in-memory state, no I/O. Always deepenable: merge the modules and test through the new interface directly. No adapter needed.
純計算、記憶體狀態、沒有 I/O。永遠可以深化——把模組合併,直接透過新介面測試。不需要轉接器。
Dependencies that have local test stand-ins (PGLite for Postgres, in-memory filesystem). Deepenable if the stand-in exists. The deepened module is tested with the stand-in running in the test suite. The seam is internal; no port at the module's external interface.
有本機測試替身的相依(Postgres 用 PGLite、記憶體檔案系統)。如果替身存在就可深化。深化後的模組在測試套件中用跑著的替身測試。接縫是內部的;模組的外部介面上沒有連接埠。
Your own services across a network boundary (microservices, internal APIs). Define a port (interface) at the seam. The deep module owns the logic; the transport is injected as an adapter. Tests use an in-memory adapter. Production uses an HTTP/gRPC/queue adapter.
你在網路邊界另一端的自有服務(微服務、內部 API)。在接縫處定義連接埠(介面)。深模組擁有邏輯;傳輸以轉接器注入。測試用記憶體轉接器。正式環境用 HTTP/gRPC/queue 轉接器。
Recommendation shape: "Define a port at the seam, implement an HTTP adapter for production and an in-memory adapter for testing, so the logic sits in one deep module even though it's deployed across a network."
建議形狀:「在接縫處定義連接埠,為正式環境實作 HTTP 轉接器、為測試實作記憶體轉接器,這樣即使部署在網路上,邏輯也坐落在單一深模組中。」
Third-party services (Stripe, Twilio, etc.) you don't control. The deepened module takes the external dependency as an injected port; tests provide a mock adapter.
你無法控制的第三方服務(Stripe、Twilio 等)。深化後的模組把外部相依當成注入的連接埠;測試提供模擬轉接器。