Skip to content
Back to skills

Codebase Design

ASecurity

設計或重構模組介面時,分析複雜度、依賴與測試接縫;供架構與 TDD 工作參考,不自動啟動全專案重構。

  • 2 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added November 9, 2026
designapi

Works with

  • api

Security analysis

A100/100

Pro scans all 6 files and shows the line behind each finding

Scanned November 9, 2026

npx -y skills add ddmanyes/agent-skills-toolkit-zh-tw --skill codebase-design --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Codebase Design?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Codebase Design
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ddmanyes-codebase-design/badge)](https://www.skillsdirectory.com/skills/ddmanyes-codebase-design)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: codebase-design
description: 設計或重構模組介面時,分析複雜度、依賴與測試接縫;供架構與 TDD 工作參考,不自動啟動全專案重構。
---

# 模組設計

以小而清楚的介面承載有用行為。沿用專案術語與既有決策;不把行數或抽象數量當品質分數。

## 共同詞彙

- 模組(module):具有介面與實作的函式、類別、套件或跨層功能。
- 介面(interface):呼叫者必須知道的一切,包含型別、不變式、順序、錯誤、設定與效能限制。
- 深度(depth):呼叫者學會少量介面後能使用多少行為,不是實作行數除以介面行數。
- 接縫(seam):可替換行為的位置;適配器(adapter)是滿足該位置介面的具體實作。
- Leverage:呼叫者能重用多少能力;locality:一次變更及其驗證能否集中在少數相關位置。

## 判斷與設計

1. 讀實際呼叫端、測試、依賴與領域詞彙,說明目前哪種改動需要跨多處同步。
2. 做 deletion test:若移除包裝後複雜度消失,它可能只是轉接;若複雜度散回多個呼叫端,它可能有保留價值。檢查授權、快取、交易、錯誤轉換等隱含職責,不能只看函式長度。
3. 比較介面與實作的複雜度。保留有實際用途的抽象;一個實作本身不構成刪除介面的理由,安全、部署與第三方契約也可能需要接縫。
4. 記錄公開行為、錯誤、副作用與順序約束。必要的副作用放在明確邊界,不為測試任意改變既有契約。
5. 讓測試從穩定介面觀察結果;內部接縫可用於針對性測試,不為測試把內部細節暴露成公開 API。

評估跨程序、資料庫或第三方依賴時讀 [依賴與測試](references/dependencies.md)。使用者要求比較替代介面時讀 [比較設計](references/alternatives.md)。

完成時提供呼叫例子、介面契約、隱藏的複雜度、測試方式與取捨。設計評估不自動授權重構、刪除既有測試或變更正式資料。

Files in this skill

  • SKILL.md2 KB
  • UPSTREAM-LICENSE.txt1 KB
  • agents/openai.yaml174 B
  • references/alternatives.md541 B
  • references/dependencies.md700 B
  • upstream.json397 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in design →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.