Skip to main content

function-and-class-knowledge-graph-with-hooks-v2-0

為 App 開發藍圖協議 v2.0 擴充「函數與類別智識圖譜」機制。 以函數與類別為核心節點,建構完整程式碼結構知識圖譜(包含繼承、方法、相依等),並透過 hook 實現自動化觸發、展開與更新。 適用於 OOP 語言(Python、Java、TypeScript、Dart 等)。

Source facts

Repository
stevenke1981/skills2
Last source activity
April 12, 2026 at 11:24
Detected SKILL.md language
Chinese
Stars
0
Forks
0

Install options

The review-first prompt is selected by default. You can switch to a direct command or download a local copy.

Review the source files

Read SKILL.md and any companion files shown by SkillsMP before deciding whether to install.

Showing SKILL.md

SKILL.md
Source instructions · Read-only preview
name
Function_and_Class_Knowledge_Graph_with_Hooks_v2.0
version
2
description
為 App 開發藍圖協議 v2.0 擴充「函數與類別智識圖譜」機制。 以函數與類別為核心節點,建構完整程式碼結構知識圖譜(包含繼承、方法、相依等),並透過 hook 實現自動化觸發、展開與更新。 適用於 OOP 語言(Python、Java、TypeScript、Dart 等)。
tags
["coding-agent","knowledge-graph","class-function-graph","hook","blueprint","oop","ast-parsing"]
author
宇宙主腦 (Cosmic Master Brain)
requires
["App_Development_Blueprint_Protocol_v2.0","Function_Knowledge_Graph_with_Hooks_v1.0"]
# Function and Class Knowledge Graph with Hooks v2.0 Skill ## 核心使命 在藍圖規劃階段,不僅處理函數,還同步處理 **Class(類別)**,建構更完整的程式碼結構智識圖譜,讓 AI Agent 能精準管理物件導向設計、方法封裝、繼承關係與相依性。 ## 圖譜結構定義(擴充版) - **節點(Nodes)**: - Class:名稱、職責、基底類別(inheritance)、屬性(attributes)、狀態(new / existing / modified) - Method / Function:名稱、職責、輸入/輸出、所屬 Class(若為方法) - Module / File(若適用) - Spec / Concept - **邊(Edges / 關係)**(新增 class 相關): - DEFINES → Class 定義 Method / Function - INHERITS_FROM → 類別繼承關係 - CONTAINS → Class 包含 Attribute / Method - CALLS → Method / Function 呼叫其他 Method / Function - DEPENDS_ON → 依賴既有 Class / Function - REFERENCES → 引用外部庫或既有內容 - UPDATES / IMPACTS → 修改影響範圍 - HOOK_TRIGGER → 連結到特定 hook - **視覺化**:使用 Mermaid `flowchart TD` 或 `graph TD`,區分 class(矩形)與 function/method(橢圓)。 ## Hook 機制(擴充版) 1. **pre_blueprint_hook**:掃描既有程式碼,自動提取 classes、methods、functions 並建入圖譜。 2. **on_class_added_hook**:新增 Class 時,自動加入圖譜並檢查繼承/屬性。 3. **on_method_added_hook**:新增 Method 時,建立 DEFINES 邊與所屬 Class 關聯。 4. **on_reference_detected_hook**:偵測到既有 Class / Method 時,立即展開完整程式碼(階段 2)。 5. **pre_implementation_hook**:驗證 class-method 一致性與相依完整性。 6. **post_update_hook**:任何 Class 或 Method 修改後,更新圖譜並計算影響範圍(包含繼承樹)。 7. **visualization_hook**:輸出完整 Mermaid 圖譜(區分 class 與 function)。 ## 與 App 開發藍圖協議 v2.0 的整合流程(自動執行) - **階段 1**:產出 **Function & Class Inventory** 後,立即建構並輸出智識圖譜(文字版 + Mermaid)。 - **階段 2**:觸發 `on_reference_detected_hook`,自動展開既有 Class / Method 的完整程式碼(包含建構子、屬性、方法等)。 - **階段 3**:為每個 Class / Method 產出正式規格,新增「在圖譜中的關係」欄位。 - **階段 4**:觸發相關 hook,逐 Class / Method 實作,並即時更新圖譜。 - **最終**:輸出完整圖譜視覺化 + hook 清單 + 主程式入口 + 建議的單元測試結構。 ## 使用規則 - 每次任務開始時,先輸出「已啟動 Function_and_Class_Knowledge_Graph_with_Hooks_v2.0 + App_Development_Blueprint_Protocol_v2.0」。 - 若語言為 OOP,優先以 Class 為高層組織單位,再拆解 Methods。 - 既有程式碼片段提供後,自動啟動 pre_blueprint_hook 進行提取。 - Hook 可依專案需求自訂(例如新增 on_inheritance_check_hook)。 ## 範例觸發詞 「使用函數與類別智識圖譜 v2.0 開發 XXX App」「啟動 v2.0 Skill」或直接描述 App 需求。
View on GitHub